/* ============================================================================
   site.css - account.camping.it
   Layout condiviso (topbar + sidebar + main + footer).
   Palette CAMPING.IT (prototipo.html, palette concordata 2026-04-20).
   WCAG 2.2 AA: focus visibile, target size >= 24x24, contrasti >= 4.5:1 testo.
   ============================================================================ */

:root {
    --sidebar-w: 230px;
    --topbar-h: 52px;

    /* Palette brand camping.it.
       Nota: il prototipo usava --bg-sidebar #35a6d9, ma il bianco su quello sfondo
       ha contrasto ~2.8:1 (fallisce WCAG 1.4.3 AA per testo piccolo).
       Abbiamo scurito a #1d7aa6 (contrasto ~5.2:1) mantenendo la famiglia brand. */
    --bg-topbar: #005e74;           /* teal scuro brand */
    --bg-sidebar: #1d7aa6;          /* azzurro brand scurito per AA */
    --bg-sidebar-hover: #155d80;
    --bg-sidebar-active: #0e3f5a;
    --fg-sidebar: #ffffff;
    --fg-sidebar-muted: #ffffff;

    --accent: #1d7aa6;              /* blu scuro -> bottoni / link / H1 */
    --accent-hover: #155d80;
    --accent-orange: #f5a623;       /* logo CAMPING.IT */
    --accent-green: #6aa84f;        /* verde check-marks legacy */

    --color-text: #1e293b;
    --color-text-muted: #475569;
    --color-bg: #f1f5f9;
    --color-surface: #ffffff;
    --color-border: #e2e8f0;

    --color-focus: #0077cc;
    --color-danger: #b91c1c;
    --color-success: #15803d;
}

html {
    scroll-padding-top: calc(var(--topbar-h) + 12px);
}

body {
    margin: 0;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    background: var(--color-bg);
    color: var(--color-text);
    min-height: 100vh;
}

h1, h2, h3 {
    color: var(--accent);
}

a {
    color: var(--accent);
}

a:hover {
    color: var(--accent-hover);
}

/* ============================================================================
   Focus visibile (WCAG 2.4.7 / 2.4.11)
   ============================================================================ */
:focus-visible {
    outline: 3px solid var(--color-focus);
    outline-offset: 2px;
    border-radius: 4px;
}

/* ============================================================================
   Skip links
   ============================================================================ */
.skip-link {
    position: absolute;
    top: -100px;
    left: 8px;
    background: #000;
    color: #fff;
    padding: 10px 14px;
    border-radius: 4px;
    z-index: 2000;
    text-decoration: none;
    font-weight: 600;
    transition: top 0.15s ease;
}
.skip-link:focus {
    top: 8px;
    color: #fff;
}
.skip-link-second:focus {
    top: 8px;
    left: calc(var(--sidebar-w) + 8px);
}

/* ============================================================================
   Banner guest OTL (sticky sotto la topbar su tutte le pagine)
   ============================================================================ */
.guest-banner {
    position: sticky;
    top: 0;
    z-index: 1030;
    border-radius: 0;
    border-left: 0;
    border-right: 0;
    border-top: 0;
    margin-left: calc(-1 * var(--content-pad, 1rem));
    margin-right: calc(-1 * var(--content-pad, 1rem));
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.08);
}

/* ============================================================================
   Topbar
   ============================================================================ */
.topbar {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    height: var(--topbar-h);
    background: var(--bg-topbar);
    color: #fff;
    display: flex;
    align-items: center;
    padding: 0;
    z-index: 1040;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.12);
}

.brand {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    height: 100%;
    padding: 0 0.75rem;
    width: var(--sidebar-w);
    font-weight: 700;
    color: #fff;
    text-decoration: none;
    background: var(--bg-topbar);
}
.brand:hover,
.brand:focus {
    color: #fff;
}
.brand .brand-logo {
    display: block;
    height: 32px;
    width: auto;
    max-width: 100%;
    object-fit: contain;
}

