/* Assistest E-Learning Premium Styles (Mobile-First) */
@import url('https://fonts.googleapis.com/css2?family=Outfit:wght@400;500;600;700;800&display=swap');

:root {
    /* Brand Colors */
    --primary-color: #bf0029;
    --primary-gradient: linear-gradient(135deg, #bf0029 0%, #ff4b2b 100%);
    --primary-light: rgba(191, 0, 41, 0.1);
    
    --secondary-color: #25D366;
    --secondary-gradient: linear-gradient(135deg, #25D366 0%, #128C7E 100%);
    
    /* UI Colors */
    --bg-main: #ffffff;
    --bg-soft: #f4f6f9;
    --bg-gradient: linear-gradient(180deg, #f4f6f9 0%, #e2e8f0 100%);
    --text-main: #1e232d;
    --text-muted: #5a6474;
    --border-color: rgba(226, 232, 240, 0.8);
    --error: #ef4444;
    
    /* Shadows & Radii */
    --shadow-sm: 0 4px 12px rgba(0,0,0,0.05);
    --shadow-md: 0 10px 24px rgba(0,0,0,0.08);
    --shadow-lg: 0 20px 40px rgba(0,0,0,0.12);
    --shadow-glow-red: 0 8px 24px rgba(191, 0, 41, 0.3);
    --shadow-glow-green: 0 8px 24px rgba(37, 211, 102, 0.3);
    
    --radius-md: 16px;
    --radius-lg: 24px;
    --radius-xl: 32px;
    
    --transition: 0.3s cubic-bezier(0.16, 1, 0.3, 1);
}

html { scroll-behavior: smooth; }

#assistest-root {
    font-family: 'Outfit', sans-serif;
    color: var(--text-main);
    background: var(--bg-gradient);
    min-height: 100vh;
    border-radius: var(--radius-lg);
    padding: 15px;
    box-sizing: border-box;
}

#assistest-root * {
    box-sizing: border-box;
}

/* Glassmorphism Panel */
.glass-panel {
    background: rgba(255, 255, 255, 0.7);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border: 1px solid rgba(255, 255, 255, 0.8);
    border-radius: var(--radius-lg);
    padding: 20px;
    box-shadow: var(--shadow-sm);
    transition: var(--transition);
}

.text-muted { color: var(--text-muted); font-size: 0.95rem; }

/* Dashboard Layout */
.ast-dashboard-container {
    max-width: 1200px;
    margin: 0 auto;
    display: flex;
    flex-direction: column;
    gap: 20px;
}

/* Top Bar (Scrolls naturally) */
.ast-topbar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 15px;
}

.ast-topbar-profile {
    display: flex;
    align-items: center;
    gap: 15px;
}

.ast-avatar {
    width: 50px;
    height: 50px;
    background: var(--primary-gradient);
    color: white;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.5rem;
    font-weight: 800;
    box-shadow: var(--shadow-glow-red);
}

.ast-user-greeting h2 {
    margin: 0 0 2px 0;
    font-weight: 800;
    font-size: 1.5rem;
    color: var(--text-main);
    letter-spacing: -0.02em;
}

.ast-user-greeting p { margin: 0; color: var(--text-muted); font-size: 0.9rem; }

/* Codice Identificativo Widget */
.ast-user-code {
    display: flex;
    align-items: center;
    gap: 12px;
    background: rgba(255,255,255,0.9);
    padding: 10px 16px;
    border-radius: 50px;
    border: 1px solid var(--border-color);
    cursor: pointer;
    transition: var(--transition);
    box-shadow: var(--shadow-sm);
}

.hover-lift:hover {
    transform: translateY(-3px);
    box-shadow: var(--shadow-md);
    border-color: var(--primary-color);
}

