/* ============================================================
   HT SALES LEARNING - Design System Luxury
   ============================================================ */

:root {
  /* Gold palette */
  --gold: #D4AF37;
  --gold-light: #F0D060;
  --gold-dark: #B8942A;
  --gold-subtle: rgba(212, 175, 55, 0.12);
  --gold-border: rgba(212, 175, 55, 0.25);

  /* Dark theme (default) */
  --bg-primary: #0A0A0B;
  --bg-secondary: #111113;
  --bg-card: #161618;
  --bg-elevated: #1C1C1F;
  --bg-hover: #222226;
  --bg-input: #1A1A1D;
  --bg-sidebar: #0D0D10;
  --bg-overlay: rgba(0,0,0,0.85);

  --text-primary: #F5F5F7;
  --text-secondary: #A1A1AA;
  --text-muted: #6B6B77;
  --text-inverse: #0A0A0B;

  --border-subtle: rgba(255,255,255,0.06);
  --border-default: rgba(255,255,255,0.1);
  --border-strong: rgba(255,255,255,0.18);

  --accent-blue: #3B82F6;
  --accent-green: #10B981;
  --accent-red: #EF4444;
  --accent-orange: #F59E0B;
  --accent-purple: #8B5CF6;

  --sidebar-width: 260px;
  --header-height: 64px;
  --radius-sm: 6px;
  --radius-md: 10px;
  --radius-lg: 16px;
  --radius-xl: 24px;
  --radius-full: 9999px;

  --shadow-sm: 0 1px 3px rgba(0,0,0,0.4);
  --shadow-md: 0 4px 16px rgba(0,0,0,0.5);
  --shadow-lg: 0 12px 40px rgba(0,0,0,0.6);
  --shadow-gold: 0 0 20px rgba(212,175,55,0.15);

  --transition: 0.2s ease;
  --transition-slow: 0.35s ease;
}

/* Light Theme */
.theme-light {
  --bg-primary: #F8F8F5;
  --bg-secondary: #FFFFFF;
  --bg-card: #FFFFFF;
  --bg-elevated: #F0F0ED;
  --bg-hover: #E8E8E5;
  --bg-input: #FFFFFF;
  --bg-sidebar: #1A1A1D;
  --bg-overlay: rgba(0,0,0,0.5);
  --text-primary: #1A1A1D;
  --text-secondary: #5C5C66;
  --text-muted: #9090A0;
  --border-subtle: rgba(0,0,0,0.05);
  --border-default: rgba(0,0,0,0.1);
  --border-strong: rgba(0,0,0,0.2);
  --shadow-sm: 0 1px 3px rgba(0,0,0,0.08);
  --shadow-md: 0 4px 16px rgba(0,0,0,0.12);
  --shadow-lg: 0 12px 40px rgba(0,0,0,0.15);
}

/* Reset e Base */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { font-size: 16px; -webkit-text-size-adjust: 100%; }

body.ht-body {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
  background-color: var(--bg-primary);
  color: var(--text-primary);
  line-height: 1.6;
  min-height: 100vh;
  overflow-x: hidden;
  -webkit-font-smoothing: antialiased;
}

/* Loading Screen */
#loading-screen {
  position: fixed; inset: 0;
  display: flex; flex-direction: column;
  align-items: center; justify-content: center;
  background: var(--bg-primary);
  z-index: 9999; gap: 24px;
}
.loading-logo {
  display: flex; align-items: center; gap: 12px;
  font-size: 20px; font-weight: 700;
  letter-spacing: 0.1em; color: var(--gold);
}
.loading-spinner {
  width: 36px; height: 36px;
  border: 2px solid var(--border-subtle);
  border-top-color: var(--gold);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* Scrollbar */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: var(--bg-secondary); }
::-webkit-scrollbar-thumb { background: var(--border-strong); border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: var(--gold-dark); }

/* Layout */
.ht-layout { display: flex; min-height: 100vh; }
.ht-sidebar {
  width: var(--sidebar-width);
  background: var(--bg-sidebar);
  border-right: 1px solid var(--border-subtle);
  position: fixed; left: 0; top: 0; bottom: 0;
  display: flex; flex-direction: column;
  z-index: 100; overflow-y: auto;
  transition: transform var(--transition-slow);
}
.ht-main {
  margin-left: var(--sidebar-width);
  flex: 1; display: flex; flex-direction: column;
  min-height: 100vh;
}
.ht-header {
  height: var(--header-height);
  background: var(--bg-secondary);
  border-bottom: 1px solid var(--border-subtle);
  display: flex; align-items: center;
  padding: 0 24px; gap: 16px;
  position: sticky; top: 0; z-index: 50;
  backdrop-filter: blur(12px);
}
.ht-content {
  flex: 1; padding: 32px;
  max-width: 1440px;
}

