/* ==========================================================================
   SOLON — Design System & Global Styles
   ========================================================================== */

/* ---- Z-index layers (non tematici) ---- */
:root {
  --z-base: 1;
  --z-dropdown: 100;
  --z-nav: 500;
  --z-overlay: 800;
  --z-modal: 900;
  --z-toast: 1000;
  --z-cookie: 1050;
}

/* ---- Reset & Base ---- */
*,
*::before,
*::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html {
  scroll-behavior: smooth;
  -webkit-font-smoothing: antialiased;
}

body {
  font-family: 'Inter', sans-serif;
  background-color: var(--bg);
  color: var(--txt);
  line-height: 1.5;
  min-height: 100vh;
}

a {
  color: var(--accent);
  text-decoration: none;
  transition: color var(--transition);
}

a:hover {
  color: var(--accent);
}

img {
  max-width: 100%;
  display: block;
}

/* ---- Layout ---- */
.page-wrapper {
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}

main {
  flex: 1;
  padding-bottom: 5rem;
}

.container-solon {
  max-width: 680px;
  margin: 0 auto;
  padding: 0 1rem;
}

.container-wide {
  max-width: 1100px;
  margin: 0 auto;
  padding: 0 1rem;
}

/* ---- Topbar ---- */
.solon-topbar {
  position: sticky;
  top: 0;
  z-index: var(--z-nav);
  background: color-mix(in srgb, var(--surface) 88%, transparent);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border-bottom: 0.5px solid var(--border);
  height: 3.4rem;
}

.topbar-inner {
  max-width: 1100px;
  margin: 0 auto;
  padding: 0 1rem;
  height: 100%;
  display: flex;
  align-items: center;
  gap: 1.5rem;
}

.solon-logo {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  text-decoration: none;
  flex-shrink: 0;
}

.logo-icon {
  font-size: 1.4rem;
  line-height: 1;
  filter: drop-shadow(0 0 6px rgba(201, 162, 39, 0.5));
}

