/* ============================================
   CityFriend LMS — Design System
   ============================================ */

/* --- CSS Variables (Theming) --- */
:root {
    /* Colori brand */
    --color-primary: #0063ae;
    --color-primary-dark: #004d8a;
    --color-primary-light: #e8f1fa;
    --color-accent: #FF7100;
    --color-accent-dark: #e06500;
    --color-accent-light: #fff3e8;

    /* Colori testo */
    --color-text: #212934;
    --color-text-light: #717171;
    --color-text-white: #ffffff;

    /* Colori sfondo */
    --color-bg: #ffffff;
    --color-bg-light: #f9f9fb;
    --color-bg-dark: #212934;

    /* Colori stato */
    --color-success: #22c55e;
    --color-success-light: #f0fdf4;
    --color-warning: #f59e0b;
    --color-warning-light: #fffbeb;
    --color-error: #e64a5d;
    --color-error-light: #fdf2f4;
    --color-info: #0063ae;
    --color-info-light: #e8f1fa;

    /* Bordi */
    --color-border: #e5e7eb;
    --color-border-light: #f3f4f6;

    /* Ombre */
    --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.05);
    --shadow-md: 0 4px 6px rgba(0, 0, 0, 0.07);
    --shadow-lg: 0 10px 25px rgba(0, 0, 0, 0.1);
    --shadow-card: 0 2px 8px rgba(0, 0, 0, 0.08);

    /* Bordi arrotondati */
    --radius-sm: 4px;
    --radius-md: 8px;
    --radius-lg: 12px;
    --radius-xl: 16px;
    --radius-full: 9999px;

    /* Spaziature */
    --space-xs: 4px;
    --space-sm: 8px;
    --space-md: 16px;
    --space-lg: 24px;
    --space-xl: 32px;
    --space-2xl: 48px;
    --space-3xl: 64px;

    /* Tipografia */
    --font-family: 'Poppins', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    --font-size-xs: 0.75rem;
    --font-size-sm: 0.875rem;
    --font-size-base: 1rem;
    --font-size-lg: 1.125rem;
    --font-size-xl: 1.25rem;
    --font-size-2xl: 1.5rem;
    --font-size-3xl: 2rem;
    --font-size-4xl: 2.5rem;
    --font-weight-regular: 400;
    --font-weight-medium: 500;
    --font-weight-semibold: 600;
    --font-weight-bold: 700;
    --line-height-tight: 1.25;
    --line-height-normal: 1.5;
    --line-height-relaxed: 1.75;

    /* Layout */
    --container-max: 1200px;
    --sidebar-width: 280px;
    --header-height: 70px;

    /* Transizioni */
    --transition-fast: 150ms ease;
    --transition-normal: 250ms ease;
    --transition-slow: 350ms ease;
}

/* --- Reset & Base --- */
*,
*::before,
*::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

html {
    font-size: 16px;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    scroll-behavior: smooth;
}

