/* ===== RESET & VARIABILI ===== */
:root {
  --background: #1a1512;
  --foreground: #f5ede6;
  --primary: #C77D3E;
  --primary-foreground: #f5ede6;
  --secondary: #D4A574;
  --secondary-foreground: #1a1512;
  --accent-cyan: #22d3ee;
  --text-muted: #a89588;
  --text-primary: #f5ede6;
  --border: rgba(212, 165, 116, 0.2);
  --border-subtle: rgba(255, 255, 255, 0.06);
  --bg-panel: rgba(26, 21, 18, 0.85);
  --bg-panel-hover: rgba(212, 165, 116, 0.08);
  --bg-panel-2: rgba(255, 255, 255, 0.04);
  --card: rgba(26, 21, 18, 0.75);
  --muted: rgba(255, 255, 255, 0.04);
  --radius: 12px;
  --radius-sm: 8px;
  --shadow-card: 0 8px 32px rgba(0, 0, 0, 0.4);
  --shadow-cta: 0 8px 24px rgba(199, 125, 62, 0.35);
  --shadow-cta-secondary: 0 8px 24px rgba(212, 165, 116, 0.25);
  --max-width: 1280px;
  --font-mono: 'Courier New', monospace;
}

* { margin: 0; padding: 0; box-sizing: border-box; }
html { scroll-behavior: smooth; }

body {
  font-family: 'Raleway', 'Segoe UI', system-ui, -apple-system, sans-serif;
  background: var(--background);
  color: var(--foreground);
  line-height: 1.6;
  min-height: 100vh;
  overflow-x: hidden;
}

a { text-decoration: none; color: inherit; }
img { display: block; max-width: 100%; }

svg.icon {
  width: 20px;
  height: 20px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.ocean-bg {
  position: fixed;
  inset: 0;
  z-index: -1;
  background: var(--background);
  background-image:
    radial-gradient(ellipse at 20% 50%, rgba(199, 125, 62, 0.08) 0%, transparent 60%),
    radial-gradient(ellipse at 80% 50%, rgba(212, 165, 116, 0.05) 0%, transparent 60%);
}

/* ===== NAVBAR ===== */
.navbar {
  position: fixed;
  top: 0; left: 0; right: 0;
  z-index: 100;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 12px 24px;
  background: rgba(26, 21, 18, 0.85);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--border-subtle);
  flex-wrap: wrap;
}
.navbar-logo {
  display: flex;
  align-items: center;
  gap: 10px;
  font-weight: 800;
  font-size: 18px;
  color: var(--primary);
  margin-right: 16px;
}
.navbar-logo img { height: 36px; width: auto; }
.navbar a {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 8px 14px;
  border-radius: var(--radius-sm);
  font-size: 13px;
  font-weight: 600;
  color: var(--text-muted);
  transition: all 0.15s ease;
}
.navbar a:hover { background: var(--bg-panel-hover); color: var(--foreground); }
.navbar a.active { color: var(--primary); background: rgba(199, 125, 62, 0.12); }
.navbar a svg { width: 18px; height: 18px; }
.navbar a:last-child { margin-left: auto; }

/* ===== BUTTONS ===== */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 12px 24px;
  border: none;
  border-radius: var(--radius-sm);
  font-family: inherit;
  font-size: 14px;
  font-weight: 700;
  cursor: pointer;
  transition: transform 0.15s ease, box-shadow 0.15s ease, background-color 0.15s ease;
  background: var(--bg-panel);
  color: var(--foreground);
  border: 1px solid var(--border-subtle);
}
.btn:hover { transform: translateY(-2px); }
.btn:active { transform: translateY(0); }
.btn-primary { background: var(--primary); color: var(--primary-foreground); box-shadow: var(--shadow-cta); border: none; }
.btn-secondary { background: var(--secondary); color: var(--secondary-foreground); box-shadow: var(--shadow-cta-secondary); border: none; }
.btn-ghost { background: var(--card); color: var(--foreground); border: 1px solid var(--border); box-shadow: none; font-weight: 600; }
.btn-ghost:hover { background: var(--muted); transform: none; }
.btn-lg { padding: 16px 32px; font-size: 18px; text-transform: uppercase; letter-spacing: 0.03em; }
.btn-md { padding: 12px 24px; font-size: 15px; }
.btn-sm { padding: 8px 16px; font-size: 14px; }

/* ===== HERO ===== */
.hero {
  position: relative;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}
.hero__bg {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  transform: scale(1.1);
}
.hero__bg img { width: 100%; height: 100%; object-fit: cover; }
.hero__veil { position: absolute; inset: 0; background: transparent; }
.hero__fade { position: absolute; inset: 0; background: transparent; }
.hero > *:not(.hero__bg):not(.hero__veil):not(.hero__fade) { position: relative; z-index: 1; }