.logo-text {
  font-family: 'Playfair Display', serif;
  font-size: 1.35rem;
  font-weight: 600;
  color: var(--txt);
  letter-spacing: -0.01em;
  background: linear-gradient(135deg, var(--txt) 20%, var(--accent));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

/* Desktop nav */
.topbar-nav {
  display: flex;
  align-items: center;
  gap: 0.25rem;
  flex: 1;
}

.topbar-link {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.4rem 0.8rem;
  border-radius: var(--radius-pill);
  font-size: 0.875rem;
  font-weight: 500;
  color: var(--txt2);
  text-decoration: none;
  transition: all var(--transition);
}

.topbar-link:hover,
.topbar-link.active {
  color: var(--txt);
  background: var(--surface2);
}

.topbar-link.active {
  color: var(--accent);
}

/* Azioni destra */
.topbar-actions {
  margin-left: auto;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.topbar-icon-btn {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 2.375rem;
  height: 2.375rem;
  border-radius: 50%;
  color: var(--txt2);
  text-decoration: none;
  transition: all var(--transition);
  font-size: 1.1rem;
}

.topbar-icon-btn:hover {
  background: var(--accent-bg);
  color: var(--accent);
}

/* Badge notifiche */
.notif-badge {
  position: absolute;
  top: 4px;
  right: 4px;
  background: var(--dislike);
  color: #fff;
  font-size: 0.6rem;
  font-weight: 600;
  min-width: 1rem;
  height: 1rem;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0 3px;
  animation: pulse 2s infinite;
}

/* Avatar button */
.topbar-avatar-btn {
  background: none;
  border: 2px solid var(--border);
  border-radius: 50%;
  padding: 1px;
  cursor: pointer;
  transition: border-color var(--transition);
  display: flex;
  align-items: center;
}

.topbar-avatar-btn:hover {
  border-color: var(--accent);
}

.topbar-avatar-btn::after {
  display: none;
}

/* ---- Dropdown ---- */
.solon-dropdown {
  background: var(--surface);
  border: 0.5px solid var(--border);
  border-radius: var(--radius-md);
  box-shadow: 0 8px 24px rgba(0,0,0,0.12);
  padding: 0.5rem;
  min-width: 220px;
}

.solon-dropdown .dropdown-header {
  color: var(--txt);
  font-size: 0.875rem;
  font-weight: 600;
  padding: 0.5rem 0.75rem;
}

.solon-dropdown .dropdown-item {
  color: var(--txt2);
  font-size: 0.875rem;
  border-radius: var(--radius-sm);
  padding: 0.5rem 0.75rem;
  transition: all var(--transition);
  display: flex;
  align-items: center;
}

.solon-dropdown .dropdown-item:hover {
  background: var(--accent-bg);
  color: var(--accent-txt);
}

.solon-dropdown .dropdown-item.text-error {
  color: var(--dislike);
}

.solon-dropdown .dropdown-item.text-error:hover {
  background: rgba(248, 81, 73, 0.1);
}

.solon-dropdown .dropdown-divider {
  border-color: var(--border);
}

/* ---- Bottom Nav ---- */
.bottom-nav {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  z-index: var(--z-nav);
  background: color-mix(in srgb, var(--surface) 92%, transparent);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border-top: 0.5px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-around;
  height: 3.5rem;
  padding-bottom: env(safe-area-inset-bottom);
}

.bottom-nav-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 2px;
  color: var(--txt3);
  text-decoration: none;
  font-size: 1.3rem;
  padding: 0 0.75rem;
  height: 100%;
  transition: color var(--transition);
  flex: 1;
}

.bottom-nav-item small {
  font-size: 0.65rem;
  font-weight: 500;
}

.bottom-nav-item:hover,
.bottom-nav-item.active {
  color: var(--accent);
}

/* FAB upload */
.upload-fab {
  width: 2.75rem;
  height: 2.75rem;
  background: linear-gradient(135deg, var(--accent), var(--accent));
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  font-size: 1.1rem;
  box-shadow: 0 4px 12px rgba(13, 110, 253, 0.4);
  transition: transform var(--transition), box-shadow var(--transition);
}

.bottom-nav-item:hover .upload-fab {
  transform: scale(1.08);
  box-shadow: 0 6px 20px rgba(13, 110, 253, 0.5);
}

[data-theme="dark"] .upload-fab {
  box-shadow: 0 4px 12px rgba(26, 108, 245, 0.4);
}

[data-theme="dark"] .bottom-nav-item:hover .upload-fab {
  box-shadow: 0 6px 20px rgba(26, 108, 245, 0.5);
}

/* Badge mobile */
.notif-badge-mobile {
  position: absolute;
  top: -4px;
  right: -4px;
  width: 8px;
  height: 8px;
  background: var(--dislike);
  border-radius: 50%;
}

/* ---- Footer ---- */
.solon-footer {
  background: var(--surface);
  border-top: 1px solid var(--border);
  padding: 1.25rem 0;
  text-align: center;
  font-size: 0.8rem;
  color: var(--txt3);
}

.solon-footer a {
  color: var(--txt3);
  transition: color var(--transition);
}

.solon-footer a:hover {
  color: var(--txt);
}

/* ---- Cards ---- */
.solon-card {
  background: var(--surface);
  border: 0.5px solid var(--border);
  border-radius: 14px;
  padding: 14px 16px;
  transition: border-color var(--transition);
}

.solon-card:hover {
  border-color: var(--accent);
}

.solon-card-elevated {
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 1.25rem;
  box-shadow: 0 4px 12px rgba(0,0,0,0.08);
}

/* ---- Buttons ---- */
.btn-solon {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.4rem 1rem;
  border-radius: var(--radius-pill);
  font-size: 0.875rem;
  font-weight: 600;
  cursor: pointer;
  transition: all var(--transition);
  border: none;
  outline: none;
  text-decoration: none;
  white-space: nowrap;
}

.btn-primary {
  background: var(--accent);
  color: #fff;
}

.btn-primary:hover {
  background: var(--accent);
  color: #fff;
  transform: translateY(-1px);
  box-shadow: 0 4px 14px rgba(13, 110, 253, 0.4);
}

[data-theme="dark"] .btn-primary:hover {
  box-shadow: 0 4px 14px rgba(26, 108, 245, 0.4);
}

.btn-ghost {
  background: transparent;
  color: var(--txt2);
  border: 1px solid var(--border);
}

.btn-ghost:hover {
  border-color: var(--accent);
  background: var(--accent-bg);
  color: var(--accent);
}

.btn-gold {
  background: var(--gold);
  color: #0d1117;
}

.btn-gold:hover {
  background: #b8911f;
  transform: translateY(-1px);
}

.btn-danger {
  background: transparent;
  color: var(--dislike);
  border: 1px solid var(--dislike);
}

.btn-danger:hover {
  background: var(--dislike-bg);
  color: var(--dislike-txt);
}

.btn-sm {
  padding: 0.3rem 0.8rem;
  font-size: 0.8rem;
}

.btn-lg {
  padding: 0.6rem 1.5rem;
  font-size: 1rem;
}

.btn-block {
  width: 100%;
  justify-content: center;
}

.btn-solon:disabled,
.btn-solon.disabled {
  opacity: 0.4;
  cursor: not-allowed;
  transform: none;
}

.btn-outline-secondary {
  background: transparent;
  color: var(--txt2);
  border: 1px solid var(--border);
}

.btn-outline-secondary:hover {
  border-color: var(--accent);
  color: var(--accent);
  background: var(--accent-bg);
}

/* ---- Form Elements ---- */
.form-group {
  margin-bottom: 1rem;
}

.form-label {
  display: block;
  font-size: 0.85rem;
  font-weight: 500;
  color: var(--txt2);
  margin-bottom: 0.4rem;
}

.form-control-solon {
  width: 100%;
  background: var(--surface2);
  border: 0.5px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--txt);
  padding: 0.5rem 0.75rem;
  font-size: 0.95rem;
  font-family: system-ui, -apple-system, sans-serif;
  transition: border-color var(--transition), box-shadow var(--transition);
  outline: none;
}