.breadcrumb-top {
    color: rgba(255, 255, 255, 0.95);
    font-size: 0.78rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    padding: 0 1rem;
    flex: 1;
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.breadcrumb-top .breadcrumb {
    margin: 0;
    padding: 0;
    background: transparent;
}
.breadcrumb-top a {
    color: #fff;
    opacity: 0.85;
    text-decoration: none;
}
.breadcrumb-top a:hover {
    opacity: 1;
    text-decoration: underline;
}

.topbar-spacer {
    flex: 0 1 auto;
}

.topbar-actions {
    display: flex;
    align-items: center;
    gap: 0.25rem;
    padding-right: 0.5rem;
}

.btn-icon {
    border: none;
    background: transparent;
    color: #fff;
    padding: 0.5rem 0.6rem;
    border-radius: 4px;
    cursor: pointer;
    min-width: 40px;
    min-height: 40px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.35rem;
    font-size: 0.95rem;
}
.btn-icon:hover,
.btn-icon:focus {
    background: rgba(255, 255, 255, 0.14);
    color: #fff;
}

.btn-accent-outline {
    color: #fff;
    border: 1px solid rgba(255, 255, 255, 0.5);
    background: transparent;
}
.btn-accent-outline:hover,
.btn-accent-outline:focus {
    background: rgba(255, 255, 255, 0.14);
    color: #fff;
    border-color: #fff;
}

.user-info {
    display: inline-flex;
    align-items: center;
    gap: 0.6rem;
    padding: 0.25rem 0.6rem;
    border-radius: 6px;
    border: 1px solid rgba(255, 255, 255, 0.3);
    background: transparent;
    color: #fff;
    cursor: pointer;
    min-height: 40px;
}
.user-info:hover,
.user-info:focus {
    background: rgba(255, 255, 255, 0.14);
    border-color: rgba(255, 255, 255, 0.6);
}

.avatar {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 30px;
    height: 30px;
    border-radius: 50%;
    background: var(--accent-orange);
    color: #7a3f00;
    font-weight: 700;
    font-size: 0.8rem;
    flex-shrink: 0;
}

.user-name {
    font-size: 0.82rem;
    font-weight: 600;
    line-height: 1;
}

.role-badge {
    display: inline-block;
    font-size: 0.68rem;
    padding: 2px 8px;
    border-radius: 10px;
    font-weight: 700;
    line-height: 1.2;
    margin-top: 2px;
}
.role-admin {
    background: #fee2e2;
    color: #991b1b;
}
.role-user {
    background: #dcfce7;
    color: #166534;
}
.role-guest {
    background: #fef3c7;
    color: #92400e;
}

.user-dropdown {
    min-width: 240px;
}
.user-dropdown .dropdown-header {
    word-break: break-all;
    white-space: normal;
    font-weight: 600;
    color: var(--color-text-muted);
}

.dropdown-item {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    width: 100%;
    padding: 0.5rem 1rem;
    min-height: 40px;
}
.dropdown-item .bi {
    width: 18px;
    text-align: center;
    color: var(--color-text-muted);
}
.dropdown-item.text-danger .bi {
    color: var(--color-danger);
}

/* ============================================================================
   Mobile toggle + overlay
   ============================================================================ */
.mobile-menu-toggle {
    display: none;
    background: transparent;
    border: 1px solid rgba(255, 255, 255, 0.35);
    color: #fff;
    width: 40px;
    height: 40px;
    margin: 0 0.4rem 0 0.5rem;
    border-radius: 4px;
    cursor: pointer;
    align-items: center;
    justify-content: center;
}
.mobile-menu-toggle:hover,
.mobile-menu-toggle:focus {
    background: rgba(255, 255, 255, 0.14);
}
.hamburger-icon {
    position: relative;
    width: 20px;
    height: 16px;
    display: inline-flex;
    flex-direction: column;
    justify-content: space-between;
}
.hamburger-icon span {
    display: block;
    height: 2px;
    width: 100%;
    background: #fff;
    border-radius: 2px;
}

.mobile-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.45);
    z-index: 1025;
}
.mobile-overlay[hidden] {
    display: none;
}

/* ============================================================================
   Sidebar
   ============================================================================ */
.sidebar {
    position: fixed;
    top: var(--topbar-h);
    bottom: 0;
    left: 0;
    width: var(--sidebar-w);
    background: var(--bg-sidebar);
    color: var(--fg-sidebar);
    overflow-y: auto;
    z-index: 1030;
    transition: transform 0.25s ease;
    padding: 0.5rem 0;
}

