:root { --primary: #1a237e; --primary-light: #2a348e; --accent: #63b2fb; --accent-light: #e3f8ff; --bg: #f4f6f8; --bg-card: #ffffff; --text: #1f2927; --text-muted: #64748b; --border: #e2e8f0; }

* { margin: 0; padding: 0; box-sizing: border-box; }

body {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.6;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

.container {
  max-width: 1120px;
  margin: 0 auto;
  padding: 0 24px;
}

/*----------- HEADER -----------*/
header {
  background: var(--primary);
  border-bottom: 3px solid var(--accent);
  position: sticky;
  top: 0;
  z-index: 100;
}

header .container {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 64px;
}

.logo {
  display: flex;
  align-items: center;
}

.logo-text {
  color: #fff;
  text-decoration: none;
  font-size: 1.35rm;
  font-weight: 700;
  letter-spacing: -0.02em;
}

.logo-img { height: 36px; }

nav ul {
  list-style: none;
  display: flex;
  gap: 4px;
}

nav a {
  color: rgba(255,255,255,0.85);
  text-decoration: none;
  padding: 8px 16px;
  border-radius: 6px;
  font-size: 0.94rem;
  font-weight: 500;
  transition: all 0.2s;
}

nav a:hover {
  background: rgba(255,255,255,0.1);
  color: #fff;
}

/*----------- MAIN -----------*/
main {
  flex: 1;
  padding: 48px 0;
}

main h1 {
  font-size: 2.25rem;
  font-weight: 700;
  margin-bottom: 24px;
  color: var(--primary);
  line-height: 1.2;
}

main h2 {
  font-size: 1.5rem;
  font-weight: 600;
  margin: 24px 0 12px;
}

main p {
  margin-bottom: 1rem;
  color: var(--text-muted);
}

.main-hero {
  text-align: center;
  padding: 64px 24px;
  background: linear-gradient(135deg, var(--primary), var(--primary-light));
  border-radius: 16px;
  margin-bottom: 48px;
}

.main-hero h1 {
  color: #fff;
  font-size: 3rem;
  margin-bottom: 16px;
}

.main-hero p {
  color: rgba(255,255,255,0.85);
  font-size: 1.1rem;
  max-width: 600px;
  margin: 0 auto 24px;
}

/*----------- CARDS -----------*/
.cards {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  gap: 24px;
  margin-top: 32px;
}

.card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 24px;
  transition: box-shadow 0.2s, transform 0.2s;
}

.card:hover {
  box-shadow: 0 4px 12px rgba(0,0,0,0.08);
  transform: translateY(-2px);
}

.card h3 {
  font-size: 1.1rem;
  font-weight: 600;
  margin-bottom: 8px;
  color: var(--primary);
}

.card p {
  font-size: 0.875rem;
  margin-bottom: 12px;
}

.card a {
  color: var(--accent);
  text-decoration: none;
  font-weight: 600;
  font-size: 0.875rem;
}

.card a:hover { text-decoration: underline; }

/*----------- FOOTER -----------*/
footer {
  background: var(--primary);
  color: rgba(255,255,255,0.7);
  text-align: center;
  padding: 24px 0;
  font-size: 0.875rem;
}

/*----------- FORMS -----------*/
form {
  max-width: 640px;
  margin: 0 auto;
}

.form-group {
  margin-bottom: 20px;
}

.form-group label {
  display: block;
  margin-bottom: 6px;
  font-weight: 500;
  font-size: 0.875rem;
  color: var(--text-muted);
}

.form-group input,
.form-group textarea,
.form-group select {
  width: 100%;
  padding: 10px 12px;
  border: 1px solid var(--border);
  border-radius: 8px;
  font-size: 1rem;
  font-family: inherit;
  transition: border-color 0.2s;
  background: #fff;
}

.form-group input:focus,
.form-group textarea:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-light);
}

/*----------- BUTTONS -----------*/
button, .btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: var(--primary);
  color: #fff;
  border: none;
  padding: 10px 24px;
  border-radius: 8px;
  cursor: pointer;
  font-size: 1rem;
  font-weight: 500;
  text-decoration: none;
  transition: background 0.2s;
}

button:hover, .btn:hover {
  background: var(--primary-light);
}