.form-control-solon:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(13, 110, 253, 0.15);
}

[data-theme="dark"] .form-control-solon:focus {
  box-shadow: 0 0 0 3px rgba(26, 108, 245, 0.15);
}

.form-control-solon::placeholder {
  color: var(--txt3);
}

textarea.form-control-solon {
  resize: vertical;
  min-height: 100px;
}

.form-text {
  font-size: 0.8rem;
  color: var(--txt3);
  margin-top: 0.3rem;
}

.form-error {
  font-size: 0.8rem;
  color: var(--dislike);
  margin-top: 0.3rem;
}

/* ---- Badges ---- */
.badge-solon {
  display: inline-flex;
  align-items: center;
  gap: 0.25rem;
  padding: 0.2rem 0.65rem;
  border-radius: var(--radius-pill);
  font-size: 0.72rem;
  font-weight: 600;
  letter-spacing: 0.02em;
  text-transform: uppercase;
}

.badge-expert {
  background: var(--expert-bg);
  color: var(--expert-txt);
  font-size: 11px;
  font-weight: 600;
  border-radius: 6px;
  padding: 2px 7px;
}

.badge-standard {
  background: rgba(139, 148, 158, 0.1);
  color: var(--txt2);
  border: 1px solid var(--border);
}

.badge-pending {
  background: rgba(210, 153, 34, 0.15);
  color: #f59e0b;
  border: 1px solid rgba(210, 153, 34, 0.3);
}

.badge-admin {
  background: rgba(248, 81, 73, 0.1);
  color: var(--dislike);
  border: 1px solid rgba(248, 81, 73, 0.3);
}

/* ---- Avatar ---- */
.avatar {
  border-radius: 50%;
  object-fit: cover;
  background: var(--surface2);
  flex-shrink: 0;
}

.avatar-sm {
  width: 2rem;
  height: 2rem;
}

.avatar-md {
  width: 2.625rem;
  height: 2.625rem;
}

.avatar-lg {
  width: 4rem;
  height: 4rem;
}

.avatar-xl {
  width: 6rem;
  height: 6rem;
}

.avatar-placeholder {
  border-radius: 50%;
  background: linear-gradient(135deg, var(--accent) 0%, var(--accent) 100%);
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 600;
  color: #fff;
  flex-shrink: 0;
}

/* ---- Alert / Toast ---- */
.alert-solon {
  padding: 0.9rem 1.2rem;
  border-radius: var(--radius-md);
  font-size: 0.9rem;
  display: flex;
  align-items: flex-start;
  gap: 0.75rem;
  border: 1px solid transparent;
  animation: fadeIn 0.3s ease;
}

.alert-success {
  background: rgba(63, 185, 80, 0.1);
  border-color: rgba(63, 185, 80, 0.3);
  color: var(--like);
}

.alert-error {
  background: rgba(248, 81, 73, 0.1);
  border-color: rgba(248, 81, 73, 0.3);
  color: var(--dislike);
}

.alert-warning {
  background: rgba(210, 153, 34, 0.1);
  border-color: rgba(210, 153, 34, 0.3);
  color: #f59e0b;
}

.alert-info {
  background: rgba(88, 166, 255, 0.1);
  border-color: rgba(88, 166, 255, 0.3);
  color: var(--doc);
}