body {
    font-family: var(--font-family);
    font-size: var(--font-size-base);
    font-weight: var(--font-weight-regular);
    line-height: var(--line-height-normal);
    color: var(--color-text);
    background-color: var(--color-bg);
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

/* --- Tipografia --- */
h1, h2, h3, h4, h5, h6 {
    font-weight: var(--font-weight-semibold);
    line-height: var(--line-height-tight);
    color: var(--color-text);
}

h1 { font-size: var(--font-size-4xl); }
h2 { font-size: var(--font-size-3xl); }
h3 { font-size: var(--font-size-2xl); }
h4 { font-size: var(--font-size-xl); }
h5 { font-size: var(--font-size-lg); }
h6 { font-size: var(--font-size-base); }

p {
    margin-bottom: var(--space-md);
    color: var(--color-text);
}

a {
    color: var(--color-primary);
    text-decoration: none;
    transition: color var(--transition-fast);
}

a:hover {
    color: var(--color-primary-dark);
}

a:focus-visible {
    outline: 2px solid var(--color-primary);
    outline-offset: 2px;
    border-radius: var(--radius-sm);
}

img {
    max-width: 100%;
    height: auto;
    display: block;
}

/* --- Container --- */
.container {
    width: 100%;
    max-width: var(--container-max);
    margin: 0 auto;
    padding: 0 var(--space-lg);
}

/* --- Header --- */
.header {
    background: var(--color-bg);
    border-bottom: 1px solid var(--color-border);
    height: var(--header-height);
    position: sticky;
    top: 0;
    z-index: 100;
}

.header .container {
    display: flex;
    align-items: center;
    justify-content: space-between;
    height: 100%;
}

.header__logo img {
    height: 40px;
    width: auto;
}

.header__nav {
    display: flex;
    align-items: center;
    gap: var(--space-lg);
}

.header__nav a {
    color: var(--color-text);
    font-weight: var(--font-weight-medium);
    font-size: var(--font-size-sm);
    padding: var(--space-sm) 0;
    border-bottom: 2px solid transparent;
    transition: all var(--transition-fast);
}

.header__nav a:hover,
.header__nav a.active {
    color: var(--color-primary);
    border-bottom-color: var(--color-primary);
}

.header__actions {
    display: flex;
    align-items: center;
    gap: var(--space-md);
}

/* Mobile menu toggle */
.header__menu-toggle {
    display: none;
    background: none;
    border: none;
    cursor: pointer;
    padding: var(--space-sm);
}

/* --- Notif Bell --- */
.notif-bell {
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
    border-radius: 50%;
    color: var(--color-text);
    text-decoration: none;
    transition: background var(--transition-fast);
}
.notif-bell:hover {
    background: var(--color-bg-light);
}
.notif-bell__badge {
    position: absolute;
    top: 2px;
    right: 2px;
    min-width: 16px;
    height: 16px;
    background: var(--color-error);
    color: #fff;
    border-radius: 8px;
    font-size: 10px;
    font-weight: 700;
    line-height: 16px;
    text-align: center;
    padding: 0 4px;
}

/* --- User Menu (avatar dropdown) --- */
.user-menu {
    position: relative;
}

.user-menu__trigger {
    display: flex;
    align-items: center;
    gap: var(--space-sm);
    background: none;
    border: 1px solid var(--color-border);
    border-radius: var(--radius-full);
    padding: 4px 12px 4px 4px;
    cursor: pointer;
    transition: background var(--transition-fast), box-shadow var(--transition-fast);
    color: var(--color-text);
    font-family: var(--font-family);
    font-size: var(--font-size-sm);
    font-weight: var(--font-weight-medium);
}

.user-menu__trigger:hover {
    background: var(--color-bg-light);
    box-shadow: var(--shadow-sm);
}

.user-menu__avatar {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    object-fit: cover;
    flex-shrink: 0;
}

.user-menu__avatar--lg {
    width: 44px;
    height: 44px;
}

.user-menu__initials {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: var(--color-primary);
    color: #fff;
    font-size: 12px;
    font-weight: 600;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.user-menu__initials--lg {
    width: 44px;
    height: 44px;
    font-size: 16px;
}

.user-menu__name {
    max-width: 120px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.user-menu__chevron {
    width: 14px;
    height: 14px;
    color: var(--color-text-light);
    transition: transform var(--transition-fast);
    flex-shrink: 0;
}

.user-menu__chevron.rotated {
    transform: rotate(180deg);
}

.user-menu__dropdown {
    display: none;
    position: absolute;
    top: calc(100% + 8px);
    right: 0;
    min-width: 240px;
    background: var(--color-bg);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-lg);
    z-index: 200;
    overflow: hidden;
}

.user-menu__dropdown.is-open {
    display: block;
}

.user-menu__header {
    display: flex;
    align-items: center;
    gap: var(--space-md);
    padding: var(--space-md);
}

.user-menu__fullname {
    font-weight: var(--font-weight-semibold);
    font-size: var(--font-size-sm);
    line-height: 1.3;
}

.user-menu__email {
    font-size: var(--font-size-xs);
    color: var(--color-text-light);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 160px;
}

.user-menu__divider {
    height: 1px;
    background: var(--color-border-light);
    margin: 4px 0;
}

.user-menu__item {
    display: flex;
    align-items: center;
    gap: var(--space-sm);
    padding: 10px var(--space-md);
    font-size: var(--font-size-sm);
    color: var(--color-text);
    font-weight: var(--font-weight-medium);
    text-decoration: none;
    transition: background var(--transition-fast);
    width: 100%;
    background: none;
    border: none;
    cursor: pointer;
    font-family: var(--font-family);
    text-align: left;
}

.user-menu__item:hover {
    background: var(--color-bg-light);
    color: var(--color-primary);
}

.user-menu__item--danger {
    color: var(--color-error);
}

.user-menu__item--danger:hover {
    background: var(--color-error-light);
    color: var(--color-error);
}

/* --- Dashboard studente layout --- */
.student-dashboard {
    display: grid;
    grid-template-columns: 1fr 340px;
    gap: var(--space-xl);
    align-items: start;
}

.student-dashboard__main {}

.student-dashboard__sidebar {
    display: flex;
    flex-direction: column;
    gap: var(--space-lg);
}

/* Pagine area studente — header uniforme */
.student-page {
    max-width: 800px !important;
    padding-bottom: var(--space-3xl);
}

.student-breadcrumb {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    color: var(--color-text-light);
    font-size: var(--font-size-sm);
    font-weight: var(--font-weight-medium);
    text-decoration: none;
    margin-bottom: var(--space-lg);
    transition: color var(--transition-fast);
}

.student-breadcrumb:hover {
    color: var(--color-primary);
}

.student-page-title {
    font-size: 1.8rem;
    font-weight: 800;
    color: var(--color-text);
    margin-bottom: 8px;
}

.student-page-subtitle {
    color: #717171;
    font-size: 16px;
    font-weight: 500;
    line-height: 1.6;
    margin: 0 0 var(--space-xl);
}

/* Hero benvenuto studente */
.student-hero {
    background: linear-gradient(120deg, var(--color-primary) 0%, var(--color-primary-dark) 100%);
    border-radius: var(--radius-xl);
    padding: var(--space-xl) var(--space-2xl);
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: var(--space-lg);
    margin-bottom: var(--space-xl);
    overflow: hidden;
    position: relative;
}

.student-hero::after {
    content: '';
    position: absolute;
    right: -40px;
    top: -40px;
    width: 200px;
    height: 200px;
    border-radius: 50%;
    background: rgba(255,255,255,.07);
    pointer-events: none;
}

.student-hero__greeting {
    font-size: var(--font-size-2xl);
    font-weight: var(--font-weight-bold);
    line-height: 1.2;
    margin-bottom: var(--space-xs);
}

.student-hero__sub {
    font-size: var(--font-size-sm);
    opacity: .8;
}

.student-hero__stats {
    display: flex;
    gap: var(--space-lg);
    flex-shrink: 0;
}

.student-hero__stat {
    text-align: center;
}

.student-hero__stat-value {
    font-size: var(--font-size-2xl);
    font-weight: var(--font-weight-bold);
    line-height: 1;
}

.student-hero__stat-label {
    font-size: 11px;
    opacity: .75;
    text-transform: uppercase;
    letter-spacing: .04em;
    margin-top: 2px;
}

/* Corso card (dashboard) */
.corso-card {
    display: flex;
    align-items: center;
    gap: var(--space-md);
    padding: var(--space-md);
    background: var(--color-bg);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-lg);
    text-decoration: none;
    color: var(--color-text);
    transition: box-shadow var(--transition-fast), border-color var(--transition-fast);
    margin-bottom: var(--space-sm);
}

.corso-card:hover {
    box-shadow: var(--shadow-md);
    border-color: var(--color-primary);
}

.corso-card__thumb {
    width: 72px;
    height: 72px;
    border-radius: var(--radius-md);
    object-fit: cover;
    flex-shrink: 0;
    overflow: hidden;
    background: linear-gradient(135deg, var(--color-primary-light), var(--color-primary));
    display: flex;
    align-items: center;
    justify-content: center;
}

.corso-card__body {
    flex: 1;
    min-width: 0;
}

.corso-card__title {
    font-weight: var(--font-weight-semibold);
    font-size: var(--font-size-sm);
    margin-bottom: 2px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.corso-card__edition {
    font-size: var(--font-size-xs);
    color: var(--color-text-light);
    margin-bottom: var(--space-sm);
}

.corso-card__progress {
    display: flex;
    align-items: center;
    gap: var(--space-sm);
}

.corso-card__bar {
    flex: 1;
    height: 5px;
    background: var(--color-border-light);
    border-radius: 3px;
    overflow: hidden;
}

.corso-card__bar-fill {
    height: 100%;
    background: var(--color-primary);
    border-radius: 3px;
    transition: width .4s ease;
}

.corso-card__pct {
    font-size: 11px;
    font-weight: 600;
    color: var(--color-text-light);
    flex-shrink: 0;
    width: 32px;
    text-align: right;
}

.corso-card__cta {
    flex-shrink: 0;
}

/* --- Main Content --- */
.main {
    flex: 1;
    padding: var(--space-2xl) 0;
}

.main--no-pad {
    padding: 0;
}

/* --- Footer --- */
.footer {
    background: #0063ae;
    color: #fff;
    padding: var(--space-2xl) 0 0;
    margin-top: auto;
}

.footer__grid {
    display: grid;
    grid-template-columns: 1.4fr 1fr 1fr;
    gap: var(--space-2xl);
    padding-bottom: var(--space-2xl);
}

.footer__brand img {
    height: 36px;
    margin-bottom: var(--space-md);
}

.footer__brand p {
    color: rgba(255, 255, 255, 0.85);
    font-size: 1rem;
    font-weight: 400;
    line-height: 1.7;
    margin: 0 0 var(--space-md);
}

.footer__col-title {
    font-size: var(--font-size-sm);
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: .06em;
    color: rgba(255,255,255,.6);
    margin-bottom: var(--space-md);
}

.footer__links {
    display: flex;
    flex-direction: column;
    gap: var(--space-sm);
}

.footer__links a {
    color: rgba(255, 255, 255, 0.9);
    font-size: 1rem;
    font-weight: 400;
    text-decoration: none;
    transition: color var(--transition-fast);
    display: flex;
    align-items: center;
    gap: 6px;
}

.footer__links a:hover {
    color: #fff;
}

.footer__contact-item {
    display: flex;
    align-items: center;
    gap: 8px;
    color: rgba(255,255,255,.9);
    font-size: 1rem;
    font-weight: 400;
    margin-bottom: var(--space-sm);
}

.footer__bottom {
    border-top: 1px solid rgba(255, 255, 255, 0.15);
    padding: var(--space-md) 0;
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: var(--space-sm);
    font-size: var(--font-size-xs);
    color: rgba(255, 255, 255, 0.5);
}

/* --- Buttons --- */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: var(--space-sm);
    padding: var(--space-sm) var(--space-lg);
    font-family: var(--font-family);
    font-size: var(--font-size-sm);
    font-weight: var(--font-weight-medium);
    line-height: var(--line-height-normal);
    border: 2px solid transparent;
    border-radius: var(--radius-md);
    cursor: pointer;
    transition: all var(--transition-fast);
    text-decoration: none;
    white-space: nowrap;
}

.btn:focus-visible {
    outline: 2px solid var(--color-primary);
    outline-offset: 2px;
}

.btn--primary {
    background: var(--color-primary);
    color: var(--color-text-white);
    border-color: var(--color-primary);
}

.btn--primary:hover {
    background: var(--color-primary-dark);
    border-color: var(--color-primary-dark);
    color: var(--color-text-white);
}

.btn--accent {
    background: var(--color-accent);
    color: var(--color-text-white);
    border-color: var(--color-accent);
}

.btn--accent:hover {
    background: var(--color-accent-dark);
    border-color: var(--color-accent-dark);
    color: var(--color-text-white);
}

.btn--outline {
    background: transparent;
    color: var(--color-primary);
    border-color: var(--color-primary);
}

.btn--outline:hover {
    background: var(--color-primary);
    color: var(--color-text-white);
}

.btn--ghost {
    background: transparent;
    color: var(--color-text);
    border-color: transparent;
}

.btn--ghost:hover {
    background: var(--color-bg-light);
}

.btn--lg {
    padding: var(--space-md) var(--space-xl);
    font-size: var(--font-size-base);
}

.btn--sm {
    padding: var(--space-xs) var(--space-md);
    font-size: var(--font-size-xs);
}

.btn--full {
    width: 100%;
}

.btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

/* --- Forms --- */
.form-group {
    margin-bottom: var(--space-lg);
}

.form-label {
    display: block;
    font-size: var(--font-size-sm);
    font-weight: var(--font-weight-medium);
    color: var(--color-primary);
    margin-bottom: var(--space-xs);
}

.form-input {
    width: 100%;
    padding: var(--space-sm) var(--space-md);
    font-family: var(--font-family);
    font-size: var(--font-size-base);
    color: var(--color-text);
    background: var(--color-bg);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-md);
    transition: border-color var(--transition-fast), box-shadow var(--transition-fast);
}

.form-input:focus {
    outline: none;
    border-color: var(--color-primary);
    box-shadow: 0 0 0 3px var(--color-primary-light);
}

.form-input::placeholder {
    color: var(--color-text-light);
}

.form-input--error {
    border-color: var(--color-error);
}

.form-input--error:focus {
    box-shadow: 0 0 0 3px var(--color-error-light);
}