.nav {
  max-width: 900px;
  margin: 0 auto;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: center;
  gap: 12px 32px;
  padding: 28px 20px;
  font-size: 14px;
  font-weight: 700;
  color: var(--primary-foreground);
}
.nav a { display: inline-flex; align-items: center; gap: 8px; transition: color 0.15s ease; }
.nav a:hover { color: var(--primary); }
.nav .icon { color: var(--primary); width: 16px; height: 16px; }
.nav__store {
  background: var(--primary);
  color: var(--primary-foreground);
  padding: 12px 28px;
  border-radius: 12px;
  font-size: 16px;
  font-weight: 800;
  box-shadow: var(--shadow-card);
  transition: transform 0.15s ease;
}
.nav__store:hover { transform: translateY(-2px); color: var(--primary-foreground); }
.nav__store .icon { color: currentColor; width: 20px; height: 20px; }

.hero__main {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 48px;
  padding: 64px 20px 96px;
}
.hero__logo {
  width: 288px;
  height: 288px;
  flex-shrink: 0;
  filter: drop-shadow(0 25px 25px rgba(0, 0, 0, 0.35));
}

.stat { display: flex; align-items: center; gap: 16px; }
.stat__circle {
  width: 56px; height: 56px;
  flex-shrink: 0;
  border-radius: 999px;
  background: var(--primary);
  color: var(--primary-foreground);
  display: flex;
  align-items: center;
  justify-content: center;
}
.stat__circle .icon { width: 28px; height: 28px; }
.stat__label {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 12px;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.2em;
  color: var(--primary);
}
.dot { width: 8px; height: 8px; border-radius: 999px; background: var(--primary); }
.stat__value { font-size: 24px; font-weight: 900; text-transform: uppercase; color: var(--primary-foreground); }

.hero__cards {
  max-width: 1024px;
  width: 100%;
  margin: 0 auto;
  display: grid;
  gap: 16px;
  grid-template-columns: 1.5fr 1fr;
  padding: 0 20px 24px;
}
.card-welcome {
  display: flex;
  align-items: center;
  gap: 20px;
  padding: 20px;
  border-radius: 12px;
  background: rgba(58, 36, 16, 0.95);
  color: var(--primary-foreground);
  box-shadow: var(--shadow-card);
  backdrop-filter: blur(6px);
}
.card-welcome__title { font-size: 18px; font-weight: 900; }

.card-store {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 20px 24px;
  border-radius: 12px;
  background: rgba(199, 125, 62, 0.15);
  border: 1px solid rgba(199, 125, 62, 0.2);
  color: var(--primary-foreground);
  transition: all 0.15s ease;
}
.card-store:hover { background: rgba(199, 125, 62, 0.25); transform: translateY(-2px); box-shadow: var(--shadow-card); }
.card-store__title { font-size: 18px; font-weight: 800; }
.card-store__sub { font-size: 13px; opacity: 0.7; }
.card-store svg { width: 28px; height: 28px; color: var(--primary); }

/* ===== PANELS ===== */
.panel {
  background: var(--bg-panel);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius);
  padding: 20px;
  backdrop-filter: blur(6px);
}
.panel-shell {
  background: var(--bg-panel);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius);
  padding: 20px;
}

.welcome-bar { max-width: var(--max-width); margin: 0 auto 20px; padding: 0 24px; }
.welcome-card {
  display: flex;
  align-items: center;
  gap: 20px;
  padding: 20px 24px;
  background: var(--bg-panel);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius);
  flex-wrap: wrap;
}
.welcome-card .avatar { width: 48px; height: 48px; border-radius: 50%; background: var(--primary); flex-shrink: 0; }
.welcome-card h3 { font-size: 16px; font-weight: 700; margin: 0; }
.welcome-card p { font-size: 13px; color: var(--text-muted); margin: 0; }
.welcome-card .actions { display: flex; gap: 10px; margin-left: auto; }

/* ===== STORE LAYOUT ===== */
.store-layout {
  max-width: var(--max-width);
  margin: 0 auto 60px;
  padding: 0 24px;
  display: grid;
  grid-template-columns: 220px 1.6fr 260px;
  gap: 20px;
}
@media (max-width: 1000px) { .store-layout { grid-template-columns: 1fr; } }

.cat-list a {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 12px;
  border-radius: var(--radius-sm);
  font-size: 13.5px;
  color: var(--text-muted);
  margin-bottom: 4px;
  cursor: pointer;
  transition: all 0.15s ease;
}
.cat-list a:hover, .cat-list a.active { background: var(--bg-panel-hover); color: var(--accent-cyan); }
.cat-dropdown-items { display: none; padding-left: 14px; margin-top: 4px; }
.cat-dropdown-items.open { display: block; }
.cat-dropdown-items a { font-size: 12.5px; padding: 6px 10px; }

