/* ============================================================
   AutoPhotoList — Design System
   Inspired by Notion / Linear / Stripe Dashboard: quiet, fast,
   professional. One accent color, generous whitespace, soft depth.
   ============================================================ */

:root {
  /* Palette */
  --color-primary: #3B5FE0;       /* confident blue, not the generic terracotta */
  --color-primary-hover: #2F4EC2;
  --color-primary-soft: #EEF1FD;
  --color-bg: #FAFAFB;
  --color-surface: #FFFFFF;
  --color-surface-alt: #F4F5F7;
  --color-border: #E6E7EB;
  --color-text: #16181D;
  --color-text-muted: #6B7280;
  --color-text-faint: #9CA3AF;
  --color-success: #1D9A6C;
  --color-success-soft: #E6F7F0;
  --color-warning: #B7791F;
  --color-warning-soft: #FDF3E4;
  --color-danger: #D64545;
  --color-danger-soft: #FCEAEA;

  /* Type */
  --font-display: "Manrope", -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  --font-body: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;

  /* Shape & depth */
  --radius-sm: 8px;
  --radius-md: 12px;
  --radius-lg: 16px;
  --shadow-sm: 0 1px 2px rgba(16, 24, 40, 0.04), 0 1px 1px rgba(16, 24, 40, 0.03);
  --shadow-md: 0 4px 12px rgba(16, 24, 40, 0.06), 0 2px 4px rgba(16, 24, 40, 0.04);
  --shadow-lg: 0 12px 32px rgba(16, 24, 40, 0.10);

  --sidebar-width: 240px;
}

* { box-sizing: border-box; }

body {
  font-family: var(--font-body);
  background: var(--color-bg);
  color: var(--color-text);
  font-size: 14.5px;
  line-height: 1.55;
}

h1, h2, h3, h4, h5, .font-display {
  font-family: var(--font-display);
  font-weight: 700;
  letter-spacing: -0.01em;
  color: var(--color-text);
}

a { color: var(--color-primary); text-decoration: none; }
a:hover { color: var(--color-primary-hover); }

/* ---------- Layout shell ---------- */

.app-shell { display: flex; min-height: 100vh; }

.sidebar {
  width: var(--sidebar-width);
  flex-shrink: 0;
  background: var(--color-surface);
  border-right: 1px solid var(--color-border);
  padding: 20px 14px;
  position: sticky;
  top: 0;
  height: 100vh;
  overflow-y: auto;
}

.sidebar-brand {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 6px 8px 22px;
  font-family: var(--font-display);
  font-weight: 800;
  font-size: 16px;
}

.sidebar-brand .mark {
  width: 28px; height: 28px;
  border-radius: 8px;
  background: var(--color-primary);
  display: flex; align-items: center; justify-content: center;
  color: white; font-size: 14px; font-weight: 800;
}

.nav-section-label {
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--color-text-faint);
  padding: 14px 10px 6px;
  font-weight: 600;
}

.nav-link-custom {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 10px;
  border-radius: var(--radius-sm);
  color: var(--color-text-muted);
  font-size: 13.5px;
  font-weight: 500;
  margin-bottom: 2px;
  transition: background 0.12s ease, color 0.12s ease;
}

.nav-link-custom:hover { background: var(--color-surface-alt); color: var(--color-text); }
.nav-link-custom.active { background: var(--color-primary-soft); color: var(--color-primary); }
.nav-link-custom svg { width: 17px; height: 17px; flex-shrink: 0; }

.main-content {
  flex: 1;
  min-width: 0;
  padding: 28px 36px 60px;
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 26px;
}

.page-title { font-size: 22px; margin: 0; }
.page-subtitle { color: var(--color-text-muted); font-size: 13.5px; margin-top: 2px; }

/* ---------- Cards ---------- */

.card-custom {
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-sm);
}

.card-custom-pad { padding: 20px; }

.stat-card {
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  padding: 18px 20px;
  box-shadow: var(--shadow-sm);
}

.stat-card .stat-value {
  font-family: var(--font-display);
  font-size: 26px;
  font-weight: 800;
}

