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

:root {
  --bg:       #0f0f0f;
  --surface:  #1a1a1a;
  --surface2: #222;
  --border:   #2e2e2e;
  --text:     #f0f0f0;
  --muted:    #888;
  --accent:   #c9a96e;
  --accent-d: #a8883d;
  --green:    #4caf50;
  --red:      #ef4444;
  --radius:   8px;
}

body {
  background: var(--bg);
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', system-ui, sans-serif;
  font-size: 15px;
  line-height: 1.6;
  min-height: 100vh;
}

/* ── Typography ── */
h1 { font-size: 22px; font-weight: 700; letter-spacing: -.02em; }
h2 { font-size: 17px; font-weight: 600; }
h3 { font-size: 14px; font-weight: 600; }

/* ── Buttons ── */
.btn {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 8px 16px; border-radius: var(--radius);
  font-size: 13.5px; font-weight: 600; cursor: pointer;
  border: 1px solid transparent; transition: all .15s; text-decoration: none;
  white-space: nowrap;
}
.btn-primary  { background: var(--accent);  color: #0f0f0f; }
.btn-primary:hover  { background: var(--accent-d); }
.btn-ghost   { background: transparent; color: var(--text); border-color: var(--border); }
.btn-ghost:hover { background: var(--surface2); }
.btn-danger  { background: transparent; color: var(--red); border-color: var(--red); }
.btn-danger:hover { background: rgba(239,68,68,.1); }
.btn-sm { padding: 5px 11px; font-size: 12px; }
.btn:disabled { opacity: .4; cursor: not-allowed; }

/* ── Form ── */
.field { margin-bottom: 16px; }
.field label { display: block; font-size: 12px; font-weight: 600; color: var(--muted); letter-spacing: .06em; text-transform: uppercase; margin-bottom: 6px; }
.field input, .field select {
  width: 100%; padding: 10px 14px; background: var(--surface2);
  border: 1px solid var(--border); border-radius: var(--radius);
  color: var(--text); font-size: 14px; outline: none; transition: border-color .15s;
}
.field input:focus, .field select:focus { border-color: var(--accent); }

/* ── Badge ── */
.badge {
  display: inline-block; padding: 2px 9px; border-radius: 20px;
  font-size: 11px; font-weight: 700; letter-spacing: .05em; text-transform: uppercase;
}
.badge-green { background: rgba(76,175,80,.15); color: var(--green); border: 1px solid rgba(76,175,80,.3); }
.badge-red   { background: rgba(239,68,68,.12); color: var(--red);   border: 1px solid rgba(239,68,68,.25); }
.badge-muted { background: rgba(136,136,136,.1); color: var(--muted); border: 1px solid var(--border); }

/* ── Modal ── */
.modal-backdrop {
  position: fixed; inset: 0; background: rgba(0,0,0,.75);
  display: flex; align-items: center; justify-content: center;
  z-index: 100; padding: 24px;
}
.modal-backdrop.hidden { display: none; }
.modal {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: 12px; padding: 28px; width: 100%; max-width: 440px;
}
.modal h2 { margin-bottom: 20px; }

/* ── Toast ── */
#toast {
  position: fixed; bottom: 24px; right: 24px;
  background: var(--surface2); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 12px 18px;
  font-size: 13px; z-index: 200; transition: opacity .2s;
  max-width: 320px;
}
#toast.hidden { opacity: 0; pointer-events: none; }

/* ── Admin Layout ── */
.admin-header {
  display: flex; align-items: center; justify-content: space-between;
  padding: 18px 24px; border-bottom: 1px solid var(--border);
  background: var(--surface);
}
.admin-logo { display: flex; align-items: center; gap: 10px; }
.admin-logo .name { font-weight: 700; font-size: 15px; }
.admin-logo .sub  { font-size: 11px; color: var(--accent); font-weight: 600; letter-spacing: .08em; text-transform: uppercase; }

.admin-main { max-width: 960px; margin: 0 auto; padding: 32px 24px; }

.stats-row {
  display: flex; gap: 16px; margin-bottom: 32px; flex-wrap: wrap;
}
.stat-card {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 16px 20px; flex: 1; min-width: 140px;
}
.stat-card .val { font-size: 28px; font-weight: 700; color: var(--accent); line-height: 1.1; }
.stat-card .lbl { font-size: 12px; color: var(--muted); margin-top: 2px; }

.section-header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 16px; }

/* ── Gallery Card ── */
.gallery-card {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: 10px; padding: 18px 20px; margin-bottom: 12px;
  display: grid; grid-template-columns: 1fr auto; gap: 12px; align-items: center;
}
.gallery-card.expired { opacity: .55; }
.gallery-card-info .gname { font-weight: 700; font-size: 15px; margin-bottom: 4px; }
.gallery-card-info .gmeta { font-size: 12px; color: var(--muted); display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.gallery-card-actions { display: flex; gap: 8px; flex-wrap: wrap; justify-content: flex-end; }

/* ── Upload Zone ── */
.upload-zone {
  border: 2px dashed var(--border); border-radius: var(--radius);
  padding: 32px; text-align: center; cursor: pointer; transition: all .2s; margin-bottom: 16px;
}
.upload-zone:hover, .upload-zone.drag-over { border-color: var(--accent); background: rgba(201,169,110,.05); }
.upload-zone .icon { font-size: 32px; margin-bottom: 8px; }
.upload-zone p { font-size: 13px; color: var(--muted); }

.progress-bar { background: var(--border); border-radius: 4px; height: 6px; margin-top: 12px; overflow: hidden; }
.progress-bar-fill { height: 100%; background: var(--accent); transition: width .3s; }

/* ── Login Screen ── */
.login-wrap {
  min-height: 100vh; display: flex; align-items: center; justify-content: center; padding: 24px;
}
.login-box {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: 12px; padding: 36px; width: 100%; max-width: 380px;
}
.login-box .brand { text-align: center; margin-bottom: 28px; }
.login-box .brand .logo { font-size: 28px; margin-bottom: 6px; }
.login-box .brand h1 { font-size: 18px; }
.login-box .brand p  { font-size: 12px; color: var(--muted); margin-top: 2px; }
.error-msg { color: var(--red); font-size: 13px; margin-top: 8px; }

/* ── Gallery Page ── */
.gallery-page { min-height: 100vh; }

.gallery-header {
  position: sticky; top: 0; z-index: 10;
  background: rgba(15,15,15,.92); backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--border);
  padding: 14px 24px; display: flex; align-items: center; justify-content: space-between; gap: 16px;
}
.gallery-title { font-weight: 700; font-size: 15px; }
.gallery-meta  { font-size: 12px; color: var(--muted); }
.gallery-header-actions { display: flex; gap: 8px; align-items: center; }

