/* ==================== INSEGNAMI WEB — Italian Learning App ==================== */
:root {
  --primary: #D4511E;
  --primary-light: #E8621E;
  --primary-dark: #B8441A;
  --accent-gold: #F59E0B;
  --accent-green: #10B981;
  --accent-blue: #3B82F6;
  --accent-purple: #6366F1;
  --bg: #121016;
  --surface: #1E1A24;
  --surface2: #252030;
  --text: #F5F0EA;
  --text-muted: #A89F96;
  --border: #352F3A;
  --card-radius: 20px;
  --radius: 16px;
  --font: 'Inter', -apple-system, sans-serif;
  --shadow: 0 4px 20px rgba(0,0,0,0.3);
}

* { margin: 0; padding: 0; box-sizing: border-box; }
body { font-family: var(--font); background: var(--bg); color: var(--text); min-height: 100vh; }
a { color: var(--primary-light); text-decoration: none; }

/* ==================== LAYOUT ==================== */
.app { display: flex; min-height: 100vh; }
.sidebar {
  width: 260px; background: var(--surface); border-right: 1px solid var(--border);
  display: flex; flex-direction: column; position: fixed; height: 100vh; overflow-y: auto; z-index: 100;
  transition: transform 0.3s ease;
}
.sidebar-header { padding: 20px; display: flex; align-items: center; justify-content: space-between; }
.logo-text {
  font-size: 22px; font-weight: 800; letter-spacing: -0.5px;
  background: linear-gradient(135deg, var(--primary), var(--accent-gold));
  -webkit-background-clip: text; -webkit-text-fill-color: transparent;
}
.sidebar-toggle { background: none; border: none; color: var(--text); font-size: 20px; cursor: pointer; display: none; }
.nav-links { list-style: none; padding: 8px 12px; flex: 1; }
.nav-item {
  display: flex; align-items: center; gap: 12px; padding: 12px 16px; margin-bottom: 4px;
  border-radius: var(--radius); cursor: pointer; transition: all 0.2s; font-size: 14px; font-weight: 500;
}
.nav-item:hover { background: rgba(212,81,30,0.1); }
.nav-item.active { background: rgba(212,81,30,0.15); color: var(--primary-light); font-weight: 600; }
.nav-icon { font-size: 18px; }
.sidebar-footer { padding: 16px 20px; border-top: 1px solid var(--border); }
.credits { font-size: 11px; color: var(--text-muted); }
.content { margin-left: 260px; flex: 1; min-height: 100vh; padding: 24px; }

/* ==================== PAGES ==================== */
.page { display: none; max-width: 900px; margin: 0 auto; }
.page.active { display: block; animation: fadeIn 0.3s ease; }
@keyframes fadeIn { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: translateY(0); } }
.page-header { margin-bottom: 24px; }
.page-header h1 { font-size: 28px; font-weight: 800; letter-spacing: -0.5px; }
.page-header .subtitle { color: var(--text-muted); margin-top: 6px; font-size: 14px; }

/* ==================== HERO ==================== */
.hero-banner {
  background: linear-gradient(135deg, var(--primary), var(--accent-gold));
  border-radius: var(--card-radius); padding: 40px 32px; margin-bottom: 28px; position: relative; overflow: hidden;
}
.hero-banner::after { content: '🇮🇹'; position: absolute; right: 24px; top: 50%; transform: translateY(-50%); font-size: 64px; opacity: 0.3; }
.hero-content h1 { font-size: 32px; font-weight: 900; color: white; margin-bottom: 8px; }
.hero-subtitle { color: rgba(255,255,255,0.85); font-size: 15px; max-width: 400px; }

/* ==================== STATS ==================== */
.stats-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 14px; margin-bottom: 28px; }
.stat-card {
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--card-radius);
  padding: 20px; display: flex; align-items: center; gap: 14px; cursor: pointer; transition: all 0.2s;
}
.stat-card:hover { border-color: var(--primary); transform: translateY(-2px); box-shadow: var(--shadow); }
.stat-icon { width: 48px; height: 48px; border-radius: 14px; display: flex; align-items: center; justify-content: center; font-size: 22px; }
.stat-icon.orange { background: rgba(212,81,30,0.15); }
.stat-icon.green { background: rgba(16,185,129,0.15); }
.stat-icon.purple { background: rgba(99,102,241,0.15); }
.stat-icon.blue { background: rgba(59,130,246,0.15); }
.stat-number { font-size: 24px; font-weight: 800; display: block; }
.stat-label { font-size: 12px; color: var(--text-muted); }

/* ==================== FEATURES ==================== */
.features-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); gap: 16px; }
.feature-card {
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--card-radius);
  padding: 24px; cursor: pointer; transition: all 0.2s;
}
.feature-card:hover { border-color: var(--primary); transform: translateY(-2px); }
.feature-icon { font-size: 32px; margin-bottom: 12px; }
.feature-card h3 { font-size: 16px; font-weight: 700; margin-bottom: 6px; }
.feature-card p { font-size: 13px; color: var(--text-muted); line-height: 1.5; }

