@import url('https://fonts.googleapis.com/css2?family=Cormorant+Garamond:wght@400;500;600&family=Outfit:wght@300;400;500;600&display=swap');

:root {
  --bg: #08080a;
  --bg-elev: #101012;
  --bg-card: #141417;
  --bg-input: #1b1b1f;
  --gold: #c8a96a;
  --gold-soft: #d9c193;
  --text: #f4f2ec;
  --muted: #a6a199;
  --faint: #6c675f;
  --line: rgba(255, 255, 255, 0.08);
  --line-strong: rgba(255, 255, 255, 0.16);
  --danger: #d4604f;
  --font-display: 'Cormorant Garamond', Georgia, serif;
  --font-body: 'Outfit', system-ui, sans-serif;
  --ease: cubic-bezier(0.22, 1, 0.36, 1);
}

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

body {
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-body);
  font-weight: 300;
  line-height: 1.6;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

img { display: block; max-width: 100%; }
a { color: inherit; text-decoration: none; }

input, button { font: inherit; color: inherit; }

/* ---------- Auth pages ---------- */
.auth-wrap {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 2rem;
  padding: 3rem 1.5rem;
}

.auth-brand img { height: 76px; width: auto; }

.auth-card {
  width: 100%;
  max-width: 400px;
  background: var(--bg-card);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 2.5rem;
}

.auth-card h1 {
  font-family: var(--font-display);
  font-weight: 500;
  font-size: 2rem;
  letter-spacing: 0.5px;
}

.auth-sub { color: var(--muted); margin: 0.4rem 0 1.75rem; font-size: 0.95rem; }
.auth-note { margin-top: 1.5rem; font-size: 0.85rem; color: var(--faint); }
.auth-note a { color: var(--gold-soft); }
.auth-note code, code { background: var(--bg-input); padding: 0.1rem 0.4rem; border-radius: 3px; color: var(--gold-soft); }

.fld { display: block; margin-bottom: 1.1rem; }
.fld span {
  display: block;
  font-size: 0.72rem;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--muted);
  margin-bottom: 0.5rem;
}
.fld input,
.fld textarea {
  width: 100%;
  background: var(--bg-input);
  border: 1px solid var(--line);
  border-radius: 4px;
  padding: 0.85rem 1rem;
  font-size: 0.95rem;
  transition: border-color 0.3s var(--ease), box-shadow 0.3s var(--ease);
}
.fld textarea { resize: vertical; min-height: 90px; }
.fld input:focus,
.fld textarea:focus,
.row-form input:focus,
.upload-form input:focus {
  outline: none;
  border-color: var(--gold);
  box-shadow: 0 0 0 3px rgba(200, 169, 106, 0.14);
}

.sel-note { max-width: 640px; margin-top: 2rem; }

.btn-gold {
  width: 100%;
  background: var(--gold);
  color: #0a0a0a;
  border: 1px solid var(--gold);
  border-radius: 4px;
  padding: 0.9rem 1.4rem;
  font-weight: 600;
  letter-spacing: 0.03em;
  cursor: pointer;
  transition: background-color 0.3s var(--ease), transform 0.2s var(--ease);
}
.btn-gold:hover { background: var(--gold-soft); }
.btn-gold:active, .btn-ghost-gold:active, .btn-danger:active { transform: scale(0.97); }

.alert {
  background: rgba(212, 96, 79, 0.12);
  border: 1px solid var(--danger);
  color: #f0b8af;
  border-radius: 4px;
  padding: 0.8rem 1rem;
  font-size: 0.9rem;
  margin-bottom: 1.25rem;
}
.alert.ok {
  background: rgba(200, 169, 106, 0.12);
  border-color: var(--gold);
  color: var(--gold-soft);
}

/* ---------- Gallery + admin header ---------- */
.g-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 1rem 2rem;
  border-bottom: 1px solid var(--line);
  background: rgba(8, 8, 10, 0.9);
  position: sticky;
  top: 0;
  z-index: 10;
  backdrop-filter: blur(12px);
}
.g-logo img { height: 52px; }
.g-head-right { display: flex; align-items: center; gap: 1.5rem; }
.g-hi { color: var(--muted); font-size: 0.9rem; }
.g-hi strong { color: var(--text); font-weight: 500; }
.g-logout {
  color: var(--muted);
  font-size: 0.85rem;
  border: 1px solid var(--line-strong);
  border-radius: 3px;
  padding: 0.45rem 0.9rem;
  transition: color 0.3s var(--ease), border-color 0.3s var(--ease);
}
.g-logout:hover { color: var(--gold-soft); border-color: var(--gold); }