.form-error {
    color: var(--color-error);
    font-size: var(--font-size-xs);
    margin-top: var(--space-xs);
}

.form-hint {
    color: var(--color-text-light);
    font-size: var(--font-size-xs);
    margin-top: var(--space-xs);
}

textarea.form-input {
    resize: vertical;
    min-height: 100px;
}

select.form-input {
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='%23717171' d='M6 8L1 3h10z'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right var(--space-md) center;
    padding-right: var(--space-2xl);
}

/* --- Cards --- */
.card {
    background: var(--color-bg);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-lg);
    overflow: hidden;
    transition: box-shadow var(--transition-normal), transform var(--transition-normal);
}

.card:hover {
    box-shadow: var(--shadow-card);
    transform: translateY(-2px);
}

.card__image {
    width: 100%;
    height: 200px;
    object-fit: cover;
}

.card__body {
    padding: var(--space-lg);
}

.card__title {
    font-size: var(--font-size-lg);
    font-weight: var(--font-weight-semibold);
    margin-bottom: var(--space-sm);
}

.card__text {
    color: var(--color-text-light);
    font-size: var(--font-size-sm);
    margin-top: 15px;
    margin-bottom: var(--space-md);
}

.card__footer {
    padding: var(--space-md) var(--space-lg);
    border-top: 1px solid var(--color-border-light);
    display: flex;
    align-items: center;
    justify-content: space-between;
}

/* --- Badges --- */
.badge {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 2px var(--space-sm);
    font-size: var(--font-size-xs);
    font-weight: var(--font-weight-medium);
    border-radius: var(--radius-full);
}

.badge--primary { background: var(--color-primary-light); color: var(--color-primary); }
.badge--success { background: var(--color-success-light); color: var(--color-success); }
.badge--warning { background: var(--color-warning-light); color: var(--color-warning); }
.badge--error { background: var(--color-error-light); color: var(--color-error); }
.badge--accent { background: var(--color-accent-light); color: var(--color-accent); }

/* --- Progress Bar --- */
.progress {
    width: 100%;
    height: 8px;
    background: var(--color-bg-light);
    border-radius: var(--radius-full);
    overflow: hidden;
}

.progress__bar {
    height: 100%;
    background: var(--color-primary);
    border-radius: var(--radius-full);
    transition: width var(--transition-slow);
}

.progress__bar--accent {
    background: var(--color-accent);
}

/* --- Alert / Flash Messages --- */
.alert {
    padding: var(--space-md) var(--space-lg);
    border-radius: var(--radius-md);
    font-size: var(--font-size-sm);
    margin-bottom: var(--space-lg);
    display: flex;
    align-items: flex-start;
    gap: var(--space-md);
}

.alert--success { background: var(--color-success-light); color: #166534; border-left: 4px solid var(--color-success); }
.alert--error { background: var(--color-error-light); color: #991b1b; border-left: 4px solid var(--color-error); }
.alert--warning { background: var(--color-warning-light); color: #92400e; border-left: 4px solid var(--color-warning); }
.alert--info { background: var(--color-info-light); color: var(--color-primary-dark); border-left: 4px solid var(--color-primary); }

/* --- Tables --- */
.table-wrapper {
    overflow-x: auto;
    border: 1px solid var(--color-border);
    border-radius: var(--radius-lg);
}

.table {
    width: 100%;
    border-collapse: collapse;
}

.table th,
.table td {
    padding: var(--space-md) var(--space-lg);
    text-align: left;
    font-size: var(--font-size-sm);
}

.table th {
    background: var(--color-bg-light);
    font-weight: var(--font-weight-semibold);
    color: var(--color-text);
    border-bottom: 2px solid var(--color-border);
}

.table td {
    border-bottom: 1px solid var(--color-border-light);
}

.table tbody tr:hover {
    background: var(--color-bg-light);
}

.table tbody tr:last-child td {
    border-bottom: none;
}

/* --- Auth Pages (Login, Registrazione) --- */
.auth-page {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--color-bg-light);
    padding: var(--space-lg);
}

.auth-card {
    width: 100%;
    max-width: 440px;
    background: var(--color-bg);
    border-radius: var(--radius-xl);
    box-shadow: var(--shadow-lg);
    padding: var(--space-2xl);
}

.auth-card__logo {
    text-align: center;
    margin-bottom: var(--space-xl);
}

.auth-card__logo img {
    height: 48px;
    margin: 0 auto;
}

.auth-card__title {
    text-align: center;
    font-size: var(--font-size-2xl);
    margin-bottom: var(--space-xs);
}

.auth-card__subtitle {
    text-align: center;
    color: var(--color-text-light);
    font-size: var(--font-size-sm);
    margin-bottom: var(--space-xl);
}

.auth-card__footer {
    text-align: center;
    margin-top: var(--space-lg);
    font-size: var(--font-size-sm);
    color: var(--color-text-light);
}

/* --- Alpine.js --- */
[x-cloak] { display: none !important; }

/* --- Accordion --- */
.accordion-header:hover {
    border-bottom-color: var(--color-primary);
}
.accordion-header h2 {
    transition: color var(--transition-fast);
}
.accordion-header:hover h2 {
    color: var(--color-primary);
}

/* ============================================
   Roadmap / Timeline (Admin corso)
   ============================================ */

.roadmap {
    position: relative;
    padding-left: 48px;
}

/* Linea verticale continua */
.roadmap::before {
    content: '';
    position: absolute;
    left: 17px;
    top: 20px;
    bottom: 20px;
    width: 2px;
    background: linear-gradient(to bottom, var(--color-primary-light), var(--color-border));
}

.roadmap__node {
    position: relative;
    display: flex;
    gap: var(--space-md);
    margin-bottom: var(--space-lg);
}

.roadmap__node:last-child {
    margin-bottom: 0;
}

/* Dot sulla timeline — default: sfondo bianco, icona blu, bordo 1px blu */
.roadmap__dot {
    position: absolute;
    left: -48px;
    top: 10px;
    width: 34px;
    height: 34px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    z-index: 2;
    border: 1px solid var(--color-primary);
    background: #fff;
    color: var(--color-primary);
    box-shadow: 0 2px 6px rgba(0,0,0,0.06);
}

.roadmap__dot--info {
    border-color: var(--color-primary);
    background: #fff;
    color: var(--color-primary);
}

.roadmap__dot--edition {
    border-color: var(--color-primary);
    background: #fff;
    color: var(--color-primary);
}

/* Moduli con numero: sfondo blu, numero bianco */
.roadmap__dot--module {
    border-color: var(--color-primary);
    background: var(--color-primary);
    color: #fff;
}

.roadmap__dot--empty {
    border-color: var(--color-border);
    background: #fff;
    color: var(--color-text-light);
}

.roadmap__dot--add {
    border-color: var(--color-primary);
    background: #fff;
    color: var(--color-primary);
    border-style: dashed;
    box-shadow: none;
}

/* Contenuto a destra del dot */
.roadmap__content {
    flex: 1;
    min-width: 0;
}

/* Header cliccabile */
.roadmap__header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 14px var(--space-lg);
    background: var(--color-bg);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-lg);
    cursor: pointer;
    transition: all var(--transition-fast);
    gap: var(--space-sm);
    width: 100%;
    font-family: inherit;
    font-size: var(--font-size-sm);
    font-weight: var(--font-weight-medium);
    text-align: left;
    color: inherit;
    box-shadow: var(--shadow-sm);
}

.roadmap__header strong,
.roadmap__title {
    font-weight: var(--font-weight-semibold);
    font-size: var(--font-size-base);
    color: var(--color-text);
}

.roadmap__header:hover {
    border-color: var(--color-primary);
    box-shadow: 0 2px 12px rgba(0, 99, 174, 0.1);
    background: #fafcff;
}

/* Freccia rotante */
.roadmap__arrow {
    transition: transform var(--transition-fast);
    color: var(--color-text-light);
    flex-shrink: 0;
}

.roadmap__header.is-open .roadmap__arrow {
    transform: rotate(180deg);
}

/* Dettaglio espanso */
.roadmap__detail {
    margin-top: 6px;
    padding: var(--space-lg);
    background: var(--color-bg);
    border: 1px solid var(--color-border-light);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-sm);
}

/* Sub-item (lezione, edizione nella lista) */
.roadmap__sub-item {
    padding: 10px 12px;
    border-bottom: 1px solid var(--color-border-light);
    border-left: 3px solid var(--color-primary-light);
    background: #fafcff;
    border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
    margin-bottom: 4px;
    transition: border-left-color .15s;
}

.roadmap__sub-item:last-child {
    border-bottom: none;
    margin-bottom: 0;
}

.roadmap__sub-item:hover {
    border-left-color: var(--color-primary);
}

