/* ================================================================
   YBM Artist Pages — Admin / Dashboard styles
   ================================================================ */
:root {
  --bg: #0a0a0a;
  --surface: #131313;
  --surface-2: #1c1c1c;
  --line: rgba(255,255,255,0.08);
  --line-strong: rgba(255,255,255,0.16);
  --gold: #C9A84C;
  --gold-soft: #b69536;
  --gold-dim: #8b7228;
  --text: #f5f3ee;
  --text-muted: #9a948a;
  --danger: #d9534f;
  --ok: #5fb572;
  --radius: 14px;
  --radius-sm: 8px;
  --shadow: 0 14px 40px rgba(0,0,0,0.45);
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; background: var(--bg); color: var(--text); font-family: 'Inter', system-ui, sans-serif; -webkit-font-smoothing: antialiased; }
a { color: var(--gold); text-decoration: none; }
a:hover { color: var(--gold-soft); }
h1, h2, h3, h4 { font-family: 'Cinzel', serif; font-weight: 600; letter-spacing: 0.02em; margin: 0; }
.brand-serif { font-family: 'Cinzel', serif; }

/* ── Auth pages ── */
.auth-body { min-height: 100vh; background:
    radial-gradient(60% 50% at 15% 20%, rgba(201,168,76,0.18), transparent 60%),
    radial-gradient(60% 50% at 85% 80%, rgba(201,168,76,0.08), transparent 60%),
    var(--bg);
  display: grid; place-items: center; padding: 24px; }
.auth-shell { width: 100%; max-width: 460px; }
.auth-back { display: inline-flex; align-items: center; gap: 6px; color: var(--text-muted); font-size: 13px; margin-bottom: 18px; }
.auth-back:hover { color: var(--text); }
.auth-card { background: linear-gradient(180deg, var(--surface), var(--surface-2)); border: 1px solid var(--line); border-radius: var(--radius); padding: 40px 32px; box-shadow: var(--shadow); }
.auth-logo { text-align: center; margin-bottom: 28px; }
.logo-mark { display: inline-flex; align-items: center; justify-content: center; width: 56px; height: 56px; background: var(--gold); color: #0a0a0a; font-family: 'Cinzel', serif; font-weight: 700; border-radius: 12px; box-shadow: 0 6px 18px rgba(201,168,76,0.35); margin-bottom: 14px; letter-spacing: 0.04em; }
.auth-brand { font-size: 22px; color: var(--gold); }
.auth-sub { color: var(--text-muted); font-size: 14px; margin-top: 8px; }
.btn-google { width: 100%; display: inline-flex; align-items: center; justify-content: center; gap: 10px; padding: 14px 18px; border-radius: 999px; background: #fff; color: #1a1a1a; font-weight: 600; font-size: 15px; border: none; cursor: pointer; transition: transform 0.15s ease, box-shadow 0.15s ease; }
.btn-google:hover { transform: translateY(-1px); box-shadow: 0 8px 22px rgba(0,0,0,0.4); }
.auth-note { color: var(--text-muted); font-size: 12px; text-align: center; margin-top: 18px; line-height: 1.5; }
.spinner { width: 36px; height: 36px; border: 3px solid var(--line-strong); border-top-color: var(--gold); border-radius: 50%; animation: spin 0.9s linear infinite; margin: 16px auto 0; }
@keyframes spin { to { transform: rotate(360deg); } }

/* ── App shell ── */
.app-shell { min-height: 100vh; display: flex; flex-direction: column; }
.topbar { display: flex; align-items: center; justify-content: space-between; padding: 16px 28px; border-bottom: 1px solid var(--line); background: var(--surface); position: sticky; top: 0; z-index: 100; }
.topbar-left { display: flex; align-items: center; gap: 14px; }
.topbar-logo { display: flex; align-items: center; gap: 10px; color: var(--gold); font-family: 'Cinzel', serif; font-weight: 700; font-size: 18px; }
.topbar-logo .logo-mark { width: 34px; height: 34px; margin: 0; border-radius: 8px; font-size: 13px; }
.role-pill { background: rgba(201,168,76,0.15); color: var(--gold); border: 1px solid rgba(201,168,76,0.4); padding: 4px 10px; border-radius: 999px; font-size: 11px; text-transform: uppercase; letter-spacing: 0.08em; font-weight: 600; }
.topbar-right { display: flex; align-items: center; gap: 14px; }
.user-chip { display: flex; align-items: center; gap: 10px; color: var(--text-muted); font-size: 14px; }
.user-chip img { width: 32px; height: 32px; border-radius: 50%; object-fit: cover; border: 1px solid var(--line-strong); }
.btn-logout { background: transparent; border: 1px solid var(--line-strong); color: var(--text-muted); padding: 8px 14px; border-radius: 999px; cursor: pointer; font-size: 13px; }
.btn-logout:hover { color: var(--text); border-color: var(--text-muted); }

.layout { flex: 1; display: grid; grid-template-columns: 240px 1fr; min-height: 0; }
.sidebar { background: var(--surface); border-right: 1px solid var(--line); padding: 24px 14px; }
.sidebar h4 { color: var(--text-muted); font-size: 11px; text-transform: uppercase; letter-spacing: 0.12em; font-family: 'Inter', sans-serif; font-weight: 600; padding: 0 12px; margin-bottom: 8px; }
.sidebar-link { display: flex; align-items: center; gap: 10px; padding: 10px 12px; border-radius: 8px; color: var(--text-muted); font-size: 14px; margin-bottom: 2px; cursor: pointer; }
.sidebar-link:hover { background: var(--surface-2); color: var(--text); }
.sidebar-link.active { background: rgba(201,168,76,0.12); color: var(--gold); }
.sidebar-section { margin-bottom: 22px; }

.content { padding: 32px 36px; max-width: 1200px; width: 100%; }
.content h2 { font-size: 28px; color: var(--gold); margin-bottom: 6px; }
.content .h-sub { color: var(--text-muted); font-size: 14px; margin-bottom: 28px; }

/* ── Cards ── */
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 24px; margin-bottom: 20px; }
.card h3 { font-size: 17px; color: var(--text); margin-bottom: 16px; font-family: 'Inter', sans-serif; font-weight: 600; }
.card-row { display: flex; gap: 16px; flex-wrap: wrap; margin-bottom: 16px; }
.card-row > * { flex: 1; min-width: 220px; }

.stat-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 16px; margin-bottom: 28px; }
.stat-card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 20px; }
.stat-card .label { color: var(--text-muted); font-size: 12px; text-transform: uppercase; letter-spacing: 0.08em; }
.stat-card .value { color: var(--gold); font-family: 'Cinzel', serif; font-size: 32px; margin-top: 6px; }