/* Sidebar */
.sidebar-logo {
  padding: 24px 20px;
  display: flex; align-items: center; gap: 10px;
  border-bottom: 1px solid var(--border-subtle);
}
.sidebar-logo-icon {
  width: 36px; height: 36px;
  background: linear-gradient(135deg, var(--gold) 0%, var(--gold-dark) 100%);
  border-radius: var(--radius-sm);
  display: flex; align-items: center; justify-content: center;
  color: #000; font-weight: 900; font-size: 16px;
  letter-spacing: -0.05em;
}
.sidebar-logo-text { font-size: 13px; font-weight: 700; color: var(--gold); letter-spacing: 0.05em; line-height: 1.2; }
.sidebar-logo-sub { font-size: 10px; color: var(--text-muted); letter-spacing: 0.08em; text-transform: uppercase; }

.sidebar-nav { flex: 1; padding: 16px 0; }
.nav-section { padding: 0 12px 8px; }
.nav-section-label {
  font-size: 10px; text-transform: uppercase;
  letter-spacing: 0.1em; color: var(--text-muted);
  padding: 12px 8px 4px; font-weight: 600;
}
.nav-item {
  display: flex; align-items: center; gap: 10px;
  padding: 9px 10px; border-radius: var(--radius-sm);
  color: var(--text-secondary); font-size: 13.5px; font-weight: 500;
  cursor: pointer; transition: all var(--transition);
  text-decoration: none; margin-bottom: 2px;
  border: 1px solid transparent;
}
.nav-item:hover { background: var(--bg-hover); color: var(--text-primary); }
.nav-item.active {
  background: var(--gold-subtle);
  color: var(--gold);
  border-color: var(--gold-border);
}
.nav-item i { width: 18px; text-align: center; font-size: 14px; }
.nav-badge {
  margin-left: auto; background: var(--accent-red);
  color: white; font-size: 10px; font-weight: 700;
  padding: 2px 6px; border-radius: var(--radius-full);
}