.roadmap__lesson-num {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 18px;
    height: 18px;
    background: var(--color-border);
    color: #717171;
    border-radius: 50%;
    font-size: 10px;
    font-weight: var(--font-weight-semibold);
    flex-shrink: 0;
}

/* Pulsante azione piccolo (frecce, edit) */
.roadmap__action-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 30px;
    height: 30px;
    border: 1px solid var(--color-border);
    border-radius: var(--radius-md);
    background: var(--color-bg);
    color: var(--color-text-light);
    cursor: pointer;
    transition: all var(--transition-fast);
    padding: 0;
    font-family: inherit;
}

.roadmap__action-btn:hover {
    border-color: var(--color-primary);
    color: var(--color-primary);
    background: var(--color-primary-light);
    box-shadow: 0 1px 4px rgba(0,99,174,0.12);
}

.roadmap__action-btn--add {
    background: var(--color-primary);
    border-color: var(--color-primary);
    color: #fff;
}

.roadmap__action-btn--add:hover {
    background: #0052a3;
    border-color: #0052a3;
    color: #fff;
    box-shadow: 0 2px 6px rgba(0,99,174,0.25);
}

/* Gap xs utility */
.gap-xs { gap: 4px; }

/* --- Utility Classes --- */
.text-center { text-align: center; }
.text-right { text-align: right; }
.text-light { color: var(--color-text-light); }
.text-primary { color: var(--color-primary); }
.text-accent { color: var(--color-accent); }
.text-success { color: var(--color-success); }
.text-error { color: var(--color-error); }
.text-sm { font-size: var(--font-size-sm); }
.text-xs { font-size: var(--font-size-xs); }
.text-lg { font-size: var(--font-size-lg); }
.font-medium { font-weight: var(--font-weight-medium); }
.font-semibold { font-weight: var(--font-weight-semibold); }
.font-bold { font-weight: var(--font-weight-bold); }

.mt-sm { margin-top: var(--space-sm); }
.mt-md { margin-top: var(--space-md); }
.mt-lg { margin-top: var(--space-lg); }
.mt-xl { margin-top: var(--space-xl); }
.mb-sm { margin-bottom: var(--space-sm); }
.mb-md { margin-bottom: var(--space-md); }
.mb-lg { margin-bottom: var(--space-lg); }
.mb-xl { margin-bottom: var(--space-xl); }

.flex { display: flex; }
.flex-col { flex-direction: column; }
.items-center { align-items: center; }
.justify-between { justify-content: space-between; }
.justify-center { justify-content: center; }
.gap-sm { gap: var(--space-sm); }
.gap-md { gap: var(--space-md); }
.gap-lg { gap: var(--space-lg); }

.grid {
    display: grid;
    gap: var(--space-lg);
}

.grid--2 { grid-template-columns: repeat(2, 1fr); }
.grid--3 { grid-template-columns: repeat(3, 1fr); }
.grid--4 { grid-template-columns: repeat(4, 1fr); }

.sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border-width: 0;
}

/* ============================================
   Admin Layout — Sidebar + Content
   Ispirato a design professionale con sidebar
   scura, gruppi di navigazione, badge ruolo
   ============================================ */

.admin-body {
    display: flex;
    min-height: 100vh;
    background: #f0f2f5;
}

/* --- Sidebar --- */
.admin-sidebar {
    width: 240px;
    min-width: 240px;
    background: linear-gradient(180deg, #1a2332 0%, #212d3f 100%);
    color: var(--color-text-white);
    display: flex;
    flex-direction: column;
    position: fixed;
    top: 0;
    left: 0;
    bottom: 0;
    z-index: 100;
    overflow-y: auto;
}

/* Logo area */
.admin-sidebar__logo {
    padding: var(--space-xl) var(--space-lg) var(--space-lg);
    text-align: center;
}

.admin-sidebar__logo a {
    display: block;
    margin-bottom: var(--space-sm);
}

.admin-sidebar__logo img {
    max-width: 120px;
    height: auto;
    margin: 0 auto;
}

.admin-sidebar__badge {
    display: inline-block;
    padding: 3px 12px;
    font-size: 10px;
    font-weight: var(--font-weight-bold);
    letter-spacing: 1.5px;
    color: #fff;
    background: var(--color-primary);
    border-radius: var(--radius-sm);
    text-transform: uppercase;
    margin-top: var(--space-xs);
}

/* Group labels */
.admin-sidebar__group-label {
    padding: var(--space-lg) var(--space-lg) var(--space-sm);
    font-size: 11px;
    font-weight: var(--font-weight-semibold);
    color: rgba(255,255,255,0.35);
    text-transform: uppercase;
    letter-spacing: 1.2px;
}

/* Navigation */
.admin-sidebar__nav {
    flex: 1;
    padding: 0;
    display: flex;
    flex-direction: column;
}

.admin-sidebar__link {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px var(--space-lg);
    color: rgba(255,255,255,0.65);
    text-decoration: none;
    font-size: var(--font-size-sm);
    font-weight: var(--font-weight-medium);
    transition: all var(--transition-fast);
    border: none;
    background: none;
    cursor: pointer;
    width: 100%;
    text-align: left;
    font-family: inherit;
    border-left: 3px solid transparent;
    margin: 1px 0;
}

.admin-sidebar__link:hover {
    color: #ffffff;
    background: rgba(255,255,255,0.06);
}

.admin-sidebar__link.is-active {
    color: #ffffff;
    background: rgba(0, 99, 174, 0.25);
    border-left-color: var(--color-primary);
    border-radius: 0;
}

/* Footer / User area */
.admin-sidebar__footer {
    padding: var(--space-md) 0 var(--space-sm);
    border-top: 1px solid rgba(255,255,255,0.08);
    margin-top: auto;
}

.admin-sidebar__footer > .admin-sidebar__link {
    font-size: var(--font-size-xs);
    color: rgba(255,255,255,0.45);
    padding: 8px var(--space-lg);
}

.admin-sidebar__user {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: var(--space-md) var(--space-lg);
    margin-top: var(--space-xs);
}

.admin-sidebar__avatar {
    width: 34px;
    height: 34px;
    border-radius: 50%;
    background: var(--color-primary);
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: var(--font-size-sm);
    font-weight: var(--font-weight-bold);
    flex-shrink: 0;
}

.admin-sidebar__user-info {
    display: flex;
    flex-direction: column;
    gap: 2px;
    min-width: 0;
}

.admin-sidebar__user-name {
    font-size: var(--font-size-xs);
    font-weight: var(--font-weight-medium);
    color: rgba(255,255,255,0.8);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.admin-sidebar__role-badge {
    display: inline-block;
    padding: 1px 8px;
    font-size: 9px;
    font-weight: var(--font-weight-bold);
    letter-spacing: 0.8px;
    color: var(--color-primary);
    background: var(--color-primary-light);
    border-radius: var(--radius-sm);
    text-transform: uppercase;
    width: fit-content;
}

.admin-sidebar__role-badge--super {
    color: #c97b00;
    background: #fef3cd;
}

.admin-sidebar__logout-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 30px;
    height: 30px;
    border: none;
    border-radius: var(--radius-sm);
    background: rgba(255,255,255,0.06);
    color: rgba(255,255,255,0.4);
    cursor: pointer;
    transition: all var(--transition-fast);
    padding: 0;
    flex-shrink: 0;
}

.admin-sidebar__logout-btn:hover {
    color: var(--color-error);
    background: rgba(239,68,68,0.15);
}

/* --- Main content area --- */
.admin-main {
    flex: 1;
    margin-left: 240px;
    display: flex;
    flex-direction: column;
    min-height: 100vh;
}

/* --- Top bar --- */
.admin-topbar {
    background: var(--color-bg);
    border-bottom: 1px solid var(--color-border);
    padding: var(--space-xl) var(--space-2xl);
    display: flex;
    align-items: center;
    justify-content: space-between;
    min-height: 72px;
    position: sticky;
    top: 0;
    z-index: 50;
}

.admin-topbar__title {
    font-size: var(--font-size-xl);
    font-weight: var(--font-weight-bold);
    margin: 0;
    color: var(--color-text);
}

.admin-topbar__actions {
    display: flex;
    align-items: center;
    gap: var(--space-md);
}

/* --- Content area --- */
.admin-content {
    padding: var(--space-2xl) var(--space-2xl) var(--space-3xl);
    flex: 1;
}

/* Override card in admin */
.admin-body .card {
    transition: box-shadow var(--transition-normal);
    box-shadow: 0 1px 4px rgba(0,0,0,0.06);
    border-color: var(--color-border-light);
    border-radius: var(--radius-lg);
}
.admin-body .card:hover {
    transform: none;
    box-shadow: 0 4px 16px rgba(0,0,0,0.08);
}

.admin-body .card__body {
    padding: var(--space-xl);
}

/* Admin-specific table styling */
.admin-body .table th {
    font-size: var(--font-size-xs);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: var(--color-text-light);
    font-weight: var(--font-weight-semibold);
    padding: var(--space-md) var(--space-lg);
}

.admin-body .table td {
    padding: var(--space-md) var(--space-lg);
    vertical-align: middle;
}

.admin-body .table tbody tr {
    transition: background var(--transition-fast);
}

/* Admin table — usato nelle liste docenti, utenti, ecc */
.admin-table {
    width: 100%;
    border-collapse: collapse;
}

.admin-table th {
    font-size: 11px;
    font-weight: var(--font-weight-semibold);
    text-transform: uppercase;
    letter-spacing: 0.6px;
    color: var(--color-text-light);
    padding: var(--space-md) var(--space-lg);
    text-align: left;
    background: var(--color-bg-light);
    border-bottom: 1px solid var(--color-border-light);
}

.admin-table th:first-child { border-radius: var(--radius-lg) 0 0 0; }
.admin-table th:last-child  { border-radius: 0 var(--radius-lg) 0 0; }

.admin-table td {
    padding: 14px var(--space-lg);
    vertical-align: middle;
    border-bottom: 1px solid var(--color-border-light);
    font-size: var(--font-size-sm);
}

.admin-table tbody tr:last-child td {
    border-bottom: none;
}

.admin-table tbody tr {
    transition: background var(--transition-fast);
}

.admin-table tbody tr:hover {
    background: var(--color-bg-light);
}

/* Admin filter panel */
.admin-filter-panel {
    border: 1px solid var(--color-border-light);
    border-radius: var(--radius-lg);
    background: var(--color-bg);
    box-shadow: var(--shadow-sm);
    overflow: hidden;
}

.admin-filter-panel__toggle {
    width: 100%;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px var(--space-lg);
    background: none;
    border: none;
    cursor: pointer;
    font-family: inherit;
    font-size: var(--font-size-sm);
    font-weight: var(--font-weight-medium);
    color: var(--color-text);
    transition: background var(--transition-fast);
}

.admin-filter-panel__toggle:hover {
    background: var(--color-bg-light);
}

.admin-filter-panel__body {
    padding: var(--space-md) var(--space-lg) var(--space-lg);
    border-top: 1px solid var(--color-border-light);
}

/* Admin filter tabs (like Sito Smart) */
.admin-tabs {
    display: flex;
    gap: var(--space-sm);
    flex-wrap: wrap;
    margin-bottom: var(--space-lg);
}

.admin-tab {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 6px 16px;
    font-size: var(--font-size-sm);
    font-weight: var(--font-weight-medium);
    color: var(--color-text-light);
    background: var(--color-bg);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-full);
    text-decoration: none;
    transition: all var(--transition-fast);
    cursor: pointer;
    font-family: inherit;
}

