/* ===== Reset & base ===== */
* { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  --bg-gradient: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  --card-bg: #ffffff;
  --text: #1f2937;
  --text-muted: #6b7280;
  --border: #e5e7eb;
  --primary: #6366f1;
  --primary-dark: #4f46e5;
  --primary-light: #eef2ff;
  --success: #10b981;
  --success-light: #d1fae5;
  --danger: #ef4444;
  --danger-light: #fee2e2;
  --warning: #f59e0b;
  --shadow-sm: 0 1px 3px rgba(0,0,0,0.06);
  --shadow: 0 4px 16px rgba(0,0,0,0.08);
  --shadow-lg: 0 10px 40px rgba(0,0,0,0.12);
  --radius: 12px;
  --radius-sm: 8px;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", sans-serif;
  background: var(--bg-gradient);
  background-attachment: fixed;
  color: var(--text);
  min-height: 100vh;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

.container {
  max-width: 1000px;
  margin: 0 auto;
  padding: 2.5rem 1.5rem;
}

/* ===== Page header ===== */
.page-header {
  text-align: center;
  margin-bottom: 2rem;
  color: #fff;
}
.page-header h1 {
  font-size: 2.5rem;
  font-weight: 700;
  margin-bottom: 0.5rem;
  text-shadow: 0 2px 8px rgba(0,0,0,0.15);
}
.page-header .subtitle {
  font-size: 1.05rem;
  opacity: 0.9;
}

/* ===== Admin header bar ===== */
header.admin-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  background: var(--card-bg);
  padding: 1.25rem 1.75rem;
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  margin-bottom: 1.75rem;
}
header.admin-header h1 {
  font-size: 1.5rem;
  color: var(--text);
}
header.admin-header .actions { display: flex; gap: 0.6rem; align-items: center; }

/* ===== Card / Section ===== */
.card, section {
  background: var(--card-bg);
  border-radius: var(--radius);
  padding: 1.75rem;
  margin-bottom: 1.5rem;
  box-shadow: var(--shadow);
}
section h2 {
  font-size: 1.2rem;
  margin-bottom: 0.5rem;
  color: var(--text);
  display: flex;
  align-items: center;
  gap: 0.5rem;
}
section p { color: var(--text-muted); margin-bottom: 1rem; font-size: 0.95rem; }
section code {
  background: var(--primary-light);
  color: var(--primary-dark);
  padding: 0.15rem 0.45rem;
  border-radius: 4px;
  font-size: 0.85rem;
}

/* ===== Login box ===== */
.login-box {
  max-width: 400px;
  margin: 6rem auto;
  padding: 2.5rem;
  background: var(--card-bg);
  border-radius: var(--radius);
  box-shadow: var(--shadow-lg);
  text-align: center;
}
.login-box h2 {
  font-size: 1.6rem;
  margin-bottom: 1.5rem;
  color: var(--text);
}
.login-box input {
  width: 100%;
  padding: 0.75rem 1rem;
  margin: 0.5rem 0;
  border: 1.5px solid var(--border);
  border-radius: var(--radius-sm);
  font-size: 1rem;
  transition: border-color 0.15s, box-shadow 0.15s;
}
.login-box input:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px var(--primary-light);
}
.login-box button {
  width: 100%;
  padding: 0.85rem;
  margin-top: 0.75rem;
  background: var(--primary);
  color: #fff;
  border: none;
  border-radius: var(--radius-sm);
  font-size: 1rem;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.15s, transform 0.05s;
}
.login-box button:hover { background: var(--primary-dark); }
.login-box button:active { transform: translateY(1px); }
.login-box p { margin-top: 1.25rem; color: var(--text-muted); }
.login-box a { color: var(--primary); text-decoration: none; }
.login-box a:hover { text-decoration: underline; }
.error {
  background: var(--danger-light);
  color: var(--danger);
  padding: 0.6rem;
  border-radius: var(--radius-sm);
  margin-bottom: 1rem;
  font-size: 0.9rem;
}