.stat-card .stat-label {
  color: var(--color-text-muted);
  font-size: 12.5px;
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

/* ---------- Buttons ---------- */

.btn-primary-custom {
  background: var(--color-primary);
  color: white;
  border: none;
  border-radius: var(--radius-sm);
  padding: 9px 16px;
  font-weight: 600;
  font-size: 13.5px;
  transition: background 0.12s ease, transform 0.05s ease;
}
.btn-primary-custom:hover { background: var(--color-primary-hover); color: white; }
.btn-primary-custom:active { transform: translateY(1px); }

.btn-outline-custom {
  background: var(--color-surface);
  color: var(--color-text);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-sm);
  padding: 9px 16px;
  font-weight: 600;
  font-size: 13.5px;
}
.btn-outline-custom:hover { background: var(--color-surface-alt); color: var(--color-text); }

.btn-danger-outline {
  background: transparent;
  color: var(--color-danger);
  border: 1px solid var(--color-danger-soft);
  border-radius: var(--radius-sm);
  padding: 9px 16px;
  font-weight: 600;
  font-size: 13.5px;
}
.btn-danger-outline:hover { background: var(--color-danger-soft); color: var(--color-danger); }

/* ---------- Badges ---------- */

.badge-status {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 3px 10px;
  border-radius: 999px;
  font-size: 11.5px;
  font-weight: 600;
  text-transform: capitalize;
}
.badge-draft { background: var(--color-warning-soft); color: var(--color-warning); }
.badge-published { background: var(--color-success-soft); color: var(--color-success); }

/* ---------- Forms ---------- */

.form-label-custom {
  font-size: 12.5px;
  font-weight: 600;
  color: var(--color-text-muted);
  margin-bottom: 5px;
  text-transform: uppercase;
  letter-spacing: 0.03em;
}

.form-control-custom {
  border: 1px solid var(--color-border);
  border-radius: var(--radius-sm);
  padding: 9px 12px;
  font-size: 13.5px;
  width: 100%;
  background: var(--color-surface);
  transition: border-color 0.12s ease, box-shadow 0.12s ease;
}
.form-control-custom:focus {
  outline: none;
  border-color: var(--color-primary);
  box-shadow: 0 0 0 3px var(--color-primary-soft);
}

textarea.form-control-custom { resize: vertical; min-height: 90px; }

/* ---------- Auth pages ---------- */

.auth-wrapper {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--color-bg);
  padding: 20px;
}

.auth-card {
  width: 100%;
  max-width: 380px;
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-md);
  padding: 32px 30px;
}

/* ---------- Upload dropzone ---------- */

.dropzone {
  border: 2px dashed var(--color-border);
  border-radius: var(--radius-lg);
  background: var(--color-surface);
  padding: 56px 24px;
  text-align: center;
  transition: border-color 0.15s ease, background 0.15s ease;
  cursor: pointer;
}
.dropzone.drag-active {
  border-color: var(--color-primary);
  background: var(--color-primary-soft);
}
.dropzone-icon {
  width: 52px; height: 52px;
  border-radius: 14px;
  background: var(--color-primary-soft);
  color: var(--color-primary);
  display: flex; align-items: center; justify-content: center;
  margin: 0 auto 16px;
}

.preview-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
  gap: 12px;
  margin-top: 20px;
}
.preview-tile {
  position: relative;
  border-radius: var(--radius-sm);
  overflow: hidden;
  aspect-ratio: 1;
  border: 1px solid var(--color-border);
}
.preview-tile img { width: 100%; height: 100%; object-fit: cover; }
.preview-tile .remove-btn {
  position: absolute; top: 5px; right: 5px;
  width: 22px; height: 22px;
  border-radius: 50%;
  background: rgba(22,24,29,0.7);
  color: white;
  border: none;
  display: flex; align-items: center; justify-content: center;
  font-size: 13px;
  cursor: pointer;
}

/* ---------- Review page ---------- */