.admin-tab:hover {
    color: var(--color-primary);
    border-color: var(--color-primary);
}

.admin-tab.is-active {
    color: #fff;
    background: var(--color-primary);
    border-color: var(--color-primary);
}

.admin-tab__count {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 20px;
    height: 20px;
    padding: 0 6px;
    font-size: 11px;
    font-weight: var(--font-weight-bold);
    border-radius: var(--radius-full);
    background: rgba(0,0,0,0.08);
    color: inherit;
}

.admin-tab.is-active .admin-tab__count {
    background: rgba(255,255,255,0.25);
}

/* Admin stat card (dashboard) */
.admin-stat-card {
    background: var(--color-bg);
    border: 1px solid var(--color-border-light);
    border-radius: var(--radius-lg);
    padding: var(--space-xl);
    box-shadow: var(--shadow-sm);
    transition: box-shadow var(--transition-normal);
    text-decoration: none;
    color: inherit;
    display: block;
}

.admin-stat-card:hover {
    box-shadow: var(--shadow-card);
    color: inherit;
}

.admin-stat-card__icon {
    width: 42px;
    height: 42px;
    border-radius: var(--radius-md);
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: var(--space-md);
}

.admin-stat-card__icon--primary {
    background: var(--color-primary-light);
    color: var(--color-primary);
}

.admin-stat-card__icon--accent {
    background: var(--color-accent-light);
    color: var(--color-accent);
}

.admin-stat-card__icon--success {
    background: var(--color-success-light);
    color: var(--color-success);
}

.admin-stat-card__value {
    font-size: 2rem;
    font-weight: var(--font-weight-semibold);
    color: var(--color-text);
    line-height: 1;
    margin-bottom: 2px;
}

.admin-stat-card__title {
    font-size: var(--font-size-sm);
    font-weight: var(--font-weight-semibold);
    color: var(--color-text-light);
    margin-bottom: 2px;
    text-transform: uppercase;
    letter-spacing: 0.04em;
}

.admin-stat-card__desc {
    font-size: var(--font-size-sm);
    color: var(--color-text-light);
    margin: 0;
}

/* Empty state */
.admin-empty-state {
    text-align: center;
    padding: var(--space-3xl) var(--space-xl);
    background: var(--color-bg);
    border-radius: var(--radius-lg);
    border: 1px solid var(--color-border-light);
}

.admin-empty-state__icon {
    color: var(--color-text-light);
    width: 48px;
    height: 48px;
    display: inline-block;
    margin-bottom: var(--space-md);
    opacity: 0.5;
}

.admin-empty-state__text {
    color: var(--color-text-light);
    font-size: var(--font-size-sm);
    margin-bottom: var(--space-lg);
}

/* --- Responsive --- */
@media (max-width: 1024px) {
    .grid--3 { grid-template-columns: repeat(2, 1fr); }
    .grid--4 { grid-template-columns: repeat(2, 1fr); }
}

@media (max-width: 768px) {
    :root {
        --font-size-4xl: 2rem;
        --font-size-3xl: 1.5rem;
        --font-size-2xl: 1.25rem;
        --header-height: 60px;
    }

    .container {
        padding: 0 var(--space-md);
    }

    .grid--2,
    .grid--3,
    .grid--4 {
        grid-template-columns: 1fr;
    }

    .header__nav {
        display: none;
    }

    .header__menu-toggle {
        display: block;
    }

    .header__nav.is-open {
        display: flex;
        flex-direction: column;
        position: absolute;
        top: var(--header-height);
        left: 0;
        right: 0;
        background: var(--color-bg);
        border-bottom: 1px solid var(--color-border);
        padding: var(--space-lg);
        box-shadow: var(--shadow-md);
    }

    .footer__grid {
        grid-template-columns: 1fr;
        gap: var(--space-lg);
    }

    .footer__bottom {
        flex-direction: column;
        text-align: center;
    }

    .auth-card {
        padding: var(--space-lg);
    }

    /* User menu mobile */
    .user-menu__name {
        display: none;
    }

    .user-menu__trigger {
        padding: 4px;
        border-radius: 50%;
    }

    .user-menu__chevron {
        display: none;
    }

    .user-menu__dropdown {
        right: -8px;
    }

    /* Dashboard studente mobile */
    .student-dashboard {
        grid-template-columns: 1fr;
    }

    .student-hero {
        padding: var(--space-lg);
        flex-direction: column;
        align-items: flex-start;
        gap: var(--space-md);
    }

    .student-hero__stats {
        gap: var(--space-xl);
    }

    .student-hero__greeting {
        font-size: var(--font-size-xl);
    }
}

@media (max-width: 480px) {
    :root {
        --font-size-4xl: 1.75rem;
        --font-size-3xl: 1.375rem;
    }

    .btn--lg {
        width: 100%;
    }
}

/* =============================================
   RESPONSIVE ADMIN / DOCENTE
   ============================================= */

/* Su schermi medi (es. iMac con finestra ridotta o 1280px) */
@media (max-width: 1280px) {
    .admin-content {
        padding: var(--space-xl) var(--space-lg) var(--space-2xl);
    }
}

/* Sidebar collassabile sotto 1024px */
@media (max-width: 1024px) {
    .admin-sidebar {
        width: 200px;
        min-width: 200px;
    }

    .admin-main {
        margin-left: 200px;
    }

    /* grid dashboard 1fr 340px → tutto su 1 colonna */
    .admin-dashboard-grid {
        grid-template-columns: 1fr !important;
    }
}

/* Mobile: sidebar nascosta, hamburger futuro */
@media (max-width: 768px) {
    .admin-sidebar {
        display: none;
    }

    .admin-main {
        margin-left: 0;
    }

    .admin-content {
        padding: var(--space-md);
    }

    .grid--4 {
        grid-template-columns: repeat(2, 1fr);
    }
}