.ast-code-info { display: flex; flex-direction: column; }
.ast-code-label { font-size: 0.7rem; text-transform: uppercase; letter-spacing: 1px; color: var(--text-muted); font-weight: 700; }
.ast-code-value { font-size: 1.1rem; font-weight: 800; color: var(--primary-color); }
.ast-code-icon { color: var(--text-muted); transition: var(--transition); }
.ast-user-code:hover .ast-code-icon { color: var(--primary-color); }

/* Bento Grid */
.ast-bento-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 20px;
}

@media (min-width: 900px) {
    .ast-bento-grid {
        grid-template-columns: 1fr 1fr;
    }
    #sez-progressi, #sez-materie, #sez-simulazioni, #sez-allenamento {
        grid-column: 1 / -1;
    }
    #sez-lezioni {
        grid-column: 1 / 2;
    }
    #sez-libreria {
        grid-column: 2 / 3;
    }
}

.ast-bento-item {
    scroll-margin-top: 190px;
}

.ast-bento-item h3 {
    margin: 0 0 15px 0;
    font-weight: 800;
    font-size: 1.5rem;
    display: flex;
    align-items: center;
    gap: 8px;
}

/* Score Widget */
.ast-score-display {
    display: flex;
    align-items: baseline;
    gap: 5px;
    margin: 15px 0;
}
.ast-score-number { font-size: 3.5rem; font-weight: 800; background: var(--primary-gradient); -webkit-background-clip: text; -webkit-text-fill-color: transparent; line-height: 1; }
.ast-score-max { font-size: 1.2rem; font-weight: 600; color: var(--text-muted); }

