/*
Theme Name: VivaItalia
Theme URI: https://vivaitalia.it
Author: VivaItalia Team
Description: Tema custom per VivaItalia — Quiz patente e italiano per immigrati
Version: 1.3.0
License: GNU General Public License v2 or later
Text Domain: vivaitalia
*/

/* ── RESET & BASE ─────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  --green-dark:   #0F6E56;
  --green-mid:    #1D9E75;
  --green-light:  #E1F5EE;
  --blue-dark:    #185FA5;
  --blue-light:   #E6F1FB;
  --amber-dark:   #633806;
  --amber-light:  #FAEEDA;
  --red-light:    #FCEBEB;
  --red-dark:     #A32D2D;
  --gray-dark:    #2C2C2A;
  --gray-mid:     #888780;
  --gray-light:   #F1EFE8;
  --white:        #FFFFFF;
  --radius-sm:    6px;
  --radius-md:    10px;
  --radius-lg:    14px;
  --radius-xl:    20px;
  --font-main:    'Nunito', 'Segoe UI', sans-serif;
  --shadow-sm:    0 1px 3px rgba(0,0,0,0.08);
  --shadow-md:    0 4px 12px rgba(0,0,0,0.10);
  --max-width:    1100px;
  --content-width: 780px;
}

html { font-size: 16px; scroll-behavior: smooth; }

body {
  font-family: var(--font-main);
  color: var(--gray-dark);
  background: #FAFAF8;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}

img { max-width: 100%; height: auto; display: block; }
a { color: var(--green-dark); text-decoration: none; }
a:hover { text-decoration: underline; }
ul { list-style: none; }

/* ── TYPOGRAPHY ───────────────────────────────────── */
h1, h2, h3, h4, h5, h6 {
  font-weight: 700;
  line-height: 1.25;
  color: var(--gray-dark);
}
h1 { font-size: clamp(1.8rem, 4vw, 2.6rem); }
h2 { font-size: clamp(1.4rem, 3vw, 2rem); }
h3 { font-size: 1.25rem; }
h4 { font-size: 1.1rem; }
p  { margin-bottom: 1rem; color: #444441; }

/* ── LAYOUT ───────────────────────────────────────── */
.container {
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 0 20px;
}
.container--narrow {
  max-width: var(--content-width);
  margin: 0 auto;
  padding: 0 20px;
}

/* ── BUTTONS ──────────────────────────────────────── */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 10px 22px;
  border-radius: var(--radius-md);
  font-size: 0.9rem;
  font-weight: 600;
  cursor: pointer;
  border: none;
  transition: opacity 0.15s, transform 0.1s;
  text-decoration: none;
}
.btn:hover { opacity: 0.92; text-decoration: none; }
.btn:active { transform: scale(0.98); }

