/*
 * AulaForms - Stile CSS principale
 * Utilizza colori pastello e design moderno
 */

:root {
    /* Colori pastello */
    --primary: #a5d8ff;       /* Azzurro pastello */
    --primary-dark: #7ec8ff;  /* Azzurro pastello scuro */
    --secondary: #ffd8a8;     /* Arancione pastello */
    --success: #b2f2bb;       /* Verde pastello */
    --danger: #ffc9c9;        /* Rosso pastello */
    --warning: #ffec99;       /* Giallo pastello */
    --info: #d0ebff;          /* Azzurro chiaro pastello */
    --light: #f8f9fa;
    --dark: #4a5568;
    --purple: #e599f7;        /* Viola pastello */
    --pink: #fcc2d7;          /* Rosa pastello */
    --teal: #96f2d7;          /* Verde acqua pastello */
}

/* Personalizzazioni Bootstrap */
.btn-primary {
    background-color: var(--primary);
    border-color: var(--primary-dark);
    color: #333;
}

/* Badge utente nell'header */
.navbar-brand .badge {
    font-size: 0.65rem;
    padding: 0.25em 0.4em;
    vertical-align: middle;
}

/* Colori specifici per i badge utente */
.badge.bg-danger {
    background-color: #dc3545 !important;
    color: white !important;
}

.badge.bg-warning {
    background-color: #ffc107 !important;
    color: #000 !important;
}

.badge.bg-info {
    background-color: #0dcaf0 !important;
    color: #000 !important;
}

/* Correzione dropdown header utente */
.dropdown-menu {
    position: absolute !important;
    right: 0;
    left: auto;
    min-width: 10rem;
}

.navbar .dropdown {
    position: relative !important;
}

/* Correzioni input di ricerca */
.form-control {
    color: #333 !important; /* Assicura che il testo dell'input sia scuro */
}

.form-control::placeholder {
    color: #adb5bd !important; /* Colore più scuro per i placeholder */
}

/* Personalizzazioni Bootstrap originali */
.btn-primary:hover, .btn-primary:focus {
    background-color: var(--primary-dark);
    border-color: var(--primary-dark);
    color: #333;
}

.bg-primary {
    background-color: var(--primary) !important;
}

.text-primary {
    color: var(--primary-dark) !important;
}

.btn-secondary {
    background-color: var(--secondary);
    border-color: var(--secondary);
    color: #333;
}

.btn-success {
    background-color: var(--success);
    border-color: var(--success);
    color: #333;
}

.btn-danger {
    background-color: var(--danger);
    border-color: var(--danger);
    color: #333;
}

.btn-warning {
    background-color: var(--warning);
    border-color: var(--warning);
    color: #333;
}

.btn-info {
    background-color: var(--info);
    border-color: var(--info);
    color: #333;
}

.forms-table-wrapper {
    overflow-x: auto;
    overflow-y: visible;
    position: relative;
}

.forms-table-wrapper .dropdown-menu {
    z-index: 1050;
    min-width: 14rem;
    padding: 0.35rem 0;
    border-radius: 0.75rem;
}

.forms-table-wrapper .dropdown-item {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

/* Tabelle responsive: evita che le dropdown vengano tagliate pur mantenendo lo scroll orizzontale */

.table-responsive {
   position: relative;
   width: 100%;
    max-width: 100vw;
    overflow-x: auto;
    overflow-y: visible !important;
    -webkit-overflow-scrolling: touch;
}

.table-responsive,
.forms-table-wrapper {
    overflow-y: visible !important;
}

.table-responsive .dropdown-menu {
    z-index: 1050;
}
.table-scrollbar {
    position: sticky;
    bottom: 0;
    height: 14px;
    overflow-x: auto;
    overflow-y: hidden;
    max-width: 100vw;
    width: 100%;
    margin-top: 0.35rem;
    background: linear-gradient(180deg, rgba(255,255,255,0) 0%, rgba(255,255,255,0.85) 40%, rgba(255,255,255,1) 100%);
    backdrop-filter: blur(1px);
    z-index: 20;
}

.table-scrollbar-inner {
    height: 1px;
}

/* Stili generali */
body {
    font-family: 'Poppins', 'Segoe UI', Roboto, sans-serif;
    color: #333;
    background-color: #f9f9f9;
    overflow-x: hidden;
}

.navbar {
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.05);
    height: 60px;
}

