/* ═══════════════════════════════════════════════════════
   Sofa Studio — Shared CSS
   Include in tutte le pagine: <link rel="stylesheet" href="/shared.css">
   ═══════════════════════════════════════════════════════ */

/* ── Variables ── */
:root {
  --bg: #0a0a0b;
  --surface: #131316;
  --surface2: #1a1a1f;
  --surface3: #222228;
  --border: #2a2a30;
  --border2: #3a3a42;
  --text: #e8e8ec;
  --text2: #9898a0;
  --text3: #686870;
  --violet: #7c3aed;
  --violet2: #a78bfa;
  --violet-dark: #6d28d9;
  --violet-bg: rgba(124, 58, 237, .12);
  --violet-bg2: #1e1b2e;
  --violet-bg3: #1f1f2e;
  --violet-bg4: #1a1527;
  --violet-900: rgba(76, 29, 149, .6);
  --green: #34d399;
  --green-bg: rgba(52, 211, 153, .12);
  --orange: #fb923c;
  --orange-bg: rgba(251, 146, 60, .12);
  --red: #f87171;
  --red-bg: rgba(248, 113, 113, .12);
  --blue: #60a5fa;
  --blue-bg: rgba(96, 165, 250, .12);
  --yellow: #fbbf24;
  --yellow-bg: rgba(251, 191, 36, .12);
  --radius: 12px;
  --radius-sm: 8px;
}

/* ── Reset ── */
* { margin: 0; padding: 0; box-sizing: border-box }

/* ── Base ── */
body {
  font-family: 'Inter', system-ui, sans-serif;
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
}
button { cursor: pointer; border: none; font-family: inherit; font-size: inherit }
input { font-family: inherit }