/* Toast fixed */
.toast-container {
  position: fixed;
  top: 80px;
  right: 1rem;
  z-index: var(--z-toast);
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.toast {
  min-width: 280px;
  padding: 0.8rem 1.1rem;
  border-radius: var(--radius-md);
  font-size: 0.875rem;
  font-weight: 500;
  box-shadow: 0 8px 24px rgba(0,0,0,0.12);
  animation: slideInRight 0.3s ease, fadeOut 0.3s ease 3.7s forwards;
}

/* ---- Score Chips ---- */
.score-chip {
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  padding: 0.15rem 0.6rem;
  border-radius: var(--radius-pill);
  font-size: 0.78rem;
  font-weight: 600;
}

.score-interaction {
  background: rgba(13, 110, 253, 0.1);
  color: var(--accent);
  border: 1px solid rgba(13, 110, 253, 0.2);
}

[data-theme="dark"] .score-interaction {
  background: rgba(26, 108, 245, 0.1);
  border-color: rgba(26, 108, 245, 0.2);
}

.score-reputation {
  background: var(--expert-bg);
  color: var(--gold);
  border: 1px solid rgba(201, 162, 39, 0.2);
}

/* ---- Dividers ---- */
.divider {
  border: none;
  border-top: 1px solid var(--border);
  margin: 1.5rem 0;
}

/* ---- Skeleton ---- */
.skeleton {
  background: linear-gradient(90deg, var(--surface2) 25%, var(--surface) 50%, var(--surface2) 75%);
  background-size: 200% 100%;
  animation: shimmer 1.5s infinite;
  border-radius: var(--radius-sm);
}

.skeleton-line {
  height: 0.75rem;
  border-radius: var(--radius-sm);
  margin-bottom: 0.5rem;
}

/* ---- Cookie Banner ---- */
.cookie-banner {
  position: fixed;
  bottom: 70px;
  left: 0;
  right: 0;
  z-index: var(--z-cookie);
  background: var(--surface);
  border-top: 1px solid var(--border);
  padding: 0.85rem 1.25rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  flex-wrap: wrap;
  box-shadow: 0 -4px 20px rgba(0, 0, 0, 0.15);
  animation: slideUp 0.35s ease;
}

@keyframes slideUp {
  from {
    transform: translateY(100%);
    opacity: 0;
  }
  to {
    transform: translateY(0);
    opacity: 1;
  }
}

.cookie-content {
  display: flex;
  align-items: center;
  font-size: 0.82rem;
  color: var(--txt2);
  flex: 1;
}

.cookie-link {
  color: var(--accent);
  text-decoration: underline;
  margin-left: 0.3rem;
}

@media (min-width: 768px) {
  .cookie-banner {
    bottom: 0;
    left: auto;
    right: 1.5rem;
    max-width: 600px;
    border-radius: var(--radius-md) var(--radius-md) 0 0;
  }
}

/* ---- Scrollbar ---- */
::-webkit-scrollbar {
  width: 6px;
}

::-webkit-scrollbar-track {
  background: var(--bg);
}

::-webkit-scrollbar-thumb {
  background: var(--border);
  border-radius: 3px;
}

::-webkit-scrollbar-thumb:hover {
  background: var(--txt3);
}

/* ---- Keyframes ---- */
@keyframes fadeIn {
  from {
    opacity: 0;
    transform: translateY(-6px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes slideInRight {
  from {
    transform: translateX(120%);
    opacity: 0;
  }
  to {
    transform: translateX(0);
    opacity: 1;
  }
}

@keyframes fadeOut {
  from {
    opacity: 1;
  }
  to {
    opacity: 0;
    transform: translateY(-10px);
  }
}

@keyframes shimmer {
  to {
    background-position: -200% 0;
  }
}

@keyframes pulse {
  0%,
  100% {
    opacity: 1;
  }
  50% {
    opacity: 0.5;
  }
}

/* ---- Utility ---- */
.text-primary-solon {
  color: var(--accent);
}

.text-gold {
  color: var(--gold);
}

.text-muted-solon {
  color: var(--txt3);
}

.text-secondary-solon {
  color: var(--txt2);
}

.text-success-solon {
  color: var(--like);
}

.text-error-solon {
  color: var(--dislike);
}

.bg-surface {
  background: var(--surface);
}

.bg-elevated {
  background: var(--surface2);
}

.fw-500 {
  font-weight: 500;
}

.fw-600 {
  font-weight: 600;
}

.fw-600 {
  font-weight: 600;
}

.fs-xs {
  font-size: 0.75rem;
}

.fs-sm {
  font-size: 0.875rem;
}

.fs-md {
  font-size: 1rem;
}

.fs-lg {
  font-size: 1.125rem;
}

.fs-xl {
  font-size: 1.5rem;
}

.mt-auto {
  margin-top: auto;
}

.d-flex {
  display: flex;
}

.align-center {
  align-items: center;
}

.gap-1 {
  gap: 0.5rem;
}

.gap-2 {
  gap: 1rem;
}

.justify-between {
  justify-content: space-between;
}

/* ---- Responsive bottom nav ---- */
@media (min-width: 900px) {
  .bottom-nav {
    max-width: 600px;
    left: 50%;
    transform: translateX(-50%);
    border-radius: var(--radius-lg) var(--radius-lg) 0 0;
    border-left: 1px solid var(--border);
    border-right: 1px solid var(--border);
  }
}