/* ---------- Client gallery ---------- */
.g-wrap { flex: 1; max-width: 1200px; width: 100%; margin: 0 auto; padding: 3rem 2rem; }
.g-intro { margin-bottom: 2.5rem; }
.g-intro h1 { font-family: var(--font-display); font-weight: 500; font-size: 2.6rem; }
.g-intro p { color: var(--muted); margin-top: 0.4rem; }

.g-empty {
  border: 1px dashed var(--line-strong);
  border-radius: 6px;
  padding: 3rem;
  text-align: center;
  color: var(--muted);
}

.g-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 1rem;
}
.g-item {
  position: relative;
  border-radius: 4px;
  overflow: hidden;
  background: #111;
  aspect-ratio: 3 / 2;
}
.g-item img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 0.6s var(--ease);
}
.g-item:hover img { transform: scale(1.04); }
.g-dl {
  position: absolute;
  left: 0.75rem;
  bottom: 0.75rem;
  background: rgba(8, 8, 10, 0.82);
  border: 1px solid var(--line-strong);
  color: var(--text);
  font-size: 0.78rem;
  letter-spacing: 0.04em;
  padding: 0.4rem 0.85rem;
  border-radius: 3px;
  opacity: 0;
  transform: translateY(6px);
  transition: opacity 0.3s var(--ease), transform 0.3s var(--ease), background-color 0.3s var(--ease);
}
.g-item:hover .g-dl { opacity: 1; transform: none; }
.g-dl:hover { background: var(--gold); color: #0a0a0a; border-color: var(--gold); }

/* ---------- Admin ---------- */
.admin-wrap { flex: 1; max-width: 980px; width: 100%; margin: 0 auto; padding: 2.5rem 2rem 4rem; }
.admin-wrap > h1 { font-family: var(--font-display); font-weight: 500; font-size: 2.4rem; margin-bottom: 1.5rem; }

.card {
  background: var(--bg-card);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 1.75rem;
  margin-bottom: 1.5rem;
}
.card h2 { font-family: var(--font-display); font-weight: 500; font-size: 1.5rem; margin-bottom: 1rem; }

.row-form { display: flex; flex-wrap: wrap; gap: 0.75rem; }
.row-form input {
  flex: 1 1 160px;
  background: var(--bg-input);
  border: 1px solid var(--line);
  border-radius: 4px;
  padding: 0.75rem 0.9rem;
  font-size: 0.9rem;
}
.row-form .btn-gold { width: auto; flex: 0 0 auto; }
.hint { margin-top: 0.85rem; font-size: 0.82rem; color: var(--faint); }
.muted { color: var(--muted); }

.client-top {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: 1.25rem;
}
.client-top h3 { font-family: var(--font-display); font-weight: 500; font-size: 1.6rem; }

.btn-danger {
  background: transparent;
  border: 1px solid rgba(212, 96, 79, 0.5);
  color: #e29a8e;
  border-radius: 4px;
  padding: 0.5rem 0.9rem;
  font-size: 0.82rem;
  cursor: pointer;
  transition: background-color 0.3s var(--ease), color 0.3s var(--ease);
}
.btn-danger:hover { background: var(--danger); color: #0a0a0a; border-color: var(--danger); }

.upload-form {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
  align-items: center;
  padding: 1rem;
  border: 1px dashed var(--line-strong);
  border-radius: 5px;
  margin-bottom: 1.25rem;
}
.upload-form input[type=file] { flex: 1 1 240px; font-size: 0.85rem; color: var(--muted); }
.upload-form .btn-gold { width: auto; }

.thumbs { display: grid; grid-template-columns: repeat(auto-fill, minmax(130px, 1fr)); gap: 0.6rem; }
.thumb { position: relative; aspect-ratio: 1; border-radius: 4px; overflow: hidden; background: #111; }
.thumb img { width: 100%; height: 100%; object-fit: cover; }
.thumb form { position: absolute; top: 4px; right: 4px; }
.thumb-x {
  width: 26px;
  height: 26px;
  border-radius: 50%;
  background: rgba(8, 8, 10, 0.8);
  border: 1px solid var(--line-strong);
  color: #fff;
  font-size: 1rem;
  line-height: 1;
  cursor: pointer;
  transition: background-color 0.3s var(--ease);
}
.thumb-x:hover { background: var(--danger); border-color: var(--danger); color: #0a0a0a; }

/* ---------- Footer ---------- */
.portal-foot {
  text-align: center;
  padding: 2rem;
  color: var(--faint);
  font-size: 0.8rem;
  border-top: 1px solid var(--line);
}

/* ---------- Selection / proofing ---------- */
.g-intro.more { margin-top: 3.5rem; padding-top: 2rem; border-top: 1px solid var(--line); }
.g-intro.more h2 { font-family: var(--font-display); font-weight: 500; font-size: 2rem; }
.g-intro strong { color: var(--gold-soft); font-weight: 500; }
.btn-gold.inline { display: inline-block; width: auto; margin-top: 1rem; }

.g-grid.select .pick {
  position: relative;
  display: block;
  border-radius: 4px;
  overflow: hidden;
  cursor: pointer;
  aspect-ratio: 3 / 2;
  background: #111;
}
.g-grid.select .pick img { width: 100%; height: 100%; object-fit: cover; transition: transform 0.5s var(--ease); }
.g-grid.select .pick input { position: absolute; opacity: 0; pointer-events: none; }
.pick-mark {
  position: absolute;
  top: 0.6rem; right: 0.6rem;
  width: 30px; height: 30px;
  border-radius: 50%;
  background: rgba(8, 8, 10, 0.6);
  border: 1.5px solid rgba(255, 255, 255, 0.55);
  color: #fff;
  display: flex; align-items: center; justify-content: center;
  font-size: 1rem; line-height: 1;
  transition: all 0.25s var(--ease);
}
.pick::after {
  content: '';
  position: absolute; inset: 0;
  border: 3px solid transparent;
  border-radius: 4px;
  transition: border-color 0.25s var(--ease);
  pointer-events: none;
}
.pick.on::after { border-color: var(--gold); }
.pick.on .pick-mark { background: var(--gold); border-color: var(--gold); color: #0a0a0a; }
.pick.on img { transform: scale(1.03); }
.pick input:disabled ~ img { opacity: 0.45; }

.selbar {
  position: sticky;
  bottom: 0;
  margin-top: 1.5rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  flex-wrap: wrap;
  padding: 1rem 1.25rem;
  background: rgba(16, 16, 18, 0.96);
  border: 1px solid var(--line-strong);
  border-radius: 6px;
  backdrop-filter: blur(10px);
  z-index: 20;
}
.selcount { color: var(--muted); font-size: 0.95rem; }
.selcount strong { color: var(--gold-soft); font-size: 1.1rem; }
.selbar-actions { display: flex; gap: 0.6rem; flex-wrap: wrap; }
.selbar .btn-gold { width: auto; }
.btn-gold:disabled { opacity: 0.4; cursor: not-allowed; }

.btn-ghost-gold {
  background: transparent;
  border: 1px solid var(--gold);
  color: var(--gold-soft);
  border-radius: 4px;
  padding: 0.7rem 1.1rem;
  font-weight: 500;
  cursor: pointer;
  transition: background-color 0.3s var(--ease), color 0.3s var(--ease);
}
.btn-ghost-gold:hover { background: var(--gold); color: #0a0a0a; }

/* ---------- Admin badges / package ---------- */
.status { margin-top: 0.5rem; display: flex; align-items: center; gap: 0.5rem; flex-wrap: wrap; }
.badge {
  display: inline-block;
  font-size: 0.72rem;
  letter-spacing: 0.04em;
  padding: 0.25rem 0.6rem;
  border-radius: 100px;
  border: 1px solid var(--line-strong);
  color: var(--muted);
}
.badge.gold { border-color: var(--gold); color: var(--gold-soft); background: rgba(200, 169, 106, 0.1); }

.pkg { margin: 0.5rem 0 1.25rem; }
.pkg summary { cursor: pointer; color: var(--muted); font-size: 0.88rem; padding: 0.5rem 0; }
.pkg summary:hover { color: var(--text); }
.pkg .mini { display: flex; flex-direction: column; font-size: 0.72rem; letter-spacing: 0.08em; text-transform: uppercase; color: var(--faint); gap: 0.3rem; }
.pkg .mini input { background: var(--bg-input); border: 1px solid var(--line); border-radius: 4px; padding: 0.55rem 0.7rem; font-size: 0.9rem; color: var(--text); }
.pkg .btn-ghost-gold { align-self: flex-end; }

.thumb-tag {
  position: absolute;
  left: 4px; bottom: 4px;
  font-size: 0.62rem;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  background: rgba(8, 8, 10, 0.8);
  border: 1px solid var(--gold);
  color: var(--gold-soft);
  padding: 0.1rem 0.4rem;
  border-radius: 3px;
}

@media (max-width: 560px) {
  .g-head { padding: 0.85rem 1.25rem; }
  .g-hi { display: none; }
  .g-wrap, .admin-wrap { padding-left: 1.25rem; padding-right: 1.25rem; }
  .client-top { flex-direction: column; }
  .selbar { flex-direction: column; align-items: stretch; }
  .selbar-actions { justify-content: stretch; }
  .selbar-actions button { flex: 1; }
}

@media (hover: none) {
  .g-item:hover img { transform: none; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.001ms !important;
    transition-duration: 0.001ms !important;
  }
  .g-item:hover img, .pick.on img { transform: none !important; }
}