/* ── Scrollbar ── */
::-webkit-scrollbar { width: 6px; height: 6px }
::-webkit-scrollbar-track { background: transparent }
::-webkit-scrollbar-thumb { background: #333; border-radius: 3px }
::-webkit-scrollbar-thumb:hover { background: #555 }

/* ══════════════════════════════════════════════════
   TOPBAR (shared module — topbar.js)
   ══════════════════════════════════════════════════ */
.ss-topbar { display: flex; align-items: center; justify-content: space-between; padding: 12px 24px; background: rgba(10,10,11,.92); backdrop-filter: blur(12px); position: sticky; top: 0; z-index: 50; font-family: 'Inter', system-ui, sans-serif }
.ss-topbar-left { display: flex; align-items: center; gap: 10px }
.ss-topbar-right { display: flex; align-items: center; gap: 10px }
.ss-logo { width: 32px; height: 32px; border-radius: 10px; background: var(--violet); display: flex; align-items: center; justify-content: center; font-weight: 800; color: #fff; font-size: 13px; flex-shrink: 0 }
.ss-logo-text { font-weight: 700; font-size: 17px; letter-spacing: -.3px; color: #e8e8ec }
.ss-nav-switch { display: flex; align-items: center; gap: 0; background: #1a1a1a; border-radius: 8px; border: 1px solid #2a2a2a; overflow: hidden; margin-left: 6px }
.ss-nav-btn { padding: 5px 14px; font-size: 12px; font-weight: 600; color: #666; text-decoration: none; display: flex; align-items: center; gap: 5px; transition: all .15s; cursor: pointer; border: none; background: none }
.ss-nav-btn:hover { color: #aaa; background: #222 }
.ss-nav-btn.active { background: var(--violet-bg); color: var(--violet2) }
.ss-nav-btn i { font-size: 11px }
.ss-credits { color: #34d399; font-weight: 600; font-size: 12px; display: flex; align-items: center; gap: 4px }
.ss-btn-new { padding: 6px 16px; border-radius: 8px; font-size: 12px; font-weight: 600; background: #1a1a1a; border: 1px solid #2a2a2a; color: #ccc; cursor: pointer; display: flex; align-items: center; gap: 5px; transition: background .15s }
.ss-btn-new:hover { background: #252525 }
.ss-user-dropdown { position: relative; display: inline-block }
.ss-user-btn { display: flex; align-items: center; gap: 6px; padding: 5px 10px; border-radius: 8px; background: #1a1a1a; border: 1px solid #2a2a2a; color: #ccc; font-size: 12px; cursor: pointer; transition: background .15s }
.ss-user-btn:hover { background: #222 }
.ss-user-menu { display: none; position: absolute; top: calc(100% + 4px); right: 0; background: #1a1a1a; border: 1px solid #2a2a2a; border-radius: 8px; min-width: 160px; z-index: 100; box-shadow: 0 8px 24px rgba(0,0,0,.5); padding: 4px }
.ss-user-menu.open { display: block }
.ss-user-menu a, .ss-user-menu button { display: flex; align-items: center; gap: 8px; width: 100%; padding: 8px 12px; border: none; background: none; color: #ccc; font-size: 12px; text-decoration: none; cursor: pointer; border-radius: 6px; transition: background .15s; text-align: left; font-family: inherit }
.ss-user-menu a:hover, .ss-user-menu button:hover { background: #252525 }
.ss-product-id { font-size: 11px; color: #555; font-family: monospace }
.ss-hamburger { display: none; width: 32px; height: 32px; border-radius: 6px; background: #1a1a1a; border: 1px solid #2a2a2a; color: #999; font-size: 14px; cursor: pointer; align-items: center; justify-content: center; transition: background .15s }
.ss-hamburger:hover { background: #252525 }
@media (max-width: 768px) {
  .ss-topbar { padding: 10px 14px; flex-wrap: wrap; gap: 8px }
  .ss-hide-mobile { display: none !important }
  .ss-btn-new span { display: none }
  .ss-hamburger { display: flex }
}

/* ══════════════════════════════════════════════════
   COMMON BUTTONS
   ══════════════════════════════════════════════════ */
.btn, .btn-primary, .btn-ghost, .btn-danger { padding: 9px 18px; border-radius: var(--radius-sm); font-weight: 600; font-size: 13px; transition: all .2s; display: inline-flex; align-items: center; gap: 6px }
.btn-primary { background: var(--violet); color: #fff }
.btn-primary:hover { background: var(--violet-dark) }
.btn-primary:disabled { background: #3b3b3b; color: #666; cursor: not-allowed }
.btn-ghost { background: transparent; color: var(--text2); border: 1px solid var(--border) }
.btn-ghost:hover { background: var(--surface2); color: var(--text) }
.btn-danger { background: var(--red-bg); color: var(--red); border: 1px solid rgba(248, 113, 113, .2) }
.btn-danger:hover { background: rgba(248, 113, 113, .2) }
.btn-sm { padding: 6px 12px; font-size: 12px }
.btn-icon { padding: 6px 8px; border-radius: 6px; background: transparent; color: var(--text3); font-size: 16px }
.btn-icon:hover { background: var(--surface3); color: var(--text) }

/* ══════════════════════════════════════════════════
   COMMON FORMS
   ══════════════════════════════════════════════════ */
.form-group { margin-bottom: 16px }
.form-group label { display: block; font-size: 12px; font-weight: 600; color: var(--text2); margin-bottom: 6px; text-transform: uppercase; letter-spacing: .03em }
.form-group input, .form-group select, .form-group textarea { width: 100%; padding: 10px 12px; background: var(--surface2); border: 1px solid var(--border); border-radius: var(--radius-sm); color: var(--text); font-size: 13px; font-family: inherit }
.form-group input:focus, .form-group select:focus { border-color: var(--violet); outline: none }
.form-row { display: flex; gap: 12px }
.form-row .form-group { flex: 1 }
.form-actions { display: flex; gap: 10px; justify-content: flex-end; margin-top: 20px }
.checkbox-row { display: flex; align-items: center; gap: 8px; font-size: 13px; margin-bottom: 8px }
.checkbox-row input[type="checkbox"] { width: 16px; height: 16px; accent-color: var(--violet) }

/* ══════════════════════════════════════════════════
   COMMON MODALS
   ══════════════════════════════════════════════════ */
.modal-overlay { position: fixed; inset: 0; background: rgba(0,0,0,.6); backdrop-filter: blur(4px); z-index: 100; display: none; align-items: center; justify-content: center }
.modal-overlay.open { display: flex }
.modal { background: var(--surface); border: 1px solid var(--border); border-radius: 16px; padding: 28px; max-width: 480px; width: 90%; max-height: 90vh; overflow-y: auto }
.modal h3 { font-size: 18px; font-weight: 700; margin-bottom: 20px }

/* ══════════════════════════════════════════════════
   COMMON BADGES
   ══════════════════════════════════════════════════ */
.badge { display: inline-block; padding: 3px 10px; border-radius: 6px; font-size: 10px; font-weight: 700; text-transform: uppercase; letter-spacing: .03em }
.badge-admin { background: var(--violet-bg); color: var(--violet2) }
.badge-user { background: var(--surface3); color: var(--text3) }
.badge-starter { background: var(--green-bg); color: var(--green) }
.badge-pro { background: var(--violet-bg); color: var(--violet2) }
.badge-studio { background: var(--orange-bg); color: var(--orange) }
.badge-active { background: var(--green-bg); color: var(--green) }
.badge-suspended { background: var(--red-bg); color: var(--red) }
.badge-generic { background: rgba(96, 165, 250, .18); color: var(--blue) }
.badge-personal { background: var(--orange-bg); color: var(--orange) }

/* ══════════════════════════════════════════════════
   COMMON TABLES
   ══════════════════════════════════════════════════ */
.data-table { width: 100%; border-collapse: collapse; font-size: 13px }
.data-table th { text-align: left; padding: 10px 12px; color: var(--text3); font-weight: 600; font-size: 11px; text-transform: uppercase; letter-spacing: .04em; border-bottom: 1px solid var(--border); background: var(--surface) }
.data-table td { padding: 10px 12px; border-bottom: 1px solid rgba(42,42,48,.5); vertical-align: middle }
.data-table tr:hover td { background: rgba(124,58,237,.03) }
.table-scroll { overflow-x: auto }

/* ══════════════════════════════════════════════════
   COMMON TOAST
   ══════════════════════════════════════════════════ */
.toast { position: fixed; bottom: 24px; right: 24px; padding: 12px 20px; border-radius: var(--radius-sm); font-size: 13px; font-weight: 500; z-index: 200; transform: translateY(100px); opacity: 0; transition: all .3s }
.toast.show { transform: translateY(0); opacity: 1 }
.toast.success { background: var(--green-bg); color: var(--green); border: 1px solid rgba(52,211,153,.2) }
.toast.error { background: var(--red-bg); color: var(--red); border: 1px solid rgba(248,113,113,.2) }

/* ══════════════════════════════════════════════════
   COMMON ACTION BUTTONS (table row)
   ══════════════════════════════════════════════════ */
.action-btns { display: flex; gap: 4px; flex-wrap: wrap }
.action-btn { width: 30px; height: 30px; border-radius: 6px; border: 1px solid var(--border); background: transparent; color: var(--text3); cursor: pointer; display: inline-flex; align-items: center; justify-content: center; font-size: 12px; transition: all .15s }
.action-btn:hover { border-color: var(--border2); color: var(--text) }
.action-btn.danger:hover { color: var(--red); border-color: rgba(248,113,113,.3) }

/* ══════════════════════════════════════════════════
   COMMON TABS
   ══════════════════════════════════════════════════ */
.tabs { display: flex; gap: 4px; margin-bottom: 28px; background: var(--surface); border: 1px solid var(--border); border-radius: 10px; padding: 4px; width: fit-content }
.tab-btn { padding: 8px 20px; border: none; border-radius: 8px; font-family: inherit; font-size: 13px; font-weight: 600; cursor: pointer; transition: all .2s; background: transparent; color: var(--text3) }
.tab-btn.active { background: var(--violet); color: #fff }
.tab-panel { display: none }
.tab-panel.active { display: block }

/* ══════════════════════════════════════════════════
   COMMON STATS
   ══════════════════════════════════════════════════ */
.stats-bar { display: flex; gap: 16px; margin-bottom: 24px; 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 .label { font-size: 11px; color: var(--text3); text-transform: uppercase; letter-spacing: .04em; margin-bottom: 4px }
.stat-card .value { font-size: 22px; font-weight: 700 }

/* ══════════════════════════════════════════════════
   COMMON SEARCH
   ══════════════════════════════════════════════════ */
.search-input { flex: 1; min-width: 200px; padding: 10px 14px; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-sm); color: var(--text); font-size: 13px; font-family: inherit }
.search-input:focus { border-color: var(--violet); outline: none }
.toolbar { display: flex; gap: 12px; margin-bottom: 16px; align-items: center; flex-wrap: wrap }

/* ══════════════════════════════════════════════════
   LIGHTBOX (fullscreen gallery)
   ══════════════════════════════════════════════════ */
.lightbox-overlay { position: fixed; inset: 0; background: rgba(0, 0, 0, .92); z-index: 500; display: none; flex-direction: column; align-items: center; justify-content: center }
.lightbox-overlay.open { display: flex }
.lightbox-toolbar { position: absolute; top: 0; left: 0; right: 0; display: flex; align-items: center; justify-content: space-between; padding: 16px 24px; z-index: 510 }
.lightbox-title { font-size: 14px; font-weight: 600; color: #fff }
.lightbox-counter { font-size: 12px; color: rgba(255,255,255,.6); margin-left: 12px }
.lightbox-close { background: rgba(255,255,255,.15); border: none; color: #fff; width: 40px; height: 40px; border-radius: 50%; font-size: 18px; cursor: pointer; transition: background .2s }
.lightbox-close:hover { background: rgba(255,255,255,.3) }
.lightbox-actions { display: flex; gap: 8px; align-items: center }
.lightbox-action-btn { background: rgba(255,255,255,.12); border: none; color: #fff; width: 40px; height: 40px; border-radius: 50%; font-size: 16px; cursor: pointer; transition: all .2s }
.lightbox-action-btn:hover { background: rgba(255,255,255,.25) }
.lightbox-action-btn.active { background: var(--violet); color: #fff }
.lightbox-img-wrap { flex: 1; display: flex; align-items: center; justify-content: center; width: 100%; padding: 60px 80px; overflow: auto; cursor: grab }
.lightbox-img-wrap.zoomed { cursor: move }
.lightbox-img-wrap img { max-width: 100%; max-height: 100%; object-fit: contain; border-radius: 8px; box-shadow: 0 8px 48px rgba(0,0,0,.5); transition: transform .3s }
.lightbox-img-wrap.zoomed img { max-width: none; max-height: none; cursor: move; transform-origin: center center }
.lightbox-nav { position: absolute; top: 50%; transform: translateY(-50%); background: rgba(255,255,255,.12); border: none; color: #fff; width: 48px; height: 48px; border-radius: 50%; font-size: 20px; cursor: pointer; transition: background .2s; z-index: 510 }
.lightbox-nav:hover { background: rgba(255,255,255,.25) }
.lightbox-nav.prev { left: 16px }
.lightbox-nav.next { right: 16px }
.lightbox-thumbstrip { position: absolute; bottom: 0; left: 0; right: 0; display: flex; gap: 6px; padding: 12px 24px; overflow-x: auto; background: linear-gradient(transparent, rgba(0,0,0,.6)); z-index: 510 }
.lightbox-thumbstrip img { width: 56px; height: 42px; object-fit: cover; border-radius: 4px; border: 2px solid transparent; cursor: pointer; opacity: .5; transition: all .2s; flex-shrink: 0 }
.lightbox-thumbstrip img:hover { opacity: .8 }
.lightbox-thumbstrip img.active { border-color: var(--violet); opacity: 1 }
.lightbox-res-badge { position: absolute; top: 16px; left: 50%; transform: translateX(-50%); background: rgba(0,0,0,.7); color: #fff; font-size: 11px; padding: 4px 12px; border-radius: 20px; z-index: 510; font-weight: 600; opacity: 0; transition: opacity .3s; pointer-events: none }
.lightbox-res-badge.show { opacity: 1 }
@media (max-width: 768px) {
  .lightbox-nav { width: 36px; height: 36px; font-size: 16px }
  .lightbox-nav.prev { left: 8px }
  .lightbox-nav.next { right: 8px }
  .lightbox-img-wrap { padding: 50px 16px }
}