/* Gamification Widgets (Streak & Medals) */
.ast-gamification-row {
    display: flex;
    gap: 15px;
    margin-top: 15px;
}
.ast-gamification-card {
    flex: 1;
    background: rgba(255,255,255,0.6);
    border-radius: var(--radius-md);
    padding: 15px;
    text-align: center;
    border: 1px solid var(--border-color);
    transition: var(--transition);
}
.ast-gamification-card:hover {
    background: #fff;
    transform: translateY(-2px);
    box-shadow: var(--shadow-sm);
}
.ast-streak-icon {
    font-size: 2rem;
    background: linear-gradient(135deg, #ff8c00, #ff4b2b);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    margin-bottom: 5px;
}
.ast-medal-icon {
    font-size: 2rem;
    background: linear-gradient(135deg, #ffd700, #ff8c00);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    margin-bottom: 5px;
}

/* Performance Widget (Carousel on Mobile) */
.ast-materie-widget { overflow: hidden; }
#ast-dashboard-materie-stats {
    display: flex;
    gap: 15px;
    margin-top: 15px;
    overflow-x: auto;
    padding-bottom: 10px;
    scroll-snap-type: x mandatory;
    scrollbar-width: none; /* Firefox */
}
#ast-dashboard-materie-stats::-webkit-scrollbar { display: none; } /* Chrome */
.ast-stat-card {
    flex: 0 0 85%; /* Mobile carousel item width */
    scroll-snap-align: center;
    background: white;
    padding: 20px;
    border-radius: var(--radius-md);
    border: 1px solid var(--border-color);
    text-align: center;
    box-shadow: var(--shadow-sm);
}
@media (min-width: 768px) {
    #ast-dashboard-materie-stats { flex-wrap: wrap; overflow-x: visible; }
    .ast-stat-card { flex: 1 1 calc(33% - 15px); }
}

.ast-stat-materia { font-weight: 700; font-size: 1.1rem; color: var(--text-main); margin-bottom: 5px; }
.ast-stat-perc { font-weight: 800; font-size: 2rem; margin-bottom: 5px; }
.ast-stat-details { font-size: 0.85rem; color: var(--text-muted); }

/* Buttons */
.btn {
    display: inline-flex; align-items: center; justify-content: center;
    padding: 16px 24px; border-radius: 50px; font-weight: 700;
    text-decoration: none; border: none; font-size: 1.05rem; gap: 10px;
    cursor: pointer; transition: var(--transition);
    width: 100%; font-family: 'Outfit', sans-serif;
}
.btn-primary { background: var(--primary-gradient); color: #fff; box-shadow: var(--shadow-glow-red); }
.btn-glow:hover { transform: translateY(-3px); box-shadow: 0 12px 28px rgba(191, 0, 41, 0.4); }
.btn-secondary { background: var(--secondary-gradient); color: #fff; box-shadow: var(--shadow-glow-green); }
.btn-glow-green:hover { transform: translateY(-3px); box-shadow: 0 12px 28px rgba(37, 211, 102, 0.4); }

/* Card Buttons for Training */
.ast-card-button {
    background: white;
    border: 2px solid var(--border-color);
    border-radius: var(--radius-lg);
    padding: 25px;
    text-align: center;
    cursor: pointer;
    transition: var(--transition);
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 15px;
}
.ast-card-button:hover {
    border-color: var(--primary-color);
    box-shadow: var(--shadow-glow-red);
    transform: translateY(-5px);
}
.ast-card-button-icon {
    font-size: 2.5rem;
    color: var(--primary-color);
}
.ast-card-button-title {
    font-size: 1.3rem;
    font-weight: 800;
    color: var(--text-main);
}
.ast-card-button-desc {
    font-size: 0.9rem;
    color: var(--text-muted);
}

/* Training Overlay Full Screen */
#ast-training-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: var(--bg-main);
    z-index: 2147483640;
    overflow-y: auto;
    display: none;
    flex-direction: column;
    padding: 20px;
    animation: ast-slide-up 0.4s cubic-bezier(0.16, 1, 0.3, 1);
}
.ast-training-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 10px 15px;
    border-bottom: 1px solid var(--border-color);
    position: sticky;
    top: 0;
    z-index: 2147483645;
    background: var(--bg-main);
    margin: -20px -20px 15px -20px;
}
.ast-training-title {
    font-size: 1.05rem;
    font-weight: 700;
    color: var(--text-muted);
}
.ast-quiz-question-box {
    background: var(--bg-soft);
    padding: 30px 20px;
    border-radius: var(--radius-lg);
    text-align: center;
    font-size: 1.4rem;
    font-weight: 700;
    line-height: 1.4;
    margin-bottom: 30px;
    box-shadow: inset 0 2px 10px rgba(0,0,0,0.02);
}
.ast-quiz-options {
    display: flex;
    flex-direction: column;
    gap: 15px;
}
.ast-option-btn {
    background: white;
    border: 2px solid var(--border-color);
    border-radius: var(--radius-md);
    padding: 20px;
    font-size: 1.1rem;
    font-weight: 600;
    text-align: left;
    cursor: pointer;
    transition: var(--transition);
    color: var(--text-main);
    font-family: 'Outfit', sans-serif;
    position: relative;
    overflow: hidden;
}
.ast-option-btn:active {
    transform: scale(0.98);
}
.ast-option-btn.selected {
    border-color: var(--primary-color);
    background: var(--primary-light);
    color: var(--primary-color);
}
.ast-option-btn.correct {
    border-color: var(--secondary-color);
    background: rgba(37, 211, 102, 0.1);
    color: var(--secondary-color);
}
.ast-option-btn.wrong {
    border-color: var(--error);
    background: rgba(239, 68, 68, 0.1);
    color: var(--error);
}

/* Forms & Modals */
.assistest-modal {
    display: none; position: fixed; top: 0; left: 0; right: 0; bottom: 0;
    z-index: 2147483647; align-items: center; justify-content: center;
}
/* Manteniamo l'auth modal come blocco inline per evitare conflitti con WordPress/Elementor */
#assistest-auth-modal {
    position: relative; z-index: 10;
    padding: 40px 20px; min-height: 80vh;
}

