/* ══════════════════════════════════════════════════════════════
   GoldVision SPA — app.css
   Stile fedele al template originale Gold Rock Capital
   ══════════════════════════════════════════════════════════════ */

:root {
  --gold:         #c8a800;
  --gold-dark:    #9e8400;
  --gold-light:   #f0cc00;
  --primary-teal: #007A8E;
  --red:          #e53935;
  --red-dark:     #5d1a05;
  --bg-body:      #f4f4f7;
  --bg-sidebar:   #0d0d0d;
  --bg-card:      #ffffff;
  --text-dark:    #1F2937;
  --text-muted:   #6B7280;
  --border:       #E5E7EB;
  --radius-lg:    16px;
  --radius-xl:    20px;
  --shadow:       0 4px 16px rgba(0,0,0,.1);
  --shadow-hover: 0 12px 32px rgba(0,0,0,.18);
  --sidebar-w:    260px;
  --topbar-h:     64px;
}

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

html, body { height: 100%; }

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

a { color: var(--gold); text-decoration: none; }
a:hover { color: var(--gold-light); }

/* ── LAYOUT ─────────────────────────────────────────────────── */
#app-shell {
  display: flex;
  min-height: 100vh;
}

/* ── SIDEBAR ─────────────────────────────────────────────────── */
#sidebar {
  width: var(--sidebar-w);
  background: linear-gradient(180deg, #111 0%, #0a0a0a 100%);
  display: flex;
  flex-direction: column;
  flex-shrink: 0;
  position: fixed;
  top: 0; left: 0; bottom: 0;
  z-index: 100;
  overflow-y: auto;
  overflow-x: hidden;
  transition: transform .3s ease;
  border-right: 1px solid rgba(200,168,0,.12);
}
#sidebar::-webkit-scrollbar { width: 4px; }
#sidebar::-webkit-scrollbar-track { background: transparent; }
#sidebar::-webkit-scrollbar-thumb { background: rgba(200,168,0,.3); border-radius: 2px; }

.sidebar-logo {
  padding: 1.5rem 1.5rem 1rem;
  display: flex;
  align-items: center;
  gap: .75rem;
  border-bottom: 1px solid rgba(200,168,0,.15);
  flex-shrink: 0;
}
.sidebar-logo-text {
  font-size: 1.3rem;
  font-weight: 900;
  letter-spacing: 2px;
  color: var(--gold);
  text-transform: uppercase;
}
.sidebar-logo-sub {
  font-size: .65rem;
  color: #666;
  letter-spacing: 1px;
  margin-top: 2px;
}

#sidebar-menu {
  list-style: none;
  padding: .75rem 0;
  flex: 1;
}

.nav-group { position: relative; }

.nav-group-header {
  display: flex;
  align-items: center;
  gap: .75rem;
  padding: .75rem 1.25rem;
  color: #bbb;
  font-weight: 600;
  font-size: .9rem;
  cursor: pointer;
  transition: color .2s, background .2s;
  user-select: none;
  border-radius: 10px;
  margin: 2px 8px;
}
.nav-group-header:hover { color: var(--gold); background: rgba(200,168,0,.07); }
.nav-group.open .nav-group-header { color: var(--gold); background: rgba(200,168,0,.1); }

.nav-icon { width: 20px; text-align: center; font-size: 1rem; }
.nav-label { flex: 1; }
.nav-arrow { font-size: .7rem; transition: transform .25s; }
.nav-group.open .nav-arrow { transform: rotate(180deg); }

.nav-sub {
  list-style: none;
  overflow: hidden;
  max-height: 0;
  transition: max-height .3s ease;
  padding: 0 8px 0 16px;
}
.nav-group.open .nav-sub { max-height: 300px; }

