/* ============================================================
   ReviewMaster Pro — Stile Globale
   Tema: Nero · Oro sfumato · Bianco
============================================================ */

:root {
  --black:      #0a0a0c;
  --black-2:    #111115;
  --black-3:    #18181f;
  --black-4:    #1e1e27;
  --gold-1:     #c9a84c;
  --gold-2:     #e8c96d;
  --gold-3:     #f5e199;
  --gold-dark:  #7a5f1e;
  --gold-muted: #4a3a10;
  --white:      #f7f4ee;
  --white-dim:  #c8c4bc;
  --white-faint:#888580;
  --red:        #c0392b;
  --red-bg:     rgba(192,57,43,0.12);
  --red-border: rgba(192,57,43,0.35);
  --green:      #27ae60;
  --green-bg:   rgba(39,174,96,0.12);
  --border:     rgba(201,168,76,0.16);
  --border-2:   rgba(201,168,76,0.28);
  --grad-gold:  linear-gradient(135deg, #c9a84c 0%, #f5e199 48%, #c9a84c 100%);
  --grad-card:  linear-gradient(160deg, #18181f 0%, #111115 100%);
  --shadow-gold:0 4px 20px rgba(201,168,76,0.22);
  --sidebar-w:  260px;
  --topbar-h:   64px;
}

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

html { font-size: 15px; }

body {
  font-family: 'DM Sans', sans-serif;
  background: var(--black);
  color: var(--white);
  min-height: 100vh;
  overflow-x: hidden;
  line-height: 1.5;
}

/* Grain texture overlay */
body::after {
  content: '';
  position: fixed; inset: 0;
  background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 200 200' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)' opacity='0.035'/%3E%3C/svg%3E");
  pointer-events: none; z-index: 9999; opacity: .5;
}

/* ── Typography ─────────────────────────────────────── */
h1,h2,h3 { font-family: 'Cormorant Garamond', serif; font-weight: 700; }
a { color: var(--gold-2); text-decoration: none; }
a:hover { color: var(--gold-3); }

/* ── Auth Pages ─────────────────────────────────────── */
.auth-page {
  display: flex; align-items: center; justify-content: center; min-height: 100vh;
}
.auth-bg-glow {
  position: fixed; top: -200px; left: 50%; transform: translateX(-50%);
  width: 700px; height: 700px; border-radius: 50%;
  background: radial-gradient(circle, rgba(201,168,76,0.07) 0%, transparent 68%);
  pointer-events: none;
}
.login-card {
  position: relative; z-index: 10;
  width: 420px; padding: 48px 44px;
  background: var(--grad-card);
  border: 1px solid var(--border-2);
  border-radius: 20px;
  box-shadow: 0 32px 80px rgba(0,0,0,0.7), 0 0 60px rgba(201,168,76,0.05);
  animation: cardIn .4s ease;
}
@keyframes cardIn { from { opacity:0; transform:translateY(16px) } to { opacity:1; transform:none } }

.login-logo { text-align: center; margin-bottom: 8px; }
.logo-icon {
  width: 52px; height: 52px; border-radius: 12px;
  background: var(--grad-gold); margin: 0 auto 14px;
  display: flex; align-items: center; justify-content: center;
  font-size: 24px; box-shadow: 0 0 28px rgba(201,168,76,0.35);
}
.logo-title {
  font-family: 'Cormorant Garamond', serif;
  font-size: 26px; font-weight: 700;
  background: var(--grad-gold);
  -webkit-background-clip: text; -webkit-text-fill-color: transparent;
}
.logo-sub { font-size: 12px; color: var(--white-faint); letter-spacing: 0.5px; margin-top: 4px; }

.field-group { margin-bottom: 16px; }
.field-label {
  display: block; font-size: 11px; text-transform: uppercase;
  letter-spacing: 1.8px; color: var(--white-dim); margin-bottom: 7px; font-weight: 500;
}
.field-input {
  width: 100%; padding: 11px 14px; border-radius: 9px;
  background: rgba(255,255,255,0.04); border: 1px solid var(--border);
  color: var(--white); font-family: 'DM Sans', sans-serif; font-size: 14px;
  outline: none; transition: border-color .2s, background .2s;
}
.field-input:focus { border-color: var(--gold-1); background: rgba(201,168,76,0.05); }
.field-input::placeholder { color: #444; }
select.field-input option { background: var(--black-3); color: var(--white); }
textarea.field-input { resize: vertical; min-height: 80px; line-height: 1.6; }

.btn-login {
  width: 100%; padding: 14px; margin-top: 6px;
  background: var(--grad-gold); color: var(--black);
  border: none; border-radius: 10px;
  font-family: 'DM Sans', sans-serif; font-size: 15px; font-weight: 600;
  cursor: pointer; letter-spacing: 0.3px;
  box-shadow: 0 4px 22px rgba(201,168,76,0.32);
  transition: box-shadow .2s, transform .15s;
}
.btn-login:hover { box-shadow: 0 6px 30px rgba(201,168,76,0.5); transform: translateY(-1px); }
.btn-login:active { transform: translateY(0); }

.login-link { text-align: center; margin-top: 18px; font-size: 13px; color: var(--white-faint); }

.alert-msg {
  padding: 12px 16px; border-radius: 9px; font-size: 13px; margin-bottom: 16px;
}
.alert-msg.ok     { background: var(--green-bg); border:1px solid rgba(39,174,96,.3); color:#5db886; }
.alert-msg.error  { background: var(--red-bg);   border:1px solid var(--red-border);  color:#e07070; }
.alert-msg.warn   { background: rgba(201,168,76,.08); border:1px solid var(--border-2); color:var(--gold-2); }

/* ── Gold Divider ───────────────────────────────────── */
.gold-divider {
  height: 1px; width: 100%;
  background: linear-gradient(90deg, transparent, var(--gold-1) 50%, transparent);
  opacity: .25;
}

/* ── Layout ─────────────────────────────────────────── */
.app-layout { display: flex; min-height: 100vh; }

/* ── Sidebar ─────────────────────────────────────────── */
.sidebar {
  position: fixed; left: 0; top: 0; bottom: 0;
  width: var(--sidebar-w);
  background: var(--black-2);
  border-right: 1px solid var(--border);
  display: flex; flex-direction: column;
  z-index: 200;
  transition: transform .3s ease;
}
.sidebar-logo {
  padding: 28px 24px 20px;
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
}
.sidebar-logo .logo-icon { width: 40px; height: 40px; font-size: 18px; border-radius: 9px; margin-bottom: 10px; }
.sidebar-logo .logo-title { font-size: 18px; }
.sidebar-logo .logo-sub { letter-spacing: 2px; text-transform: uppercase; font-size: 10px; margin-top: 2px; }

.nav { flex: 1; padding: 14px 0; overflow-y: auto; }
.nav::-webkit-scrollbar { width: 3px; }
.nav::-webkit-scrollbar-thumb { background: var(--border-2); border-radius: 2px; }

.nav-section {
  padding: 10px 22px 4px; font-size: 10px;
  letter-spacing: 2.5px; text-transform: uppercase;
  color: var(--gold-dark); font-weight: 600;
}
.nav-item {
  display: flex; align-items: center; gap: 11px;
  padding: 10px 22px; cursor: pointer; font-size: 13.5px;
  color: var(--white-faint); border-left: 2px solid transparent;
  transition: all .18s;
}
.nav-item:hover { color: var(--white); background: rgba(201,168,76,.05); }
.nav-item.active { color: var(--gold-2); background: rgba(201,168,76,.08); border-left-color: var(--gold-1); }
.nav-item .nav-icon { font-size: 15px; width: 18px; text-align: center; flex-shrink: 0; }
.nav-badge {
  margin-left: auto; min-width: 20px; height: 20px; padding: 0 6px;
  border-radius: 10px; background: var(--red); color: #fff;
  font-size: 11px; font-weight: 700;
  display: flex; align-items: center; justify-content: center;
}
.nav-badge.gold { background: var(--gold-muted); color: var(--gold-3); }

.sidebar-user {
  padding: 16px 18px;
  border-top: 1px solid var(--border);
  flex-shrink: 0;
}
.user-chip {
  display: flex; align-items: center; gap: 11px;
  padding: 10px 14px; border-radius: 10px;
  background: var(--black-3); border: 1px solid var(--border);
  cursor: pointer; transition: border-color .2s;
}
.user-chip:hover { border-color: var(--border-2); }
.avatar {
  width: 34px; height: 34px; border-radius: 50%;
  background: var(--grad-gold);
  display: flex; align-items: center; justify-content: center;
  font-weight: 700; font-size: 14px; color: var(--black); flex-shrink: 0;
}
.user-info { flex: 1; min-width: 0; }
.user-name  { font-size: 13px; font-weight: 500; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.user-role  { font-size: 11px; color: var(--white-faint); }
.logout-btn { font-size: 16px; color: var(--white-faint); cursor: pointer; padding: 4px; }
.logout-btn:hover { color: var(--gold-2); }

/* ── Main ───────────────────────────────────────────── */
.main { margin-left: var(--sidebar-w); flex: 1; display: flex; flex-direction: column; min-height: 100vh; }

/* ── Topbar ─────────────────────────────────────────── */
.topbar {
  height: var(--topbar-h); padding: 0 28px;
  display: flex; align-items: center; justify-content: space-between;
  border-bottom: 1px solid var(--border);
  background: rgba(10,10,12,.85);
  backdrop-filter: blur(10px);
  position: sticky; top: 0; z-index: 100;
  flex-shrink: 0;
}
.page-title { font-family: 'Cormorant Garamond', serif; font-size: 20px; font-weight: 600; }
.page-title span { background: var(--grad-gold); -webkit-background-clip: text; -webkit-text-fill-color: transparent; }
.topbar-right { display: flex; gap: 10px; align-items: center; }

/* ── Buttons ─────────────────────────────────────────── */
.btn {
  display: inline-flex; align-items: center; gap: 7px;
  padding: 9px 18px; border-radius: 8px; cursor: pointer;
  font-family: 'DM Sans', sans-serif; font-size: 13px; font-weight: 500;
  border: none; transition: all .18s; text-decoration: none; white-space: nowrap;
}
.btn-gold { background: var(--grad-gold); color: var(--black); box-shadow: var(--shadow-gold); }
.btn-gold:hover { box-shadow: 0 6px 26px rgba(201,168,76,.45); transform: translateY(-1px); color: var(--black); }
.btn-ghost { background: rgba(201,168,76,.07); color: var(--gold-2); border: 1px solid var(--border); }
.btn-ghost:hover { background: rgba(201,168,76,.14); }
.btn-danger { background: var(--red-bg); color: #e07070; border: 1px solid var(--red-border); }
.btn-danger:hover { background: rgba(192,57,43,.2); }
.btn-sm { padding: 6px 13px; font-size: 12px; }
.btn:disabled { opacity: .45; cursor: not-allowed; transform: none !important; }

.icon-btn {
  width: 30px; height: 30px; border-radius: 7px;
  border: 1px solid var(--border); background: var(--black-3);
  display: inline-flex; align-items: center; justify-content: center;
  font-size: 13px; cursor: pointer; transition: all .18s; color: var(--white-faint);
}
.icon-btn:hover { border-color: var(--gold-1); color: var(--gold-2); background: rgba(201,168,76,.1); }

/* ── Content ─────────────────────────────────────────── */
.content { padding: 24px 28px; flex: 1; }

/* ── Sections ────────────────────────────────────────── */
.section { display: none; }
.section.active { display: block; animation: fadeIn .22s ease; }
@keyframes fadeIn { from { opacity: 0; transform: translateY(8px) } to { opacity: 1; transform: none } }

/* ── Alert Strip ─────────────────────────────────────── */
.alert-strip {
  display: flex; align-items: center; gap: 14px;
  padding: 13px 18px; border-radius: 10px; margin-bottom: 20px;
  background: var(--red-bg); border: 1px solid var(--red-border);
}
.alert-strip-icon { font-size: 18px; flex-shrink: 0; }
.alert-strip-text { font-size: 13px; color: #e07070; flex: 1; }
.alert-strip-text strong { color: #f08080; }

/* ── Stats Grid ─────────────────────────────────────── */
.stats-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 16px; margin-bottom: 24px; }
.stat-card {
  background: var(--grad-card); border: 1px solid var(--border);
  border-radius: 14px; padding: 20px 22px; position: relative; overflow: hidden;
  transition: transform .2s, box-shadow .2s;
}
.stat-card:hover { transform: translateY(-2px); box-shadow: 0 8px 28px rgba(201,168,76,.1); }
.stat-card::before {
  content: ''; position: absolute; top: -10px; right: -10px;
  width: 80px; height: 80px;
  background: radial-gradient(circle, rgba(201,168,76,.1) 0%, transparent 70%);
}
.stat-label  { font-size: 10.5px; text-transform: uppercase; letter-spacing: 1.8px; color: var(--white-faint); margin-bottom: 8px; }
.stat-value  { font-family: 'Cormorant Garamond', serif; font-size: 38px; font-weight: 700; line-height: 1;
               background: var(--grad-gold); -webkit-background-clip: text; -webkit-text-fill-color: transparent; }
.stat-sub    { font-size: 12px; color: var(--white-faint); margin-top: 6px; }
.stat-up     { color: #5db886; }
.stat-down   { color: #e07070; }

/* ── Panel ───────────────────────────────────────────── */
.panel {
  background: var(--grad-card); border: 1px solid var(--border);
  border-radius: 14px; overflow: hidden;
}
.panel + .panel { margin-top: 20px; }
.panel-head {
  padding: 14px 20px;
  border-bottom: 1px solid var(--border);
  display: flex; align-items: center; justify-content: space-between;
  gap: 12px; flex-wrap: wrap;
}
.panel-title { font-size: 14px; font-weight: 600; display: flex; align-items: center; gap: 8px; }
.panel-dot { width: 7px; height: 7px; border-radius: 50%; background: var(--gold-1); flex-shrink: 0; }
.panel-dot.red { background: var(--red); }
.panel-body { padding: 18px 20px; }

/* ── Grid ────────────────────────────────────────────── */
.grid-2 { display: grid; grid-template-columns: 1fr 1.35fr; gap: 20px; }
.grid-2-eq { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }

/* ── Table ───────────────────────────────────────────── */
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: 13.5px; }
thead th {
  padding: 11px 14px; text-align: left;
  font-size: 10px; letter-spacing: 2px; text-transform: uppercase;
  color: var(--gold-dark); font-weight: 600;
  border-bottom: 1px solid var(--border);
}
tbody tr { border-bottom: 1px solid rgba(201,168,76,.05); transition: background .15s; }
tbody tr:hover { background: rgba(201,168,76,.03); }
tbody td { padding: 12px 14px; color: var(--white-dim); vertical-align: middle; }
tbody td:first-child { color: var(--white); font-weight: 500; }

/* ── Review Item ─────────────────────────────────────── */
.review-item { padding: 16px 0; border-bottom: 1px solid rgba(201,168,76,.07); }
.review-item:last-child { border: none; padding-bottom: 0; }
.review-header { display: flex; align-items: flex-start; gap: 12px; margin-bottom: 8px; }
.review-avatar {
  width: 34px; height: 34px; border-radius: 50%; flex-shrink: 0;
  background: linear-gradient(135deg, #2c2c38, #3a3a48);
  display: flex; align-items: center; justify-content: center;
  font-size: 12px; font-weight: 700; color: var(--gold-2);
  border: 1px solid var(--border);
}
.review-author { flex: 1; }
.review-name { font-size: 13.5px; font-weight: 500; line-height: 1.3; }
.review-meta { font-size: 11px; color: var(--white-faint); margin-top: 2px; }
.review-date { font-size: 11px; color: var(--white-faint); white-space: nowrap; }
.stars { color: var(--gold-1); font-size: 12px; letter-spacing: 1px; }
.stars.low { color: var(--red); }
.stars.mid { color: #d4872a; }
.review-text { font-size: 13px; color: #a8a4a0; line-height: 1.65; margin-bottom: 10px; }

/* ── Status Chips ─────────────────────────────────────── */
.chip {
  display: inline-flex; align-items: center; gap: 5px;
  padding: 4px 11px; border-radius: 20px;
  font-size: 11.5px; font-weight: 500; white-space: nowrap;
}
.chip-pending   { background: rgba(201,168,76,.1);  color: var(--gold-2); border: 1px solid rgba(201,168,76,.25); }
.chip-replied   { background: var(--green-bg);       color: #5db886;       border: 1px solid rgba(39,174,96,.3); }
.chip-alert     { background: var(--red-bg);         color: #e07070;       border: 1px solid var(--red-border); }
.chip-dismissed { background: rgba(100,100,120,.15); color: #666;          border: 1px solid rgba(100,100,120,.25); }
.chip-approved  { background: rgba(100,149,237,.1);  color: #85a8f0;       border: 1px solid rgba(100,149,237,.3); }
.chip-active    { background: var(--green-bg); color: #5db886; border: 1px solid rgba(39,174,96,.3); }
.chip-paused    { background: rgba(201,168,76,.08); color: var(--gold-2); border: 1px solid rgba(201,168,76,.2); }

/* ── Form ────────────────────────────────────────────── */
.form-grid   { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.form-group  { margin-bottom: 14px; }
.form-full   { grid-column: 1 / -1; }

/* ── Tone Selector ───────────────────────────────────── */
.tone-selector { display: flex; flex-wrap: wrap; gap: 8px; }
.tone-chip {
  padding: 7px 14px; border-radius: 20px; font-size: 12.5px; font-weight: 500;
  cursor: pointer; border: 1px solid var(--border);
  background: var(--black-3); color: var(--white-faint); transition: all .18s;
  user-select: none;
}
.tone-chip:hover { border-color: var(--gold-1); color: var(--gold-2); }
.tone-chip.active { background: rgba(201,168,76,.15); border-color: var(--gold-1); color: var(--gold-2); }

/* ── Timer Widget ─────────────────────────────────────── */
.timer-widget {
  display: flex; align-items: center; gap: 16px;
  padding: 14px 18px; border-radius: 12px; margin-bottom: 10px;
  background: rgba(201,168,76,.06); border: 1px solid rgba(201,168,76,.18);
}
.timer-icon { font-size: 24px; flex-shrink: 0; }
.timer-value { font-family: 'Cormorant Garamond', serif; font-size: 28px; font-weight: 700;
               background: var(--grad-gold); -webkit-background-clip: text; -webkit-text-fill-color: transparent; }
.timer-label { font-size: 11px; color: var(--white-faint); text-transform: uppercase; letter-spacing: 1px; }
input[type=range] {
  -webkit-appearance: none; width: 100%; height: 4px;
  border-radius: 2px; background: var(--black-4); outline: none; margin-top: 8px;
}
input[type=range]::-webkit-slider-thumb {
  -webkit-appearance: none; width: 18px; height: 18px; border-radius: 50%;
  background: var(--grad-gold); cursor: pointer;
  box-shadow: 0 0 10px rgba(201,168,76,.5);
}

/* ── Signature Box ───────────────────────────────────── */
.sig-box {
  padding: 12px 16px; border-radius: 9px;
  background: rgba(201,168,76,.06); border: 1px solid rgba(201,168,76,.2);
  font-size: 13px; color: var(--gold-3); font-style: italic; line-height: 1.7;
  display: flex; align-items: flex-start; gap: 10px;
}

/* ── Modal ───────────────────────────────────────────── */
.modal-overlay {
  position: fixed; inset: 0; background: rgba(0,0,0,.65);
  backdrop-filter: blur(4px); z-index: 1000;
  display: flex; align-items: center; justify-content: center;
  animation: overlayIn .2s ease;
}
@keyframes overlayIn { from { opacity: 0 } to { opacity: 1 } }
.modal {
  background: var(--black-3); border: 1px solid var(--border-2);
  border-radius: 16px; padding: 28px; width: 540px; max-width: 95vw; max-height: 90vh; overflow-y: auto;
  box-shadow: 0 24px 60px rgba(0,0,0,.7);
  animation: modalIn .25s ease;
}
@keyframes modalIn { from { opacity:0; transform:translateY(-16px) scale(.97) } to { opacity:1; transform:none scale(1) } }
.modal-title { font-family: 'Cormorant Garamond', serif; font-size: 20px; font-weight: 700;
               background: var(--grad-gold); -webkit-background-clip: text; -webkit-text-fill-color: transparent;
               margin-bottom: 20px; }
.modal-footer { display: flex; gap: 10px; margin-top: 22px; justify-content: flex-end; }

/* ── Toast ───────────────────────────────────────────── */
#toast-container { position: fixed; bottom: 24px; right: 24px; z-index: 9000; display: flex; flex-direction: column; gap: 10px; }
.toast {
  padding: 13px 18px; border-radius: 10px; font-size: 13.5px; font-weight: 500;
  box-shadow: 0 8px 24px rgba(0,0,0,.5); min-width: 260px; max-width: 380px;
  animation: toastIn .3s ease;
}
@keyframes toastIn { from { opacity:0; transform:translateX(20px) } to { opacity:1; transform:none } }
.toast.success { background: #0d2a1a; border:1px solid rgba(39,174,96,.4); color:#5db886; }
.toast.error   { background: #2a0d0d; border:1px solid var(--red-border); color:#e07070; }
.toast.info    { background: var(--black-3); border:1px solid var(--border-2); color:var(--gold-2); }

/* ── Loading ─────────────────────────────────────────── */
.spinner {
  width: 20px; height: 20px; border: 2px solid rgba(201,168,76,.2);
  border-top-color: var(--gold-1); border-radius: 50%;
  animation: spin .7s linear infinite; display: inline-block;
}
@keyframes spin { to { transform: rotate(360deg) } }
.loading-center { display: flex; align-items: center; justify-content: center; padding: 40px; gap: 12px; color: var(--white-faint); }

/* ── Misc ────────────────────────────────────────────── */
.flex-row  { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.flex-end  { justify-content: flex-end; }
.mt-12     { margin-top: 12px; }
.mt-16     { margin-top: 16px; }
.mb-16     { margin-bottom: 16px; }
.text-dim  { color: var(--white-faint); }
.text-gold { color: var(--gold-2); }
.text-sm   { font-size: 12px; }
.text-mono { font-family: monospace; font-size: 12px; color: #888; }
.separator { height: 1px; background: var(--border); margin: 16px 0; }
.empty-state { text-align: center; padding: 48px 20px; color: var(--white-faint); }
.empty-state .empty-icon { font-size: 40px; margin-bottom: 12px; }
.empty-state p { font-size: 14px; }