.sidebar-nav .nav-list {
    list-style: none;
    margin: 0;
    padding: 0;
}

.sidebar-nav .nav-section {
    font-size: 0.68rem;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    color: var(--fg-sidebar-muted);
    padding: 0.85rem 0.9rem 0.3rem;
    font-weight: 700;
}

.sidebar-nav .nav-separator {
    border-top: 1px solid rgba(255, 255, 255, 0.28);
    margin: 0.5rem 0.6rem;
    list-style: none;
    height: 0;
}

.sidebar-nav .nav-link {
    display: flex;
    align-items: center;
    gap: 0.65rem;
    color: var(--fg-sidebar);
    padding: 0.6rem 1rem;
    font-size: 0.8rem;
    font-weight: 700;
    text-decoration: none;
    text-transform: uppercase;
    letter-spacing: 0.03em;
    border-left: 3px solid transparent;
    min-height: 40px;
}
.sidebar-nav .nav-link:hover {
    background: var(--bg-sidebar-hover);
    color: #fff;
}
.sidebar-nav .nav-link.active {
    background: var(--bg-sidebar-active);
    color: #fff;
    border-left-color: var(--accent-orange);
}
.sidebar-nav .nav-icon {
    width: 18px;
    text-align: center;
    flex-shrink: 0;
    font-size: 1rem;
}

/* Voci con sottomenu collapsible (Bootstrap collapse). Il pulsante root usa
   gli stessi stili .nav-link ma e' un <button> per evitare navigazione; il
   caret a destra ruota in base a aria-expanded. */
.sidebar-nav .nav-group-toggle {
    width: 100%;
    background: transparent;
    border: none;
    border-left: 3px solid transparent;
    cursor: pointer;
    text-align: left;
}
.sidebar-nav .nav-group-toggle .nav-caret {
    margin-left: auto;
    transition: transform 0.2s ease;
}
.sidebar-nav .nav-group-toggle[aria-expanded="true"] .nav-caret {
    transform: rotate(180deg);
}
.sidebar-nav .nav-sublist {
    list-style: none;
    margin: 0;
    padding: 0;
    background: rgba(0, 0, 0, 0.12);
}
.sidebar-nav .nav-sublink {
    padding-left: 2.5rem;
    font-size: 0.75rem;
    text-transform: none;
    letter-spacing: 0;
    font-weight: 600;
    min-height: 36px;
}

/* Sotto-livelli annidati: la indentazione aumenta di 1rem ad ogni profondita'.
   Il partial _MenuVoice imposta data-depth=N sui <li>; selezioniamo via
   selettore figlio diretto cosi' gli stili non si sommano tra sub-sub-menu. */
.sidebar-nav .nav-sublist-nested .nav-sublink {
    padding-left: 3.75rem;
    font-size: 0.72rem;
}
.sidebar-nav .nav-sublist-nested .nav-group-toggle {
    padding-left: 2.5rem;
}
/* Livello 3 (sotto-sottomenu): indentazione + sfondo leggermente piu' scuro
   per dare profondita' visiva. Le voci marcate data-depth="2" sono foglie
   sotto un gruppo nidificato. */
.sidebar-nav .nav-sublist-nested {
    background: rgba(0, 0, 0, 0.18);
}
/* Voci foglia a livello 2 (figli di un gruppo annidato): indentate di
   1.5rem in piu' rispetto al livello 1. I gruppi-toggle a livello 1
   restano allineati alle altre voci foglia dello stesso livello. */
.sidebar-nav .nav-item[data-depth="2"] .nav-sublink {
    padding-left: 4rem;
    font-size: 0.72rem;
}

/* ============================================================================
   Main content + footer
   ============================================================================ */
.main-content {
    margin-left: var(--sidebar-w);
    margin-top: var(--topbar-h);
    padding: 1.5rem 2rem 0;
    min-height: calc(100vh - var(--topbar-h));
    display: flex;
    flex-direction: column;
}
.main-content:focus {
    outline: none;
}

.main-content > *:not(.app-footer) {
    flex: 0 0 auto;
}