.nav-sub li a {
  display: block;
  padding: .5rem 1rem;
  color: #888;
  font-size: .875rem;
  border-radius: 8px;
  transition: color .2s, background .2s;
  margin: 1px 0;
}
.nav-sub li a:hover { color: #fff; background: rgba(255,255,255,.06); }
.nav-sub li a.active { color: var(--gold) !important; background: rgba(200,168,0,.12) !important; font-weight: 700; }

.sidebar-footer {
  padding: 1rem 1.25rem;
  border-top: 1px solid rgba(200,168,0,.1);
  flex-shrink: 0;
}
.btn-logout {
  width: 100%;
  padding: .6rem;
  border-radius: 10px;
  background: transparent;
  border: 1px solid rgba(229,57,53,.4);
  color: #f87171;
  font-size: .85rem;
  font-weight: 600;
  cursor: pointer;
  transition: all .2s;
}
.btn-logout:hover { background: rgba(229,57,53,.15); border-color: var(--red); }

/* ── TOPBAR ──────────────────────────────────────────────────── */
#main-area {
  margin-left: var(--sidebar-w);
  flex: 1;
  min-width: 0;
  overflow-x: hidden;
  display: flex;
  flex-direction: column;
  min-height: 100vh;
  transition: margin-left .3s ease;
}

/* Sidebar collassata — !important garantisce override su qualsiasi altra regola */
#sidebar.sidebar-hidden      { transform: translateX(-260px) !important; }
#main-area.sidebar-collapsed { margin-left: 0 !important; }

#topbar {
  height: var(--topbar-h);
  background: #fff;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  padding: 0 1.5rem;
  gap: 1rem;
  position: sticky;
  top: 0;
  z-index: 50;
  box-shadow: 0 1px 8px rgba(0,0,0,.06);
}
#hamburger-btn {
  display: flex;           /* sempre visibile su desktop */
  align-items: center;
  justify-content: center;
  background: none;
  border: none;
  font-size: 1.3rem;
  color: var(--text-dark);
  cursor: pointer;
  padding: .25rem .5rem;
  border-radius: 6px;
  transition: color .2s, background .2s;
  flex-shrink: 0;
}
#hamburger-btn:hover { background: rgba(200,168,0,.1); color: var(--gold); }
#page-title { font-size: 1.1rem; font-weight: 700; color: var(--text-dark); flex: 1; }
.topbar-user { display: flex; align-items: center; gap: .5rem; font-size: .875rem; color: var(--text-muted); }
.topbar-avatar {
  width: 32px; height: 32px; border-radius: 50%;
  background: linear-gradient(135deg, var(--gold), var(--gold-dark));
  display: flex; align-items: center; justify-content: center;
  color: #000; font-weight: 800; font-size: .8rem;
}

/* ── GOLD FLOW BUTTON ─────────────────────────────────────────── */
.goldflow-btn {
  display: inline-flex; align-items: center; gap: .4rem;
  padding: .35rem 1.1rem;
  background: linear-gradient(135deg, var(--gold) 0%, var(--gold-dark) 100%);
  color: #000 !important; font-weight: 800; font-size: .78rem; letter-spacing: .8px;
  border-radius: 20px; text-decoration: none !important; white-space: nowrap;
  box-shadow: 0 2px 8px rgba(200,168,0,.45);
  transition: transform .2s, box-shadow .2s;
  border: 1.5px solid rgba(200,168,0,.6);
}
.goldflow-btn:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 18px rgba(200,168,0,.6);
  color: #000 !important;
}

/* ── DASHBOARD FULL-HEIGHT ────────────────────────────────────── */
.dashboard-page {
  display: flex;
  flex-direction: column;
}
.dashboard-page .kpi-grid {
  grid-auto-rows: minmax(360px, auto);
  margin-bottom: 1.5rem;
}
.dashboard-page .kpi-card {
  min-height: 360px;
  justify-content: flex-start;
  padding: 3rem 2rem;
}
/* raccolta-box pieno-larghezza anche con kpi-card centrata */
.kpi-card .raccolta-box {
  width: 100%;
  align-self: stretch;
}

/* ── PAGE CONTENT ─────────────────────────────────────────────── */
#page-content {
  flex: 1;
  padding: 1.75rem;
}

/* ── FOOTER ──────────────────────────────────────────────────── */
#app-footer {
  background: #fff;
  border-top: 1px solid var(--border);
  padding: .75rem 1.5rem;
  font-size: .75rem;
  color: var(--text-muted);
  text-align: center;
}