.pkg-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 14px; }
.pkg-card {
  background: var(--bg-panel);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius);
  padding: 16px;
  cursor: pointer;
  transition: border-color 0.15s ease, transform 0.15s ease;
}
.pkg-card:hover { border-color: var(--accent-cyan); transform: translateY(-2px); }
.pkg-card .pkg-img {
  width: 100%;
  height: 90px;
  border-radius: var(--radius-sm);
  background: linear-gradient(135deg, rgba(34, 211, 238, 0.25), rgba(34, 211, 238, 0.05));
  background-size: contain;
  background-position: center;
  background-repeat: no-repeat;
  margin-bottom: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--accent-cyan);
}
.pkg-card .pkg-name { font-weight: 700; font-size: 14px; margin-bottom: 4px; }
.pkg-card .pkg-price { font-family: var(--font-mono); font-size: 13px; color: #4ade80; font-weight: 600; }

.section-title {
  color: var(--accent-cyan);
  font-size: 13px;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin-bottom: 14px;
}

.donor-card { display: flex; align-items: center; gap: 12px; }
.donor-card img { width: 48px; height: 48px; border-radius: var(--radius-sm); image-rendering: pixelated; }
.donor-card .name { font-weight: 700; color: var(--accent-cyan); font-size: 14px; }
.donor-card .amount { font-family: var(--font-mono); font-size: 12.5px; color: #4ade80; }

.recent-payments { display: flex; flex-wrap: wrap; gap: 8px; }
.recent-payments img { width: 34px; height: 34px; border-radius: 6px; image-rendering: pixelated; cursor: default; }

.pkg-overlay {
  position: fixed;
  inset: 0;
  background: rgba(4, 8, 14, 0.75);
  display: none;
  align-items: center;
  justify-content: center;
  z-index: 100;
  padding: 20px;
}
.pkg-overlay.open { display: flex; }
.pkg-modal {
  background: var(--bg-panel);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius);
  padding: 24px;
  max-width: 420px;
  width: 100%;
  position: relative;
  max-height: 85vh;
  overflow-y: auto;
}
.pkg-modal .close-btn {
  position: absolute;
  top: 10px;
  right: 12px;
  background: none;
  border: none;
  color: var(--text-muted);
  font-size: 20px;
  cursor: pointer;
}
.pkg-modal .pkg-img-large {
  width: 100%;
  height: 160px;
  border-radius: var(--radius-sm);
  background: linear-gradient(135deg, rgba(34, 211, 238, 0.25), rgba(34, 211, 238, 0.05));
  background-size: contain;
  background-position: center;
  background-repeat: no-repeat;
  margin-bottom: 14px;
}
.pkg-modal h3 { font-size: 19px; margin-bottom: 10px; }
.pkg-modal .desc { font-size: 13.5px; color: var(--text-muted); white-space: pre-line; margin-bottom: 16px; line-height: 1.6; }
.pkg-modal .price-row { font-size: 20px; font-weight: 700; color: #4ade80; font-family: var(--font-mono); margin-bottom: 16px; }
.pkg-modal .actions { display: flex; gap: 10px; }
.pkg-modal .gift-box { display: none; margin-top: 12px; gap: 8px; }
.pkg-modal .gift-box.open { display: flex; }
.pkg-modal .gift-box input { flex: 1; padding: 8px 10px; border-radius: 6px; border: 1px solid var(--border-subtle); background: var(--bg-panel-2); color: var(--text-primary); }

/* ===== FOOTER ===== */
.footer {
  text-align: center;
  padding: 40px 20px;
  border-top: 1px solid var(--border-subtle);
  font-size: 13px;
  color: var(--text-muted);
}
.footer a { color: var(--primary); transition: color 0.15s ease; }
.footer a:hover { color: var(--secondary); }

/* ===== RESPONSIVE ===== */
@media (max-width: 768px) {
  .navbar { padding: 10px 16px; gap: 4px; }
  .navbar a { padding: 6px 10px; font-size: 12px; }
  .navbar a span { display: none; }
  .hero__logo { width: 180px; height: 180px; }
  .hero__cards { grid-template-columns: 1fr; }
  .card-welcome { flex-direction: column; text-align: center; }
  .hero__main { padding: 40px 16px 60px; gap: 24px; }
  .nav { gap: 8px 16px; padding: 16px; font-size: 12px; }
  .nav__store { padding: 8px 16px; font-size: 14px; }
  .welcome-card { flex-direction: column; text-align: center; }
  .welcome-card .actions { margin-left: 0; }
  .pkg-grid { grid-template-columns: 1fr 1fr; }
}
@media (max-width: 480px) {
  .pkg-grid { grid-template-columns: 1fr; }
  .stat { flex-direction: column; align-items: center; text-align: center; }
}

/* ===================================================
   TEMA CHIARO
   =================================================== */
[data-theme="light"] {
  --background: #f5f1ed;
  --foreground: #2a1f18;
  --primary: #C77D3E;
  --primary-foreground: #ffffff;
  --secondary: #A8673A;
  --secondary-foreground: #ffffff;
  --accent-cyan: #0891b2;
  --text-muted: #7a6b5f;
  --text-primary: #2a1f18;
  --border: rgba(199, 125, 62, 0.25);
  --border-subtle: rgba(0, 0, 0, 0.08);
  --bg-panel: rgba(255, 255, 255, 0.85);
  --bg-panel-hover: rgba(199, 125, 62, 0.1);
  --bg-panel-2: rgba(0, 0, 0, 0.03);
  --card: rgba(255, 255, 255, 0.9);
  --muted: rgba(0, 0, 0, 0.05);
  --shadow-card: 0 8px 32px rgba(0, 0, 0, 0.1);
  --shadow-cta: 0 8px 24px rgba(199, 125, 62, 0.25);
  --shadow-cta-secondary: 0 8px 24px rgba(168, 103, 58, 0.2);
}

[data-theme="light"] body {
  background: #f5f1ed;
  color: #2a1f18;
}

[data-theme="light"] .ocean-bg {
  background: #f5f1ed;
  background-image:
    radial-gradient(ellipse at 20% 50%, rgba(199, 125, 62, 0.06) 0%, transparent 60%),
    radial-gradient(ellipse at 80% 50%, rgba(168, 103, 58, 0.04) 0%, transparent 60%);
}

[data-theme="light"] .navbar {
  background: rgba(255, 255, 255, 0.9);
  border-bottom-color: rgba(0, 0, 0, 0.08);
}

[data-theme="light"] .navbar a {
  color: #7a6b5f;
}

[data-theme="light"] .navbar a:hover {
  background: rgba(199, 125, 62, 0.1);
  color: #2a1f18;
}

[data-theme="light"] .user-widget,
[data-theme="light"] .theme-toggle {
  background: rgba(255, 255, 255, 0.95);
  border-color: rgba(199, 125, 62, 0.25);
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.1);
}

[data-theme="light"] .user-widget__name {
  color: #2a1f18;
}

[data-theme="light"] .footer {
  background: #f5f1ed;
  border-top-color: rgba(0, 0, 0, 0.08);
}

[data-theme="light"] .panel,
[data-theme="light"] .store-panel,
[data-theme="light"] .forum-panel,
[data-theme="light"] .table-card,
[data-theme="light"] .stat-card,
[data-theme="light"] .value-card,
[data-theme="light"] .about-story,
[data-theme="light"] .about-team,
[data-theme="light"] .timeline-card,
[data-theme="light"] .form-card,
[data-theme="light"] .form-container {
  background: rgba(255, 255, 255, 0.85);
  border-color: rgba(0, 0, 0, 0.08);
}

[data-theme="light"] .data-table th {
  color: #7a6b5f;
  border-bottom-color: rgba(0, 0, 0, 0.08);
}

[data-theme="light"] .data-table td {
  border-bottom-color: rgba(0, 0, 0, 0.08);
}

[data-theme="light"] .data-table tr:hover td {
  background: rgba(199, 125, 62, 0.05);
}

[data-theme="light"] .timeline-card {
  background: rgba(255, 255, 255, 0.7);
}

[data-theme="light"] .timeline-card:hover {
  box-shadow: 0 12px 40px rgba(199, 125, 62, 0.15);
}

[data-theme="light"] .chat-container {
  background: rgba(255, 255, 255, 0.85);
  border-color: rgba(0, 0, 0, 0.08);
}

[data-theme="light"] .chat-message__text {
  background: rgba(0, 0, 0, 0.04);
}

[data-theme="light"] .chat-input-row textarea {
  background: rgba(0, 0, 0, 0.03);
  border-color: rgba(0, 0, 0, 0.08);
  color: #2a1f18;
}

[data-theme="light"] .form-group input,
[data-theme="light"] .form-group select,
[data-theme="light"] .form-group textarea {
  background: rgba(0, 0, 0, 0.03);
  border-color: rgba(0, 0, 0, 0.1);
  color: #2a1f18;
}

[data-theme="light"] .cat-list a:hover,
[data-theme="light"] .cat-list a.active {
  background: rgba(199, 125, 62, 0.1);
}