/* ── Forms ── */
.field { display: flex; flex-direction: column; gap: 6px; margin-bottom: 14px; }
.field label { color: var(--text-muted); font-size: 12px; text-transform: uppercase; letter-spacing: 0.06em; font-weight: 600; }
.field input, .field textarea, .field select {
  background: var(--surface-2);
  border: 1px solid var(--line-strong);
  border-radius: var(--radius-sm);
  padding: 11px 14px;
  color: var(--text);
  font-family: inherit;
  font-size: 14px;
  transition: border-color 0.15s ease;
}
.field input:focus, .field textarea:focus, .field select:focus { outline: none; border-color: var(--gold); }
.field textarea { resize: vertical; min-height: 90px; }
.field .hint { color: var(--text-muted); font-size: 12px; }

.toggle-row { display: flex; align-items: center; justify-content: space-between; padding: 10px 0; border-bottom: 1px solid var(--line); }
.toggle-row:last-child { border-bottom: none; }
.toggle-row .lbl { color: var(--text); font-size: 14px; }
.toggle-row .desc { color: var(--text-muted); font-size: 12px; margin-top: 2px; }
.toggle { position: relative; display: inline-block; width: 42px; height: 24px; }
.toggle input { display: none; }
.toggle .slider { position: absolute; inset: 0; background: var(--surface-2); border: 1px solid var(--line-strong); border-radius: 999px; cursor: pointer; transition: background 0.15s; }
.toggle .slider::before { content: ''; position: absolute; top: 2px; left: 2px; width: 18px; height: 18px; background: #fff; border-radius: 50%; transition: transform 0.15s; }
.toggle input:checked + .slider { background: var(--gold); border-color: var(--gold); }
.toggle input:checked + .slider::before { transform: translateX(18px); }

.btn { display: inline-flex; align-items: center; gap: 8px; padding: 11px 22px; border-radius: 999px; border: none; cursor: pointer; font-weight: 600; font-size: 14px; transition: transform 0.15s ease, box-shadow 0.15s ease; }
.btn-primary { background: var(--gold); color: #0a0a0a; }
.btn-primary:hover { transform: translateY(-1px); box-shadow: 0 8px 22px rgba(201,168,76,0.35); }
.btn-ghost { background: transparent; color: var(--text); border: 1px solid var(--line-strong); }
.btn-ghost:hover { border-color: var(--gold); color: var(--gold); }
.btn-danger { background: transparent; color: var(--danger); border: 1px solid rgba(217,83,79,0.4); }
.btn-danger:hover { background: rgba(217,83,79,0.1); }

.save-bar { position: sticky; bottom: 16px; display: flex; justify-content: flex-end; gap: 10px; margin-top: 20px; padding: 14px; background: rgba(19,19,19,0.92); backdrop-filter: blur(8px); border: 1px solid var(--line); border-radius: var(--radius); }

.toast { position: fixed; bottom: 24px; left: 50%; transform: translateX(-50%); background: rgba(0,0,0,0.94); border: 1px solid var(--line-strong); padding: 14px 22px; border-radius: 999px; z-index: 9999; font-size: 14px; }
.toast.ok { border-color: rgba(95,181,114,0.5); color: var(--ok); }
.toast.err { border-color: rgba(217,83,79,0.5); color: var(--danger); }

/* ── Tables ── */
.tbl { width: 100%; border-collapse: collapse; }
.tbl th { text-align: left; padding: 12px 14px; color: var(--text-muted); font-size: 11px; text-transform: uppercase; letter-spacing: 0.08em; border-bottom: 1px solid var(--line); }
.tbl td { padding: 14px; border-bottom: 1px solid var(--line); font-size: 14px; }
.tbl tr:hover td { background: var(--surface-2); }
.badge { display: inline-block; padding: 3px 10px; border-radius: 999px; font-size: 11px; text-transform: uppercase; letter-spacing: 0.06em; font-weight: 600; }
.badge.super { background: rgba(201,168,76,0.15); color: var(--gold); }
.badge.artist { background: rgba(255,255,255,0.06); color: var(--text-muted); }
.badge.pub { background: rgba(95,181,114,0.15); color: var(--ok); }
.badge.draft { background: rgba(255,255,255,0.06); color: var(--text-muted); }

/* ── Template gallery ── */
.tier-tabs { display: flex; gap: 6px; background: var(--surface-2); padding: 6px; border-radius: 999px; margin-bottom: 24px; width: max-content; }
.tier-tab { padding: 8px 18px; border-radius: 999px; color: var(--text-muted); font-size: 13px; cursor: pointer; border: none; background: transparent; font-weight: 600; }
.tier-tab.active { background: var(--gold); color: #0a0a0a; }
.tpl-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 18px; }
.tpl-card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; }
.tpl-card .thumb { aspect-ratio: 16/10; background: linear-gradient(135deg, #1a1a1a, #2a2316); position: relative; overflow: hidden; }
.tpl-card .thumb iframe { width: 100%; height: 100%; border: none; transform: scale(0.5); transform-origin: top left; width: 200%; height: 200%; pointer-events: none; }
.tpl-card .info { padding: 16px; }
.tpl-card .info h4 { font-family: 'Cinzel', serif; color: var(--gold); font-size: 17px; margin-bottom: 4px; font-weight: 600; }
.tpl-card .info p { color: var(--text-muted); font-size: 12px; margin-bottom: 12px; }
.tpl-card .actions { display: flex; gap: 8px; }
.tpl-card .actions .btn { flex: 1; padding: 8px 12px; font-size: 12px; justify-content: center; }
.tpl-card.selected { border-color: var(--gold); box-shadow: 0 0 0 1px var(--gold); }
.tier-badge { position: absolute; top: 10px; right: 10px; background: rgba(0,0,0,0.85); color: var(--gold); border: 1px solid var(--gold); padding: 3px 8px; border-radius: 999px; font-size: 10px; text-transform: uppercase; letter-spacing: 0.08em; font-weight: 600; }

/* ── Mobile hamburger button (hidden on desktop) ── */
.mobile-menu-btn { display: none; background: transparent; border: 1px solid var(--line-strong); color: var(--text); width: 38px; height: 38px; border-radius: 8px; cursor: pointer; padding: 0; align-items: center; justify-content: center; }
.mobile-menu-btn span { display: block; width: 18px; height: 2px; background: currentColor; position: relative; }
.mobile-menu-btn span::before, .mobile-menu-btn span::after { content: ""; position: absolute; left: 0; width: 18px; height: 2px; background: currentColor; }
.mobile-menu-btn span::before { top: -6px; }
.mobile-menu-btn span::after { top: 6px; }
.sidebar-backdrop { display: none; position: fixed; inset: 0; background: rgba(0,0,0,0.6); z-index: 95; backdrop-filter: blur(4px); }
.sidebar-backdrop.open { display: block; }

@media (max-width: 880px) {
  .layout { grid-template-columns: 1fr; }
  .sidebar { position: fixed; top: 0; left: 0; bottom: 0; width: 260px; transform: translateX(-100%); transition: transform 0.25s ease; z-index: 100; padding-top: 80px; box-shadow: 12px 0 30px rgba(0,0,0,0.5); display: block; }
  .sidebar.open { transform: translateX(0); }
  .content { padding: 22px 18px; }
  .topbar { padding: 12px 14px; gap: 8px; }
  .mobile-menu-btn { display: inline-flex; }
  .topbar-logo span:last-child { display: none; }   /* hide "Artist Pages" wordmark */
  .topbar-logo .logo-mark { width: 32px; height: 32px; font-size: 11px; }
  .topbar-left { gap: 8px; flex-shrink: 1; min-width: 0; }
  .topbar-right { gap: 6px; flex-shrink: 0; }
  .topbar-right .user-chip span { display: none; }       /* hide long name */
  .topbar-right .user-chip img { width: 28px; height: 28px; }
  .btn-logout { padding: 6px 10px; font-size: 11px; }
  #viewMyPage .long-text { display: none; }
  #viewMyPage .short-text { display: inline !important; }
  /* "View my page" button shortened */
  #viewMyPage { padding: 6px 10px !important; font-size: 11px !important; white-space: nowrap; }
  .role-pill { font-size: 9px; padding: 3px 8px; }
  .tier-pill { font-size: 9px; padding: 2px 8px; }
  /* Touch-friendlier form */
  .field input, .field textarea, .field select { padding: 13px 14px; font-size: 15px; }
  .toggle-row { padding: 12px 0; }
  .toggle { width: 50px; height: 28px; flex-shrink: 0; }
  .toggle .slider::before { width: 22px; height: 22px; top: 2px; left: 2px; }
  .toggle input:checked + .slider::before { transform: translateX(22px); }
  .save-bar { flex-direction: column; gap: 8px; }
  .save-bar .btn { width: 100%; justify-content: center; }
  /* Template grid card — keep iframe usable on small viewports */
  .tpl-grid { grid-template-columns: 1fr; }
  .tpl-card .thumb { aspect-ratio: 16/9; }
  .tpl-card .thumb iframe { width: 200%; height: 200%; }
  /* Tables → cards on mobile */
  .tbl { display: block; }
  .tbl thead { display: none; }
  .tbl tbody, .tbl tr { display: block; }
  .tbl tr { background: var(--surface-2); border-radius: 10px; padding: 12px; margin-bottom: 10px; border: 1px solid var(--line); }
  .tbl td { display: flex; justify-content: space-between; padding: 8px 0; border-bottom: 1px dashed var(--line); font-size: 13px; gap: 12px; text-align: right; align-items: center; }
  .tbl td:last-child { border-bottom: none; }
  .tbl td::before { content: attr(data-label); color: var(--text-muted); font-size: 11px; text-transform: uppercase; letter-spacing: 0.08em; text-align: left; flex-shrink: 0; }
  .stat-grid { grid-template-columns: repeat(2, 1fr); gap: 10px; }
  .stat-card { padding: 14px; }
  .stat-card .value { font-size: 24px; }
  /* Tier tabs scroll horizontally if needed */
  .tier-tabs { overflow-x: auto; white-space: nowrap; max-width: 100%; padding: 4px; }
  .tier-tab { flex-shrink: 0; font-size: 12px; padding: 7px 14px; }
  /* Modals */
  .modal-panel { padding: 22px 18px; }
  .content h2 { font-size: 22px; }
}

/* ── Modal ── */
.modal-backdrop { position: fixed; inset: 0; background: rgba(0,0,0,0.7); z-index: 9000; display: grid; place-items: center; padding: 24px; backdrop-filter: blur(6px); }
.modal-panel { background: var(--surface); border: 1px solid var(--line-strong); border-radius: 16px; padding: 28px; max-width: 560px; width: 100%; max-height: 88vh; overflow-y: auto; box-shadow: 0 24px 60px rgba(0,0,0,0.6); }
.modal-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 8px; }
.modal-head h3 { font-family: 'Cinzel', serif; color: var(--gold); font-size: 20px; margin: 0; }
.modal-x { background: transparent; border: none; color: var(--text-muted); font-size: 20px; cursor: pointer; padding: 4px 8px; }
.modal-x:hover { color: var(--text); }
.modal-actions { display: flex; justify-content: flex-end; gap: 10px; margin-top: 18px; padding-top: 18px; border-top: 1px solid var(--line); }

/* ── Add-on rows ── */
.addon-rows { display: grid; gap: 8px; }
.addon-row { display: flex; align-items: flex-start; gap: 12px; padding: 14px; background: var(--surface-2); border: 1px solid var(--line); border-radius: 10px; cursor: pointer; transition: border-color 0.15s; }
.addon-row:hover { border-color: var(--gold-dim); }
.addon-row input[type="checkbox"] { margin-top: 3px; accent-color: var(--gold); width: 18px; height: 18px; }
.addon-name { color: var(--text); font-weight: 600; font-size: 15px; display: flex; align-items: center; gap: 10px; }
.addon-price { background: rgba(201,168,76,0.15); color: var(--gold); padding: 2px 10px; border-radius: 999px; font-size: 11px; font-weight: 600; }
.addon-tag { color: var(--text-muted); font-size: 13px; margin-top: 2px; line-height: 1.4; }

/* ── Tier badges ── */
.tier-pill { display: inline-block; padding: 3px 10px; border-radius: 999px; font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.06em; }
.tier-pill.basic    { background: rgba(154,148,138,0.18); color: #c9c2b6; }
.tier-pill.standard { background: rgba(201,168,76,0.18);  color: var(--gold); border: 1px solid rgba(201,168,76,0.4); }
.tier-pill.premium  { background: linear-gradient(135deg, #C9A84C, #e6c875); color: #0a0a0a; }

/* ── Plan card grid (for pricing page) ── */
.plan-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); gap: 18px; margin: 30px 0; }
.plan-card { background: var(--surface); border: 1px solid var(--line); border-radius: 16px; padding: 28px; display: flex; flex-direction: column; }
.plan-card.featured { border-color: var(--gold); box-shadow: 0 0 0 1px var(--gold), 0 20px 50px rgba(201,168,76,0.15); }
.plan-card .name { font-family: 'Cinzel', serif; color: var(--gold); font-size: 26px; margin: 0; }
.plan-card .price { font-family: 'Cinzel', serif; font-size: 42px; color: var(--text); margin: 12px 0 4px; }
.plan-card .price-unit { color: var(--text-muted); font-size: 13px; }
.plan-card .tagline { color: var(--text-muted); font-size: 14px; margin: 14px 0 18px; min-height: 40px; line-height:1.5; }
.plan-card ul { list-style: none; padding: 0; margin: 0 0 22px; flex: 1; }
.plan-card ul li { padding: 8px 0; color: var(--text); font-size: 14px; border-bottom: 1px dashed var(--line); display: flex; gap: 10px; }
.plan-card ul li::before { content: "✓"; color: var(--gold); font-weight: 700; }

/* ── Locked feature banner ── */
.locked-banner { background: rgba(201,168,76,0.08); border: 1px dashed var(--gold-dim); border-radius: 10px; padding: 14px 16px; color: var(--gold-soft); font-size: 13px; line-height:1.5; display: flex; gap: 12px; align-items: center; }
.locked-banner strong { color: var(--gold); }
.locked-banner a { color: var(--gold); text-decoration: underline; }

/* ── Color palette swatches ── */
.palette-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 10px; }
.palette-swatch { display: flex; align-items: center; gap: 10px; padding: 10px 12px; background: var(--surface-2); border: 1px solid var(--line-strong); border-radius: 10px; cursor: pointer; transition: border-color 0.15s, transform 0.15s; font: inherit; color: var(--text); text-align: left; }
.palette-swatch:hover { border-color: var(--gold-dim); transform: translateY(-1px); }
.palette-swatch.selected { border-color: var(--gold); box-shadow: 0 0 0 1px var(--gold); }
.palette-swatch .dot { width: 22px; height: 22px; border-radius: 50%; flex-shrink: 0; border: 1px solid rgba(255,255,255,0.2); }
.palette-swatch .lbl { font-size: 13px; }
@media (max-width: 880px) {
  .palette-grid { grid-template-columns: repeat(2, 1fr); }
}
