/* =====================================================================
   Power Studio Online — private client photo galleries.
   Design tokens mirror powerstudiostorefront.com (dark + gold, serif heads).
   ===================================================================== */
:root {
  --bg: #0f0f13;
  --surface: #17171d;
  --surface-2: #1e1e26;
  --tint: #1a1a21;
  --ink: #f4f2ec;
  --muted: #a2a1ac;
  --line: #2b2b34;
  --brand: #d4a24e;
  --brand-dark: #b9863a;
  --brand-soft: rgba(212, 162, 78, .14);

  --font-head: Georgia, "Times New Roman", serif;
  --font-body: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;

  --radius: 14px;
  --radius-sm: 9px;
  --shadow-md: 0 18px 44px rgba(0, 0, 0, .4);
  --maxw: 1160px;
}

* { box-sizing: border-box; }
html, body { overflow-x: clip; }
body { margin: 0; background: var(--bg); color: var(--ink); font-family: var(--font-body); line-height: 1.6; -webkit-font-smoothing: antialiased; }
h1, h2, h3, h4 { font-family: var(--font-head); font-weight: 600; line-height: 1.16; color: var(--ink); margin: 0; }
a { color: var(--brand); text-decoration: none; }
img { display: block; max-width: 100%; }
.wrap { max-width: var(--maxw); margin: 0 auto; padding: 0 20px; }
[hidden] { display: none !important; }