/* ===== Drop zone ===== */
.drop-zone {
  border: 2px dashed #cbd5e1;
  background: #f9fafb;
  padding: 2.5rem 1rem;
  text-align: center;
  border-radius: var(--radius-sm);
  cursor: pointer;
  font-size: 1rem;
  color: var(--text-muted);
  transition: all 0.15s;
  margin-bottom: 1rem;
}
.drop-zone:hover, .drop-zone.hover {
  border-color: var(--primary);
  background: var(--primary-light);
  color: var(--primary-dark);
}

/* ===== Tables ===== */
table {
  width: 100%;
  border-collapse: separate;
  border-spacing: 0;
  background: #fff;
  border-radius: var(--radius-sm);
  overflow: hidden;
}
th, td {
  padding: 0.85rem 1rem;
  text-align: left;
  border-bottom: 1px solid var(--border);
}
th {
  background: #f8fafc;
  color: var(--text-muted);
  font-weight: 600;
  font-size: 0.8rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}
tbody tr { transition: background 0.1s; }
tbody tr:hover { background: #f9fafb; }
tbody tr:last-child td { border-bottom: none; }

/* Inline-edit inputs in admin table */
td input[type="text"], td input:not([type]) {
  width: 100%;
  border: 1px solid transparent;
  background: transparent;
  padding: 0.4rem 0.5rem;
  border-radius: 4px;
  font-size: 0.95rem;
  font-family: inherit;
  transition: all 0.15s;
}
td input[type="text"]:hover, td input:not([type]):hover {
  border-color: var(--border);
  background: #fff;
}
td input[type="text"]:focus, td input:not([type]):focus {
  outline: none;
  border-color: var(--primary);
  background: #fff;
  box-shadow: 0 0 0 3px var(--primary-light);
}

/* Hidden rows in admin */
.row-hidden { opacity: 0.45; background: #fafafa; }
.row-hidden:hover { background: #f3f4f6; }

.empty {
  text-align: center;
  color: var(--text-muted);
  padding: 2.5rem 1rem;
  font-style: italic;
}

/* ===== Badges (public page) ===== */
.badge {
  display: inline-block;
  padding: 0.25rem 0.7rem;
  border-radius: 999px;
  font-size: 0.85rem;
  font-weight: 600;
}
.badge-success {
  background: var(--success-light);
  color: #047857;
}
.badge-muted {
  background: #f3f4f6;
  color: var(--text-muted);
  font-style: italic;
}
.badge-danger {
  background: var(--danger-light);
  color: #b91c1c;
}

/* ===== Buttons ===== */
button, .btn-link {
  padding: 0.55rem 1.1rem;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  background: #fff;
  cursor: pointer;
  font-size: 0.9rem;
  font-weight: 500;
  font-family: inherit;
  color: var(--text);
  text-decoration: none;
  transition: all 0.15s;
  display: inline-block;
}
button:hover, .btn-link:hover {
  background: #f9fafb;
  border-color: #d1d5db;
}
button:active { transform: translateY(1px); }

button.primary {
  background: var(--primary);
  color: #fff;
  border-color: var(--primary);
}
button.primary:hover { background: var(--primary-dark); border-color: var(--primary-dark); }

button.danger {
  background: #fff;
  color: var(--danger);
  border-color: #fecaca;
}
button.danger:hover { background: var(--danger-light); }
button.small { padding: 0.3rem 0.6rem; font-size: 0.85rem; }

a.btn-link {
  color: var(--primary);
  border-color: var(--primary-light);
  background: var(--primary-light);
}
a.btn-link:hover { background: #ddd6fe; }

/* ===== Stats row ===== */
.stats-row {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 1rem;
  margin-bottom: 1rem;
}
.stat-card {
  background: rgba(255,255,255,0.15);
  backdrop-filter: blur(8px);
  border: 1px solid rgba(255,255,255,0.25);
  border-radius: var(--radius);
  padding: 1.25rem 1rem;
  text-align: center;
  color: #fff;
}
.stat-card--success { background: rgba(16,185,129,0.2); border-color: rgba(16,185,129,0.35); }
.stat-card--pending { background: rgba(245,158,11,0.2); border-color: rgba(245,158,11,0.35); }
.stat-value {
  font-size: 2.2rem;
  font-weight: 700;
  line-height: 1;
  margin-bottom: 0.3rem;
}
.stat-label {
  font-size: 0.8rem;
  text-transform: uppercase;
  letter-spacing: 0.07em;
  opacity: 0.85;
  font-weight: 600;
}

/* ===== Progress card ===== */
.progress-card {
  background: rgba(255,255,255,0.15);
  backdrop-filter: blur(8px);
  border: 1px solid rgba(255,255,255,0.25);
  border-radius: var(--radius);
  padding: 1.25rem 1.5rem;
  margin-bottom: 1rem;
  color: #fff;
}
.progress-header {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  margin-bottom: 0.6rem;
}
.progress-label { font-size: 0.9rem; font-weight: 600; opacity: 0.9; }
.progress-pct { font-size: 1.1rem; font-weight: 700; }
.progress-track {
  background: rgba(255,255,255,0.25);
  border-radius: 999px;
  height: 10px;
  overflow: hidden;
  margin-bottom: 0.5rem;
}
.progress-fill {
  height: 100%;
  background: linear-gradient(90deg, #10b981, #34d399);
  border-radius: 999px;
  transition: width 0.6s ease;
  min-width: 0%;
}
.progress-sub {
  font-size: 0.8rem;
  opacity: 0.8;
  text-align: right;
}

@media (max-width: 640px) {
  .stats-row { grid-template-columns: repeat(3, 1fr); gap: 0.6rem; }
  .stat-value { font-size: 1.6rem; }
}

/* ===== Public page ===== */
.public-table tbody tr td:first-child { font-weight: 600; color: var(--text); }
.footer-link {
  text-align: center;
  margin-top: 1.5rem;
  color: rgba(255,255,255,0.85);
}
.footer-link a {
  color: #fff;
  text-decoration: none;
  border-bottom: 1px solid rgba(255,255,255,0.5);
  padding-bottom: 2px;
  font-size: 0.9rem;
}
.footer-link a:hover { border-bottom-color: #fff; }

/* ===== Row states ===== */
.row-received { opacity: 0.45; background: #f0fdf4; }
.row-received:hover { background: #dcfce7; }

/* ===== Flash messages ===== */
.flash {
  background: var(--primary-light);
  color: var(--primary-dark);
  border: 1px solid #c7d2fe;
  border-radius: var(--radius-sm);
  padding: 0.7rem 1rem;
  margin-bottom: 1rem;
  font-size: 0.9rem;
}

/* ===== Back link ===== */
.back-link {
  color: var(--text-muted);
  text-decoration: none;
  font-size: 0.9rem;
  white-space: nowrap;
}
.back-link:hover { color: var(--text); }

/* ===== User badge ===== */
.user-badge {
  font-size: 0.85rem;
  font-weight: 600;
  background: var(--primary-light);
  color: var(--primary-dark);
  padding: 0.35rem 0.75rem;
  border-radius: 999px;
}

/* ===== Primary / outline buttons ===== */
.btn-primary {
  padding: 0.55rem 1.1rem;
  border-radius: var(--radius-sm);
  border: none;
  background: var(--primary);
  color: #fff;
  font-size: 0.9rem;
  font-weight: 600;
  cursor: pointer;
  text-decoration: none;
  display: inline-block;
  transition: background 0.15s;
}
.btn-primary:hover { background: var(--primary-dark); }

.btn-outline {
  padding: 0.5rem 1rem;
  border-radius: var(--radius-sm);
  border: 1.5px solid var(--border);
  background: transparent;
  color: var(--text);
  font-size: 0.85rem;
  font-weight: 500;
  cursor: pointer;
  text-decoration: none;
  display: inline-block;
  transition: all 0.15s;
}
.btn-outline:hover { background: #f9fafb; border-color: #d1d5db; }

.btn-sm {
  padding: 0.28rem 0.65rem;
  border-radius: 6px;
  border: 1px solid var(--border);
  background: #fff;
  color: var(--text);
  font-size: 0.8rem;
  font-weight: 500;
  cursor: pointer;
  text-decoration: none;
  display: inline-block;
  transition: all 0.15s;
}
.btn-sm:hover { background: #f9fafb; }
.btn-sm--danger { color: var(--danger); border-color: #fecaca; }
.btn-sm--danger:hover { background: var(--danger-light); }

/* ===== Campaign grid (dashboard) ===== */
.campaign-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 1.25rem;
  margin-top: 0.5rem;
}
.campaign-card {
  background: var(--card-bg);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  overflow: hidden;
}
.campaign-card__banner {
  height: 6px;
  background: linear-gradient(135deg, var(--c1), var(--c2));
}
.campaign-card__body { padding: 1.25rem; }
.campaign-card__body h3 { font-size: 1.1rem; margin-bottom: 0.3rem; color: var(--text); }
.campaign-desc { font-size: 0.85rem; color: var(--text-muted); margin-bottom: 0.75rem; }
.mini-stats { display: flex; gap: 1rem; font-size: 0.8rem; color: var(--text-muted); margin-bottom: 0.5rem; }
.mini-stats strong { color: var(--text); }
.mini-progress-track {
  background: var(--border);
  border-radius: 999px;
  height: 6px;
  overflow: hidden;
  margin-bottom: 0.25rem;
}
.mini-progress-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--c1), var(--c2));
  border-radius: 999px;
  transition: width 0.5s;
}
.mini-pct { font-size: 0.75rem; color: var(--text-muted); margin-bottom: 0.9rem; text-align: right; }
.campaign-card__actions { display: flex; gap: 0.5rem; flex-wrap: wrap; }

/* ===== Color swatch ===== */
.color-swatch {
  display: inline-block;
  width: 60px;
  height: 20px;
  border-radius: 4px;
  vertical-align: middle;
}
.color-dot {
  display: inline-block;
  width: 12px;
  height: 12px;
  border-radius: 50%;
  vertical-align: middle;
  margin-right: 0.4rem;
}

/* ===== Tag ===== */
.tag {
  display: inline-block;
  padding: 0.2rem 0.55rem;
  background: var(--primary-light);
  color: var(--primary-dark);
  border-radius: 999px;
  font-size: 0.75rem;
  font-weight: 600;
  margin: 0.1rem;
}

/* ===== Form fields ===== */
.form-field { margin-bottom: 1.1rem; }
.form-field label {
  display: block;
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--text-muted);
  margin-bottom: 0.4rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}
.form-field input[type="text"],
.form-field input[type="password"] {
  width: 100%;
  padding: 0.7rem 0.9rem;
  border: 1.5px solid var(--border);
  border-radius: var(--radius-sm);
  font-size: 0.95rem;
  font-family: inherit;
  transition: border-color 0.15s, box-shadow 0.15s;
}
.form-field input:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px var(--primary-light);
}
.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 1rem; }
.color-input-wrap { display: flex; align-items: center; gap: 0.6rem; }
.color-input-wrap input[type="color"] {
  width: 48px; height: 38px;
  border: 1.5px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 2px; cursor: pointer;
}
.gradient-preview {
  height: 56px;
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  font-weight: 700;
  font-size: 0.9rem;
  letter-spacing: 0.05em;
  text-shadow: 0 1px 3px rgba(0,0,0,0.2);
  margin-top: 0.5rem;
}

/* ===== Checkbox list ===== */
.checkbox-list { display: flex; flex-direction: column; gap: 0.5rem; }
.checkbox-item {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  padding: 0.55rem 0.75rem;
  border: 1.5px solid var(--border);
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: border-color 0.15s, background 0.15s;
  font-size: 0.95rem;
}
.checkbox-item:hover { border-color: var(--primary); background: var(--primary-light); }
.checkbox-item input[type="checkbox"] { accent-color: var(--primary); width: 16px; height: 16px; }

/* ===== Responsive ===== */
@media (max-width: 640px) {
  .container { padding: 1rem; }
  .page-header h1 { font-size: 1.9rem; }
  header.admin-header { flex-direction: column; gap: 1rem; align-items: stretch; }
  header.admin-header .actions { justify-content: center; flex-wrap: wrap; }
  .card, section { padding: 1.25rem; }
  th, td { padding: 0.6rem 0.5rem; font-size: 0.9rem; }
  .form-row { grid-template-columns: 1fr; }
  .campaign-grid { grid-template-columns: 1fr; }
}