/* ==================== CARDS ==================== */
.card {
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--card-radius);
  padding: 20px; margin-bottom: 14px; transition: all 0.2s;
}
.card:hover { border-color: var(--primary-light); }
.card-title { font-size: 16px; font-weight: 700; margin-bottom: 8px; }
.card-subtitle { font-size: 12px; color: var(--text-muted); margin-bottom: 12px; }
.tag { display: inline-block; padding: 4px 10px; border-radius: 8px; font-size: 11px; font-weight: 600; margin-right: 6px; margin-bottom: 4px; }
.tag-basico { background: rgba(16,185,129,0.15); color: #10B981; }
.tag-intermedio { background: rgba(245,158,11,0.15); color: #F59E0B; }
.tag-avanzado { background: rgba(239,68,68,0.15); color: #EF4444; }

/* ==================== VERB TABLE ==================== */
.verb-card { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 8px; align-items: center; }
.verb-inf { font-weight: 700; font-size: 16px; color: var(--primary-light); }
.verb-past { font-weight: 600; color: var(--accent-gold); }
.verb-spanish { font-size: 13px; color: var(--text-muted); }
.verb-pron { font-size: 12px; color: var(--accent-green); font-style: italic; }

/* ==================== EXERCISES ==================== */
.exercise-set { margin-bottom: 20px; }
.exercise-item { padding: 14px; border-left: 3px solid var(--primary); background: var(--surface2); border-radius: 0 var(--radius) var(--radius) 0; margin-bottom: 8px; }
.exercise-input { width: 120px; padding: 6px 10px; border: 1px solid var(--border); border-radius: 8px; background: var(--bg); color: var(--text); font-family: var(--font); }
.exercise-input:focus { border-color: var(--primary); outline: none; }
.btn-check { padding: 6px 14px; border: none; border-radius: 8px; background: var(--primary); color: white; cursor: pointer; font-weight: 600; font-size: 13px; }
.btn-check:hover { background: var(--primary-dark); }
.correct { color: var(--accent-green) !important; font-weight: 700; }
.incorrect { color: #EF4444 !important; }

/* ==================== DIALOGUE ==================== */
.dialogue-box { background: var(--surface2); border-radius: var(--radius); padding: 16px; margin: 12px 0; white-space: pre-line; line-height: 1.8; font-size: 14px; }

/* ==================== APK ==================== */
.apk-section { text-align: center; padding: 40px 0; }
.apk-card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--card-radius); padding: 40px; max-width: 500px; margin: 0 auto; }
.apk-icon { font-size: 64px; margin-bottom: 16px; }
.apk-card h2 { font-size: 24px; margin-bottom: 12px; }
.apk-card p { color: var(--text-muted); margin-bottom: 24px; line-height: 1.6; }
.btn-primary {
  display: inline-block; padding: 14px 32px; background: linear-gradient(135deg, var(--primary), var(--accent-gold));
  color: white; border-radius: var(--radius); font-weight: 700; font-size: 15px; transition: all 0.2s;
}
.btn-primary:hover { transform: translateY(-2px); box-shadow: 0 8px 24px rgba(212,81,30,0.3); }

/* ==================== TTS BUTTON ==================== */
.tts-btn {
  background: none; border: none; cursor: pointer; font-size: 18px; padding: 4px; border-radius: 50%;
  transition: all 0.2s; display: inline-flex; align-items: center;
}
.tts-btn:hover { background: rgba(212,81,30,0.15); transform: scale(1.1); }

/* ==================== GAME ==================== */
.game-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); gap: 14px; }
.game-card {
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--card-radius);
  padding: 24px; cursor: pointer; transition: all 0.2s; text-align: center;
}
.game-card:hover { border-color: var(--primary); transform: translateY(-3px); box-shadow: var(--shadow); }
.game-card .game-emoji { font-size: 40px; margin-bottom: 10px; }
.game-card h3 { font-size: 15px; margin-bottom: 6px; }
.game-card p { font-size: 12px; color: var(--text-muted); }

/* ==================== RESPONSIVE ==================== */
@media (max-width: 768px) {
  .sidebar { transform: translateX(-100%); width: 280px; }
  .sidebar.open { transform: translateX(0); }
  .sidebar-toggle { display: block; }
  .content { margin-left: 0; padding: 16px; }
  .hero-content h1 { font-size: 24px; }
  .stats-grid { grid-template-columns: repeat(2, 1fr); }
  .features-grid { grid-template-columns: 1fr; }
  .verb-card { grid-template-columns: 1fr; gap: 4px; }
}

/* Mobile header */
.mobile-header {
  display: none; position: fixed; top: 0; left: 0; right: 0; height: 56px; background: var(--surface);
  border-bottom: 1px solid var(--border); z-index: 99; align-items: center; padding: 0 16px;
}
.mobile-header .logo-text { font-size: 18px; }
@media (max-width: 768px) {
  .mobile-header { display: flex; justify-content: space-between; }
  .content { padding-top: 72px; }
}

/* Overlay for mobile sidebar */
.sidebar-overlay { display: none; position: fixed; inset: 0; background: rgba(0,0,0,0.5); z-index: 99; }
.sidebar-overlay.active { display: block; }