.notification-icon {
    position: relative;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 2.25rem;
    min-height: 2.25rem;
}

.notification-badge-indicator {
    position: absolute;
    top: 0.05rem;
    right: 0.35rem;
    transform: translate(45%, -35%);
    z-index: 5;
    font-size: 0.65rem;
    padding: 0.2rem 0.35rem;
    line-height: 1;
    min-width: 1.2rem;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

/* Dropdown notifiche header */
.notifications-dropdown-menu {
    width: 320px;
    max-width: calc(100vw - 2rem);
    padding: 0;
    border: 0;
    border-radius: 12px;
    box-shadow: 0 12px 24px rgba(15, 23, 42, 0.12);
    overflow: hidden;
}

/* Overlay rete offline */
.network-guard-overlay {
    position: fixed;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 2rem;
    background: rgba(25, 32, 45, 0.85);
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
    transition: opacity 0.3s ease, visibility 0.3s ease;
    z-index: 1100;
}

.network-guard-overlay.is-active {
    opacity: 1;
    visibility: visible;
    pointer-events: auto;
}

.network-guard-panel {
    width: 100%;
    max-width: 420px;
    background: linear-gradient(145deg, rgba(77, 99, 123, 0.95), rgba(41, 53, 72, 0.95));
    color: #fff;
    padding: 2rem 2.25rem;
    border-radius: 1.25rem;
    box-shadow: 0 20px 45px rgba(10, 14, 23, 0.4);
    text-align: center;
}

.network-guard-panel h2 {
    font-size: 1.75rem;
    margin-bottom: 1rem;
    font-weight: 600;
}

.network-guard-panel p {
    margin-bottom: 1.5rem;
}

.network-guard-icon {
    width: 72px;
    height: 72px;
    margin: 0 auto 1rem;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.12);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 2rem;
    color: #ffe066;
}

.network-guard-status {
    font-size: 0.95rem;
    font-weight: 600;
    padding: 0.6rem 1rem;
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.12);
    margin-bottom: 1.5rem;
    display: inline-block;
}

.network-guard-timer {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.4rem 0.85rem;
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.1);
    font-family: 'Roboto Mono', 'Courier New', monospace;
    font-size: 0.95rem;
}

.network-guard-timer .label {
    opacity: 0.75;
}

.network-guard-reminders {
    margin-top: 1.25rem;
    font-size: 0.85rem;
    opacity: 0.75;
}

.network-guard-actions {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 0.75rem;
    margin-top: 2rem;
}

.network-guard-actions .btn {
    min-width: 180px;
    font-weight: 600;
}

.network-guard-indicator {
    position: fixed;
    bottom: 1.5rem;
    right: 1.5rem;
    display: inline-flex;
    align-items: center;
    gap: 0.6rem;
    padding: 0.75rem 1.25rem;
    border-radius: 999px;
    border: none;
    background: linear-gradient(135deg, #495d80, #2f3b56);
    color: #fff;
    box-shadow: 0 12px 25px rgba(18, 24, 38, 0.35);
    cursor: pointer;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
    z-index: 1100;
}

.network-guard-indicator .icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 1.25rem;
}

.network-guard-indicator .label {
    font-weight: 600;
}

.network-guard-indicator:hover {
    transform: translateY(-4px);
    box-shadow: 0 16px 32px rgba(18, 24, 38, 0.45);
}

body.network-status-offline {
    transition: filter 0.3s ease;
}