.btn--primary { background: var(--green-dark); color: var(--white); }
.btn--secondary { background: var(--white); color: var(--gray-dark); border: 1.5px solid #D3D1C7; }
.btn--outline { background: transparent; color: var(--green-dark); border: 1.5px solid var(--green-dark); }
.btn--lg { padding: 13px 28px; font-size: 1rem; }
.btn--sm { padding: 6px 14px; font-size: 0.8rem; }

/* ── CARDS ────────────────────────────────────────── */
.card {
  background: var(--white);
  border-radius: var(--radius-lg);
  border: 1px solid #E8E6DF;
  padding: 20px;
  transition: box-shadow 0.2s;
}
.card:hover { box-shadow: var(--shadow-md); }

/* ── BADGES / PILLS ───────────────────────────────── */
.badge {
  display: inline-block;
  padding: 3px 10px;
  border-radius: 20px;
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.3px;
}
.badge--green  { background: var(--green-light);  color: var(--green-dark); }
.badge--blue   { background: var(--blue-light);   color: var(--blue-dark); }
.badge--amber  { background: var(--amber-light);  color: var(--amber-dark); }
.badge--red    { background: var(--red-light);    color: var(--red-dark); }
.badge--gray   { background: var(--gray-light);   color: #444441; }

/* ── LANGUAGE BAR ─────────────────────────────────── */
.lang-bar {
  background: var(--green-light);
  border-bottom: 1px solid #9FE1CB;
  padding: 8px 0;
}
.lang-bar__inner {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}
.lang-bar__label {
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--green-dark);
  margin-right: 4px;
}
.lang-btn {
  padding: 4px 12px;
  border-radius: 20px;
  font-size: 0.78rem;
  font-weight: 600;
  border: 1.5px solid transparent;
  cursor: pointer;
  transition: all 0.15s;
  background: var(--white);
  color: var(--green-dark);
  border-color: #5DCAA5;
}
.lang-btn:hover,
.lang-btn.active {
  background: var(--green-dark);
  color: var(--white);
  border-color: var(--green-dark);
}

/* ── HEADER / NAV ─────────────────────────────────── */
.site-header {
  background: var(--white);
  border-bottom: 1px solid #E8E6DF;
  position: sticky;
  top: 0;
  z-index: 100;
  box-shadow: var(--shadow-sm);
}
.site-header__inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 20px;
  max-width: var(--max-width);
  margin: 0 auto;
}
.site-logo {
  font-size: 1.4rem;
  font-weight: 800;
  color: var(--green-dark);
  text-decoration: none;
  display: flex;
  align-items: center;
  gap: 8px;
}
.site-logo span { color: var(--gray-dark); font-weight: 400; font-size: 0.85rem; }
.main-nav { display: flex; align-items: center; gap: 4px; }
.main-nav a {
  padding: 7px 14px;
  border-radius: var(--radius-md);
  font-size: 0.88rem;
  font-weight: 600;
  color: #444441;
  transition: background 0.15s, color 0.15s;
  text-decoration: none;
}
.main-nav a:hover { background: var(--gray-light); color: var(--green-dark); }
.main-nav a.active { color: var(--green-dark); background: var(--green-light); }
.nav-actions { display: flex; gap: 8px; align-items: center; }

/* Hamburger menu mobile */
.menu-toggle {
  display: none;
  flex-direction: column;
  gap: 5px;
  cursor: pointer;
  padding: 6px;
  background: none;
  border: none;
}
.menu-toggle span {
  display: block;
  width: 22px;
  height: 2px;
  background: var(--gray-dark);
  border-radius: 2px;
  transition: all 0.3s;
}

/* ── HERO ─────────────────────────────────────────── */
.hero {
  padding: 60px 0 50px;
  background: var(--white);
  border-bottom: 1px solid #E8E6DF;
}
.hero__inner {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 48px;
  align-items: center;
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 0 20px;
}
.hero__badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: var(--green-light);
  color: var(--green-dark);
  padding: 4px 12px;
  border-radius: 20px;
  font-size: 0.78rem;
  font-weight: 700;
  margin-bottom: 16px;
}
.hero__title { margin-bottom: 14px; }
.hero__title em { font-style: normal; color: var(--green-dark); }
.hero__sub {
  font-size: 1.05rem;
  color: #5F5E5A;
  margin-bottom: 28px;
  line-height: 1.7;
}
.hero__btns { display: flex; gap: 10px; flex-wrap: wrap; }
.hero__stats {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}
.stat-card {
  background: var(--gray-light);
  border-radius: var(--radius-lg);
  padding: 18px;
  text-align: center;
}
.stat-card__num {
  font-size: 1.7rem;
  font-weight: 800;
  color: var(--green-dark);
  line-height: 1;
  margin-bottom: 4px;
}
.stat-card__label {
  font-size: 0.78rem;
  color: var(--gray-mid);
  font-weight: 600;
}

/* ── SECTION ──────────────────────────────────────── */
.section { padding: 52px 0; }
.section--gray { background: #FAFAF8; }
.section--white { background: var(--white); }
.section__header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 28px;
}
.section__title { font-size: 1.5rem; }
.section__link {
  font-size: 0.88rem;
  color: var(--green-dark);
  font-weight: 600;
}

/* ── LEZIONI ITALIANO ─────────────────────────────── */
.lessons-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 14px;
}
.lesson-card {
  background: var(--white);
  border-radius: var(--radius-lg);
  border: 1px solid #E8E6DF;
  padding: 16px;
  cursor: pointer;
  transition: box-shadow 0.2s, transform 0.1s;
}
.lesson-card:hover { box-shadow: var(--shadow-md); transform: translateY(-2px); }
.lesson-card__icon {
  width: 40px;
  height: 40px;
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.3rem;
  margin-bottom: 10px;
}
.lesson-card__title { font-size: 0.9rem; font-weight: 700; margin-bottom: 4px; color: var(--gray-dark); }
.lesson-card__sub { font-size: 0.75rem; color: var(--gray-mid); margin-bottom: 10px; }
.lesson-card__bar { height: 4px; background: var(--gray-light); border-radius: 2px; overflow: hidden; }
.lesson-card__fill { height: 100%; background: var(--green-mid); border-radius: 2px; transition: width 0.3s; }