/* ── Photo Grid ── */
.photo-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
  gap: 4px; padding: 4px;
}
.photo-item {
  aspect-ratio: 4/3; overflow: hidden; cursor: pointer; position: relative;
  background: var(--surface);
}
.photo-item img {
  width: 100%; height: 100%; object-fit: cover;
  transition: transform .3s; display: block;
}
.photo-item:hover img { transform: scale(1.04); }
.photo-item .photo-overlay {
  position: absolute; inset: 0; background: rgba(0,0,0,0); transition: background .2s;
  display: flex; align-items: flex-end; padding: 10px;
}
.photo-item:hover .photo-overlay { background: rgba(0,0,0,.4); }
.photo-item .dl-btn {
  opacity: 0; transition: opacity .2s;
  background: rgba(255,255,255,.15); backdrop-filter: blur(8px);
  border: 1px solid rgba(255,255,255,.2); border-radius: 6px;
  color: white; padding: 5px 10px; font-size: 12px; font-weight: 600;
  cursor: pointer; text-decoration: none;
}
.photo-item:hover .dl-btn { opacity: 1; }

/* ── Lightbox ── */
.lightbox {
  position: fixed; inset: 0; background: rgba(0,0,0,.95); z-index: 200;
  display: flex; align-items: center; justify-content: center;
}
.lightbox.hidden { display: none; }
.lightbox img { max-width: 90vw; max-height: 85vh; object-fit: contain; border-radius: 4px; }
.lb-close {
  position: absolute; top: 20px; right: 24px; font-size: 28px;
  color: var(--muted); cursor: pointer; line-height: 1; background: none; border: none;
}
.lb-close:hover { color: var(--text); }
.lb-prev, .lb-next {
  position: absolute; top: 50%; transform: translateY(-50%);
  background: rgba(255,255,255,.1); border: none; color: white;
  width: 44px; height: 44px; border-radius: 50%; font-size: 20px;
  cursor: pointer; display: flex; align-items: center; justify-content: center;
  transition: background .15s;
}
.lb-prev:hover, .lb-next:hover { background: rgba(255,255,255,.2); }
.lb-prev { left: 16px; }
.lb-next { right: 16px; }
.lb-info {
  position: absolute; bottom: 20px; left: 50%; transform: translateX(-50%);
  font-size: 12px; color: var(--muted); display: flex; gap: 12px; align-items: center;
}
.lb-dl {
  background: var(--accent); color: #0f0f0f; border: none;
  border-radius: 6px; padding: 6px 14px; font-size: 12px;
  font-weight: 700; cursor: pointer;
}

/* ── Password Screen ── */
.pw-screen {
  min-height: 100vh; display: flex; align-items: center; justify-content: center;
  background: radial-gradient(ellipse at center, #1a1a1a 0%, #0f0f0f 70%);
  padding: 24px;
}
.pw-box {
  text-align: center; width: 100%; max-width: 360px;
}
.pw-box .brand-name { font-size: 13px; font-weight: 700; letter-spacing: .15em; text-transform: uppercase; color: var(--accent); margin-bottom: 32px; }
.pw-box h1 { font-size: 22px; margin-bottom: 6px; }
.pw-box p  { color: var(--muted); font-size: 14px; margin-bottom: 28px; }
.pw-box input {
  width: 100%; padding: 13px 16px; background: var(--surface2);
  border: 1px solid var(--border); border-radius: var(--radius);
  color: var(--text); font-size: 16px; text-align: center;
  letter-spacing: .2em; outline: none; margin-bottom: 12px; transition: border-color .15s;
}
.pw-box input:focus { border-color: var(--accent); }
.pw-box input.error { border-color: var(--red); }
.pw-box .pw-btn {
  width: 100%; padding: 13px; background: var(--accent); color: #0f0f0f;
  border: none; border-radius: var(--radius); font-size: 15px; font-weight: 700;
  cursor: pointer; transition: background .15s;
}
.pw-box .pw-btn:hover { background: var(--accent-d); }
.pw-error { color: var(--red); font-size: 13px; margin-top: 10px; }

/* ── Expired Screen ── */
.expired-screen {
  min-height: 100vh; display: flex; align-items: center; justify-content: center;
  flex-direction: column; gap: 12px; text-align: center; padding: 24px;
}
.expired-screen .icon { font-size: 48px; }
.expired-screen h1 { font-size: 22px; }
.expired-screen p  { color: var(--muted); max-width: 340px; }

/* ── Utils ── */
.hidden { display: none !important; }
.text-muted { color: var(--muted); }
.mt-2 { margin-top: 8px; }
.flex-gap { display: flex; gap: 8px; align-items: center; }