.main-content > .content-flex {
    flex: 1 0 auto;
}

.app-footer {
    margin-top: auto;
    padding: 1.25rem 0 1rem;
    border-top: 1px solid var(--color-border);
    font-size: 0.82rem;
    color: var(--color-text-muted);
}
.footer-inner {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    flex-wrap: wrap;
}
.footer-copy {
    margin: 0;
}
.footer-links {
    list-style: none;
    margin: 0;
    padding: 0;
    display: flex;
    gap: 1rem;
    flex-wrap: wrap;
}
.footer-links a {
    color: var(--color-text-muted);
    text-decoration: none;
    padding: 6px 4px;
    display: inline-block;
    min-height: 24px;
}
.footer-links a:hover,
.footer-links a:focus {
    color: var(--accent);
    text-decoration: underline;
}

/* ============================================================================
   Utility classi di pagina condivise
   ============================================================================ */
.page-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.75rem;
    flex-wrap: wrap;
    margin-bottom: 1rem;
}
.page-header h1 {
    font-size: 1.35rem;
    margin: 0;
    text-transform: uppercase;
    letter-spacing: 0.03em;
    font-weight: 700;
    color: var(--accent);
    display: flex;
    align-items: center;
    gap: 0.5rem;
}
.page-header h1 .bi {
    color: var(--accent);
}

.card-plain {
    background: var(--color-surface);
    border: 1px solid var(--color-border);
    border-radius: 10px;
    padding: 1.25rem;
}

.benefit-list {
    list-style: none;
    padding: 0;
    margin: 1rem 0 0;
}
.benefit-list li {
    display: flex;
    align-items: flex-start;
    gap: 0.6rem;
    padding: 0.45rem 0;
    color: #334155;
}
.benefit-list li .bi {
    color: var(--accent-green);
    font-size: 1.15rem;
    flex-shrink: 0;
    margin-top: 2px;
}

.btn-primary {
    --bs-btn-bg: var(--accent);
    --bs-btn-border-color: var(--accent);
    --bs-btn-hover-bg: var(--accent-hover);
    --bs-btn-hover-border-color: var(--accent-hover);
    --bs-btn-active-bg: #124f6d;
    --bs-btn-active-border-color: #124f6d;
}

.btn {
    min-height: 40px;
}

/* ============================================================================
   Landing page pubblica (utente non autenticato)
   Ispirata al legacy /http/Default.aspx: hero + sezione accesso + sezione account.
   ============================================================================ */
.landing-hero {
    background-image: radial-gradient(#e3e3e3 0.9px, #f7fafc 0.9px);
    background-size: 18px 18px;
    padding: 3rem 1.5rem 3.5rem;
    border-radius: 12px;
    border: 1px solid var(--color-border);
}
.landing-hero-inner {
    max-width: 900px;
    margin: 0 auto;
    text-align: center;
}
.landing-title {
    color: var(--accent);
    font-weight: 700;
    font-size: clamp(1.75rem, 3.5vw, 2.75rem);
    line-height: 1.2;
    letter-spacing: -0.5px;
    margin: 0 0 1rem;
}
.landing-subtitle {
    color: var(--color-text-muted);
    font-size: 1.05rem;
    line-height: 1.6;
    max-width: 700px;
    margin: 0 auto 1.75rem;
}
.landing-cta {
    display: flex;
    flex-wrap: wrap;
    gap: 0.75rem;
    justify-content: center;
}
.landing-cta-center {
    margin-top: 2rem;
}

.landing-hero-figure {
    margin: 2.5rem auto 0;
    max-width: 900px;
}
.landing-hero-image {
    width: 100%;
    height: auto;
    display: block;
    border-radius: 12px;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.12);
    border: 1px solid var(--color-border);
}

.landing-section {
    padding: 3rem 0 1rem;
    max-width: 1100px;
    margin: 0 auto;
}
.landing-section-alt {
    background: #e9f5ff;
    margin-top: 2rem;
    padding: 3rem 1.5rem;
    border-radius: 12px;
    max-width: none;
}
.landing-section-title {
    color: var(--accent);
    font-weight: 600;
    font-size: clamp(1.3rem, 2.5vw, 1.75rem);
    line-height: 1.35;
    margin: 0 0 1.5rem;
}
.landing-section-alt .landing-section-title {
    max-width: 820px;
    margin-left: auto;
    margin-right: auto;
}