/* Grid 2 colonne inline dashboard admin → 1 colonna sotto 900px */
@media (max-width: 900px) {
    .admin-dashboard-grid {
        grid-template-columns: 1fr !important;
    }
    .admin-tabs {
        flex-wrap: wrap;
        gap: 4px;
    }
}

/* ============================================
   HOME PAGE
   ============================================ */

/* --- Hero --- */
.home-hero {
    background: linear-gradient(135deg, var(--color-primary) 0%, #004d8a 100%);
    color: #fff;
    padding: var(--space-3xl) 0;
    overflow: hidden;
}

.home-hero__inner {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: var(--space-3xl);
    align-items: center;
}

.home-hero__eyebrow {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    background: rgba(255,255,255,.15);
    color: #fff;
    font-size: var(--font-size-xs);
    font-weight: var(--font-weight-semibold);
    letter-spacing: 0.5px;
    text-transform: uppercase;
    padding: 5px 12px;
    border-radius: var(--radius-full);
    margin-bottom: var(--space-lg);
}

.home-hero__title {
    font-size: var(--font-size-4xl);
    font-weight: var(--font-weight-bold);
    line-height: var(--line-height-tight);
    color: #fff;
    margin-bottom: var(--space-lg);
}

.home-hero__subtitle {
    font-size: var(--font-size-lg);
    line-height: var(--line-height-relaxed);
    color: rgba(255,255,255,.88);
    margin-bottom: var(--space-lg);
    max-width: 480px;
}

.home-hero__target {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: var(--space-xs);
    margin-bottom: var(--space-xl);
}

.home-hero__target-label {
    font-size: var(--font-size-xs);
    color: rgba(255,255,255,.55);
    text-transform: uppercase;
    letter-spacing: .06em;
    margin-right: var(--space-xs);
}

.home-hero__target-pill {
    display: inline-block;
    background: rgba(255,255,255,.12);
    border: 1px solid rgba(255,255,255,.25);
    color: rgba(255,255,255,.9);
    font-size: var(--font-size-xs);
    font-weight: var(--font-weight-medium);
    padding: 4px 10px;
    border-radius: var(--radius-full);
}

.home-hero__actions {
    display: flex;
    gap: var(--space-md);
    flex-wrap: wrap;
}

.home-hero__btn-ghost {
    background: rgba(255,255,255,.12);
    color: #fff;
    border-color: rgba(255,255,255,.3);
}
.home-hero__btn-ghost:hover {
    background: rgba(255,255,255,.22);
    color: #fff;
}

.home-hero__visual {
    display: flex;
    justify-content: center;
    align-items: center;
}

/* Foto singola hero */
.home-hero__photo-wrap {
    position: relative;
    width: 100%;
    height: 100%;
    display: flex;
    align-items: stretch;
}

.home-hero__photo {
    width: 100%;
    height: 100%;
    object-fit: contain;
    object-position: bottom center;
    display: block;
}

/* pill flottanti */
.home-hero__pill {
    position: absolute;
    background: #fff;
    color: var(--color-text);
    font-size: var(--font-size-xs);
    font-weight: var(--font-weight-semibold);
    padding: 6px 12px;
    border-radius: var(--radius-full);
    box-shadow: 0 4px 16px rgba(0,0,0,.22);
    display: flex;
    align-items: center;
    gap: 6px;
    white-space: nowrap;
    animation: heroFloat 3s ease-in-out infinite;
    z-index: 2;
}

.home-hero__pill i {
    color: var(--color-accent);
    flex-shrink: 0;
}

.home-hero__pill--1 {
    top: 8%;
    left: 0;
    animation-delay: 0s;
}
.home-hero__pill--2 {
    top: 28%;
    right: 0;
    animation-delay: 0.75s;
}
.home-hero__pill--3 {
    top: 52%;
    left: 0;
    animation-delay: 1.5s;
}
.home-hero__pill--4 {
    top: 72%;
    right: 0;
    animation-delay: 2.25s;
}

@keyframes heroFloat {
    0%, 100% { transform: translateY(0); }
    50%       { transform: translateY(-6px); }
}

/* Stats nella hero */
.home-hero__stats {
    display: flex;
    align-items: center;
    gap: var(--space-xl);
    margin-top: var(--space-2xl);
    padding-top: var(--space-xl);
    border-top: 1px solid rgba(255,255,255,.2);
}

.home-hero__stat {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.home-hero__stat-number {
    font-size: var(--font-size-2xl);
    font-weight: var(--font-weight-bold);
    color: #fff;
    line-height: 1;
}

.home-hero__stat-label {
    font-size: var(--font-size-xs);
    color: rgba(255,255,255,.65);
    font-weight: var(--font-weight-medium);
}

.home-hero__stat-divider {
    width: 1px;
    height: 36px;
    background: rgba(255,255,255,.25);
    flex-shrink: 0;
}

/* --- Social proof strip --- */
.home-strip {
    background: var(--color-bg-light);
    border-bottom: 1px solid var(--color-border-light);
    padding: var(--space-xl) 0;
}

.home-strip__inner {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: var(--space-3xl);
}

.home-strip__item {
    text-align: center;
}

.home-strip__number {
    display: block;
    font-size: var(--font-size-3xl);
    font-weight: var(--font-weight-bold);
    color: var(--color-primary);
    line-height: 1;
    margin-bottom: 4px;
}

.home-strip__label {
    font-size: var(--font-size-sm);
    color: var(--color-text-light);
    font-weight: var(--font-weight-medium);
}

.home-strip__divider {
    width: 1px;
    height: 40px;
    background: var(--color-border);
}

/* --- Sezioni generiche home --- */
.home-section {
    padding: var(--space-3xl) 0;
}

.home-section--alt {
    background: var(--color-bg-light);
}

.home-section__header {
    margin-bottom: var(--space-2xl);
}

.home-section__header--with-action {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: var(--space-lg);
}

.home-section__header--centered {
    text-align: center;
}

.home-section__title {
    font-size: 1.8rem;
    font-weight: 800;
    color: #0063af;
    margin-bottom: 8px;
}

.home-section__subtitle,
.home-section__header .home-section__subtitle,
.home-section__header--centered .home-section__subtitle {
    color: #717171 !important;
    font-size: 16px !important;
    font-weight: 500 !important;
    line-height: 1.6 !important;
    margin: 0 0 20px !important;
}

/* --- Feature cards (Perché CityFriend) --- */
.home-feature {
    text-align: center;
    padding: var(--space-lg);
    background: #fff;
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-sm);
    border: 1px solid var(--color-border-light);
}

.home-feature__icon {
    width: 56px;
    height: 56px;
    border-radius: var(--radius-lg);
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto var(--space-md);
}

.home-feature__icon--blue  { background: var(--color-primary-light); }
.home-feature__icon--orange { background: var(--color-accent-light); }
.home-feature__icon--green  { background: var(--color-success-light); }

.home-feature__title {
    font-size: var(--font-size-base);
    font-weight: var(--font-weight-semibold);
    margin-bottom: var(--space-sm);
}

.home-feature__text {
    font-size: var(--font-size-sm);
    color: var(--color-text-light);
    line-height: var(--line-height-relaxed);
    margin: 0;
}

/* --- Come funziona (nuovo layout blu) --- */
.home-how {
    background: linear-gradient(135deg, var(--color-primary) 0%, #004d8a 100%);
    color: #fff;
    padding: var(--space-3xl) 0;
}

.home-how__inner {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: var(--space-3xl);
    align-items: center;
}

.home-how__visual {
    display: flex;
    justify-content: center;
    align-items: center;
}

.home-how__img {
    width: 100%;
    max-width: 420px;
    height: auto;
    display: block;
}

.home-how__title {
    font-size: var(--font-size-2xl);
    font-weight: 800;
    color: #fff;
    margin-bottom: var(--space-xs);
}

.home-how__subtitle {
    font-size: 16px;
    color: rgba(255,255,255,.75);
    margin: 0 0 20px;
    line-height: var(--line-height-relaxed);
}

.home-how__steps {
    display: flex;
    flex-direction: column;
    gap: var(--space-xl);
}

.home-how__step {
    display: flex;
    align-items: flex-start;
    gap: var(--space-lg);
}

.home-how__step-num {
    flex-shrink: 0;
    width: 44px;
    height: 44px;
    border-radius: 50%;
    background: rgba(255,255,255,.15);
    border: 2px solid rgba(255,255,255,.35);
    color: #fff;
    font-size: var(--font-size-lg);
    font-weight: var(--font-weight-bold);
    display: flex;
    align-items: center;
    justify-content: center;
}

.home-how__step-title {
    font-size: var(--font-size-lg);
    font-weight: var(--font-weight-semibold);
    color: #fff;
    margin-bottom: 4px;
}

.home-how__step-text {
    font-size: var(--font-size-sm);
    color: rgba(255,255,255,.75);
    line-height: var(--line-height-relaxed);
    margin: 0;
}

/* --- Docenti grid --- */
.home-docenti-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: var(--space-xl);
}

/* Profili target (sezione "A chi è rivolto") */
.home-profilo {
    background: #fff;
    border-radius: var(--radius-lg);
    border: 1px solid var(--color-border-light);
    padding: var(--space-xl) var(--space-lg);
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    transition: box-shadow var(--transition-normal), transform var(--transition-normal);
}

.home-profilo:hover {
    box-shadow: var(--shadow-lg);
    transform: translateY(-3px);
}

.home-profilo__icon {
    width: 64px;
    height: 64px;
    border-radius: 50%;
    background: var(--color-primary-light);
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: var(--space-md);
    flex-shrink: 0;
}

.home-profilo__title {
    font-size: var(--font-size-base);
    font-weight: var(--font-weight-semibold);
    color: var(--color-text);
    margin-bottom: var(--space-sm);
}

.home-profilo__text {
    font-size: var(--font-size-sm);
    color: var(--color-text-light);
    line-height: var(--line-height-relaxed);
    margin: 0;
}

/* Docenti home — layout foto */
.home-docente {
    background: #fff;
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-card);
    border: 1px solid var(--color-border-light);
    overflow: hidden;
    display: flex;
    flex-direction: column;
}