body.network-status-offline main,
body.network-status-offline .container,
body.network-status-offline .content-wrapper {
    filter: blur(0.5px);
}

.notifications-dropdown-header,
.notifications-dropdown-footer {
    background-color: #fff;
    border-bottom: 1px solid #e2e8f0;
}

.notifications-dropdown-footer {
    border-top: 1px solid #e2e8f0;
    border-bottom: 0;
}

.notifications-dropdown-list {
    background-color: #fff;
    max-height: 360px;
    overflow-y: auto;
}

.notifications-dropdown-list .notification-item {
    display: block;
    padding: 0.85rem 1rem;
    color: #1f2937;
    text-decoration: none;
    border-bottom: 1px solid #f1f5f9;
    transition: background-color 0.15s ease;
}

.notifications-dropdown-list .notification-item:last-child {
    border-bottom: 0;
}

.notifications-dropdown-list .notification-item:hover,
.notifications-dropdown-list .notification-item:focus {
    background-color: #edf6ff;
    color: #1f2937;
}

.notifications-dropdown-list .notification-item.unread {
    background-color: #f5f9ff;
    font-weight: 500;
}

.notifications-dropdown-list .notification-item.unread:hover,
.notifications-dropdown-list .notification-item.unread:focus {
    background-color: #e5f1ff;
}

.notification-item-title {
    font-size: 0.95rem;
    margin-bottom: 0.2rem;
}

.notification-item-meta {
    font-size: 0.75rem;
    color: #6b7280;
}


.navbar .navbar-toggler {
    --bs-navbar-toggler-icon-bg: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 30 30'%3e%3cpath stroke='rgba(0, 0, 0, 0.75)' stroke-linecap='round' stroke-miterlimit='10' stroke-width='2' d='M4 7h22M4 15h22M4 23h22'/%3e%3c/svg%3e");
    border-color: rgba(0, 0, 0, 0.15);
    background-color: rgba(255, 255, 255, 0.92);
    width: 42px;
    height: 42px;
    padding: 0;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.08);
}

.navbar .navbar-toggler:hover {
    background-color: rgba(255, 255, 255, 0.98);
}

header.navbar .navbar-toggler {
    top: 0.5rem;
    left: 0.75rem;
}

@media (max-width: 1199.98px) {
    header.navbar .navbar-brand {
        margin-left: 3.5rem;
    }
}

.navbar .navbar-toggler:focus {
    box-shadow: 0 0 0 0.2rem rgba(0, 0, 0, 0.1);
}

.card {
    border-radius: 12px;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.05);
    border: none;
    transition: transform 0.2s, box-shadow 0.2s;
}

.card:hover {
    /*transform: translateY(-3px);*/
    box-shadow: 0 6px 12px rgba(0, 0, 0, 0.08);
}

.form-control {
    border-radius: 8px;
    padding: 10px 15px;
    border: 1px solid #e2e8f0;
}

.form-control:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 0.2rem rgba(165, 216, 255, 0.25);
}

/* Password visibility toggle: make the eye button look merged with the input */
.input-group .form-control + .toggle-password.btn {
    background-color: #fff;              /* stesso sfondo dell'input */
    border: 1px solid #e2e8f0;           /* stesso bordo dell'input */
    border-left: 0;                       /* rimuove il bordo sinistro per evitare lo stacco */
    border-radius: 0 8px 8px 0;           /* combacia con il raggio dell'input */
    color: #6c757d;                       /* colore icona neutro */
}

/* Rimuovi il bordo destro dell'input affiancato al bottone per evitare doppio bordo */
.input-group .form-control.password-with-toggle {
    border-right: 0;
}

/* Stato focus coerente tra input e bottone */
.input-group .form-control:focus + .toggle-password.btn {
    border-color: var(--primary);
    box-shadow: 0 0 0 0.2rem rgba(165, 216, 255, 0.25);
}
.toggle-password.btn:focus {
    box-shadow: none; /* eviti doppio alone di focus */
}