.landing-cards {
    margin-top: 1rem;
}
.landing-card {
    background: var(--color-surface);
    border: 1px solid var(--color-border);
    border-radius: 10px;
    padding: 1.5rem;
    height: 100%;
    text-align: left;
}
.landing-card-feature {
    text-align: center;
    padding: 2rem 1.5rem;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.06);
}
.landing-card-icon {
    display: block;
    color: var(--accent);
    font-size: 2.75rem;
    margin-bottom: 0.5rem;
}
.landing-card-feature .landing-card-icon {
    font-size: 3.25rem;
}
.landing-card-title {
    color: var(--accent);
    font-size: 1.05rem;
    font-weight: 600;
    letter-spacing: 0.3px;
    margin: 0 0 0.5rem;
}
.landing-card-text {
    color: var(--color-text-muted);
    font-size: 0.95rem;
    line-height: 1.55;
    margin: 0;
}

@media (max-width: 575.98px) {
    .landing-hero {
        padding: 2rem 1rem 2.25rem;
    }
    .landing-section {
        padding: 2rem 0 0.5rem;
    }
    .landing-section-alt {
        padding: 2rem 1rem;
    }
    .landing-cta .btn {
        width: 100%;
    }
}

/* ============================================================================
   Responsive
   ============================================================================ */
@media (max-width: 900px) {
    .mobile-menu-toggle {
        display: inline-flex;
    }
    .brand {
        width: auto;
        min-width: 0;
    }
    .breadcrumb-top {
        display: none !important;
    }
    .sidebar {
        transform: translateX(-100%);
    }
    .sidebar.open {
        transform: translateX(0);
        box-shadow: 2px 0 10px rgba(0, 0, 0, 0.25);
    }
    .main-content {
        margin-left: 0;
        padding: 1rem;
    }
    /* Skip link "al menu" inutile quando la sidebar e' fuori dallo schermo. */
    .skip-link-second {
        display: none;
    }
}

@media (max-width: 540px) {
    .user-info .user-name,
    .user-info .role-badge {
        display: none;
    }
}

/* Stampa: nasconde sidebar, topbar, toggle */
@media print {
    .topbar,
    .sidebar,
    .mobile-menu-toggle,
    .mobile-overlay,
    .app-footer {
        display: none !important;
    }
    .main-content {
        margin: 0;
        padding: 0;
    }
}

/* Pagine Auth (login, registrazione, reset, attivazione) ----------------- */
.auth-page {
    display: flex;
    justify-content: center;
    padding: 2rem 1rem;
    min-height: 60vh;
    align-items: flex-start;
}

.auth-card {
    background: #fff;
    border-radius: 12px;
    box-shadow: 0 4px 18px rgba(0, 0, 0, 0.06);
    padding: 2rem;
    width: 100%;
    max-width: 520px;
}

.auth-title {
    font-size: 1.6rem;
    margin-bottom: 0.5rem;
    color: #1b6ec2;
}

.auth-subtitle {
    margin-bottom: 1.5rem;
}

.auth-divider {
    position: relative;
    text-align: center;
    margin: 1.5rem 0;
}

.auth-divider::before {
    content: '';
    position: absolute;
    top: 50%;
    left: 0;
    right: 0;
    height: 1px;
    background: #dee2e6;
    z-index: 0;
}

.auth-divider span {
    position: relative;
    z-index: 1;
    background: #fff;
    padding: 0 0.75rem;
    color: #6c757d;
    font-size: 0.9rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

/* Focus visibile (WCAG 2.4.7) sui controlli auth */
.auth-card :is(.btn, .form-control, .form-check-input, a):focus-visible {
    outline: 3px solid #0077cc;
    outline-offset: 2px;
    box-shadow: none;
}

/* Touch target minimo 24px (WCAG 2.5.8) gia' garantito da .btn Bootstrap (>= 38px) */
.toggle-password {
    min-width: 44px;
}

@media (max-width: 480px) {
    .auth-card {
        padding: 1.25rem;
    }
}