.assistest-modal.active { display: flex; }
.assistest-modal-backdrop {
    position: absolute; top: 0; left: 0; right: 0; bottom: 0;
    background: rgba(15, 17, 21, 0.8); backdrop-filter: blur(10px);
}
#assistest-auth-modal .assistest-modal-backdrop {
    display: none; /* Rimuoviamo il backdrop solo per il form di accesso/registrazione inline */
}
.assistest-modal-content {
    position: relative; background: var(--bg-main); width: 100%; max-width: 500px;
    border-radius: var(--radius-xl); padding: 40px; box-shadow: var(--shadow-lg);
    animation: ast-slide-up 0.5s cubic-bezier(0.16, 1, 0.3, 1);
    z-index: 1;
}

@keyframes ast-slide-up {
    from { opacity: 0; transform: translateY(30px) scale(0.95); }
    to { opacity: 1; transform: translateY(0) scale(1); }
}

.ast-auth-tabs { display: flex; background: #f1f5f9; border-radius: 50px; padding: 5px; margin-bottom: 25px; box-shadow: inset 0 2px 4px rgba(0,0,0,0.02); }
.ast-tab-btn {
    flex: 1; padding: 14px; border: none; background: transparent; border-radius: 50px;
    font-weight: 700; color: #64748b; cursor: pointer; transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1); font-size: 1.15rem;
}
.ast-tab-btn:hover { color: #1e293b; }
.ast-tab-btn.active { background: #ffffff; color: var(--primary-color); box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06); transform: scale(1.02); }

.ast-tab-content { display: none; animation: fadeIn 0.3s ease; }
.ast-tab-content.active { display: block; }

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

.assistest-modal-header { text-align: center; margin-bottom: 25px; }
.assistest-modal-header h2 { margin: 0 0 5px 0; font-size: 28px; font-weight: 800; }
.assistest-modal-header p { color: var(--text-muted); margin: 0; }

.assistest-form .form-row { display: flex; gap: 15px; margin-bottom: 15px; }
.assistest-form input, .assistest-form select {
    width: 100%; padding: 16px 20px; border: 1px solid var(--border-color);
    border-radius: 16px; font-size: 17px; background: var(--bg-soft); transition: var(--transition);
    color: #1e232d !important;
}
.assistest-form input:focus, .assistest-form select:focus { outline: none; border-color: var(--primary-color); box-shadow: 0 0 0 3px var(--primary-light); background: #fff; }
.ast-forgot-password { text-align: right; margin-bottom: 20px; font-size: 0.9rem; }
.ast-forgot-password a:hover { color: var(--primary-color); text-decoration: underline; }

.assistest-error-msg { margin-top: 15px; padding: 12px; background: #fee2e2; color: var(--error); border-radius: 12px; text-align: center; font-size: 14px; font-weight: 500; }

/* Loading State */
.ast-loading-pulse {
    padding: 20px; text-align: center; color: var(--text-muted);
    animation: pulseText 1.5s infinite; font-weight: 600; font-size: 1.1rem;
}
@keyframes pulseText { 0% { opacity: 0.5; } 50% { opacity: 1; } 100% { opacity: 0.5; } }

@media (max-width: 600px) {
    .assistest-form .form-row { flex-direction: column; gap: 15px; }
    .assistest-modal-content { padding: 30px 20px; margin: 15px; border-radius: 24px; }
    .ast-topbar { flex-direction: column; align-items: stretch; }
    .ast-user-code { width: 100%; justify-content: space-between; }
}

/* Navigazione a Pillole (Solo Desktop) */
@media (max-width: 899px) {
    .ast-mobile-nav { display: none !important; }
}
.ast-mobile-nav {
    display: flex;
    gap: 10px;
    margin-top: 15px;
    padding-bottom: 5px;
    flex-wrap: nowrap;
    overflow-x: auto;
    width: 100%;
    scrollbar-width: none; /* Firefox */
    -webkit-overflow-scrolling: touch;
}

.ast-mobile-nav::-webkit-scrollbar { 
    display: none; /* Chrome/Safari */
}

.ast-nav-pill {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 8px 16px;
    background: rgba(255, 255, 255, 0.8);
    border: 1px solid var(--border-color);
    border-radius: 50px;
    font-size: 0.95rem;
    font-weight: 600;
    color: var(--text-muted);
    text-decoration: none;
    transition: var(--transition);
    white-space: nowrap;
    flex-shrink: 0;
}

.ast-nav-pill:hover {
    background: var(--primary-light);
    color: var(--primary-color);
    border-color: var(--primary-color);
    transform: translateY(-2px);
}

.ast-nav-pill i {
    width: 16px;
    height: 16px;
}

/* Sfondi Colorati */
.ast-bg-gamification {
    background: linear-gradient(135deg, rgba(255,247,237,0.9), rgba(255,237,213,0.9)) !important;
    border-color: #fed7aa !important;
}

.ast-bg-training {
    background: linear-gradient(135deg, #1e293b, #0f172a) !important;
    color: white !important;
    border: none !important;
}

.ast-bg-training h3 {
    color: white !important;
}
.ast-bg-training .text-muted {
    color: #cbd5e1 !important;
}
.ast-bg-training .ast-card-button {
    background: rgba(255,255,255,0.1);
    border-color: rgba(255,255,255,0.2);
}
.ast-bg-training .ast-card-button:hover {
    background: rgba(255,255,255,0.15);
    border-color: var(--primary-color);
}
.ast-bg-training .ast-card-button-title {
    color: white !important;
}
.ast-bg-training .ast-card-button-desc {
    color: #cbd5e1 !important;
}
.ast-bg-training .ast-card-button-icon {
    color: #facc15 !important;
}

/* Bottom Navigation Bar (Solo Mobile) */
.ast-bottom-nav {
    display: none;
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(10px);
    border-top: 1px solid var(--border-color);
    z-index: 2147483647;
    padding: 10px 15px;
    padding-bottom: calc(10px + env(safe-area-inset-bottom));
    justify-content: space-around;
    box-shadow: 0 -4px 12px rgba(0,0,0,0.05);
}

@media (max-width: 899px) {
    .ast-bottom-nav { display: flex; }
    #assistest-root { padding-bottom: 80px; } /* Evita che il contenuto sia coperto */
}

.ast-nav-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
    text-decoration: none;
    color: var(--text-muted);
    font-size: 0.75rem;
    font-weight: 600;
    transition: var(--transition);
}

.ast-nav-item:hover, .ast-nav-item:active {
    color: var(--primary-color);
}

.ast-nav-item i {
    width: 22px;
    height: 22px;
}


.ast-bottom-nav {
    transition: transform 0.3s cubic-bezier(0.16, 1, 0.3, 1);
}
.ast-bottom-nav.collapsed {
    transform: translateY(150%);
}


@keyframes ast-bounce {
    0%, 100% { transform: translateY(0); }
    50% { transform: translateY(-5px); }
}

@keyframes ast-glow-pulse {
    0% { box-shadow: 0 0 5px rgba(250, 204, 21, 0.2); }
    50% { box-shadow: 0 0 20px rgba(250, 204, 21, 0.6); }
    100% { box-shadow: 0 0 5px rgba(250, 204, 21, 0.2); }
}

@keyframes ast-pop-in {
    0% { transform: scale(0.5); opacity: 0; }
    80% { transform: scale(1.1); opacity: 1; }
    100% { transform: scale(1); opacity: 1; }
}

.ast-gamification-card:hover .ast-streak-icon i {
    animation: ast-bounce 1s ease infinite;
    color: #f97316 !important;
}

.ast-gamification-card:hover .ast-medal-icon i {
    animation: ast-glow-pulse 2s infinite;
    border-radius: 50%;
}