.btn-sm { padding: 6px 16px; font-size: 0.875rem; }
.btn-danger { background: #ef4444; }
.btn-danger:hover { background: #d32f2f; }

/*----------- TABLES -----------*/
table {
  width: 100%;
  border-collapse: collapse;
  margin-top: 24px;
  background: var(--bg-card);
  border-radius: 12px;
  overflow: hidden;
}

table th {
  background: #f8f9fb;
  font-weight: 600;
  font-size: 0.875rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

table th, table td {
  padding: 12px 16px;
  border-bottom: 1px solid var(--border);
  text-align: left;
}

table tr:last-child td { border-bottom: none; }

.unread { background: #ffffdc; }

/*----------- ALERTS -----------*/
.alert {
  padding: 16px 20px;
  border-radius: 8px;
  margin-bottom: 24px;
  font-size: 0.875rem;
}

.alert.success {
  background: #d4edcd;
  color: #155724;
  border: 1px solid #c3e6bd;
}

/*----------- ADMIN DASHBOARD -----------*/
.admin-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 32px;
}

.admin-header h1 { margin-bottom: 0; }

.admin-nav {
  display: flex;
  gap: 8px;
}

.admin-nav a {
  color: var(--text-muted);
  text-decoration: none;
  padding: 8px 16px;
  border-radius: 6px;
  font-size: 0.875rem;
  transition: all 0.2s;
}

.admin-nav a:hover {
  background: var(--bg);
  color: var(--primary);
}

/*----------- CONTENT -----------*/
.content {
  max-width: 840px;
}

.content p { margin-bottom: 1rem; }

/*----------- RESPONSIVE -----------*/
@media (max-width: 768px) {
  header .container { flex-direction: column; height: auto; padding: 16px 24px; gap: 12px; }
  nav ul { flex-wrap: wrap; justify-content: center; }
  .main-hero { padding: 32px 20px; }
  .main-hero h1 { font-size: 2rem; }
}

/*----------- UPLOAD -----------*/
.upload-wrapper {
  display: flex;
  gap: 8px;
  align-items: center;
}
.upload-wrapper input[type=text] {
  flex: 1;
}
.upload-wrapper input[type=file] {
  width: auto;
  padding: 8px;
  border: 1px dashed var(--border);
  border-radius: 8px;
  background: #f8f9fb;
  font-size: 0.875rem;
}
.upload-wrapper input[type=file]:hover {
  border-color: var(--accent);
  background: var(--accent-light);
}

/* Admin nav */
.admin-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 32px;
  flex-wrap: wrap;
  gap: 12px;
}
.admin-header h1 { margin-bottom: 0; }
.admin-nav { display: flex; gap: 4px; flex-wrap: wrap; }
.admin-nav a {
  color: var(--text-muted);
  text-decoration: none;
  padding: 8px 14px;
  border-radius: 6px;
  font-size: 0.875rem;
  transition: all 0.2s;
}
.admin-nav a:hover { background: var(--bg); color: var(--primary); }
.btn-nav-site { color: var(--accent) !important; }
.btn-nav-logout { color: #ef4444 !important; }
.btn-nav-admin { color: var(--accent) !important; font-weight: 600; }

/* Form row */
.form-row { display: flex; gap: 20px; }
.form-row .form-group.half { flex: 1; }
@media (max-width: 640px) { .form-row { flex-direction: column; } }

/* Form actions */
.form-actions { display: flex; gap: 12px; align-items: center; margin-top: 24px; }
.btn-secondary { background: #e2e8f0; color: var(--text); }
.btn-secondary:hover { background: #cbd5e1; }

/* Image field */
.image-field { display: flex; gap: 8px; align-items: center; }
.image-field input[type=text] { flex: 1; }
.image-field input[type=file] {
  width: auto;
  padding: 8px;
  border: 1px dashed var(--border);
  border-radius: 8px;
  background: #f8f9fb;
  font-size: 0.8rem;
  cursor: pointer;
}
.image-field input[type=file]:hover {
  border-color: var(--accent);
  background: var(--accent-light);
}

/* Image preview */
.image-preview {
  margin-top: 8px;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px;
  background: #f8f9fb;
  border-radius: 8px;
  border: 1px solid var(--border);
}
.image-preview img {
  max-height: 60px;
  max-width: 120px;
  border-radius: 4px;
  object-fit: cover;
}
.remove-img {
  background: #fee2e2;
  color: #ef4444;
  border: none;
  width: 28px;
  height: 28px;
  border-radius: 50%;
  cursor: pointer;
  font-size: 1.1rem;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s;
  padding: 0;
  line-height: 1;
}
.remove-img:hover { background: #fecaca; }

/* Login page */
.login-page {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 100vh;
  background: var(--bg);
}
.login-box {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 40px;
  width: 100%;
  max-width: 400px;
  box-shadow: 0 4px 24px rgba(0,0,0,0.06);
}
.login-box h1 {
  text-align: center;
  margin-bottom: 24px;
  font-size: 1.5rem;
}
.login-box form { margin: 0 auto; }
.login-back { text-align: center; margin-top: 20px; }
.login-back a { color: var(--text-muted); font-size: 0.875rem; text-decoration: none; }
.login-back a:hover { color: var(--primary); }
.alert-error { background: #fee2e2; color: #991b1b; border: 1px solid #fecaca; padding: 12px 16px; border-radius: 8px; margin-bottom: 16px; font-size: 0.875rem; }

/* Upload button */
.btn-upload {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: #e2e8f0;
  color: var(--text);
  border: 1px solid var(--border);
  padding: 10px 16px;
  border-radius: 8px;
  cursor: pointer;
  font-size: 0.875rem;
  font-weight: 500;
  transition: all 0.2s;
  white-space: nowrap;
}
.btn-upload:hover { background: #cbd5e1; border-color: var(--accent); }
.btn-upload:disabled { opacity: 0.6; cursor: not-allowed; }
.file-input-hidden { display: none; }
.image-field { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.image-field input[type=text] { flex: 1; min-width: 150px; }

/* Home page */
.home-hero {
  display: flex;
  align-items: center;
  gap: 48px;
  padding: 80px 0;
  flex-wrap: wrap;
}
.home-hero-text { flex: 1; min-width: 300px; text-align: center; }
.home-hero-text h1 {
  font-family: 'Comic Sans MS', 'Chalkboard SE', 'Comic Neue', cursive, sans-serif;
  font-size: 3rem;
  font-weight: 700;
  color: var(--primary);
  line-height: 1.2;
  margin-bottom: 16px;
}
.home-hero-text p {
  font-family: 'Comic Sans MS', 'Chalkboard SE', 'Comic Neue', cursive, sans-serif;
  font-size: 1.2rem;
  color: var(--text-muted);
  line-height: 1.6;
  margin-bottom: 0;
}
.home-hero-image { flex: 0 0 auto; text-align: center; }
.home-hero-image img {
  max-width: 320px;
  width: 100%;
  border-radius: 16px;
  box-shadow: 0 12px 40px rgba(0,0,0,0.15);
  margin-bottom: 20px;
}
.home-hero-image .btn-download {
  display: inline-block;
  background: var(--primary);
  color: #fff;
  padding: 14px 36px;
  border-radius: 10px;
  text-decoration: none;
  font-weight: 600;
  font-size: 1.05rem;
  transition: background 0.2s;
}
.home-hero-image .btn-download:hover { background: var(--primary-light); }

.home-features {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  gap: 24px;
  padding: 40px 0 60px;
}
.home-feature {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 32px;
  text-align: center;
  transition: box-shadow 0.2s, transform 0.2s;
}
.home-feature:hover {
  box-shadow: 0 4px 12px rgba(0,0,0,0.08);
  transform: translateY(-2px);
}
.home-feature .icon { font-size: 2rem; margin-bottom: 12px; }
.home-feature h3 {
  font-size: 1.1rem;
  font-weight: 600;
  margin-bottom: 8px;
  color: var(--primary);
}
.home-feature p {
  font-size: 0.9rem;
  color: var(--text-muted);
  line-height: 1.5;
}

/* Nav cards - 4 in one line */
.home-nav {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 24px;
  padding: 40px 0 60px;
}
@media (max-width: 768px) {
  .home-nav { grid-template-columns: repeat(2, 1fr); }
}
@media (max-width: 480px) {
  .home-nav { grid-template-columns: 1fr; }
}

/* Button link style */
.btn-link {
  display: inline-block;
  background: var(--primary);
  color: #fff;
  padding: 8px 20px;
  border-radius: 8px;
  text-decoration: none;
  font-size: 0.875rem;
  font-weight: 500;
  transition: background 0.2s;
  margin-top: 12px;
}
.btn-link:hover { background: var(--primary-light); }

/* Nav cards - dark theme */
.home-nav .home-feature {
  background: var(--primary);
  border-color: var(--primary-light);
}
.home-nav .home-feature h3 {
  color: #fff;
}
.home-nav .home-feature p {
  color: rgba(255,255,255,0.75);
}
.home-nav .btn-link {
  background: #fff;
  color: var(--primary);
}
.home-nav .btn-link:hover {
  background: rgba(255,255,255,0.9);
}