/* ── LEADERBOARD ──────────────────────────────────── */
.leaderboard { display: flex; flex-direction: column; gap: 8px; }
.lb-row {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 16px;
  border-radius: var(--radius-lg);
  border: 1px solid #E8E6DF;
  background: var(--white);
  transition: box-shadow 0.15s;
}
.lb-row:hover { box-shadow: var(--shadow-sm); }
.lb-row--gold   { border-color: #EF9F27; background: #FFFBF0; }
.lb-row--silver { border-color: #B4B2A9; background: #F9F9F7; }
.lb-row--bronze { border-color: #CD7F32; background: #FDF6EE; }
.lb-row--me     { border-color: var(--green-mid); background: var(--green-light); border-style: dashed; }
.lb-rank { font-size: 0.85rem; font-weight: 800; color: var(--gray-mid); width: 24px; text-align: center; }
.lb-avatar {
  width: 36px; height: 36px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.78rem;
  font-weight: 700;
}
.lb-info { flex: 1; }
.lb-name { font-size: 0.9rem; font-weight: 700; color: var(--gray-dark); }
.lb-meta { font-size: 0.75rem; color: var(--gray-mid); }
.lb-pts { font-size: 0.9rem; font-weight: 800; color: var(--green-dark); }
.lb-medal { font-size: 1.2rem; }

/* ── BLOG GRID ────────────────────────────────────── */
.blog-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 16px; }
.post-card {
  background: var(--white);
  border-radius: var(--radius-lg);
  border: 1px solid #E8E6DF;
  overflow: hidden;
  transition: box-shadow 0.2s, transform 0.1s;
  cursor: pointer;
}
.post-card:hover { box-shadow: var(--shadow-md); transform: translateY(-2px); }
.post-card__thumb {
  height: 140px;
  background: var(--green-light);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 2.5rem;
}
.post-card__body { padding: 16px; }
.post-card__cat {
  font-size: 0.72rem;
  font-weight: 800;
  color: var(--green-dark);
  text-transform: uppercase;
  letter-spacing: 0.8px;
  margin-bottom: 8px;
}
.post-card__title {
  font-size: 0.95rem;
  font-weight: 700;
  color: var(--gray-dark);
  line-height: 1.4;
  margin-bottom: 8px;
}
.post-card__meta { font-size: 0.75rem; color: var(--gray-mid); }

/* ── FOOTER ───────────────────────────────────────── */
.site-footer {
  background: var(--gray-dark);
  color: #D3D1C7;
  padding: 40px 0 20px;
}
.footer__grid {
  display: grid;
  grid-template-columns: 2fr 1fr 1fr 1fr;
  gap: 32px;
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 0 20px;
  margin-bottom: 32px;
}
.footer__logo {
  font-size: 1.3rem;
  font-weight: 800;
  color: var(--white);
  margin-bottom: 10px;
}
.footer__desc { font-size: 0.85rem; color: #888780; line-height: 1.6; }
.footer__col-title {
  font-size: 0.82rem;
  font-weight: 800;
  color: var(--white);
  text-transform: uppercase;
  letter-spacing: 0.8px;
  margin-bottom: 12px;
}
.footer__links { display: flex; flex-direction: column; gap: 8px; }
.footer__links a { font-size: 0.85rem; color: #888780; text-decoration: none; }
.footer__links a:hover { color: var(--white); }
.footer__bottom {
  border-top: 1px solid #444441;
  padding: 16px 20px 0;
  max-width: var(--max-width);
  margin: 0 auto;
  display: flex;
  justify-content: space-between;
  font-size: 0.78rem;
  color: #5F5E5A;
  flex-wrap: wrap;
  gap: 8px;
}

/* ── FORMS ────────────────────────────────────────── */
.form-group { margin-bottom: 16px; }
.form-label { display: block; font-size: 0.85rem; font-weight: 700; margin-bottom: 6px; color: var(--gray-dark); }
.form-input {
  width: 100%;
  padding: 10px 14px;
  border-radius: var(--radius-md);
  border: 1.5px solid #D3D1C7;
  font-size: 0.9rem;
  font-family: var(--font-main);
  background: var(--white);
  color: var(--gray-dark);
  transition: border-color 0.15s;
}
.form-input:focus { outline: none; border-color: var(--green-mid); }

/* ── PROGRESS BAR ─────────────────────────────────── */
.progress { height: 8px; background: var(--gray-light); border-radius: 4px; overflow: hidden; }
.progress__fill { height: 100%; background: var(--green-mid); border-radius: 4px; transition: width 0.4s; }

/* ── ALERTS ───────────────────────────────────────── */
.alert { padding: 12px 16px; border-radius: var(--radius-md); font-size: 0.88rem; margin-bottom: 16px; }
.alert--success { background: var(--green-light); color: #085041; border-left: 4px solid var(--green-mid); }
.alert--error   { background: var(--red-light);   color: var(--red-dark); border-left: 4px solid #F09595; }
.alert--info    { background: var(--blue-light);  color: var(--blue-dark); border-left: 4px solid #85B7EB; }
.alert--warning { background: var(--amber-light); color: var(--amber-dark); border-left: 4px solid #EF9F27; }

/* ── RESPONSIVE ───────────────────────────────────── */
@media (max-width: 768px) {
  .hero__inner { grid-template-columns: 1fr; gap: 32px; }
  .hero__stats { grid-template-columns: 1fr 1fr; }
  .main-nav { display: none; }
  .main-nav.open {
    display: flex;
    flex-direction: column;
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    background: var(--white);
    padding: 12px;
    border-bottom: 1px solid #E8E6DF;
    box-shadow: var(--shadow-md);
    z-index: 99;
  }
  .menu-toggle { display: flex; }
  .quiz-card__options { grid-template-columns: 1fr 1fr; }
  .footer__grid { grid-template-columns: 1fr 1fr; }
  .blog-grid { grid-template-columns: 1fr; }
  .lessons-grid { grid-template-columns: 1fr 1fr; }
}
@media (max-width: 480px) {
  .hero__stats { grid-template-columns: 1fr 1fr; }
  .quiz-card__options { grid-template-columns: 1fr 1fr; }
  .footer__grid { grid-template-columns: 1fr; }
  .lessons-grid { grid-template-columns: 1fr; }
  .nav-actions .btn--secondary { display: none; }
}

/* ── QUIZ REDESIGN v1.3.0 ─────────────────────────── */
.quiz-wrap { max-width: 720px; margin: 0 auto; }

.quiz-tabs {
  display: flex; gap: 5px; flex-wrap: wrap; margin-bottom: 20px;
}
.quiz-tab {
  padding: 6px 14px; border-radius: 20px; font-size: 0.78rem; font-weight: 600;
  border: 1px solid #D3D1C7; background: var(--white); color: #5F5E5A;
  cursor: pointer; transition: all 0.15s;
}
.quiz-tab:hover { border-color: var(--green-mid); color: var(--green-dark); }
.quiz-tab.active { background: var(--green-dark); color: var(--white); border-color: var(--green-dark); }

.quiz-card {
  background: var(--white);
  border-radius: var(--radius-xl);
  border: 1px solid #E8E6DF;
  overflow: hidden;
  box-shadow: 0 2px 8px rgba(0,0,0,0.06);
}

/* Header verde della card */
.quiz-card__header {
  background: var(--green-dark);
  padding: 16px 20px;
}
.quiz-card__header-row {
  display: flex; align-items: center; justify-content: space-between; margin-bottom: 10px;
}
.quiz-card__cat-label {
  font-size: 0.78rem; font-weight: 600; color: rgba(255,255,255,0.85);
}
.quiz-card__num-label {
  font-size: 0.75rem; color: rgba(255,255,255,0.65);
}
.quiz-card__progress {
  height: 4px; background: rgba(255,255,255,0.25); border-radius: 2px; overflow: hidden;
}
.quiz-card__progress-fill {
  height: 100%; background: white; border-radius: 2px; transition: width 0.4s ease;
}

/* Body */
.quiz-card__body { padding: 24px 20px; }

/* Immagine segnale */
.quiz-card__img-wrap {
  text-align: center; margin-bottom: 18px;
  background: var(--gray-light); border-radius: var(--radius-md);
  padding: 16px; border: 1px solid #E8E6DF;
}
.quiz-card__img-wrap img {
  max-width: 100%; max-height: 200px; object-fit: contain; margin: 0 auto;
}
.quiz-card__img-placeholder {
  height: 100px; display: flex; align-items: center;
  justify-content: center; flex-direction: column; gap: 8px;
}
.quiz-card__img-icon {
  width: 44px; height: 44px; border-radius: 50%;
  background: var(--green-light); display: flex; align-items: center; justify-content: center;
}
.quiz-card__img-label {
  font-size: 0.75rem; color: var(--gray-mid); font-weight: 600;
}

.quiz-card__chapter {
  font-size: 0.72rem; font-weight: 700; color: var(--green-dark);
  text-transform: uppercase; letter-spacing: 0.6px; margin-bottom: 10px;
}
.quiz-card__question {
  font-size: 1.05rem; font-weight: 600; color: var(--gray-dark);
  line-height: 1.6; margin-bottom: 22px;
}

/* Pulsanti VERO/FALSO */
.quiz-card__options { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-bottom: 14px; }
.quiz-option {
  padding: 16px 12px; border-radius: var(--radius-lg);
  border: 1.5px solid #D3D1C7; font-size: 0.95rem; font-weight: 700;
  cursor: pointer; background: var(--white); color: var(--gray-dark);
  text-align: center; transition: all 0.15s;
  display: flex; align-items: center; justify-content: center; gap: 8px;
}
.quiz-option .opt-badge {
  width: 22px; height: 22px; border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-size: 0.7rem; font-weight: 800; flex-shrink: 0;
}
.quiz-option .opt-badge.v { background: var(--green-mid); color: white; }
.quiz-option .opt-badge.f { background: #E24B4A; color: white; }
.quiz-option:hover:not(:disabled) { border-color: var(--green-mid); background: var(--green-light); color: #085041; }
.quiz-option.correct { background: var(--green-light); border-color: var(--green-mid); color: #085041; }
.quiz-option.wrong   { background: var(--red-light);   border-color: #F09595;           color: var(--red-dark); }
.quiz-option:disabled { cursor: default; }

/* Feedback */
.quiz-feedback {
  border-radius: var(--radius-md); padding: 12px 14px;
  font-size: 0.88rem; line-height: 1.6; display: none;
  border-left: 3px solid; margin-bottom: 4px;
}
.quiz-feedback.show  { display: block; }
.quiz-feedback.correct { background: var(--green-light); border-color: var(--green-mid); color: #085041; }
.quiz-feedback.wrong   { background: var(--red-light);   border-color: #F09595;          color: var(--red-dark); }

/* Footer */
.quiz-card__footer {
  padding: 12px 20px; border-top: 1px solid #F1EFE8;
  display: flex; align-items: center; justify-content: space-between;
  background: var(--gray-light);
}
.quiz-score { display: flex; gap: 16px; }
.quiz-score__item { display: flex; align-items: center; gap: 5px; font-size: 0.82rem; }
.quiz-score__dot { width: 8px; height: 8px; border-radius: 50%; }
.quiz-score__num { font-weight: 700; color: var(--gray-dark); }

/* Risultato finale */
.quiz-result {
  background: var(--white); border-radius: var(--radius-xl);
  border: 1px solid #E8E6DF; padding: 36px 28px; text-align: center;
  box-shadow: 0 2px 8px rgba(0,0,0,0.06);
}
.quiz-result__emoji { font-size: 3rem; margin-bottom: 12px; line-height: 1; }
.quiz-result__title { font-size: 1.4rem; font-weight: 700; margin-bottom: 6px; }
.quiz-result__sub { font-size: 0.9rem; color: #5F5E5A; margin-bottom: 20px; }
.quiz-result__bar-wrap { max-width: 300px; margin: 0 auto 6px; }
.quiz-result__bar-nums { display: flex; justify-content: space-between; font-size: 0.78rem; margin-bottom: 6px; }
.quiz-result__bar { height: 10px; background: var(--gray-light); border-radius: 5px; overflow: hidden; }
.quiz-result__bar-fill { height: 100%; background: var(--green-mid); border-radius: 5px; transition: width 0.5s; }
.quiz-result__pct { font-size: 1.8rem; font-weight: 800; color: var(--green-dark); margin-top: 6px; }
.quiz-result__esame {
  display: inline-block; padding: 8px 20px; border-radius: var(--radius-md);
  font-size: 0.88rem; font-weight: 700; margin: 14px 0;
}