.sidebar-user {
  padding: 16px; border-top: 1px solid var(--border-subtle);
  display: flex; align-items: center; gap: 10px; cursor: pointer;
}
.sidebar-user:hover { background: var(--bg-hover); }
.user-avatar {
  width: 36px; height: 36px; border-radius: 50%;
  background: linear-gradient(135deg, var(--gold), var(--gold-dark));
  display: flex; align-items: center; justify-content: center;
  font-weight: 700; font-size: 13px; color: #000; flex-shrink: 0;
  overflow: hidden;
}
.user-avatar img { width: 100%; height: 100%; object-fit: cover; }
.user-info { min-width: 0; flex: 1; }
.user-name { font-size: 13px; font-weight: 600; color: var(--text-primary); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.user-role { font-size: 11px; color: var(--text-muted); text-transform: capitalize; }

/* Cards */
.ht-card {
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  overflow: hidden;
  transition: all var(--transition-slow);
}
.ht-card:hover { border-color: var(--gold-border); box-shadow: var(--shadow-gold); transform: translateY(-2px); }
.ht-card-header { padding: 20px 24px; border-bottom: 1px solid var(--border-subtle); display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.ht-card-title { font-size: 16px; font-weight: 600; }
.ht-card-body { padding: 24px; }

/* Course Cards */
.course-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  gap: 20px;
}
.course-card {
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  overflow: hidden;
  cursor: pointer;
  transition: all var(--transition-slow);
  display: flex; flex-direction: column;
}
.course-card:hover {
  border-color: var(--gold-border);
  box-shadow: var(--shadow-gold);
  transform: translateY(-4px);
}
.course-thumbnail {
  position: relative; padding-top: 56.25%;
  background: linear-gradient(135deg, #1a1a2e, #16213e);
  overflow: hidden;
}
.course-thumbnail img {
  position: absolute; inset: 0; width: 100%; height: 100%;
  object-fit: cover; transition: transform var(--transition-slow);
}
.course-card:hover .course-thumbnail img { transform: scale(1.04); }
.course-thumbnail-placeholder {
  position: absolute; inset: 0;
  display: flex; align-items: center; justify-content: center;
  background: linear-gradient(135deg, #1a1a2e 0%, #16213e 50%, #0f0f23 100%);
}
.course-thumbnail-placeholder i { font-size: 48px; color: var(--gold); opacity: 0.4; }
.course-badge {
  position: absolute; top: 12px; left: 12px;
  padding: 4px 10px; border-radius: var(--radius-full);
  font-size: 11px; font-weight: 600;
  backdrop-filter: blur(8px);
}
.course-badge.free { background: rgba(16,185,129,0.85); color: white; }
.course-badge.paid { background: rgba(212,175,55,0.9); color: black; }
.course-badge.level {
  left: auto; right: 12px;
  background: rgba(0,0,0,0.7); color: white;
}
.course-progress-bar {
  position: absolute; bottom: 0; left: 0; right: 0;
  height: 3px; background: rgba(255,255,255,0.1);
}
.course-progress-fill { height: 100%; background: var(--gold); transition: width 0.5s ease; }
.course-body { padding: 16px; flex: 1; display: flex; flex-direction: column; gap: 8px; }
.course-category { font-size: 11px; color: var(--gold); font-weight: 600; text-transform: uppercase; letter-spacing: 0.05em; }
.course-title { font-size: 15px; font-weight: 700; line-height: 1.4; color: var(--text-primary); }
.course-meta { display: flex; align-items: center; gap: 12px; font-size: 12px; color: var(--text-muted); flex-wrap: wrap; }
.course-meta span { display: flex; align-items: center; gap: 4px; }
.course-footer { padding: 12px 16px; border-top: 1px solid var(--border-subtle); display: flex; align-items: center; justify-content: space-between; }
.course-price { font-size: 18px; font-weight: 800; color: var(--gold); }
.course-price-original { font-size: 12px; color: var(--text-muted); text-decoration: line-through; margin-left: 6px; }
.course-completion { display: flex; align-items: center; gap: 8px; font-size: 12px; color: var(--text-secondary); }

/* Stats Cards */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 16px;
}
.stat-card {
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  padding: 20px;
  display: flex; flex-direction: column; gap: 8px;
  transition: all var(--transition);
}
.stat-card:hover { border-color: var(--gold-border); }
.stat-label { font-size: 12px; color: var(--text-muted); font-weight: 500; }
.stat-value { font-size: 28px; font-weight: 800; color: var(--text-primary); line-height: 1; }
.stat-change { font-size: 12px; color: var(--accent-green); display: flex; align-items: center; gap: 4px; }
.stat-icon { width: 40px; height: 40px; border-radius: var(--radius-md); display: flex; align-items: center; justify-content: center; font-size: 18px; margin-bottom: 4px; }
.stat-icon.gold { background: var(--gold-subtle); color: var(--gold); }
.stat-icon.blue { background: rgba(59,130,246,0.1); color: var(--accent-blue); }
.stat-icon.green { background: rgba(16,185,129,0.1); color: var(--accent-green); }
.stat-icon.purple { background: rgba(139,92,246,0.1); color: var(--accent-purple); }

/* Buttons */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  padding: 10px 18px; border-radius: var(--radius-sm);
  font-size: 14px; font-weight: 600;
  cursor: pointer; border: none; outline: none;
  transition: all var(--transition); text-decoration: none;
  white-space: nowrap; user-select: none;
  -webkit-user-select: none;
}
.btn:disabled { opacity: 0.5; cursor: not-allowed; }
.btn-primary { background: linear-gradient(135deg, var(--gold) 0%, var(--gold-dark) 100%); color: #000; }
.btn-primary:hover:not(:disabled) { filter: brightness(1.1); transform: translateY(-1px); box-shadow: 0 4px 12px rgba(212,175,55,0.3); }
.btn-secondary { background: var(--bg-elevated); border: 1px solid var(--border-default); color: var(--text-primary); }
.btn-secondary:hover:not(:disabled) { background: var(--bg-hover); border-color: var(--border-strong); }
.btn-danger { background: rgba(239,68,68,0.1); border: 1px solid rgba(239,68,68,0.3); color: var(--accent-red); }
.btn-danger:hover:not(:disabled) { background: rgba(239,68,68,0.2); }
.btn-ghost { background: transparent; color: var(--text-secondary); }
.btn-ghost:hover:not(:disabled) { background: var(--bg-hover); color: var(--text-primary); }
.btn-sm { padding: 6px 12px; font-size: 12px; }
.btn-lg { padding: 13px 28px; font-size: 15px; }
.btn-block { width: 100%; }
.btn-icon { padding: 8px; width: 36px; height: 36px; }

/* Forms */
.form-group { display: flex; flex-direction: column; gap: 6px; }
.form-label { font-size: 13px; font-weight: 600; color: var(--text-secondary); }
.form-input, .form-select, .form-textarea {
  background: var(--bg-input);
  border: 1px solid var(--border-default);
  border-radius: var(--radius-sm);
  color: var(--text-primary);
  font-size: 14px; font-family: inherit;
  padding: 10px 14px; outline: none;
  transition: border-color var(--transition);
  width: 100%;
}
.form-input:focus, .form-select:focus, .form-textarea:focus {
  border-color: var(--gold);
  box-shadow: 0 0 0 3px rgba(212,175,55,0.1);
}
.form-input::placeholder { color: var(--text-muted); }
.form-textarea { resize: vertical; min-height: 100px; }
.form-select { cursor: pointer; appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='6'%3E%3Cpath d='M0 0l5 6 5-6z' fill='%236B6B77'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: right 12px center;
  padding-right: 36px;
}
.form-error { font-size: 12px; color: var(--accent-red); }
.form-hint { font-size: 12px; color: var(--text-muted); }
.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }

/* Tables */
.ht-table-wrap { overflow-x: auto; border-radius: var(--radius-md); border: 1px solid var(--border-subtle); }
.ht-table { width: 100%; border-collapse: collapse; font-size: 13.5px; }
.ht-table th {
  background: var(--bg-elevated); padding: 12px 16px;
  font-weight: 600; text-align: left; color: var(--text-secondary);
  border-bottom: 1px solid var(--border-subtle); white-space: nowrap;
  font-size: 12px; text-transform: uppercase; letter-spacing: 0.05em;
}
.ht-table td { padding: 12px 16px; border-bottom: 1px solid var(--border-subtle); color: var(--text-primary); }
.ht-table tr:last-child td { border-bottom: none; }
.ht-table tr:hover td { background: var(--bg-hover); }

/* Badges */
.badge {
  display: inline-flex; align-items: center; gap: 4px;
  padding: 3px 10px; border-radius: var(--radius-full);
  font-size: 11px; font-weight: 600;
}
.badge-green { background: rgba(16,185,129,0.15); color: #10B981; }
.badge-red { background: rgba(239,68,68,0.15); color: #EF4444; }
.badge-yellow { background: rgba(245,158,11,0.15); color: #F59E0B; }
.badge-blue { background: rgba(59,130,246,0.15); color: #3B82F6; }
.badge-gold { background: var(--gold-subtle); color: var(--gold); border: 1px solid var(--gold-border); }
.badge-gray { background: rgba(107,107,119,0.15); color: var(--text-secondary); }

/* Progress */
.progress-bar { height: 6px; background: var(--bg-elevated); border-radius: var(--radius-full); overflow: hidden; }
.progress-fill { height: 100%; background: linear-gradient(90deg, var(--gold), var(--gold-light)); border-radius: var(--radius-full); transition: width 0.5s ease; }

/* Modals */
.modal-overlay {
  position: fixed; inset: 0;
  background: var(--bg-overlay);
  backdrop-filter: blur(4px);
  z-index: 1000; display: flex;
  align-items: center; justify-content: center;
  padding: 20px; animation: fadeIn 0.2s ease;
}
.modal {
  background: var(--bg-card);
  border: 1px solid var(--border-default);
  border-radius: var(--radius-xl);
  width: 100%; max-width: 560px;
  max-height: 90vh; overflow-y: auto;
  box-shadow: var(--shadow-lg);
  animation: slideUp 0.25s ease;
}
.modal-header {
  padding: 24px 28px 0;
  display: flex; align-items: center;
  justify-content: space-between;
}
.modal-title { font-size: 20px; font-weight: 700; }
.modal-body { padding: 24px 28px; }
.modal-footer {
  padding: 0 28px 24px;
  display: flex; gap: 12px; justify-content: flex-end;
}
.modal-close {
  width: 32px; height: 32px;
  background: var(--bg-elevated); border: none;
  border-radius: var(--radius-full); cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  color: var(--text-muted); font-size: 16px;
  transition: all var(--transition);
}
.modal-close:hover { background: var(--accent-red); color: white; }
.modal-lg { max-width: 800px; }
.modal-xl { max-width: 1100px; }

/* Alerts */
.alert {
  padding: 12px 16px; border-radius: var(--radius-md);
  font-size: 13.5px; display: flex; align-items: flex-start; gap: 10px;
  border: 1px solid;
}
.alert-success { background: rgba(16,185,129,0.1); border-color: rgba(16,185,129,0.3); color: #6EE7B7; }
.alert-error { background: rgba(239,68,68,0.1); border-color: rgba(239,68,68,0.3); color: #FCA5A5; }
.alert-warning { background: rgba(245,158,11,0.1); border-color: rgba(245,158,11,0.3); color: #FCD34D; }
.alert-info { background: rgba(59,130,246,0.1); border-color: rgba(59,130,246,0.3); color: #93C5FD; }

/* Toast */
#toast-container {
  position: fixed; bottom: 24px; right: 24px;
  z-index: 9000; display: flex; flex-direction: column;
  gap: 10px; align-items: flex-end;
}
.toast {
  background: var(--bg-elevated); border: 1px solid var(--border-default);
  border-radius: var(--radius-md); padding: 12px 16px;
  font-size: 13.5px; color: var(--text-primary);
  box-shadow: var(--shadow-md); min-width: 260px; max-width: 360px;
  display: flex; align-items: center; gap: 10px;
  animation: slideInRight 0.25s ease;
}
.toast.success { border-left: 3px solid var(--accent-green); }
.toast.error { border-left: 3px solid var(--accent-red); }
.toast.warning { border-left: 3px solid var(--accent-orange); }
.toast.info { border-left: 3px solid var(--accent-blue); }

/* Skeleton */
.skeleton {
  background: linear-gradient(90deg, var(--bg-elevated) 25%, var(--bg-hover) 50%, var(--bg-elevated) 75%);
  background-size: 200% 100%;
  animation: shimmer 1.5s infinite;
  border-radius: var(--radius-sm);
}
@keyframes shimmer { 0% { background-position: 200% 0; } 100% { background-position: -200% 0; } }

/* Empty State */
.empty-state {
  display: flex; flex-direction: column;
  align-items: center; justify-content: center;
  padding: 64px 20px; text-align: center; gap: 16px;
}
.empty-state-icon { font-size: 48px; color: var(--text-muted); opacity: 0.5; }
.empty-state-title { font-size: 18px; font-weight: 600; color: var(--text-primary); }
.empty-state-desc { font-size: 14px; color: var(--text-muted); max-width: 380px; }

/* Page Header */
.page-header { margin-bottom: 28px; display: flex; align-items: flex-start; justify-content: space-between; flex-wrap: wrap; gap: 16px; }
.page-title { font-size: 26px; font-weight: 800; letter-spacing: -0.02em; }
.page-subtitle { font-size: 14px; color: var(--text-muted); margin-top: 4px; }
.page-actions { display: flex; gap: 10px; align-items: center; }

/* Breadcrumb */
.breadcrumb { display: flex; align-items: center; gap: 8px; font-size: 13px; color: var(--text-muted); margin-bottom: 16px; }
.breadcrumb a { color: var(--text-muted); text-decoration: none; }
.breadcrumb a:hover { color: var(--gold); }
.breadcrumb .sep { color: var(--border-strong); }

/* Video Player */
.video-container {
  position: relative; padding-top: 56.25%;
  background: #000; border-radius: var(--radius-md); overflow: hidden;
}
.video-container iframe {
  position: absolute; inset: 0; width: 100%; height: 100%; border: none;
}
.video-placeholder {
  position: absolute; inset: 0;
  display: flex; flex-direction: column;
  align-items: center; justify-content: center;
  background: var(--bg-elevated); gap: 12px;
  color: var(--text-muted);
}
.video-placeholder i { font-size: 48px; color: var(--gold); opacity: 0.5; }
/* Overlay errore video non incorporabile */
#video-error-overlay {
  position: absolute; inset: 0;
  background: #0a0a0b;
  display: none; flex-direction: column;
  align-items: center; justify-content: center;
  gap: 16px; z-index: 20;
  border-radius: var(--radius-lg);
}

/* Lesson Sidebar */
.lesson-layout { display: grid; grid-template-columns: 1fr 340px; gap: 24px; align-items: start; }
.lesson-sidebar {
  background: var(--bg-card); border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg); overflow: hidden;
  position: sticky; top: calc(var(--header-height) + 16px);
  max-height: calc(100vh - var(--header-height) - 48px);
  display: flex; flex-direction: column;
}
.lesson-sidebar-header {
  padding: 16px 20px; border-bottom: 1px solid var(--border-subtle);
  font-weight: 600; font-size: 14px;
}
.lesson-list { overflow-y: auto; flex: 1; }
.lesson-module-title {
  padding: 12px 16px 6px; font-size: 11px; font-weight: 700;
  text-transform: uppercase; letter-spacing: 0.08em; color: var(--text-muted);
  background: var(--bg-elevated); border-bottom: 1px solid var(--border-subtle);
}
.lesson-item {
  display: flex; align-items: center; gap: 12px;
  padding: 10px 16px; cursor: pointer;
  transition: background var(--transition);
  border-bottom: 1px solid var(--border-subtle);
  font-size: 13px;
}
.lesson-item:hover { background: var(--bg-hover); }
.lesson-item.active { background: var(--gold-subtle); }
.lesson-item.completed .lesson-check { color: var(--gold); }
.lesson-check { width: 20px; height: 20px; border-radius: 50%; border: 2px solid var(--border-default); display: flex; align-items: center; justify-content: center; flex-shrink: 0; font-size: 10px; color: var(--text-muted); }
.lesson-item.completed .lesson-check { background: var(--gold); border-color: var(--gold); color: #000; }
.lesson-title-text { flex: 1; line-height: 1.4; }

/* Auth Pages */
.auth-page {
  min-height: 100vh; display: flex;
  align-items: center; justify-content: center;
  padding: 20px;
  background: radial-gradient(ellipse at 20% 50%, rgba(212,175,55,0.08) 0%, transparent 60%),
              radial-gradient(ellipse at 80% 20%, rgba(139,92,246,0.06) 0%, transparent 60%),
              var(--bg-primary);
}
.auth-card {
  width: 100%; max-width: 440px;
  background: var(--bg-card);
  border: 1px solid var(--border-default);
  border-radius: var(--radius-xl);
  padding: 40px;
  box-shadow: var(--shadow-lg);
}
.auth-logo {
  display: flex; align-items: center; justify-content: center;
  gap: 10px; margin-bottom: 32px;
}
.auth-logo-icon {
  width: 44px; height: 44px;
  background: linear-gradient(135deg, var(--gold), var(--gold-dark));
  border-radius: var(--radius-md);
  display: flex; align-items: center; justify-content: center;
  font-weight: 900; font-size: 20px; color: #000;
}
.auth-logo-text { font-size: 16px; font-weight: 800; color: var(--gold); letter-spacing: 0.04em; line-height: 1; }
.auth-title { font-size: 22px; font-weight: 800; text-align: center; margin-bottom: 8px; }
.auth-subtitle { font-size: 13.5px; color: var(--text-muted); text-align: center; margin-bottom: 28px; }
.auth-form { display: flex; flex-direction: column; gap: 16px; }
.auth-divider { text-align: center; font-size: 12px; color: var(--text-muted); position: relative; margin: 8px 0; }
.auth-divider::before, .auth-divider::after { content: ''; position: absolute; top: 50%; width: 40%; height: 1px; background: var(--border-default); }
.auth-divider::before { left: 0; }
.auth-divider::after { right: 0; }
.auth-link { font-size: 13.5px; color: var(--text-secondary); text-align: center; margin-top: 16px; }
.auth-link a { color: var(--gold); font-weight: 600; text-decoration: none; }
.auth-link a:hover { text-decoration: underline; }

/* Public Homepage */
.hero-section {
  min-height: 100vh; display: flex;
  align-items: center; justify-content: center;
  text-align: center; padding: 80px 24px;
  background: radial-gradient(ellipse at 50% 0%, rgba(212,175,55,0.15) 0%, transparent 60%),
              radial-gradient(ellipse at 20% 100%, rgba(139,92,246,0.08) 0%, transparent 50%),
              var(--bg-primary);
  position: relative; overflow: hidden;
}
.hero-section::before {
  content: '';
  position: absolute; inset: 0;
  background: url("data:image/svg+xml,%3Csvg width='60' height='60' viewBox='0 0 60 60' xmlns='http://www.w3.org/2000/svg'%3E%3Cg fill='none' fill-rule='evenodd'%3E%3Cg fill='%23D4AF37' fill-opacity='0.03'%3E%3Cpath d='M36 34v-4h-2v4h-4v2h4v4h2v-4h4v-2h-4zm0-30V0h-2v4h-4v2h4v4h2V6h4V4h-4zM6 34v-4H4v4H0v2h4v4h2v-4h4v-2H6zM6 4V0H4v4H0v2h4v4h2V6h4V4H6z'/%3E%3C/g%3E%3C/g%3E%3C/svg%3E");
  pointer-events: none;
}
.hero-content { max-width: 760px; position: relative; z-index: 1; }
.hero-tag {
  display: inline-flex; align-items: center; gap: 6px;
  background: var(--gold-subtle); border: 1px solid var(--gold-border);
  color: var(--gold); padding: 6px 16px; border-radius: var(--radius-full);
  font-size: 12px; font-weight: 700; letter-spacing: 0.08em; text-transform: uppercase;
  margin-bottom: 24px;
}
.hero-title {
  font-size: clamp(36px, 5vw, 64px); font-weight: 900;
  letter-spacing: -0.03em; line-height: 1.1;
  margin-bottom: 20px; color: var(--text-primary);
}
.hero-title span { color: var(--gold); }
.hero-desc { font-size: 18px; color: var(--text-secondary); max-width: 560px; margin: 0 auto 36px; line-height: 1.7; }
.hero-cta { display: flex; gap: 14px; justify-content: center; flex-wrap: wrap; }
.hero-stats {
  display: flex; justify-content: center; gap: 40px;
  margin-top: 64px; flex-wrap: wrap;
}
.hero-stat { text-align: center; }
.hero-stat-value { font-size: 28px; font-weight: 900; color: var(--gold); }
.hero-stat-label { font-size: 12px; color: var(--text-muted); text-transform: uppercase; letter-spacing: 0.06em; }

/* Public Nav */
.public-nav {
  position: fixed; top: 0; left: 0; right: 0; z-index: 100;
  height: 70px; display: flex; align-items: center;
  padding: 0 40px;
  backdrop-filter: blur(16px);
  background: rgba(10,10,11,0.8);
  border-bottom: 1px solid var(--border-subtle);
  transition: all var(--transition-slow);
}
.public-nav-logo {
  display: flex; align-items: center; gap: 10px; text-decoration: none;
  font-size: 15px; font-weight: 800; color: var(--gold);
  letter-spacing: 0.04em;
}
.public-nav-links { display: flex; gap: 28px; margin: 0 auto; }
.public-nav-links a {
  font-size: 13.5px; font-weight: 500; color: var(--text-secondary);
  text-decoration: none; transition: color var(--transition);
}
.public-nav-links a:hover { color: var(--text-primary); }
.public-nav-actions { display: flex; gap: 10px; }

/* Responsive */
@media (max-width: 1200px) {
  .lesson-layout { grid-template-columns: 1fr; }
  .lesson-sidebar { position: static; max-height: 500px; }
}
@media (max-width: 900px) {
  :root { --sidebar-width: 0px; }
  .ht-sidebar { transform: translateX(-260px); width: 260px; }
  .ht-sidebar.open { transform: translateX(0); }
  .ht-main { margin-left: 0; }
  .ht-content { padding: 20px 16px; }
  .form-row { grid-template-columns: 1fr; }
  .stats-grid { grid-template-columns: repeat(2, 1fr); }
  .course-grid { grid-template-columns: 1fr; }
}
@media (max-width: 640px) {
  .public-nav { padding: 0 16px; }
  .public-nav-links { display: none; }
  .auth-card { padding: 28px 20px; }
  .hero-title { font-size: 32px; }
  .hero-stats { gap: 20px; }
  .page-header { flex-direction: column; }
  .modal { margin: 0; border-radius: var(--radius-lg) var(--radius-lg) 0 0; }
  .modal-overlay { align-items: flex-end; padding: 0; }
}

/* Animations */
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }
@keyframes slideUp { from { opacity: 0; transform: translateY(20px); } to { opacity: 1; transform: translateY(0); } }
@keyframes slideInRight { from { opacity: 0; transform: translateX(20px); } to { opacity: 1; transform: translateX(0); } }
.animate-fade-in { animation: fadeIn 0.3s ease; }
.animate-slide-up { animation: slideUp 0.3s ease; }

/* Tabs */
.tabs { display: flex; border-bottom: 1px solid var(--border-subtle); margin-bottom: 24px; gap: 0; }
.tab {
  padding: 10px 18px; font-size: 13.5px; font-weight: 500;
  cursor: pointer; border-bottom: 2px solid transparent;
  color: var(--text-muted); transition: all var(--transition);
  margin-bottom: -1px;
}
.tab:hover { color: var(--text-primary); }
.tab.active { color: var(--gold); border-bottom-color: var(--gold); }

/* Dropdown */
.dropdown { position: relative; display: inline-block; }
.dropdown-menu {
  position: absolute; top: calc(100% + 8px); right: 0;
  background: var(--bg-elevated); border: 1px solid var(--border-default);
  border-radius: var(--radius-md); min-width: 180px;
  box-shadow: var(--shadow-md); z-index: 100;
  animation: slideUp 0.15s ease;
  overflow: hidden;
}
.dropdown-item {
  display: flex; align-items: center; gap: 10px;
  padding: 10px 14px; font-size: 13.5px;
  cursor: pointer; transition: background var(--transition);
  color: var(--text-primary);
}
.dropdown-item:hover { background: var(--bg-hover); }
.dropdown-item.danger { color: var(--accent-red); }
.dropdown-divider { height: 1px; background: var(--border-subtle); margin: 4px 0; }

/* Search */
.search-input-wrap { position: relative; }
.search-input-wrap i { position: absolute; left: 12px; top: 50%; transform: translateY(-50%); color: var(--text-muted); font-size: 14px; }
.search-input-wrap .form-input { padding-left: 36px; }

/* Pagination */
.pagination { display: flex; align-items: center; gap: 6px; justify-content: center; margin-top: 24px; }
.page-btn {
  width: 36px; height: 36px; display: flex; align-items: center; justify-content: center;
  border-radius: var(--radius-sm); border: 1px solid var(--border-default);
  background: var(--bg-elevated); color: var(--text-secondary);
  cursor: pointer; font-size: 13px; font-weight: 600;
  transition: all var(--transition);
}
.page-btn:hover { border-color: var(--gold); color: var(--gold); }
.page-btn.active { background: var(--gold); border-color: var(--gold); color: #000; }
.page-btn:disabled { opacity: 0.4; cursor: not-allowed; }

/* Toggle Switch */
.toggle-wrap { display: flex; align-items: center; gap: 10px; }
.toggle {
  position: relative; width: 44px; height: 24px;
  cursor: pointer;
}
.toggle input { display: none; }
.toggle-slider {
  position: absolute; inset: 0;
  background: var(--bg-hover); border-radius: var(--radius-full);
  transition: all var(--transition);
}
.toggle-slider::before {
  content: ''; position: absolute;
  width: 18px; height: 18px; left: 3px; top: 3px;
  background: white; border-radius: 50%;
  transition: transform var(--transition);
}
.toggle input:checked + .toggle-slider { background: var(--gold); }
.toggle input:checked + .toggle-slider::before { transform: translateX(20px); }

/* ---- DRAG & DROP MODULI E LEZIONI ---- */
.mod-drag-item.drag-over-mod {
  outline: 2px dashed var(--gold);
  outline-offset: -2px;
  background: rgba(212,175,55,.06);
}
.lesson-drag-item.drag-over-lesson {
  outline: 2px dashed var(--gold);
  outline-offset: -1px;
  background: rgba(212,175,55,.06);
}
.mod-drag-handle:hover,
.lesson-drag-handle:hover {
  color: var(--gold) !important;
}
.mod-drag-item[draggable="true"],
.lesson-drag-item[draggable="true"] {
  user-select: none;
}

/* ---- TITOLO LEZIONE CLICCABILE NELL'EDITOR ---- */
.lesson-title-link {
  color: var(--text-primary);
  transition: color .15s;
}
.lesson-title-link:hover {
  color: var(--gold);
  text-decoration: underline;
  text-underline-offset: 3px;
}

/* ---- TITOLO CORSO CLICCABILE IN LISTA ADMIN ---- */
.course-title-link {
  display: inline-block;
  color: var(--text-primary);
  text-decoration: none;
  transition: color .15s, text-decoration .15s;
}
.course-title-link:hover {
  color: var(--gold);
  text-decoration: underline;
  text-underline-offset: 3px;
}

/* ---- PULSANTE TOGGLE COLLASSA MODULO ---- */
.mod-toggle-btn {
  background: none;
  border: none;
  cursor: pointer;
  padding: 4px 6px;
  border-radius: 4px;
  color: var(--text-secondary);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  transition: background .15s, color .15s;
}
.mod-toggle-btn:hover {
  background: rgba(212,175,55,.12);
  color: var(--gold);
}
.mod-chevron {
  font-size: 12px;
  transition: transform .2s ease;
}

/* ---- PULSANTI FRECCIA RIORDINO ---- */
.reorder-arrow {
  width: 24px !important;
  height: 20px !important;
  min-width: 24px !important;
  padding: 0 !important;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 4px !important;
  transition: background .15s, color .15s;
}
.reorder-arrow:not([disabled]):hover {
  background: var(--gold) !important;
  color: #000 !important;
  border-color: var(--gold) !important;
}
.reorder-arrow:not([disabled]):hover i {
  color: #000 !important;
}

/* ---- PULSANTE SPOSTA IN ALTRO MODULO ---- */
.move-to-module-btn:hover {
  background: var(--gold) !important;
  border-color: var(--gold) !important;
  color: #000 !important;
}
.move-to-module-btn:hover i {
  color: #000 !important;
}
.move-mod-option:hover {
  border-color: var(--gold) !important;
  background: rgba(212,175,55,.06) !important;
}