/* ── PAGE LOADER ─────────────────────────────────────────────── */
#page-loader {
  display: none;
  position: fixed; inset: 0;
  background: rgba(0,0,0,.4);
  backdrop-filter: blur(2px);
  z-index: 999;
  align-items: center;
  justify-content: center;
}
.spinner-border.text-gold { color: var(--gold) !important; width: 3rem; height: 3rem; border-width: 4px; }

/* ── TOAST ───────────────────────────────────────────────────── */
#toast-container { position: fixed; bottom: 1.5rem; right: 1.5rem; z-index: 1000; display: flex; flex-direction: column; gap: .5rem; }
.gv-toast {
  padding: .75rem 1.25rem; border-radius: 12px; font-size: .875rem; font-weight: 600;
  opacity: 0; transform: translateX(20px); transition: all .35s ease;
  max-width: 340px; box-shadow: 0 8px 24px rgba(0,0,0,.2);
}
.gv-toast.show { opacity: 1; transform: translateX(0); }
.gv-toast-success { background: #064e3b; color: #6ee7b7; border-left: 4px solid #10b981; }
.gv-toast-error   { background: #7f1d1d; color: #fca5a5; border-left: 4px solid #ef4444; }

/* ── CARDS KPI ───────────────────────────────────────────────── */
.kpi-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 1.5rem;
  margin-bottom: 1.75rem;
}
@media (max-width: 1400px) { .kpi-grid { grid-template-columns: repeat(2,1fr); } }
@media (max-width: 768px)  { .kpi-grid { grid-template-columns: 1fr; } }

.kpi-card {
  border-radius: var(--radius-xl);
  padding: 2rem 1.75rem;
  display: flex;
  flex-direction: column;
  gap: 1rem;
  transition: transform .35s ease, box-shadow .35s ease;
  cursor: pointer;
  animation: fadeInUp .5s ease-out both;
  position: relative;
  overflow: hidden;
}
.kpi-card::before {
  content: '';
  position: absolute; inset: 0;
  background: rgba(255,255,255,0);
  transition: background .3s;
}
.kpi-card:hover::before { background: rgba(255,255,255,.05); }
.kpi-card:hover { transform: translateY(-15px) scale(1.02); box-shadow: var(--shadow-hover); }

.kpi-card-black  { background: linear-gradient(135deg, #1a1a1a 0%, #000 100%); color: #fff; box-shadow: 0 8px 24px rgba(0,0,0,.35); }
.kpi-card-red    { background: linear-gradient(135deg, var(--red) 0%, var(--red-dark) 100%); color: #fff; box-shadow: 0 8px 24px rgba(229,57,53,.35); }
.kpi-card-gold   { background: linear-gradient(135deg, var(--gold) 0%, var(--gold-dark) 100%); color: #000; box-shadow: 0 8px 24px rgba(200,168,0,.35); }
.kpi-card-teal   { background: linear-gradient(135deg, var(--primary-teal) 0%, #005566 100%); color: #fff; box-shadow: 0 8px 24px rgba(0,122,142,.35); }

.kpi-icon {
  width: 100px; height: 100px;
  background: rgba(255,255,255,.2);
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-size: 3.5rem;
  flex-shrink: 0;
}
.kpi-title { font-size: 1.75rem; font-weight: 700; letter-spacing: 1px; text-transform: uppercase; white-space: nowrap; }
.kpi-desc  { font-size: 1rem; opacity: .9; }

/* progress box inside card */
.raccolta-box {
  background: rgba(255,255,255,.1);
  backdrop-filter: blur(8px);
  border: 1px solid rgba(255,255,255,.15);
  border-radius: 12px;
  padding: 14px 16px;
  position: relative;
  overflow: hidden;
  cursor: pointer;
  transition: background .25s;
}
.raccolta-box:hover { background: rgba(255,255,255,.15); }
.raccolta-label { font-size: .75rem; letter-spacing: 1px; font-weight: 600; opacity: .85; position: relative; z-index: 1; }
.raccolta-value { font-size: 1.05rem; font-weight: 800; margin-top: 2px; position: relative; z-index: 1; }
.raccolta-progress {
  position: absolute; top: 0; left: 0; height: 100%; width: 0;
  background: linear-gradient(90deg, rgba(255,223,0,.4), rgba(217,159,53,.35));
  transition: width 1.6s cubic-bezier(.22,1,.36,1);
  z-index: 0;
}
.raccolta-pct {
  position: absolute; bottom: 8px; right: 12px;
  font-size: .75rem; font-weight: 700; z-index: 1; opacity: .85;
}

/* ── GOLD LEAGUE BAR ─────────────────────────────────────────── */
.gold-league-bar {
  background: linear-gradient(90deg, #000, #1a1a1a);
  border-radius: var(--radius-lg);
  padding: 1.25rem 1.5rem;
  display: flex;
  align-items: center;
  gap: 1.5rem;
  margin-bottom: 1.75rem;
  overflow: hidden;
  cursor: pointer;
  box-shadow: 0 8px 24px rgba(0,0,0,.25);
}
.gold-league-label {
  flex-shrink: 0;
  font-weight: 900;
  font-size: 1.2rem;
  color: var(--gold);
  letter-spacing: 1px;
  text-align: center;
  min-width: 150px;
}
.gold-league-label small { display: block; font-size: .7rem; color: #d4c24f; font-weight: 600; letter-spacing: 1px; margin-top: 3px; }
.gold-league-divider { width: 2px; height: 48px; background: linear-gradient(180deg, transparent, var(--gold), transparent); flex-shrink: 0; }
.gold-league-scroll { overflow: hidden; flex: 1; white-space: nowrap; }
.gold-league-inner { display: inline-flex; gap: 2.5rem; animation: marquee 30s linear infinite; }
.gold-league-inner:hover { animation-play-state: paused; }
.producer-item { display: flex; align-items: center; gap: .4rem; font-weight: 700; font-size: .95rem; color: #fff; }
.producer-rank { color: var(--gold); font-weight: 900; font-size: 1.1rem; }
@keyframes marquee { from { transform: translateX(0); } to { transform: translateX(-50%); } }

/* ── CARRIERA BOX ────────────────────────────────────────────── */
.carriera-grid {
  display: grid;
  grid-template-columns: 2fr 1fr;
  gap: 1.5rem;
  margin-top: 1.5rem;
}
@media (max-width: 900px) { .carriera-grid { grid-template-columns: 1fr; } }

.carriera-box {
  background: #fff;
  border-radius: var(--radius-xl);
  padding: 1.75rem;
  box-shadow: var(--shadow);
}
.carriera-box-title {
  font-size: .75rem;
  font-weight: 800;
  letter-spacing: 2px;
  color: var(--text-muted);
  text-transform: uppercase;
  margin-bottom: 1rem;
}
.carriera-items { display: flex; gap: 2rem; flex-wrap: wrap; }
.carriera-item { flex: 1; min-width: 120px; }
.carriera-item-label { font-size: .7rem; font-weight: 700; color: var(--text-muted); text-transform: uppercase; letter-spacing: .5px; margin-bottom: .25rem; }
.carriera-item-value { font-size: 1.6rem; font-weight: 900; color: var(--gold); line-height: 1.1; }

/* ── GENERIC CARD ─────────────────────────────────────────────── */
.gv-card {
  background: var(--bg-card);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow);
  padding: 1.5rem;
  margin-bottom: 1.25rem;
}
.gv-card-header {
  font-size: .75rem;
  font-weight: 800;
  letter-spacing: 2px;
  text-transform: uppercase;
  color: var(--text-muted);
  margin-bottom: 1rem;
  padding-bottom: .75rem;
  border-bottom: 2px solid var(--border);
  display: flex;
  align-items: center;
  gap: .5rem;
}
.gv-card-header i { color: var(--gold); }

/* ── TABLE ───────────────────────────────────────────────────── */
.gv-table {
  width: 100%;
  border-collapse: collapse;
  font-size: .875rem;
}
.gv-table thead th {
  background: #f9fafb;
  font-weight: 700;
  font-size: .75rem;
  letter-spacing: .5px;
  text-transform: uppercase;
  color: var(--text-muted);
  padding: .75rem 1rem;
  border-bottom: 2px solid var(--border);
  white-space: nowrap;
}
.gv-table tbody td {
  padding: .75rem 1rem;
  border-bottom: 1px solid var(--border);
  vertical-align: middle;
}
.gv-table tbody tr:hover td { background: rgba(200,168,0,.04); }
.gv-table tbody tr:last-child td { border-bottom: none; }
.gv-table-sm th, .gv-table-sm td { padding: .5rem .75rem; font-size: .8rem; }

/* ── EMPTY STATE ─────────────────────────────────────────────── */
.gv-empty {
  text-align: center;
  padding: 3rem;
  color: var(--text-muted);
}
.gv-empty i { display: block; color: #d1d5db; margin-bottom: 1rem; }

/* ── FORM ─────────────────────────────────────────────────────── */
.gv-form-label { font-size: .85rem; font-weight: 700; color: var(--text-dark); margin-bottom: .35rem; display: block; }
.gv-input {
  width: 100%; padding: .65rem 1rem;
  border: 1.5px solid var(--border);
  border-radius: 10px;
  font-size: .9rem;
  transition: border-color .2s, box-shadow .2s;
  background: #fff;
  color: var(--text-dark);
}
.gv-input:focus {
  outline: none;
  border-color: var(--gold);
  box-shadow: 0 0 0 3px rgba(200,168,0,.15);
}

/* ── BUTTON ──────────────────────────────────────────────────── */
.btn-gold {
  padding: .6rem 1.5rem;
  border-radius: 10px;
  background: linear-gradient(135deg, var(--gold), var(--gold-dark));
  border: none;
  color: #000;
  font-weight: 700;
  font-size: .875rem;
  cursor: pointer;
  transition: all .2s;
}
.btn-gold:hover { transform: translateY(-1px); box-shadow: 0 4px 16px rgba(200,168,0,.4); }
.btn-outline-gold {
  padding: .6rem 1.5rem;
  border-radius: 10px;
  background: transparent;
  border: 2px solid var(--gold);
  color: var(--gold);
  font-weight: 700;
  font-size: .875rem;
  cursor: pointer;
  transition: all .2s;
}
.btn-outline-gold:hover { background: rgba(200,168,0,.1); }

/* ── BADGE ───────────────────────────────────────────────────── */
.badge-gold { background: rgba(200,168,0,.15); color: var(--gold-dark); padding: .2rem .6rem; border-radius: 6px; font-size: .75rem; font-weight: 700; }
.badge-red  { background: rgba(229,57,53,.15); color: var(--red); padding: .2rem .6rem; border-radius: 6px; font-size: .75rem; font-weight: 700; }
.badge-ok   { background: rgba(16,185,129,.15); color: #059669; padding: .2rem .6rem; border-radius: 6px; font-size: .75rem; font-weight: 700; }

/* ── ANIMATION ───────────────────────────────────────────────── */
@keyframes fadeInUp {
  from { opacity: 0; transform: translateY(20px); }
  to   { opacity: 1; transform: translateY(0); }
}

/* ── SIDEBAR OVERLAY (mobile) ────────────────────────────────── */
#sidebar-overlay {
  display: none;
  position: fixed; inset: 0;
  background: rgba(0,0,0,.6);
  z-index: 99;
}

/* ── RESPONSIVE ──────────────────────────────────────────────── */
@media (max-width: 900px) {
  #sidebar { transform: translateX(calc(-1 * var(--sidebar-w))); }
  #sidebar.open { transform: translateX(0); }
  #sidebar-overlay.active { display: block; }
  #main-area { margin-left: 0; }
  #hamburger-btn { display: block; }
  #page-content { padding: 1rem; }
}

/* ── SEARCH BAR ──────────────────────────────────────────────── */
.search-bar {
  display: flex;
  gap: .75rem;
  align-items: center;
  margin-bottom: 1.25rem;
}
.search-bar .gv-input { max-width: 360px; }

/* Piano Finanziario table specifics */
.pf-positive { color: #059669; font-weight: 700; }
.pf-negative { color: var(--red); font-weight: 700; }