/* ---------- Buttons ---------- */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; font: inherit; font-weight: 600; border-radius: var(--radius-sm); padding: 11px 20px; border: 1px solid transparent; cursor: pointer; transition: transform .12s ease, background .15s ease, border-color .15s ease, opacity .15s; }
.btn:active { transform: translateY(1px); }
.btn:disabled { opacity: .55; cursor: not-allowed; }
.btn-primary { background: var(--brand); color: #1a130a; }
.btn-primary:hover:not(:disabled) { background: var(--brand-dark); }
.btn-ghost { background: transparent; color: var(--ink); border-color: var(--line); }
.btn-ghost:hover:not(:disabled) { border-color: var(--brand); color: var(--brand); }
.btn-sm { padding: 8px 14px; font-size: .9rem; }
.btn-danger { background: transparent; color: #e0656b; border-color: rgba(224,101,107,.4); }
.btn-danger:hover:not(:disabled) { background: rgba(224,101,107,.12); border-color: #e0656b; }
.btn-block { width: 100%; }

/* ---------- Header ---------- */
.site-header { position: sticky; top: 0; z-index: 40; background: rgba(15,15,19,.85); backdrop-filter: blur(10px); border-bottom: 1px solid var(--line); }
.nav { display: flex; align-items: center; justify-content: space-between; height: 66px; gap: 16px; }
.brand { display: flex; align-items: center; gap: 10px; }
.brand img { width: 30px; height: 30px; }
.brand-name { font-family: var(--font-head); font-weight: 600; font-size: 1.24rem; }
.brand-name .dot { color: var(--brand); }
.nav-right { display: flex; align-items: center; gap: 12px; }
.who { display: flex; align-items: center; gap: 8px; font-size: .9rem; color: var(--muted); }
.who b { color: var(--ink); font-weight: 600; }
.badge-admin { display: inline-block; font-size: .68rem; font-weight: 700; letter-spacing: .04em; text-transform: uppercase; color: var(--brand); background: var(--brand-soft); border: 1px solid var(--brand); border-radius: 999px; padding: 2px 8px; }

/* ---------- Config banner ---------- */
.config-warn { display: none; background: rgba(224,101,107,.12); border-bottom: 1px solid rgba(224,101,107,.4); color: #f0c9cb; }
.config-warn.show { display: block; }
.config-warn .wrap { padding: 12px 20px; font-size: .92rem; }
.config-warn code { background: rgba(0,0,0,.35); padding: 1px 6px; border-radius: 5px; color: #fff; }

/* ---------- Views / layout ---------- */
main { min-height: calc(100vh - 66px); }
.view { padding: 40px 0 72px; }
.section-head { margin-bottom: 24px; }
.section-head h2 { font-size: 1.9rem; }
.section-head p { color: var(--muted); margin: 6px 0 0; }
.eyebrow { text-transform: uppercase; letter-spacing: .12em; font-size: .74rem; font-weight: 700; color: var(--brand); margin: 0 0 10px; }

/* ---------- Login ---------- */
.login-wrap { min-height: calc(100vh - 66px); display: grid; place-items: center; padding: 40px 20px; }
.login-card { width: 100%; max-width: 420px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow-md); padding: 34px 30px; }
.login-card .mark { width: 46px; height: 46px; margin-bottom: 16px; }
.login-card h1 { font-size: 1.7rem; }
.login-card .sub { color: var(--muted); margin: 8px 0 22px; font-size: .96rem; }
.field { margin-bottom: 14px; }
.field label { display: block; font-size: .82rem; color: var(--muted); margin-bottom: 6px; }
.field input { width: 100%; padding: 11px 13px; background: var(--tint); border: 1px solid var(--line); border-radius: var(--radius-sm); color: var(--ink); font: inherit; }
.field input:focus { outline: none; border-color: var(--brand); }
.login-actions { display: flex; gap: 10px; margin-top: 20px; }
.form-error { display: none; color: #e88; font-size: .88rem; margin-top: 12px; }
.form-error.show { display: block; }
.login-hint { margin-top: 18px; font-size: .84rem; color: var(--muted); text-align: center; }

/* ---------- Album cards grid ---------- */
.album-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(250px, 1fr)); gap: 22px; }
.album-card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; cursor: pointer; transition: transform .15s ease, border-color .15s ease, box-shadow .15s ease; text-align: left; padding: 0; color: inherit; font: inherit; }
.album-card:hover { transform: translateY(-4px); border-color: var(--brand); box-shadow: var(--shadow-md); }
.album-cover { aspect-ratio: 4 / 3; background: var(--tint); position: relative; display: grid; place-items: center; overflow: hidden; }
.album-cover img { width: 100%; height: 100%; object-fit: cover; }
.album-cover .placeholder { color: var(--line); font-size: 2.6rem; }
.album-count { position: absolute; bottom: 10px; right: 10px; background: rgba(8,8,11,.78); color: #fff; font-size: .78rem; padding: 3px 9px; border-radius: 999px; }
.album-body { padding: 14px 16px 16px; }
.album-body h3 { font-size: 1.14rem; }
.album-body .meta { color: var(--muted); font-size: .84rem; margin-top: 4px; }
.album-owner { color: var(--brand); font-size: .8rem; margin-top: 6px; word-break: break-all; }

/* ---------- Photo grid (inside an album) ---------- */
.album-head { display: flex; align-items: center; gap: 14px; flex-wrap: wrap; margin-bottom: 22px; }
.album-head h2 { font-size: 1.8rem; }
.album-head .spacer { flex: 1; }
.photo-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); gap: 12px; }
.photo-tile { aspect-ratio: 1 / 1; background: var(--tint); border: 1px solid var(--line); border-radius: var(--radius-sm); overflow: hidden; cursor: pointer; position: relative; }
.photo-tile img { width: 100%; height: 100%; object-fit: cover; opacity: 0; transition: opacity .35s ease; }
.photo-tile img.loaded { opacity: 1; }
.photo-tile .tile-del { position: absolute; top: 6px; right: 6px; z-index: 2; opacity: 0; }
.photo-tile:hover .tile-del { opacity: 1; }

/* ---------- Empty / loading states ---------- */
.empty { text-align: center; padding: 70px 20px; color: var(--muted); }
.empty .em-icon { font-size: 3rem; margin-bottom: 12px; opacity: .5; }
.empty h3 { color: var(--ink); margin-bottom: 8px; }
.spinner { width: 30px; height: 30px; border: 3px solid var(--line); border-top-color: var(--brand); border-radius: 50%; animation: spin .8s linear infinite; margin: 40px auto; }
@keyframes spin { to { transform: rotate(360deg); } }

/* ---------- Lightbox ---------- */
.lightbox { position: fixed; inset: 0; z-index: 90; background: rgba(6,6,9,.94); display: none; align-items: center; justify-content: center; }
.lightbox.open { display: flex; }
.lightbox img { max-width: 92vw; max-height: 84vh; border-radius: 6px; box-shadow: var(--shadow-md); }
.lb-btn { position: absolute; background: rgba(30,30,38,.7); border: 1px solid var(--line); color: #fff; width: 46px; height: 46px; border-radius: 50%; font-size: 1.5rem; cursor: pointer; display: grid; place-items: center; }
.lb-btn:hover { border-color: var(--brand); color: var(--brand); }
.lb-close { top: 20px; right: 20px; }
.lb-prev { left: 18px; top: 50%; transform: translateY(-50%); }
.lb-next { right: 18px; top: 50%; transform: translateY(-50%); }
.lb-caption { position: absolute; bottom: 20px; left: 50%; transform: translateX(-50%); color: #d9d7cf; font-size: .9rem; background: rgba(8,8,11,.7); padding: 6px 14px; border-radius: 999px; max-width: 80vw; }

/* ---------- Admin panel ---------- */
.admin-bar { background: var(--surface); border: 1px solid var(--brand); border-radius: var(--radius); padding: 20px 22px; margin-bottom: 30px; }
.admin-bar h3 { font-size: 1.15rem; margin-bottom: 4px; }
.admin-bar p { color: var(--muted); font-size: .88rem; margin: 0 0 16px; }
.admin-form { display: grid; grid-template-columns: 1fr 1fr auto; gap: 12px; align-items: end; }
.upload-status { margin-top: 14px; font-size: .9rem; color: var(--muted); }
.upload-status.err { color: #e88; }
.progress { height: 6px; background: var(--tint); border-radius: 999px; overflow: hidden; margin-top: 8px; }
.progress > i { display: block; height: 100%; width: 0; background: var(--brand); transition: width .2s ease; }
.dropzone { border: 1.5px dashed var(--line); border-radius: var(--radius-sm); padding: 22px; text-align: center; color: var(--muted); cursor: pointer; transition: border-color .15s, background .15s; }
.dropzone:hover, .dropzone.drag { border-color: var(--brand); background: var(--brand-soft); color: var(--ink); }

/* ---------- Toast ---------- */
.toast { position: fixed; left: 50%; bottom: 26px; transform: translateX(-50%) translateY(20px); background: var(--surface-2); color: var(--ink); border: 1px solid var(--line); border-left: 3px solid var(--brand); padding: 12px 18px; border-radius: var(--radius-sm); box-shadow: var(--shadow-md); opacity: 0; pointer-events: none; transition: opacity .25s, transform .25s; z-index: 120; max-width: 90vw; }
.toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }
.toast.err { border-left-color: #e0656b; }

/* ---------- Footer ---------- */
.site-footer { border-top: 1px solid var(--line); color: var(--muted); font-size: .85rem; }
.site-footer .wrap { padding: 22px 20px; display: flex; justify-content: space-between; flex-wrap: wrap; gap: 8px; }
.site-footer a { color: var(--muted); }
.site-footer a:hover { color: var(--brand); }

/* ---------- Responsive ---------- */
@media (max-width: 680px) {
  .admin-form { grid-template-columns: 1fr; }
  .who .email { display: none; }
  .section-head h2 { font-size: 1.5rem; }
}