/* Hover leggero senza spezzature */
.toggle-password.btn:hover {
    background-color: #f8f9fa;
}

/* Annotazioni grafiche - assicurati che il canvas possa eccedere il contenitore senza tagli */
.annotation-canvas-wrapper {
    width: 100%;
    overflow: auto;
    padding: 0.25rem;
    background-color: #f8f9fa;
    border-radius: 0.5rem;
    min-height: 400px;
    display: flex;
    justify-content: center;
    align-items: center;
}

.annotation-canvas-wrapper canvas {
    display: block;
    flex-shrink: 0;
    margin: 0 auto;
}

@media (max-width: 768px) {
    .annotation-canvas-wrapper {
        min-height: 300px;
    }
}

/* Login e registrazione */
.auth-card {
    max-width: 450px;
    margin: 2rem auto;
    padding: 2rem;
}

.auth-logo {
    text-align: center;
    margin-bottom: 2rem;
}

/* Sidebar */
.sidebar {
    background-color: #fff;
    box-shadow: 0 0 10px rgba(0, 0, 0, 0.05);
    min-height: calc(100vh - 56px);
}

.sidebar .nav-link {
    color: #4a5568;
    padding: 0.75rem 1.25rem;
    border-radius: 8px;
    margin-bottom: 0.25rem;
    display: flex;              /* allineamento icona + testo */
    align-items: flex-start;    /* icona allineata all'inizio del testo multilinea */
    gap: 8px;
    white-space: normal;        /* consenti a capo */
    overflow-wrap: anywhere;    /* spezza parole lunghe */
    word-break: break-word;     /* fallback per browser */
}

.sidebar .nav-link:hover, 
.sidebar .nav-link:focus, 
.sidebar .nav-link.active {
    background-color: var(--primary);
    color: #333;
}

.sidebar .nav-link i {
    margin-right: 10px;
    width: 20px;
    text-align: center;
}

/* Sidebar drawer su mobile/app: full-screen, slide da sinistra e scroll interno */
@media (max-width: 1199.98px) {
    #sidebarMenu.collapse {
        position: fixed;
        top: 60px;
        left: 0;
        right: 0;
        bottom: 0;
        width: 100vw;
        height: calc(100dvh - 60px);
        max-width: 100vw;
        margin: 0;
        border-right: 0;
        box-shadow: 0 16px 36px rgba(15, 23, 42, 0.2);
        z-index: 2147483600 !important;
        overflow: hidden;
        background: #ffffff;
        display: block !important;
        transform: translateX(-100%);
        opacity: 0;
        visibility: hidden;
        pointer-events: none;
        transition: transform 0.26s ease, opacity 0.2s ease, visibility 0s linear 0.26s;
    }

    #sidebarMenu.collapse.show,
    #sidebarMenu.collapsing {
        position: fixed;
        top: 60px;
        left: 0;
        right: 0;
        bottom: 0;
        width: 100vw;
        height: calc(100dvh - 60px);
        max-width: 100vw;
        transform: translateX(0);
        opacity: 1;
        visibility: visible;
        pointer-events: auto;
        z-index: 2147483600 !important;
        transition: transform 0.26s ease, opacity 0.2s ease;
    }

    #sidebarMenu.collapsing {
        overflow: hidden;
    }

    #sidebarMenu .sidebar-inner-scroll {
        position: static !important;
        height: 100%;
        max-height: calc(100dvh - 60px);
        overflow-y: auto;
        overflow-x: hidden;
        overscroll-behavior: contain;
        -webkit-overflow-scrolling: touch;
        padding: 0.85rem 0.75rem calc(16px + env(safe-area-inset-bottom, 0px));
    }

    #sidebarMenu .nav-link {
        font-size: 1.08rem;
        line-height: 1.25;
        padding: 0.85rem 1rem;
        border-radius: 10px;
    }

    #sidebarMenu .nav-link.py-1 {
        padding-top: 0.75rem !important;
        padding-bottom: 0.75rem !important;
    }

    #sidebarMenu .nav-link i {
        width: 24px;
        font-size: 1.12rem;
        margin-right: 0;
        text-align: center;
    }
}