.home-docente__foto-wrap {
    width: 100%;
    aspect-ratio: 4 / 3;
    overflow: hidden;
    background: var(--color-bg-light);
}

.home-docente__foto {
    width: 100%;
    height: 100%;
    object-fit: cover;
    object-position: top center;
    display: block;
}

.home-docente__foto--initials {
    width: 100%;
    height: 100%;
    background: linear-gradient(135deg, var(--color-primary) 0%, #004d8a 100%);
    color: #fff;
    font-size: var(--font-size-3xl);
    font-weight: var(--font-weight-bold);
    display: flex;
    align-items: center;
    justify-content: center;
}

.home-docente__info {
    padding: var(--space-md) var(--space-md);
}

.home-docente__name {
    font-size: var(--font-size-base);
    font-weight: var(--font-weight-semibold);
    margin-bottom: 2px;
    color: var(--color-text);
}

.home-docente__qualifica {
    font-size: var(--font-size-xs);
    color: #0063af;
    font-weight: 500;
    margin: 0;
    letter-spacing: 0;
}

/* --- CTA finale --- */
.home-cta {
    background: linear-gradient(135deg, var(--color-primary) 0%, #004d8a 100%);
    color: #fff;
    padding: var(--space-3xl) 0;
}

.home-cta__inner {
    text-align: center;
    max-width: 600px;
}

.home-cta__title {
    font-size: var(--font-size-3xl);
    font-weight: var(--font-weight-bold);
    color: #fff;
    margin-bottom: var(--space-md);
}

.home-cta__text {
    font-size: var(--font-size-lg);
    color: rgba(255,255,255,.88);
    margin-bottom: var(--space-xl);
    line-height: var(--line-height-relaxed);
}

/* Separazione visiva tra CTA blu e footer blu */
.home-cta {
    border-bottom: 1px solid rgba(255,255,255,0.15);
}

.home-cta__actions {
    display: flex;
    gap: var(--space-md);
    justify-content: center;
    flex-wrap: wrap;
}

/* --- Responsive home --- */
@media (max-width: 768px) {
    .home-hero__inner {
        grid-template-columns: 1fr;
        text-align: center;
    }

    .home-hero__subtitle {
        max-width: 100%;
    }

    .home-hero__actions {
        justify-content: center;
    }

    .home-hero__visual {
        display: none;
    }

    .home-hero__stats {
        justify-content: center;
        gap: var(--space-lg);
    }

    .home-how__inner {
        grid-template-columns: 1fr;
    }

    .home-how__visual {
        display: none;
    }

    .home-section__header--with-action {
        flex-direction: column;
        align-items: flex-start;
    }

    .home-docenti-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: var(--space-md);
    }
}

@media (max-width: 480px) {
    .home-strip__inner {
        flex-direction: column;
        gap: var(--space-lg);
    }

    .home-strip__divider {
        width: 40px;
        height: 1px;
    }
}


/* ============================================================
   DETTAGLIO CORSO (.cd-*)
   ============================================================ */

/* Wrapper pagina: grid unico a 2 colonne dall'inizio alla fine */
.cd-page {
    padding-top: var(--space-xl);
    padding-bottom: var(--space-3xl);
}

.cd-page__inner {
    display: grid;
    grid-template-columns: 1fr 340px;
    gap: var(--space-xl);
    align-items: start;
}

/* Colonna sx: hero dark + body white */
.cd-page__main {
    min-width: 0;
}

/* Colonna dx: sticky per tutta la pagina */
.cd-page__sidebar {
    position: sticky;
    top: 80px;
    align-self: start;
}

.cd-sticky-card {
    background: #fff;
    border-radius: var(--radius-lg);
    overflow: hidden;
    box-shadow: 0 4px 24px rgba(0,0,0,.12);
    border: 1px solid var(--color-border-light);
}

/* Hero (parte sinistra, sfondo scuro) */
.cd-hero-left {
    background: linear-gradient(135deg, #004d8a 0%, #0063ae 60%, #0077cc 100%);
    color: #fff;
    padding: var(--space-2xl) var(--space-xl);
    border-radius: var(--radius-lg);
    margin-bottom: var(--space-xl);
}

/* Body (parte sinistra, sfondo bianco) */
.cd-body-left {
    padding: 0;
}

/* Classe .cd-hero__inner non piu' usata — mantenuta per compatibilita' */
.cd-hero__inner {
    display: grid;
    grid-template-columns: 1fr 340px;
    gap: var(--space-xl);
    align-items: start;
}

.cd-hero__breadcrumb {
    font-size: var(--font-size-xs);
    color: rgba(255,255,255,.5);
    margin-bottom: var(--space-md);
}

.cd-hero__breadcrumb a {
    color: rgba(255,255,255,.5);
    text-decoration: none;
}

.cd-hero__breadcrumb a:hover {
    color: rgba(255,255,255,.8);
}

.cd-hero__title {
    font-size: var(--font-size-2xl);
    font-weight: 700;
    line-height: 1.2;
    color: #fff;
    margin-bottom: var(--space-md);
}

.cd-hero__subtitle {
    font-size: var(--font-size-base);
    color: rgba(255,255,255,.95);
    line-height: var(--line-height-relaxed);
    margin-bottom: var(--space-md);
}

.cd-hero__rating {
    margin-bottom: var(--space-md);
}

.cd-hero__rating-score {
    font-size: var(--font-size-base);
    font-weight: 700;
    color: #f59e0b;
}

.cd-hero__stars {
    font-size: 1rem;
    letter-spacing: 1px;
}

.cd-hero__rating-count {
    font-size: var(--font-size-xs);
    color: rgba(255,255,255,.75);
}

.cd-hero__meta {
    display: flex;
    flex-wrap: wrap;
    gap: var(--space-md);
    margin-bottom: var(--space-lg);
}

.cd-hero__meta-item {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    font-size: var(--font-size-xs);
    color: rgba(255,255,255,.95);
}

.cd-hero__docenti {
    display: flex;
    flex-direction: column;
    align-items: stretch;
    gap: 6px;
}

.cd-hero__docenti-label {
    font-size: 10px;
    color: rgba(255,255,255,.55);
    text-transform: uppercase;
    letter-spacing: .08em;
    font-weight: 600;
}

.cd-hero__docenti-main {
    display: flex;
    align-items: center;
    gap: 12px;
    flex-wrap: wrap;
}

.cd-hero__docente-avatar {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    object-fit: cover;
    border: 2px solid rgba(255,255,255,.3);
    flex-shrink: 0;
}

.cd-hero__docente-initials {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: var(--color-primary);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 12px;
    font-weight: 700;
    color: #fff;
    border: 2px solid rgba(255,255,255,.3);
    flex-shrink: 0;
}

.cd-hero__docente-info {
    display: flex;
    flex-direction: column;
    line-height: 1.3;
    min-width: 0;
}

.cd-hero__docente-name {
    font-size: var(--font-size-sm);
    font-weight: 700;
    color: #fff;
}

.cd-hero__docente-sub {
    font-size: 11px;
    color: rgba(255,255,255,.55);
    line-height: 1.4;
}

.cd-hero__docenti-link {
    color: rgba(255,255,255,.65);
    text-decoration: underline;
    text-decoration-color: rgba(255,255,255,.25);
    text-underline-offset: 2px;
    transition: color .15s, text-decoration-color .15s;
}

.cd-hero__docenti-link:hover {
    color: #fff;
    text-decoration-color: rgba(255,255,255,.6);
}

/* Card CTA nell'hero — sticky durante lo scroll */
.cd-hero__card {
    background: #fff;
    border-radius: var(--radius-lg);
    overflow: hidden;
    box-shadow: 0 8px 32px rgba(0,0,0,.25);
    color: var(--color-text);
    position: sticky;
    top: 16px;
    align-self: start;
}

.cd-card__cover {
    width: 100%;
    height: 180px;
    object-fit: cover;
    display: block;
}

.cd-card__cover-placeholder {
    width: 100%;
    height: 180px;
    background: linear-gradient(135deg, var(--color-primary-light), var(--color-primary));
    display: flex;
    align-items: center;
    justify-content: center;
}

.cd-card__body {
    padding: var(--space-lg);
}

/* Body grid */
.cd-body {
    display: grid;
    grid-template-columns: 1fr 340px;
    gap: var(--space-xl);
    align-items: start;
    padding-top: var(--space-2xl);
    padding-bottom: var(--space-3xl);
}

.cd-body__sidebar {
    position: sticky;
    top: var(--space-lg);
}

.cd-sidebar-card {
    background: #fff;
    border: 1px solid var(--color-border-light);
    border-radius: var(--radius-lg);
    padding: var(--space-lg);
    box-shadow: 0 2px 12px rgba(0,0,0,.06);
}

/* Sezioni contenuto */
.cd-section {
    padding-bottom: var(--space-xl);
    margin-bottom: var(--space-xl);
    border-bottom: 1px solid var(--color-border-light);
}

.cd-section:last-child {
    border-bottom: none;
}

.cd-section__title {
    font-size: var(--font-size-xl);
    font-weight: 700;
    margin-bottom: var(--space-lg);
    display: flex;
    align-items: center;
    gap: var(--space-sm);
}

/* Obiettivi griglia */
.cd-obiettivi {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: var(--space-sm);
    padding: var(--space-lg);
    background: #f0f7ff;
    border-radius: var(--radius-lg);
    border: 1px solid #d0e8ff;
}

.cd-obiettivi__item {
    display: flex;
    align-items: flex-start;
    gap: var(--space-xs);
}

/* Programma accordion */
.cd-programma {
    border: 1px solid var(--color-border-light);
    border-radius: var(--radius-lg);
    overflow: hidden;
}

.cd-programma__modulo {
    border-bottom: 1px solid var(--color-border-light);
}

.cd-programma__modulo:last-child {
    border-bottom: none;
}

.cd-programma__header {
    width: 100%;
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: var(--space-md) var(--space-lg);
    background: var(--color-bg-light);
    border: none;
    cursor: pointer;
    text-align: left;
    gap: var(--space-sm);
}

.cd-programma__header:hover {
    background: #eaeff5;
}

.cd-programma__lezioni {
    background: #fff;
}

.cd-programma__lezione {
    display: flex;
    align-items: center;
    gap: var(--space-sm);
    padding: var(--space-sm) var(--space-lg);
    border-top: 1px solid var(--color-border-light);
}

/* Docenti nel body */
.cd-docente {
    display: flex;
    align-items: center;
    gap: var(--space-md);
    padding: var(--space-md) 0;
    border-bottom: 1px solid var(--color-border-light);
}

.cd-docente:last-child {
    border-bottom: none;
}

.cd-docente__avatar {
    width: 52px;
    height: 52px;
    border-radius: 50%;
    object-fit: cover;
    flex-shrink: 0;
}

.cd-docente__avatar--initials {
    width: 52px;
    height: 52px;
    border-radius: 50%;
    background: var(--color-primary);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 16px;
    font-weight: 700;
    color: #fff;
    flex-shrink: 0;
}

/* Note pratiche */
.cd-note-pratiche {
    display: flex;
    align-items: flex-start;
    gap: var(--space-md);
    padding: var(--space-md) var(--space-lg);
    background: #fff8ed;
    border-radius: var(--radius-lg);
    border-left: 4px solid var(--color-accent);
}

/* Rating inline nel titolo sezione */
.cd-rating-inline {
    font-size: var(--font-size-base);
    font-weight: 600;
    margin-left: var(--space-sm);
}

/* Recensioni */
.cd-recensione {
    padding: var(--space-md) 0;
    border-bottom: 1px solid var(--color-border-light);
}

.cd-recensione:last-child {
    border-bottom: none;
}

.cd-recensione__header {
    display: flex;
    align-items: center;
    gap: var(--space-md);
    margin-bottom: var(--space-sm);
}

.cd-recensione__avatar-wrap {
    position: relative;
    flex-shrink: 0;
}

.cd-recensione__avatar {
    width: 44px;
    height: 44px;
    border-radius: 50%;
    object-fit: cover;
    display: block;
}

.cd-recensione__avatar--initials {
    width: 44px;
    height: 44px;
    border-radius: 50%;
    background: var(--color-primary);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 14px;
    font-weight: 600;
    color: #fff;
}

.cd-recensione__stars-badge {
    position: absolute;
    bottom: -4px;
    right: -6px;
    background: #fff;
    border-radius: 20px;
    padding: 1px 4px;
    font-size: 10px;
    color: #f59e0b;
    box-shadow: 0 1px 4px rgba(0,0,0,.15);
    line-height: 1.4;
    white-space: nowrap;
}

.cd-recensione__testo {
    line-height: 1.6;
    color: var(--color-text);
    margin: 0;
}

/* CTA stats */
.cd-cta__stats {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: var(--space-md);
    margin-bottom: var(--space-md);
}

.cd-cta__stat {
    display: flex;
    align-items: flex-start;
    gap: var(--space-xs);
}

.cd-cta__stat-value {
    font-size: var(--font-size-sm);
    font-weight: 700;
    color: var(--color-text);
    line-height: 1.2;
}

.cd-cta__stat-label {
    font-size: 10px;
    color: var(--color-text-light);
    text-transform: uppercase;
    letter-spacing: .04em;
}

/* Garanzie */
.cd-cta__garanzie {
    margin-top: var(--space-lg);
    display: flex;
    flex-direction: column;
    gap: var(--space-xs);
}

.cd-cta__garanzia {
    display: flex;
    align-items: center;
    gap: var(--space-xs);
    font-size: var(--font-size-xs);
    color: var(--color-text-light);
}

/* ─── Card edizioni (dettaglio corso, sidebar CTA) ─── */
.cd-edizioni__title {
    font-size: var(--font-size-xs);
    color: var(--color-text-light);
    text-transform: uppercase;
    letter-spacing: .04em;
    font-weight: 600;
    margin-bottom: var(--space-sm);
}

.cd-edizioni {
    display: flex;
    flex-direction: column;
    gap: var(--space-sm);
    margin-bottom: var(--space-md);
}

.cd-edizione {
    border: 1px solid var(--color-border-light);
    border-radius: var(--radius-md);
    padding: var(--space-sm) var(--space-md);
    background: var(--color-bg);
    transition: border-color .15s ease, box-shadow .15s ease;
}

.cd-edizione:hover {
    border-color: var(--color-primary);
    box-shadow: 0 2px 8px rgba(0,0,0,.04);
}

.cd-edizione__header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: var(--space-xs);
    margin-bottom: var(--space-xs);
}

.cd-edizione__titolo {
    font-size: var(--font-size-sm);
    font-weight: 700;
    color: var(--color-text);
    line-height: 1.3;
}

.cd-edizione__badge {
    font-size: 0.65rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: .04em;
    padding: 2px 8px;
    border-radius: var(--radius-sm);
    white-space: nowrap;
    flex-shrink: 0;
}

.cd-edizione__badge--soon {
    background: #fef3c7;
    color: #92400e;
}

.cd-edizione__badge--full {
    background: #fee2e2;
    color: #991b1b;
}

.cd-edizione__badge--few {
    background: #fef3c7;
    color: #92400e;
}

.cd-edizione__row {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: var(--font-size-xs);
    color: var(--color-text-light);
    line-height: 1.4;
    margin-top: 4px;
}

.cd-edizione__row i {
    color: var(--color-primary);
    flex-shrink: 0;
}

.cd-edizione__row--posti {
    color: var(--color-accent);
    font-weight: 600;
}

.cd-edizione__cta {
    margin-top: var(--space-sm);
}

/* Responsive dettaglio corso */
@media (max-width: 768px) {
    .cd-page__inner {
        grid-template-columns: 1fr;
    }

    .cd-page__sidebar {
        position: static;
        order: -1; /* CTA sopra il contenuto su mobile */
    }

    .cd-hero-left {
        border-radius: 0;
        padding: var(--space-xl) var(--space-md);
        margin-bottom: var(--space-lg);
    }

    .cd-obiettivi {
        grid-template-columns: 1fr;
    }
}