.gallery-main {
  width: 100%;
  aspect-ratio: 4/3;
  border-radius: var(--radius-md);
  overflow: hidden;
  background: var(--color-surface-alt);
  border: 1px solid var(--color-border);
}
.gallery-main img { width: 100%; height: 100%; object-fit: cover; }

.gallery-thumbs { display: flex; gap: 8px; margin-top: 10px; flex-wrap: wrap; }
.gallery-thumbs img {
  width: 60px; height: 60px; object-fit: cover;
  border-radius: 8px; border: 2px solid transparent;
  cursor: pointer;
}
.gallery-thumbs img.active { border-color: var(--color-primary); }

.thumb-remove-btn {
  position: absolute; top: -6px; right: -6px;
  width: 18px; height: 18px;
  border-radius: 50%;
  background: var(--color-danger);
  color: white;
  border: 2px solid var(--color-surface);
  font-size: 11px;
  line-height: 1;
  display: flex; align-items: center; justify-content: center;
  cursor: pointer;
  padding: 0;
}
.thumb-remove-btn:hover { background: #b83a3a; }

.section-heading {
  font-family: var(--font-display);
  font-size: 13px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--color-text-muted);
  margin-bottom: 14px;
}

.char-counter { font-size: 12px; color: var(--color-text-faint); }
.char-counter.over-limit { color: var(--color-danger); font-weight: 600; }

/* ---------- Empty states ---------- */

.empty-state {
  text-align: center;
  padding: 48px 24px;
  color: var(--color-text-muted);
}
.empty-state svg { width: 40px; height: 40px; color: var(--color-text-faint); margin-bottom: 12px; }

/* ---------- Listing table ---------- */

.listing-row-thumb {
  width: 44px; height: 44px;
  border-radius: 8px;
  object-fit: cover;
  border: 1px solid var(--color-border);
}

/* ---------- Loading ---------- */

.spinner-ring {
  width: 44px; height: 44px;
  border: 3px solid var(--color-primary-soft);
  border-top-color: var(--color-primary);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

@media (max-width: 900px) {
  .sidebar { display: none; }
  .main-content { padding: 20px; }
}

/* ---------- Ad slots ---------- */
/* Reserved space for banner/sidebar ads so layout doesn't shift once real
   ad units load. Swap the placeholder for a live <ins class="adsbygoogle">
   unit automatically once ADSENSE_CLIENT_ID is configured (see config.py). */

.ad-slot { width: 100%; }

.ad-placeholder {
  display: flex;
  align-items: center;
  justify-content: center;
  border: 1px dashed var(--color-border);
  border-radius: var(--radius-md);
  background: var(--color-surface-alt);
  color: var(--color-text-faint);
  font-size: 12px;
  letter-spacing: 0.02em;
}

.ad-placeholder-banner { min-height: 90px; }
.ad-placeholder-sidebar { min-height: 250px; }

.sidebar { display: flex; flex-direction: column; }
.nav-section-label.mt-auto { margin-top: auto; }

/* ---------- Footer ---------- */
.site-footer {
  margin-top: 32px;
  padding: 16px 4px 8px;
  border-top: 1px solid var(--color-border);
  color: var(--color-text-faint);
  font-size: 12.5px;
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  align-items: center;
}
.site-footer a { color: var(--color-text-faint); text-decoration: underline; }
.site-footer a:hover { color: var(--color-text); }
.site-footer .dot { opacity: 0.5; }

/* ---------- Cookie consent banner ---------- */
.cookie-banner {
  position: fixed;
  left: 16px;
  right: 16px;
  bottom: 16px;
  z-index: 1050;
  max-width: 560px;
  margin: 0 auto;
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  box-shadow: 0 10px 30px rgba(0,0,0,0.12);
  padding: 14px 16px;
  display: flex;
  align-items: center;
  gap: 14px;
  flex-wrap: wrap;
}
.cookie-banner p { margin: 0; font-size: 12.5px; flex: 1 1 260px; color: var(--color-text-muted); }
.cookie-banner .btn-primary-custom { padding: 8px 16px; font-size: 13px; white-space: nowrap; }