/* Sidebar - prevenzione overflow su schermi piccoli */
.sidebar {
    overflow-x: hidden; /* Impedisce che il background delle voci esca lateralmente */
}

.sidebar .nav-link {
    display: flex;              /* Mantiene icona + testo allineati */
    align-items: center;
    gap: 8px;
}

@media (min-width: 768px) and (max-width: 992px) {
    .sidebar .nav-link {
    overflow: visible;          /* Consenti espansione verticale */
    white-space: normal;        /* Consenti il testo su più righe */
    overflow-wrap: anywhere;    /* Forza a capo parole lunghe */
    word-break: break-word;     /* Compatibilità estesa */
    line-height: 1.2;           /* Migliore leggibilità su 2+ righe */
    align-items: flex-start;     /* Allinea l'icona con l'inizio del testo */
    padding: 0.6rem 0.9rem;     /* Leggera riduzione padding per piccoli schermi */
    margin-right: 6px;          /* Evita che il background tocchi il bordo destro */
    }

    .sidebar .nav-link i {
        flex: 0 0 20px;         /* Evita che l'icona riduca lo spazio del testo */
    }
}

/* Dashboard */
.dashboard-stats {
    border-radius: 10px;
    padding: 1.5rem;
    height: 100%;
    transition: all 0.3s;
    min-height: 150px;
}

.dashboard-stats:hover {
    transform: translateY(-5px);
}

.dashboard-stats i {
    font-size: 2.5rem;
    margin-bottom: 1rem;
}

.stats-primary {
    background-color: var(--primary);
}

.stats-secondary {
    background-color: var(--secondary);
}

.stats-success {
    background-color: var(--success);
}

.stats-purple {
    background-color: var(--purple);
}

.stats-pink {
    background-color: var(--pink);
}

.stats-teal {
    background-color: var(--teal);
}

/* Forms */
.question-card {
    border-left: 4px solid var(--primary);
    margin-bottom: 1.5rem;
    padding: 1.5rem;
    background-color: #fff;
    border-radius: 0 10px 10px 0;
}

.question-type {
    display: inline-block;
    font-size: 0.8rem;
    padding: 0.25rem 0.75rem;
    border-radius: 50px;
    background-color: var(--light);
    margin-bottom: 0.5rem;
}

/* Badge e etichette */
.badge-primary {
    background-color: var(--primary);
    color: #333;
}

.badge-secondary {
    background-color: var(--secondary);
    color: #333;
}

.badge-success {
    background-color: var(--success);
    color: #333;
}

.badge-warning {
    background-color: var(--warning);
    color: #333;
}

.badge-danger {
    background-color: var(--danger);
    color: #333;
}

/* Classi */
.class-card {
    border-radius: 10px;
    overflow: hidden;
    margin-bottom: 1.5rem;
}

.class-header {
    padding: 1.5rem;
    background-color: var(--primary);
}

.class-body {
    padding: 1.5rem;
}

.class-footer {
    border-top: 1px solid rgba(0, 0, 0, 0.05);
    padding: 1rem 1.5rem;
    background-color: #f9f9f9;
}

/* Form di creazione */
.form-builder-section {
    padding: 2rem;
    background-color: #fff;
    border-radius: 10px;
    margin-bottom: 2rem;
}

.form-question {
    padding: 1.5rem;
    border: 1px solid #e2e8f0;
    border-radius: 10px;
    margin-bottom: 1rem;
    background-color: #f8f9fa;
}

