/* ── Reset ────────────────────────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  --sidebar-w: 220px;
  --c-bg:      #F4F5F7;
  --c-surface: #FFFFFF;
  --c-border:  #E2E4E9;
  --c-sidebar: #1C1C2E;
  --c-text:    #1A1A2E;
  --c-muted:   #6B7280;
  --c-brand:   #2C1A0E;
  --c-gold:    #C8860A;
  --c-green:   #16A34A;
  --c-red:     #DC2626;
  --c-blue:    #2563EB;
  --radius:    10px;
  --shadow:    0 1px 4px rgba(0,0,0,.08), 0 4px 16px rgba(0,0,0,.05);
  --transition: .2s ease;
}

body {
  font-family: 'Inter', system-ui, sans-serif;
  font-size: 14px;
  color: var(--c-text);
  background: var(--c-bg);
  -webkit-font-smoothing: antialiased;
  height: 100vh;
}

a { color: inherit; text-decoration: none; }
button { cursor: pointer; border: none; background: none; font-family: inherit; font-size: inherit; }
input, select, textarea { font-family: inherit; font-size: inherit; }
.hidden { display: none !important; }
/* The app toggles screens via the `hidden` attribute; component display rules
   (e.g. .login-screen/.dashboard { display:flex }) would otherwise override it. */
[hidden] { display: none !important; }

/* ── Login ────────────────────────────────────────────────────────────────── */
.login-screen {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(135deg, #1A0D07 0%, #2C1A0E 60%, #1C0F0A 100%);
  padding: 24px;
}
.login-box {
  background: var(--c-surface);
  border-radius: 16px;
  padding: 2.5rem;
  width: 100%;
  max-width: 400px;
  box-shadow: 0 20px 60px rgba(0,0,0,.3);
}
.login-logo {
  display: flex;
  align-items: baseline;
  gap: .35rem;
  margin-bottom: 1.5rem;
  color: var(--c-brand);
}
.lw {
  font-size: 1.6rem;
  font-weight: 800;
  font-style: italic;
  font-family: Georgia, serif;
}
.lt {
  font-size: .65rem;
  font-weight: 700;
  letter-spacing: .18em;
  opacity: .6;
}
.login-box h1 { font-size: 1.4rem; font-weight: 700; margin-bottom: .35rem; }
.login-sub { color: var(--c-muted); margin-bottom: 1.75rem; }
.login-error {
  color: var(--c-red);
  font-size: .85rem;
  min-height: 1.2rem;
  margin-bottom: .75rem;
}

/* ── Common fields ────────────────────────────────────────────────────────── */
.field { display: flex; flex-direction: column; gap: .35rem; }
.field label { font-size: .78rem; font-weight: 600; color: var(--c-muted); text-transform: uppercase; letter-spacing: .05em; }
.field input,
.field select,
.field textarea {
  padding: .6rem .85rem;
  border: 1.5px solid var(--c-border);
  border-radius: 8px;
  font-size: .9rem;
  background: var(--c-bg);
  color: var(--c-text);
  transition: border-color var(--transition);
  width: 100%;
}
.field input:focus,
.field select:focus,
.field textarea:focus {
  outline: none;
  border-color: var(--c-gold);
  background: #fff;
}
.field textarea { resize: vertical; min-height: 80px; }
.field small { font-size: .77rem; color: var(--c-muted); }

/* ── Buttons ──────────────────────────────────────────────────────────────── */
.btn-primary {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: .4rem;
  padding: .65rem 1.5rem;
  background: var(--c-brand);
  color: #fff;
  border-radius: 8px;
  font-weight: 600;
  font-size: .9rem;
  transition: background var(--transition), transform var(--transition);
  width: 100%;
  margin-top: .5rem;
}
.btn-primary:hover { background: #1a0e07; transform: translateY(-1px); }
.btn-primary:active { transform: none; }

.btn-add {
  display: inline-flex;
  align-items: center;
  gap: .35rem;
  padding: .5rem 1.1rem;
  background: var(--c-gold);
  color: #fff;
  border-radius: 8px;
  font-size: .85rem;
  font-weight: 600;
  transition: background var(--transition);
}
.btn-add:hover { background: #b07808; }

.btn-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  border-radius: 6px;
  font-size: .85rem;
  transition: background var(--transition);
}
.btn-icon.edit  { color: var(--c-blue); background: rgba(37,99,235,.08); }
.btn-icon.edit:hover { background: rgba(37,99,235,.18); }
.btn-icon.del   { color: var(--c-red);  background: rgba(220,38,38,.08); }
.btn-icon.del:hover  { background: rgba(220,38,38,.18); }

.btn-upload {
  display: inline-flex;
  align-items: center;
  padding: .5rem 1.2rem;
  background: var(--c-brand);
  color: #fff;
  border-radius: 8px;
  font-size: .85rem;
  font-weight: 600;
  cursor: pointer;
  transition: background var(--transition);
}
.btn-upload:hover { background: #1a0e07; }

/* ── Dashboard layout ─────────────────────────────────────────────────────── */
.dashboard { display: flex; height: 100vh; overflow: hidden; }

/* ── Sidebar ──────────────────────────────────────────────────────────────── */
.sidebar {
  width: var(--sidebar-w);
  flex-shrink: 0;
  background: var(--c-sidebar);
  display: flex;
  flex-direction: column;
  padding: 1.5rem 0;
  overflow-y: auto;
}
.sidebar-brand {
  display: flex;
  align-items: baseline;
  gap: .3rem;
  padding: 0 1.25rem 1.5rem;
  color: #fff;
  border-bottom: 1px solid rgba(255,255,255,.08);
}
.sidebar-brand .lw { font-size: 1.3rem; color: #fff; }
.sidebar-brand .lt { color: rgba(255,255,255,.5); }
.sidebar-nav {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: .15rem;
  padding: 1rem .75rem;
}
.nav-item {
  display: flex;
  align-items: center;
  gap: .75rem;
  padding: .6rem .85rem;
  border-radius: 8px;
  color: rgba(255,255,255,.6);
  font-size: .88rem;
  font-weight: 500;
  text-align: left;
  transition: background var(--transition), color var(--transition);
}
.nav-item svg { width: 16px; height: 16px; flex-shrink: 0; }
.nav-item:hover { background: rgba(255,255,255,.07); color: rgba(255,255,255,.9); }
.nav-item.active { background: rgba(200,134,10,.2); color: #f0a820; }
.sidebar-logout {
  display: flex;
  align-items: center;
  gap: .6rem;
  padding: .6rem 1.6rem;
  color: rgba(255,255,255,.4);
  font-size: .82rem;
  transition: color var(--transition);
  margin-top: auto;
}
.sidebar-logout svg { width: 14px; height: 14px; }
.sidebar-logout:hover { color: rgba(255,255,255,.75); }

/* ── Main content ─────────────────────────────────────────────────────────── */
.main-content {
  flex: 1;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  min-width: 0;
}
.topbar {
  position: sticky;
  top: 0;
  background: var(--c-surface);
  border-bottom: 1px solid var(--c-border);
  padding: 1rem 1.75rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  z-index: 10;
}
.topbar-title { font-size: 1.1rem; font-weight: 700; }
.hamburger { display: none; font-size: 1.2rem; padding: .25rem .5rem; }

.section { padding: 1.75rem; }
.section-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 1.25rem;
}
.section-toolbar h3 { font-size: 1rem; font-weight: 700; }
.section-note { color: var(--c-muted); font-size: .85rem; margin-bottom: 1.5rem; }

/* ── Table / card list ────────────────────────────────────────────────────── */
.admin-table { width: 100%; border-collapse: collapse; }
.admin-table th {
  text-align: left;
  font-size: .72rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .06em;
  color: var(--c-muted);
  padding: .6rem 1rem;
  background: var(--c-bg);
  border-bottom: 2px solid var(--c-border);
}
.admin-table td {
  padding: .8rem 1rem;
  border-bottom: 1px solid var(--c-border);
  vertical-align: middle;
}
.admin-table tr:last-child td { border-bottom: none; }
.admin-table tr:hover td { background: rgba(0,0,0,.015); }
.table-wrap {
  background: var(--c-surface);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  overflow: hidden;
  overflow-x: auto;
}

.badge {
  display: inline-block;
  padding: .15rem .55rem;
  border-radius: 100px;
  font-size: .72rem;
  font-weight: 600;
}
.badge-green { background: rgba(22,163,74,.12); color: var(--c-green); }
.badge-red   { background: rgba(220,38,38,.1);  color: var(--c-red);   }
.badge-gold  { background: rgba(200,134,10,.12); color: var(--c-gold);  }

.price-cell { font-weight: 700; color: var(--c-gold); }

/* ── Category group header ────────────────────────────────────────────────── */
.cat-header {
  padding: .6rem 1rem;
  background: #F8F9FA;
  font-size: .78rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .07em;
  color: var(--c-muted);
  border-bottom: 1px solid var(--c-border);
}

/* ── Reviews admin ────────────────────────────────────────────────────────── */
.review-admin-card {
  background: var(--c-surface);
  border-radius: var(--radius);
  padding: 1.25rem;
  border: 1px solid var(--c-border);
  box-shadow: var(--shadow);
  margin-bottom: 1rem;
  display: flex;
  gap: 1rem;
  align-items: flex-start;
}
.review-admin-body { flex: 1; min-width: 0; }
.review-admin-stars { color: var(--c-gold); font-size: .9rem; margin-bottom: .25rem; }
.review-admin-text { color: var(--c-muted); font-size: .88rem; margin-bottom: .4rem; font-style: italic; }
.review-admin-meta { font-size: .8rem; font-weight: 600; }
.review-admin-actions { display: flex; gap: .4rem; flex-shrink: 0; }

/* ── Images grid ──────────────────────────────────────────────────────────── */
.upload-area {
  background: var(--c-surface);
  border: 2px dashed var(--c-border);
  border-radius: var(--radius);
  padding: 2.5rem;
  text-align: center;
  margin-bottom: 2rem;
  transition: border-color var(--transition);
}
.upload-area:hover { border-color: var(--c-gold); }
.upload-icon { font-size: 2.5rem; margin-bottom: .75rem; }
.upload-area p { color: var(--c-muted); margin-bottom: .75rem; font-size: .9rem; }
.upload-hint { font-size: .78rem !important; margin-top: .5rem !important; }
.upload-fields {
  display: flex;
  gap: .75rem;
  align-items: center;
  justify-content: center;
  flex-wrap: wrap;
  margin-top: 1.25rem;
}
.upload-fields input,
.upload-fields select {
  padding: .55rem .85rem;
  border: 1.5px solid var(--c-border);
  border-radius: 8px;
  font-size: .88rem;
  background: var(--c-bg);
  min-width: 160px;
}
.upload-fields input:focus,
.upload-fields select:focus { outline: none; border-color: var(--c-gold); }
.upload-fields .btn-primary { width: auto; margin-top: 0; }
.images-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
  gap: 1rem;
}
.image-card {
  background: var(--c-surface);
  border-radius: var(--radius);
  overflow: hidden;
  border: 1px solid var(--c-border);
  box-shadow: var(--shadow);
}
.image-card img {
  width: 100%;
  aspect-ratio: 4/3;
  object-fit: cover;
}
.image-card-info {
  padding: .6rem .75rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: .5rem;
}
.image-card-meta { font-size: .78rem; color: var(--c-muted); overflow: hidden; }
.image-card-section {
  font-size: .7rem;
  font-weight: 700;
  text-transform: uppercase;
  color: var(--c-gold);
  letter-spacing: .05em;
}
.image-use-btn {
  font-size: .72rem;
  padding: .2rem .55rem;
  border-radius: 4px;
  background: rgba(200,134,10,.12);
  color: var(--c-gold);
  font-weight: 600;
  cursor: pointer;
  border: none;
  white-space: nowrap;
}
.image-use-btn:hover { background: rgba(200,134,10,.25); }

/* ── Page photos (hero/about) ─────────────────────────────────────────────── */
.page-photos {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 1.25rem;
  margin-bottom: 1rem;
}
.page-photo-card {
  background: var(--c-surface);
  border: 1px solid var(--c-border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 1rem;
  display: flex;
  flex-direction: column;
  gap: .75rem;
  align-items: flex-start;
}
.page-photo-label { font-size: .82rem; font-weight: 700; color: var(--c-muted); text-transform: uppercase; letter-spacing: .05em; }
.page-photo-preview {
  width: 100%;
  aspect-ratio: 16/9;
  border-radius: 8px;
  overflow: hidden;
  background: var(--c-bg);
}
.page-photo-preview img { width: 100%; height: 100%; object-fit: cover; }
.page-photo-preview .no-photo {
  width: 100%; height: 100%;
  display: flex; align-items: center; justify-content: center;
  color: var(--c-muted); font-size: .85rem;
}

/* ── Gallery toolbar / bulk actions ───────────────────────────────────────── */
.gallery-toolbar {
  display: flex;
  align-items: center;
  gap: 1rem;
  margin-bottom: 1rem;
  flex-wrap: wrap;
}
.select-all-wrap { display: flex; align-items: center; gap: .45rem; font-size: .85rem; font-weight: 500; cursor: pointer; }
.gallery-hint { font-size: .8rem; color: var(--c-muted); }
.btn-danger {
  margin-left: auto;
  padding: .5rem 1.1rem;
  background: var(--c-red);
  color: #fff;
  border-radius: 8px;
  font-size: .85rem;
  font-weight: 600;
  transition: opacity var(--transition);
}
.btn-danger:disabled { opacity: .4; cursor: not-allowed; }
.btn-danger:not(:disabled):hover { opacity: .88; }
.file-count { font-size: .85rem; color: var(--c-muted); font-weight: 500; }

/* ── Gallery card: checkbox, drag handle, selected/dragging states ────────── */
.image-card { position: relative; cursor: grab; transition: box-shadow var(--transition), transform var(--transition), outline var(--transition); }
.image-card.selected { outline: 3px solid var(--c-gold); outline-offset: -1px; }
.image-card.dragging { opacity: .45; }
.image-check {
  position: absolute;
  top: 8px; left: 8px;
  z-index: 2;
  background: rgba(255,255,255,.92);
  border-radius: 5px;
  padding: 2px 4px;
  line-height: 0;
  box-shadow: 0 1px 4px rgba(0,0,0,.2);
}
.image-check input { width: 16px; height: 16px; cursor: pointer; }
.drag-handle {
  position: absolute;
  top: 6px; right: 8px;
  z-index: 2;
  color: #fff;
  font-size: 1.1rem;
  text-shadow: 0 1px 3px rgba(0,0,0,.6);
  cursor: grab;
  user-select: none;
}

/* ── Colours grid ─────────────────────────────────────────────────────────── */
.colour-grid { display: flex; flex-direction: column; gap: 1rem; margin-bottom: 1.5rem; max-width: 480px; }
.colour-row {
  display: flex;
  align-items: center;
  gap: 1rem;
  background: var(--c-surface);
  padding: .85rem 1.1rem;
  border-radius: var(--radius);
  border: 1px solid var(--c-border);
}
.colour-row label { flex: 1; font-size: .88rem; font-weight: 500; }
.colour-row input[type="color"] {
  width: 40px; height: 32px;
  border: 1.5px solid var(--c-border);
  border-radius: 6px;
  cursor: pointer;
  padding: 2px;
  flex-shrink: 0;
}
.colour-row input[type="text"] {
  width: 90px;
  padding: .45rem .65rem;
  border: 1.5px solid var(--c-border);
  border-radius: 6px;
  font-size: .85rem;
  font-family: monospace;
  background: var(--c-bg);
}
.colour-row input[type="text"]:focus { outline: none; border-color: var(--c-gold); background: #fff; }

/* ── Settings form ────────────────────────────────────────────────────────── */
.settings-form { max-width: 780px; display: flex; flex-direction: column; gap: 1.25rem; }
.settings-form.narrow { max-width: 400px; }
.field-row { display: grid; grid-template-columns: 1fr 1fr; gap: 1.25rem; }
.settings-form .btn-primary { width: auto; align-self: flex-start; margin-top: .25rem; }

/* ── Modal ────────────────────────────────────────────────────────────────── */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,.5);
  z-index: 100;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
}
.modal-overlay[hidden] { display: none; }
.modal {
  background: var(--c-surface);
  border-radius: 14px;
  width: 100%;
  max-width: 520px;
  max-height: 90vh;
  overflow-y: auto;
  box-shadow: 0 24px 80px rgba(0,0,0,.35);
}
.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 1.25rem 1.5rem;
  border-bottom: 1px solid var(--c-border);
  position: sticky;
  top: 0;
  background: var(--c-surface);
}
.modal-header h3 { font-size: 1rem; font-weight: 700; }
.modal-close {
  width: 28px; height: 28px;
  border-radius: 6px;
  color: var(--c-muted);
  font-size: .9rem;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background var(--transition);
}
.modal-close:hover { background: var(--c-bg); color: var(--c-text); }
.modal-body { padding: 1.5rem; display: flex; flex-direction: column; gap: 1.1rem; }
.modal-body .btn-primary { margin-top: .5rem; }

/* ── Toast ────────────────────────────────────────────────────────────────── */
.toast {
  position: fixed;
  bottom: 1.5rem;
  right: 1.5rem;
  background: #1A1A2E;
  color: #fff;
  padding: .75rem 1.25rem;
  border-radius: 10px;
  font-size: .88rem;
  font-weight: 500;
  box-shadow: 0 8px 24px rgba(0,0,0,.25);
  transform: translateY(100px);
  opacity: 0;
  transition: transform .3s ease, opacity .3s ease;
  z-index: 200;
  pointer-events: none;
  max-width: 320px;
}
.toast.show { transform: none; opacity: 1; }
.toast.success { background: var(--c-green); }
.toast.error   { background: var(--c-red);   }

/* ── Responsive ───────────────────────────────────────────────────────────── */
@media (max-width: 700px) {
  .sidebar { position: fixed; left: -100%; top: 0; bottom: 0; z-index: 50; transition: left var(--transition); }
  .sidebar.open { left: 0; }
  .hamburger { display: block; }
  .field-row { grid-template-columns: 1fr; }
  .colour-row { flex-wrap: wrap; }
  .section { padding: 1rem; }
}