/* Responsive */
@media (max-width: 768px) {
    .auth-card {
        margin: 1rem;
    }
    
    .dashboard-stats {
        min-height: auto;
        margin-bottom: 1rem;
    }
}

/* Icone custom */
.feature-icon {
    width: 50px;
    height: 50px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.5rem;
}

/* Breadcrumb improvements */
.breadcrumb {
    --bs-breadcrumb-divider: '/';
    font-size: 0.95rem;
    color: #6c757d;
}
.breadcrumb .breadcrumb-item + .breadcrumb-item::before {
    color: #adb5bd;
}
.breadcrumb .breadcrumb-item a {
    text-decoration: none;        /* no underline by default */
    color: #0d6efd;               /* bootstrap primary for links */
}
.breadcrumb .breadcrumb-item a:hover,
.breadcrumb .breadcrumb-item a:focus {
    text-decoration: underline;   /* show underline only on hover/focus */
}
.breadcrumb .breadcrumb-item.active {
    color: #6c757d;               /* muted for current */
}

.bg-pastel-blue {
    background-color: var(--primary);
}

.bg-pastel-orange {
    background-color: var(--secondary);
}

.bg-pastel-green {
    background-color: var(--success);
}

/* Componenti form builder */
.option-item {
    padding: 0.75rem;
    background-color: #f8f9fa;
    border-radius: 8px;
    margin-bottom: 0.5rem;
    display: flex;
    align-items: center;
}

.option-item .option-drag {
    margin-right: 0.5rem;
    cursor: move;
    color: #adb5bd;
}

.option-item .option-input {
    flex-grow: 1;
}

.option-item .option-delete {
    color: var(--danger);
    cursor: pointer;
}

/* Animazioni */
@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

.fade-in {
    animation: fadeIn 0.5s;
}

/* Toast notifications */
.toast-container {
    position: fixed;
    top: 20px;
    right: 20px;
    z-index: 9999;
}

.toast-custom {
    padding: 15px 20px;
    border-radius: 8px;
    margin-bottom: 10px;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
    animation: fadeIn 0.3s;
}

.toast-success {
    background-color: var(--success);
}

.toast-error {
    background-color: var(--danger);
}

.toast-info {
    background-color: var(--info);
}

.toast-warning {
    background-color: var(--warning);
}

/* Footer credits bar */
.app-footer {
    background-color: #fff;
    color: #6c757d;
    box-shadow: 0 -1px 0 rgba(0, 0, 0, 0.05);
}

.app-footer__credits {
    color: inherit;
}

.app-footer__credits-link {
    color: inherit;
    font-weight: 500;
    transition: color 0.2s ease;
}

.app-footer__credits-link:hover,
.app-footer__credits-link:focus {
    color: var(--primary-dark);
    text-decoration: none;
}

.app-footer__links a {
    color: #6c757d;
    transition: color 0.2s ease, transform 0.2s ease;
}

.app-footer__links a:hover,
.app-footer__links a:focus {
    color: var(--primary-dark);
    text-decoration: none;
    transform: translateY(-1px);
}

.app-footer__links i {
    font-size: 0.9rem;
}

.app-footer__credits .separator {
    color: #ced4da;
}

@media (max-width: 576px) {
    .app-footer__links {
        gap: 0.75rem;
    }
}

.question-slider {
    position: relative;
    overflow: hidden;
    margin: 0 -0.25rem;
}

.question-slider-track {
    display: flex;
    width: 100%;
    transition: transform 0.35s ease-in-out;
}

.question-slide {
    flex: 0 0 100%;
    padding: 0 0.25rem;
}

.question-slider .question-container {
    margin-bottom: 0;
}

.question-slider-controls .btn {
    min-width: 180px;
}

.question-slider-progress {
    min-width: 140px;
}

.question-slider-controls .label-last {
    font-weight: 600;
}

@media (max-width: 575.98px) {
    .question-slider-controls .btn,
    .question-slider-progress {
        width: 100%;
    }
}
