/* 
   Palestra di Riflessione - Global Styles
*/

@import url('https://fonts.googleapis.com/css2?family=Outfit:wght@300;400;600;800&display=swap');

:root {
    --primary-color: #5d5fef;
    --secondary-color: #7d7fef;
    --accent-color: #ff7f7f;
    --bg-color: #f4f7f6;
    --text-color: #2d3436;
    --sidebar-width: 280px;
    --transition-speed: 0.4s;
}

* { margin: 0; padding: 0; box-sizing: border-box; }

body {
    font-family: 'Outfit', sans-serif;
    background-color: var(--bg-color);
    color: var(--text-color);
    overflow-x: hidden;
    line-height: 1.5;
    -webkit-font-smoothing: antialiased;
    overscroll-behavior-y: none;
    -webkit-user-select: none;
    user-select: none;
}

/* Global word breaking to prevent overflow */
h1, h2, h3, h4, h5, h6, p, span, div, button {
    overflow-wrap: break-word;
    word-wrap: break-word;
    word-break: normal;
    hyphens: none;
}


.scrollable-container {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    width: 100%;
}

.hidden { display: none !important; }

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(10px); }
    to { opacity: 1; transform: translateY(0); }
}

/* Sidebar as a fixed column that allows page navigation */
.navbar {
    background: white;
    width: var(--sidebar-width);
    height: 100vh;
    position: fixed;
    top: 0;
    left: 0;
    z-index: 1000;
    box-shadow: 4px 0 20px rgba(0,0,0,0.05);
    display: flex;
    flex-direction: column;
    transition: transform var(--transition-speed) cubic-bezier(0.4, 0, 0.2, 1);
}

.navbar.hidden {
    transform: translateX(-100%);
}

.nav-container {
    height: 100vh;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.logo-area {
    padding: 2.5rem 1.5rem;
    border-bottom: 1px solid #f0f0f0;
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
}

.logo { font-weight: 800; font-size: 1.2rem; color: var(--primary-color); letter-spacing: -0.5px; }
.subtitle { font-size: 0.7rem; opacity: 0.6; margin-top: 5px; }

.close-sidebar-btn {
    background: none; border: none; font-size: 2rem; cursor: pointer; color: var(--text-color);
}

.nav-links { list-style: none; padding: 1.5rem 1rem; flex-grow: 1; overflow-y: auto; }
.nav-item {
    display: flex; align-items: center; padding: 1.2rem 1.5rem; text-decoration: none;
    color: var(--text-color); border-radius: 18px; margin-bottom: 0.8rem;
    font-weight: 700; transition: all 0.3s;
    text-align: left;
}
.nav-item.active, .nav-item:hover { background: var(--primary-color); color: white; transform: scale(1.02); }
.nav-item.logout { color: #e74c3c; }
.nav-item.logout:hover { background: #fff0f0; color: #e74c3c; }
.nav-item .icon { margin-right: 1.2rem; font-size: 1.4rem; }

/* Floating Toggle - Persistent */
.floating-toggle {
    position: fixed; top: 1.5rem; left: 1.5rem; z-index: 1100; background: white;
    border: none; width: 55px; height: 55px; border-radius: 18px;
    box-shadow: 0 10px 25px rgba(0,0,0,0.1); cursor: pointer; font-size: 1.6rem;
    display: flex; align-items: center; justify-content: center;
    transition: all 0.3s;
    opacity: 0; pointer-events: none; /* Hidden by default to prevent overlap on desktop load */
}
.floating-toggle:hover { transform: translateY(-5px); box-shadow: 0 15px 30px rgba(0,0,0,0.15); }
.floating-toggle.visible { opacity: 1; pointer-events: auto; }
.floating-toggle.hidden { opacity: 0; pointer-events: none; }

/* Main Content - No Backdrop, Full Access */
main {
    flex-grow: 1;
    margin-left: var(--sidebar-width);
    padding: 2rem;
    min-height: 100vh;
    transition: margin-left var(--transition-speed) cubic-bezier(0.4, 0, 0.2, 1), padding var(--transition-speed);
    position: relative;
    z-index: 1;
}

main.full-width { margin-left: 0 !important; padding: 1rem !important; transition: all 0.5s ease; }

@media (max-width: 1024px) {
    main { margin-left: 0; padding: 6rem 1.5rem 3rem 1.5rem; }
    main.full-width { padding-left: 1.5rem; }
    .navbar { z-index: 2000; }
    .floating-toggle:not(.hidden) { opacity: 1; pointer-events: auto; }
    .exercise-title { font-size: 1.8rem !important; }
}

@media (max-width: 768px) {
    main { padding-top: 5rem; }
    .hero { padding: 2.5rem 1.5rem; border-radius: 30px; grid-template-columns: 1fr; text-align: center; }
    .hero-content h2 { font-size: 2rem; }
    .hero-content p { font-size: 1rem; }
    .exercise-container { padding: 2rem 1.5rem; border-radius: 30px; }
    .exercise-title { font-size: 1.6rem !important; margin-bottom: 2rem; }
    .btn { padding: 1rem 1.8rem; font-size: 0.95rem; }
    .materie-grid { grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); gap: 1rem; }
    .materia-card { padding: 2rem 1rem; border-radius: 20px; }
    .materia-icon { font-size: 2.8rem; }
    
    /* Layout piatto per app-friendly view */
    .exercise-container, .profile-card, .theory-schema {
        background: transparent !important;
        border: none !important;
        box-shadow: none !important;
        padding: 10px 5px !important;
    }
}

@media (max-width: 480px) {
    html { font-size: 14px; }
    main { padding: 5rem 1rem 2rem 1rem; }
    .exercise-container { padding: 1.5rem 1rem; border-radius: 20px; }
    .hero { padding: 2rem 1rem; }
    .hero-content h2 { font-size: 1.8rem; }
}

/* Cards & Grid */
.hero {
    background: linear-gradient(135deg, var(--primary-color), var(--secondary-color));
    color: white; padding: 4rem; border-radius: 40px; display: grid;
    grid-template-columns: 1.2fr 1fr; gap: 3rem; align-items: center;
    box-shadow: 0 20px 40px rgba(93, 95, 239, 0.2); margin-bottom: 3rem;
}
.hero-content h2 { font-size: 3rem; font-weight: 800; margin-bottom: 1.5rem; line-height: 1.1; }
.hero-content p { font-size: 1.2rem; opacity: 0.9; margin-bottom: 2.5rem; }

.materie-grid {
    display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 2rem; margin-top: 2rem;
}
.materia-card {
    background: white; padding: 3rem 2rem; border-radius: 30px; text-align: center;
    cursor: pointer; transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: 0 10px 20px rgba(0,0,0,0.02); border: 1px solid #f0f0f0;
}
.materia-card:hover { transform: translateY(-10px); box-shadow: 0 20px 40px rgba(0,0,0,0.06); border-color: var(--primary-color); }
.materia-icon { font-size: 3.5rem; margin-bottom: 1.5rem; display: block; }
.materia-card h3 { font-size: 1.2rem; font-weight: 800; color: var(--text-color); }

/* Exercise Elements */
.btn {
    padding: 0.8rem 1.8rem; border: none; border-radius: 12px; font-weight: 800;
    cursor: pointer; transition: all 0.3s; font-size: 0.95rem; display: inline-block;
    text-decoration: none; text-transform: uppercase; letter-spacing: 1px;
    text-align: center;
}
.btn-primary { background: var(--accent-color); color: white; box-shadow: 0 10px 20px rgba(255, 127, 127, 0.3); }
.btn-primary:hover { transform: scale(1.05); box-shadow: 0 15px 30px rgba(255, 127, 127, 0.4); }

.exercise-container {
    background: white; padding: 2.5rem; border-radius: 40px;
    box-shadow: 0 20px 50px rgba(0,0,0,0.08);
    max-width: 1250px;
    margin: 0 auto;
    transition: max-width 0.5s ease, padding 0.5s ease;
}

.onboarding-container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 2.5rem 1.5rem;
    transition: max-width 0.5s ease, padding 0.5s ease;
}

.full-width .exercise-container,
.full-width .onboarding-container,
.full-width .contact-card-wrapper {
    max-width: 99% !important;
    width: 99% !important;
    padding: 2rem 1.5rem !important;
}

.full-width .reading-text,
.full-width .interactive-container {
    max-width: 100% !important;
    width: 100% !important;
    padding: 3rem !important; /* Ripristinato padding per PC */
    font-size: 1.5rem !important;
}

.full-width .reading-text p {
    font-size: 1.5rem !important;
}

.full-width .home-description {
    max-width: 1200px;
}
.exercise-title { font-size: 2.5rem; font-weight: 800; margin-bottom: 2.5rem; color: var(--primary-color); }

/* List Menus */
.list-menu { display: flex; flex-direction: column; gap: 1rem; }
.list-item { 
    display: flex; align-items: center; justify-content: space-between;
    padding: 1.5rem 2rem; background: #f8f9fa; border-radius: 20px;
    cursor: pointer; transition: all 0.3s; border: 2px solid transparent;
}
.list-item:hover { transform: translateX(10px); background: white; border-color: var(--primary-color); box-shadow: 0 10px 20px rgba(0,0,0,0.05); }

/* Reading & Pedagogical Highlighting */
.reading-text { font-size: 1.5rem; line-height: 2; padding: 3rem; border-radius: 30px; background: white; border: 1px solid #eee; }
.punct-highlight { color: var(--accent-color); font-weight: 800; background: #fff5f5; padding: 0 4px; border-radius: 5px; }

.phase-btn {
    padding: 1rem 2rem; border-radius: 20px; font-weight: 800; cursor: pointer;
    transition: 0.3s cubic-bezier(0.4, 0, 0.2, 1); background: #f8f9fa; border: 2px solid transparent;
}
.phase-btn:hover { transform: translateY(-3px); box-shadow: 0 10px 20px rgba(0,0,0,0.05); cursor: pointer; }
.phase-btn.active { background: var(--primary-color); color: white; }

.nav-btns { display: flex; gap: 1rem; margin-top: 3rem; border-top: 1px solid #eee; padding-top: 2rem; }
.nav-btn {
    padding: 0.6rem 1.4rem; border-radius: 30px; font-weight: 800; cursor: pointer;
    border: none; background: #eee; transition: 0.3s; cursor: pointer;
    font-size: 0.9rem;
}
.nav-btn.primary { background: var(--primary-color); color: white; }
.nav-btn:hover { opacity: 0.9; transform: scale(1.02); cursor: pointer; }

/* Level Selection */
.filter-bar { display: flex; gap: 0.5rem; margin-bottom: 2rem; overflow-x: auto; padding-bottom: 0.5rem; }
.filter-btn { padding: 0.5rem 1.2rem; border-radius: 30px; border: none; font-weight: 800; cursor: pointer; background: #eee; font-size: 0.85rem; }
.filter-btn.active { background: var(--primary-color); color: white; }

.level-row {
    background: #f8f9fa; padding: 1.5rem; border-radius: 20px; margin-bottom: 1rem;
    display: flex; align-items: center; cursor: pointer; border: 2px solid transparent; transition: all 0.2s;
}
.level-row:hover { border-color: var(--primary-color); background: white; transform: translateX(5px); }

/* Menu Cards (Unità di Apprendimento) */
.menu-card {
    border-radius: 30px; padding: 2rem; text-align: center; color: var(--text-color); cursor: pointer;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1); box-shadow: 0 4px 15px rgba(0,0,0,0.05);
}
.menu-card:hover { transform: translateY(-5px); box-shadow: 0 10px 25px rgba(0,0,0,0.1); }

/* Navigazione Esercizi */
.exercise-nav { display: flex; justify-content: space-between; align-items: center; margin-top: 3rem; background: #f8f9fa; padding: 1rem 2rem; border-radius: 20px; }
.nav-text { font-weight: 700; color: #555; }


/* Modal */
.modal {
    position: fixed; top: 0; left: 0; width: 100vw; height: 100vh;
    background: rgba(0,0,0,0.7); display: flex; align-items: center; justify-content: center; z-index: 2000;
}
.modal.hidden { display: none; }
.modal-content { 
    background: white; 
    padding: 3rem; 
    border-radius: 40px; 
    max-width: 600px; 
    width: 90%; 
    text-align: center; 
    max-height: 90vh; 
    overflow-y: auto; 
}

/* Feedback */
.map-container { background: #f0f7ff; padding: 2rem; border-radius: 20px; margin: 2rem 0; text-align: left; border-left: 5px solid var(--primary-color); }
.example-box { background: #fff9f0; padding: 1.5rem; border-radius: 20px; border: 1px dashed #ffa502; text-align: left; font-style: italic; }

/* Footer */
.footer { padding: 1rem; text-align: center; background: white; border-top: 1px solid #eee; margin-top: 4rem; margin-left: var(--sidebar-width); transition: margin-left var(--transition-speed) cubic-bezier(0.4, 0, 0.2, 1); }
.footer.full-width { margin-left: 0 !important; }
.footer-btn { background: #f8f9fa; border: none; padding: 0.5rem 1.2rem; border-radius: 30px; font-weight: 700; cursor: pointer; margin: 0 0.5rem; transition: 0.3s; font-size: 0.85rem; }
.footer-btn:hover { background: var(--primary-color); color: white; }

.sidebar-backdrop { display: none; } /* Disabled as per user request */

/* Elementi Interattivi Esercizi */
.completion-input {
    border: none;
    border-bottom: 2px dashed var(--primary-color);
    background: #f0f7ff;
    padding: 2px 8px;
    font-size: 1.15rem;
    font-weight: 700;
    color: var(--primary-color);
    width: auto;
    max-width: 100%;
    border-radius: 4px;
    outline: none;
    transition: 0.3s;
    font-family: inherit;
    display: inline-block;
    margin: 0 5px;
    vertical-align: middle;
}
td .completion-input {
    margin: 0;
    background: transparent;
    border-radius: 0;
    padding: 8px;
}
.completion-input:focus { background: white; border-bottom: 2px solid var(--primary-color); box-shadow: 0 4px 15px rgba(0,0,0,0.05); }

.drag-container { display: flex; gap: 2rem; margin: 2rem 0; justify-content: center; flex-wrap: wrap; }
.draggable-item {
    padding: 1rem 1.5rem; background: white; border: 2px solid #ddd; border-radius: 15px;
    cursor: grab; font-weight: 700; transition: 0.2s; box-shadow: 0 4px 6px rgba(0,0,0,0.05);
}
.draggable-item:active { cursor: grabbing; transform: scale(0.95); }
.drop-zone {
    min-width: 150px; min-height: 60px; padding: 1rem; border: 2px dashed #ccc;
    border-radius: 20px; display: flex; align-items: center; justify-content: center;
    background: #fafafa; transition: 0.3s;
}
.drop-zone.over { border-color: var(--primary-color); background: #e0f7fa; }

.word-tag.selected { background: var(--primary-color); color: white; transform: translateY(-2px); }

.word-selector-span {
    display: inline-block;
    padding: 2px 4px;
    margin: 0 2px;
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.2s;
    border-bottom: 3px solid transparent;
}

.word-selector-span:hover {
    background: #f0f7ff;
}

.word-selector-span.selected {
    background: rgba(93, 95, 239, 0.1);
    border-bottom-color: var(--primary-color);
    font-weight: 800;
    color: var(--primary-color);
}

.theory-schema {
    background: white; border: 1px solid #e0e0e0; border-radius: 25px; padding: 2rem;
    margin: 1.5rem 0; box-shadow: 0 10px 20px rgba(0,0,0,0.03);
}
.schema-row { display: flex; align-items: center; gap: 1rem; margin-bottom: 1rem; }
.schema-label { background: var(--primary-color); color: white; padding: 0.5rem 1rem; border-radius: 10px; font-weight: 800; min-width: 120px; text-align: center; }

@media (max-width: 1024px) {
    .footer { margin-left: 0; }
}
/* Home Page Redesign */
.home-header {
    text-align: center;
    margin-bottom: 3rem;
}

.main-title {
    font-size: 3rem;
    font-weight: 800;
    color: var(--primary-color);
    margin-bottom: 1rem;
}

.home-description {
    font-size: 1.2rem;
    max-width: 800px;
    margin: 0 auto 1.5rem auto;
    line-height: 1.6;
    color: #4b4b4b;
}

.home-cta {
    font-size: 1.4rem;
    font-weight: 700;
    color: var(--accent-color);
    text-transform: uppercase;
    letter-spacing: 1px;
}

.home-main-layout {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 3rem;
    padding: 2rem 0;
}

.home-side {
    display: flex;
    flex-direction: column;
    gap: 2rem;
}

.home-center {
    flex: 0 1 400px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
}

.hero-image-new {
    width: 100%;
    max-width: 350px;
    border-radius: 40px;
    box-shadow: 0 25px 50px rgba(0,0,0,0.15);
    transition: transform 0.3s ease;
}

.hero-image-new:hover {
    transform: scale(1.02);
}

.materia-card-home {
    background: white;
    padding: 2rem;
    border-radius: 25px;
    text-align: center;
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: 0 10px 20px rgba(0,0,0,0.05);
    border: 2px solid transparent;
    width: 180px;
}

.materia-card-home:hover {
    transform: translateY(-10px);
    box-shadow: 0 20px 40px rgba(0,0,0,0.1);
    border-color: var(--primary-color);
}

.materia-card-home .materia-icon {
    font-size: 3rem;
    margin-bottom: 1rem;
    display: block;
}

.materia-card-home .materia-label {
    font-size: 1.1rem;
    font-weight: 700;
    color: var(--text-color);
}

@media (max-width: 1024px) {
    .home-main-layout {
        flex-direction: column;
        gap: 2rem;
    }
    .home-side {
        flex-direction: row;
        justify-content: center;
        flex-wrap: wrap;
    }
    .main-title {
        font-size: 2.2rem;
    }
}

/* Vocabulary & Profile Styles */
.vocabulary-word {
    cursor: pointer;
    transition: all 0.2s;
    border-radius: 4px;
    padding: 0 2px;
}

.vocabulary-word:hover {
    background: #fff3bf;
    color: #e67e22;
}

.profile-dashboard {
    display: grid;
    grid-template-columns: 1fr 2fr;
    gap: 2rem;
}

.profile-card {
    background: white;
    padding: 2rem;
    border-radius: 30px;
    box-shadow: 0 10px 30px rgba(0,0,0,0.05);
}

.stat-item {
    text-align: center;
    padding: 1.5rem;
    background: #f8f9fa;
    border-radius: 20px;
    margin-bottom: 1rem;
}

.stat-value {
    font-size: 2.5rem;
    font-weight: 800;
    color: var(--primary-color);
}

.stat-label {
    font-size: 0.9rem;
    font-weight: 700;
    color: #666;
    text-transform: uppercase;
}

.vocab-list {
    display: flex;
    flex-wrap: wrap;
    gap: 0.8rem;
    margin-top: 1.5rem;
}

.vocab-tag {
    background: #f1f2f6;
    padding: 0.6rem 1.2rem;
    border-radius: 50px;
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    transition: 0.2s;
}

.vocab-tag:hover {
    background: #dfe4ea;
}

.vocab-remove {
    cursor: pointer;
    color: #ff7f7f;
    font-size: 1.2rem;
    line-height: 1;
}

@media (max-width: 768px) {
    .profile-dashboard {
        grid-template-columns: 1fr;
    }
}

/* Scrollbar Customization for Profile Cards */
.vocab-list::-webkit-scrollbar,
.profile-card div::-webkit-scrollbar {
    width: 6px;
}

.vocab-list::-webkit-scrollbar-track,
.profile-card div::-webkit-scrollbar-track {
    background: #f1f1f1;
    border-radius: 10px;
}

.vocab-list::-webkit-scrollbar-thumb,
.profile-card div::-webkit-scrollbar-thumb {
    background: #ccc;
    border-radius: 10px;
}

.vocab-list::-webkit-scrollbar-thumb:hover,
.profile-card div::-webkit-scrollbar-thumb:hover {
    background: var(--primary-color);
}

/* --- LOGIN OVERLAY --- */
.login-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.7);
    backdrop-filter: blur(10px);
    z-index: 9999;
    display: flex;
    align-items: flex-start; /* Permette lo scroll se il contenuto è lungo */
    justify-content: center;
    overflow-y: auto;
    padding: 2rem 1rem;
    opacity: 0;
    visibility: hidden;
    transition: all 0.5s ease;
}

.login-overlay.hidden {
    display: none;
}

.login-overlay:not(.hidden) {
    display: flex;
    opacity: 1 !important;
    visibility: visible !important;
}

.login-card {
    background: white;
    width: 90%;
    max-width: 450px;
    padding: 3rem;
    border-radius: 40px;
    box-shadow: 0 25px 50px rgba(0, 0, 0, 0.2);
    text-align: center;
    transform: translateY(30px);
    transition: all 0.5s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

.login-overlay:not(.hidden) .login-card {
    transform: translateY(0);
}

.login-logo {
    width: 100px;
    margin-bottom: 1.5rem;
}

.login-header h2 {
    font-size: 1.8rem;
    font-weight: 800;
    color: var(--text-color);
    margin-bottom: 0.5rem;
}

.login-header p {
    color: #666;
    margin-bottom: 2rem;
}

#user-name-input {
    width: 100%;
    padding: 1.2rem;
    border-radius: 15px;
    border: 2px solid #eee;
    font-size: 1.1rem;
    font-family: inherit;
    margin-bottom: 1.5rem;
    outline: none;
    transition: border-color 0.3s;
    text-align: center;
}

#user-name-input:focus {
    border-color: var(--primary-color);
}

.avatar-selector {
    margin-bottom: 2rem;
}

.avatar-selector p {
    font-weight: 600;
    font-size: 0.9rem;
    margin-bottom: 1rem;
}

.avatar-options {
    display: flex;
    justify-content: center;
    gap: 1rem;
}

.avatar-opt {
    width: 45px;
    height: 45px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: #f8f9fa;
    border-radius: 50%;
    font-size: 1.5rem;
    cursor: pointer;
    border: 2px solid transparent;
    transition: all 0.2s;
}

.avatar-opt:hover {
    background: #eee;
}

.avatar-opt.active {
    border-color: var(--primary-color);
    background: white;
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.1);
}

.login-submit {
    width: 100%;
    padding: 1.2rem;
    font-weight: 800;
    font-size: 1.1rem;
    margin-bottom: 1rem;
}

.btn-guest {
    background: none;
    border: none;
    color: #888;
    font-weight: 600;
    cursor: pointer;
    font-size: 0.9rem;
    text-decoration: underline;
}

/* --- PROFILE DASHBOARD --- */
.profile-header {
    background: white;
    padding: 2.5rem;
    border-radius: 30px;
    box-shadow: 0 10px 30px rgba(0,0,0,0.05);
    margin-bottom: 2rem;
    display: flex;
    align-items: center;
    gap: 2rem;
    position: relative;
    overflow: hidden;
}

.profile-avatar-large {
    width: 120px;
    height: 120px;
    border-radius: 50%;
    border: 5px solid white;
    box-shadow: 0 5px 15px rgba(0,0,0,0.1);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 3.5rem;
    background: #f8f9fa;
    flex-shrink: 0;
    overflow: hidden;
}

.profile-avatar-large img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.profile-info {
    flex-grow: 1;
}

.profile-name {
    font-size: 2rem;
    font-weight: 900;
    color: var(--text-color);
    margin-bottom: 0.5rem;
    letter-spacing: -0.5px;
}

.profile-badges {
    display: flex;
    gap: 0.6rem;
    flex-wrap: wrap;
}

.badge {
    padding: 0.4rem 1.2rem;
    border-radius: 50px;
    font-size: 0.85rem;
    font-weight: 800;
    text-transform: uppercase;
}

.badge.rank { background: var(--primary-color); color: white; }
.badge.role { background: #f1f2f6; color: #57606f; }

.guest-notice {
    color: #ffa502;
    font-size: 0.8rem;
    margin-top: 0.8rem;
    font-weight: 700;
}

.profile-actions {
    display: flex;
    flex-direction: column;
    gap: 0.8rem;
}

.btn-edit {
    background: rgba(93, 95, 239, 0.1) !important;
    color: var(--primary-color) !important;
    border: 1.5px solid var(--primary-color) !important;
}

.btn-logout {
    background: #fff5f5 !important;
    color: #e74c3c !important;
    border: 1.5px solid #feb2b2 !important;
}

.teacher-area {
    width: 100%;
}

.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 1.5rem;
    margin-bottom: 2rem;
}

.stat-card {
    background: white;
    padding: 1.5rem;
    border-radius: 20px;
    box-shadow: 0 4px 15px rgba(0,0,0,0.02);
    display: flex;
    align-items: center;
    gap: 1.2rem;
}

.stat-icon {
    font-size: 2rem;
    width: 50px;
    height: 50px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: #f0f7ff;
    border-radius: 12px;
}

.stat-info h4 {
    font-size: 0.8rem;
    color: #888;
    text-transform: uppercase;
    letter-spacing: 1px;
    margin-bottom: 0.2rem;
}

.stat-info p {
    font-size: 1.4rem;
    font-weight: 800;
    color: var(--text-color);
}

.profile-sections {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 2rem;
}

.profile-card {
    background: white;
    padding: 2rem;
    border-radius: 25px;
    box-shadow: 0 4px 20px rgba(0,0,0,0.03);
}

.profile-card-title {
    font-size: 1.2rem;
    font-weight: 800;
    margin-bottom: 1.5rem;
    display: flex;
    align-items: center;
    gap: 0.8rem;
}

.vocab-list {
    max-height: 300px;
    overflow-y: auto;
}

.vocab-item {
    padding: 1rem;
    border-bottom: 1px solid #f0f0f0;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.history-item {
    padding: 1rem;
    border-radius: 12px;
    background: #f8f9fa;
    margin-bottom: 0.8rem;
    display: flex;
    align-items: center;
    gap: 1rem;
    cursor: pointer;
    transition: transform 0.2s;
}

.history-item:hover {
    transform: translateX(5px);
    background: #f0f7ff;
}

@media (max-width: 768px) {
    .profile-sections, .teacher-area > div {
        grid-template-columns: 1fr !important;
    }
}

/* --- ROLE SELECTOR --- */
.role-selector {
    margin-bottom: 1.5rem;
}

.role-selector p {
    font-weight: 600;
    font-size: 0.9rem;
    margin-bottom: 0.8rem;
}

.role-options {
    display: flex;
    gap: 1rem;
    justify-content: center;
}

.role-opt {
    flex: 1;
    padding: 0.8rem;
    border-radius: 15px;
    border: 2px solid #eee;
    background: white;
    cursor: pointer;
    font-weight: 700;
    transition: all 0.3s;
    font-family: inherit;
}

.profile-setup-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 3rem;
}

@media (max-width: 600px) {
    .profile-setup-grid {
        grid-template-columns: 1fr;
        gap: 2rem;
    }
}

.role-opt.active {
    border-color: var(--primary-color);
    background: #f0f7ff;
    color: var(--primary-color);
    box-shadow: 0 4px 10px rgba(52, 152, 219, 0.1);
}

/* --- LEGAL CHECKS --- */
.legal-checks {
    text-align: left;
    margin-bottom: 1.5rem;
    padding: 0 0.5rem;
}

.check-container {
    display: flex;
    align-items: center;
    position: relative;
    padding-left: 35px;
    margin-bottom: 12px;
    cursor: pointer;
    font-size: 0.85rem;
    line-height: 1.4;
    user-select: none;
    color: #666;
}

.check-container input {
    position: absolute;
    opacity: 0;
    cursor: pointer;
    height: 0;
    width: 0;
}

.checkmark {
    position: absolute;
    top: 0;
    left: 0;
    height: 22px;
    width: 22px;
    background-color: #eee;
    border-radius: 6px;
    transition: all 0.2s;
}

.check-container:hover input ~ .checkmark {
    background-color: #ccc;
}

.check-container input:checked ~ .checkmark {
    background-color: var(--primary-color);
}

.checkmark:after {
    content: "";
    position: absolute;
    display: none;
}

.check-container input:checked ~ .checkmark:after {
    display: block;
}

.check-container .checkmark:after {
    left: 8px;
    top: 4px;
    width: 5px;
    height: 10px;
    border: solid white;
    border-width: 0 3px 3px 0;
    transform: rotate(45deg);
}

.check-text a {
    color: var(--primary-color);
    text-decoration: underline;
}

/* --- LEGAL MODAL --- */
.legal-modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0,0,0,0.8);
    backdrop-filter: blur(5px);
    z-index: 10000;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s;
}

.legal-modal:not(.hidden) {
    opacity: 1 !important;
    visibility: visible !important;
}

.legal-modal-content {
    background: white;
    width: 90%;
    max-width: 600px;
    max-height: 80vh;
    padding: 3rem;
    border-radius: 30px;
    position: relative;
    overflow-y: auto;
}

.close-legal {
    position: absolute;
    top: 20px;
    right: 25px;
    font-size: 2rem;
    cursor: pointer;
    color: #888;
}

#legal-text-container h2 {
    margin-bottom: 1.5rem;
    color: var(--text-color);
    font-weight: 800;
}

#legal-text-container h3 {
    margin-top: 1.5rem;
    margin-bottom: 0.5rem;
    font-size: 1.1rem;
    color: var(--primary-color);
}

#legal-text-container p {
    margin-bottom: 1rem;
    line-height: 1.6;
    color: #555;
    font-size: 0.95rem;
}

/* --- SHARE DROPDOWN --- */
.teacher-share-container {
    position: relative;
    display: inline-block;
}

.share-dropdown {
    position: absolute;
    top: 100%;
    right: 0;
    width: 250px;
    background: white;
    border-radius: 20px;
    box-shadow: 0 15px 40px rgba(0,0,0,0.15);
    padding: 1.5rem;
    z-index: 1000;
    margin-top: 10px;
    border: 1px solid #f0f0f0;
    transform-origin: top right;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.share-dropdown.hidden {
    opacity: 0;
    visibility: hidden;
    transform: scale(0.95);
}

.share-section-title {
    font-size: 0.75rem;
    font-weight: 800;
    color: #95a5a6;
    text-transform: uppercase;
    letter-spacing: 1px;
    margin-bottom: 0.8rem;
    margin-top: 1rem;
}

.share-section-title:first-child {
    margin-top: 0;
}

.share-btn-list {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.share-action-btn {
    width: 100%;
    padding: 0.8rem;
    border-radius: 12px;
    border: 1px solid #eee;
    background: #f9f9f9;
    color: #2c3e50;
    font-size: 0.85rem;
    font-weight: 700;
    text-align: left;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 0.8rem;
    transition: all 0.2s;
    font-family: inherit;
}

.share-action-btn:hover {
    background: #f0f7ff;
    border-color: var(--primary-color);
    color: var(--primary-color);
    transform: translateX(5px);
}

.share-action-btn.classroom:hover {
    background: #e8f5e9;
    border-color: #2e7d32;
    color: #2e7d32;
}

/* --- CONTACT FORM SECTION --- */
.contact-card-wrapper {
    display: flex;
    max-width: 1250px;
    margin: 0 auto;
    background: white;
    border-radius: 40px;
    overflow: hidden;
    box-shadow: 0 20px 60px rgba(0,0,0,0.1);
}

.contact-info-side {
    flex: 1;
    background: #1e4bd1;
    color: white;
    padding: 4rem;
    display: flex;
    flex-direction: column;
    gap: 2rem;
}

.contact-info-side h2 {
    font-size: 3.5rem;
    font-weight: 800;
    line-height: 1.1;
    margin-bottom: 1rem;
}

.contact-info-side p {
    font-size: 1.2rem;
    opacity: 0.9;
    line-height: 1.5;
}

.contact-method {
    display: flex;
    align-items: center;
    gap: 1rem;
    font-size: 1.2rem;
    font-weight: 600;
    margin-top: 1rem;
}

.contact-method-icon {
    width: 50px;
    height: 50px;
    background: rgba(255,255,255,0.2);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.5rem;
}

.info-card-box {
    background: rgba(255,255,255,0.1);
    border: 1px solid rgba(255,255,255,0.2);
    padding: 2rem;
    border-radius: 25px;
    margin-top: auto;
    display: flex;
    gap: 1.5rem;
    align-items: flex-start;
}

.info-card-icon {
    width: 60px;
    height: 60px;
    background: rgba(255,255,255,0.2);
    border-radius: 15px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 2rem;
    flex-shrink: 0;
}

.info-card-text h4 {
    font-size: 1.3rem;
    margin-bottom: 0.5rem;
    font-weight: 800;
}

.info-card-text p {
    font-size: 1rem;
    opacity: 0.8;
}

.contact-form-side {
    flex: 1.2;
    padding: 4rem;
    background: white;
}

.form-group-contact {
    margin-bottom: 2rem;
}

.form-group-contact label {
    display: block;
    font-weight: 800;
    font-size: 1.1rem;
    margin-bottom: 0.8rem;
    color: var(--text-color);
}

.form-group-contact input, 
.form-group-contact textarea {
    width: 100%;
    padding: 1.2rem;
    border: 2px solid #f0f0f0;
    border-radius: 15px;
    font-family: inherit;
    font-size: 1.1rem;
    transition: all 0.3s;
    background: #fdfdfd;
}

.form-group-contact input:focus, 
.form-group-contact textarea:focus {
    border-color: #1e4bd1;
    outline: none;
    background: white;
    box-shadow: 0 5px 15px rgba(30, 75, 209, 0.05);
}

.form-group-contact textarea {
    height: 180px;
    resize: none;
}

.contact-legal {
    display: flex;
    gap: 1rem;
    margin-bottom: 2.5rem;
    align-items: flex-start;
}

.contact-legal input[type="checkbox"] {
    width: 24px;
    height: 24px;
    margin-top: 3px;
    cursor: pointer;
}

.contact-legal label {
    font-size: 0.95rem;
    line-height: 1.5;
    color: #555;
    font-weight: 600;
}

.contact-legal a {
    color: #1e4bd1;
    text-decoration: underline;
}

.btn-contact-submit {
    width: 100%;
    background: #1e4bd1;
    color: white;
    padding: 1.5rem;
    border-radius: 20px;
    font-size: 1.2rem;
    font-weight: 800;
    border: none;
    cursor: pointer;
    transition: all 0.3s;
    box-shadow: 0 10px 20px rgba(30, 75, 209, 0.2);
}

.btn-contact-submit:hover {
    transform: translateY(-5px);
    box-shadow: 0 15px 30px rgba(30, 75, 209, 0.3);
    background: #1538a1;
}

@media (max-width: 992px) {
    .contact-card-wrapper {
        flex-direction: column !important;
        border-radius: 0 !important;
        box-shadow: none !important;
        width: 100% !important;
        margin: 0 !important;
        max-width: 100% !important;
    }
    .contact-info-side {
        padding: 5rem 1.5rem 3rem !important;
    }
    .contact-info-side h2 {
        font-size: 2.2rem !important;
    }
    .contact-method {
        font-size: 1.1rem !important;
        word-break: break-all !important;
    }
    .info-card-box {
        flex-direction: column !important;
        background: rgba(255,255,255,0.1) !important;
        border-radius: 20px !important;
        padding: 1.5rem !important;
        box-shadow: 0 5px 15px rgba(0,0,0,0.05) !important;
    }
    .contact-form-side {
        padding: 3rem 1.5rem !important;
        background: white !important;
    }
}

.footer-logo {
    width: 60px;
    height: auto;
    transition: all 0.3s ease;
    filter: drop-shadow(0 5px 15px rgba(0,0,0,0.1));
}

.footer-logo:hover {
    filter: drop-shadow(0 8px 20px rgba(93, 95, 239, 0.2));
}

/* Note: .btn-verify buttons are managed individually by JS logic */

/* --- LOGIN PATH STYLES --- */
.login-path-card {
    background: #f8faff;
    border: 2px solid #eee;
    border-radius: 20px;
    padding: 1.2rem;
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.login-path-card:hover {
    transform: translateX(5px);
    border-color: var(--secondary-color);
    background: white;
    box-shadow: 0 10px 20px rgba(0,0,0,0.05);
}

.login-path-card.active {
    border-color: var(--primary-color);
    background: white;
    box-shadow: 0 10px 25px rgba(93, 95, 239, 0.1);
}

.login-path-card.active h4 {
    color: var(--primary-color);
}

/* --- ONBOARDING STYLES --- */
.onboarding-container {
    animation: fadeIn 0.8s ease-out;
}

.onboarding-card-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 2rem;
}

@media (max-width: 900px) {
    .onboarding-card-grid {
        grid-template-columns: 1fr;
        gap: 1.5rem;
    }
}

.onboarding-card {
    border: 1px solid rgba(0,0,0,0.05);
}

.role-opt-large {
    background: #fff;
    border: 2px solid #f0f0f0;
    border-radius: 40px;
    padding: 3rem 2rem;
    text-align: center;
    cursor: pointer;
    transition: all 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 1.2rem;
    box-shadow: 0 4px 6px rgba(0,0,0,0.02);
}

.role-opt-large h3 {
    font-weight: 900;
    letter-spacing: -0.5px;
    margin: 0;
}

.role-opt-large p {
    font-size: 0.95rem;
    color: #777;
    line-height: 1.5;
}

.role-opt-large:hover {
    transform: translateY(-12px);
    border-color: var(--primary-color);
    box-shadow: 0 25px 50px rgba(255, 127, 127, 0.15);
}

.role-opt-large.active {
    background: white;
    border-color: var(--primary-color);
    box-shadow: 0 20px 40px rgba(93, 95, 239, 0.15);
}

.role-opt-large h4 {
    font-size: 1.4rem;
    color: var(--primary-color);
}

.role-opt-large p {
    font-size: 0.9rem;
    opacity: 0.7;
}

.onboarding-step.hidden {
    display: none;
}

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(20px); }
    to { opacity: 1; transform: translateY(0); }
}

@media (max-width: 768px) {
    .onboarding-container { padding: 2rem 1rem; }
    .role-opt-large { padding: 1.5rem; }
}

/* 📱 OTTIMIZZAZIONE MOBILE: Rimozione Card per massimizzare lo spazio di lettura */
@media (max-width: 768px) {
    /* Trasformiamo la card in un contenitore trasparente a tutta larghezza */
    .exercise-container {
        background: transparent !important;
        padding: 1.5rem 0.2rem !important;
        border-radius: 0 !important;
        box-shadow: none !important;
        border: none !important;
        width: 100% !important;
        max-width: 100% !important;
    }
    
    /* I testi di lettura non devono più avere bordi o sfondi bianchi */
    .reading-text {
        padding: 1.5rem 0.5rem !important;
        background: transparent !important;
        border: none !important;
        font-size: 1.3rem !important;
        line-height: 1.7 !important;
    }
    
    .exercise-title {
        font-size: 1.6rem !important;
        margin-bottom: 1.5rem !important;
        padding: 0 0.5rem 0.5rem 0.5rem !important;
    }

    /* Riduciamo il padding globale del corpo pagina per dare più respiro */
    main {
        padding-left: 0.8rem !important;
        padding-right: 0.8rem !important;
    }

    /* Anche la teoria e gli schemi diventano meno ingombranti */
    .theory-schema, .map-container, .example-box {
        padding: 1.2rem !important;
        border-radius: 15px !important;
        margin: 1rem 0 !important;
    }

    /* Le griglie di opzioni usano meglio lo spazio */
    .options-grid {
        grid-template-columns: 1fr !important; /* Una sola colonna su mobile molto piccolo */
        gap: 0.8rem !important;
    }
}

/* 📱 OTTIMIZZAZIONE MOBILE: Rimozione Card per massimizzare lo spazio di lettura */
@media (max-width: 768px) {
    .exercise-container {
        background: transparent !important;
        padding: 1.5rem 0.2rem !important;
        border-radius: 0 !important;
        box-shadow: none !important;
        border: none !important;
        width: 100% !important;
        max-width: 100% !important;
    }
    
    .reading-text {
        padding: 1.5rem 0.5rem !important;
        background: transparent !important;
        border: none !important;
        font-size: 1.3rem !important;
        line-height: 1.7 !important;
    }
    
    .exercise-title {
        font-size: 1.6rem !important;
        margin-bottom: 1.5rem !important;
        padding: 0 0.5rem 0.5rem 0.5rem !important;
    }

    main {
        padding-left: 0.8rem !important;
        padding-right: 0.8rem !important;
    }

    .theory-schema, .map-container, .example-box {
        padding: 1.2rem !important;
        border-radius: 15px !important;
        margin: 1rem 0 !important;
    }

    .options-grid {
        grid-template-columns: 1fr !important;
        gap: 0.8rem !important;
    }
}

/* 📱 OTTIMIZZAZIONE RADICALE MOBILE: Eliminazione "Effetto Card" */
@media (max-width: 992px) {
    main {
        padding: 5rem 0.5rem 1rem 0.5rem !important; 
        background-color: white !important; 
    }

    /* Rimuoviamo bordi, ombre e padding eccessivi da TUTTI i contenitori card-like */
    .exercise-container, .full-width .exercise-container,
    .interactive-container, .full-width .interactive-container,
    .reading-text, .full-width .reading-text,
    .theory-schema, .map-container, .example-box, .question-block, .profile-card, .stat-card,
    .theory-section, .instruction-box, .profile-header, .teacher-area {
        background: white !important;
        padding-left: 0 !important;
        padding-right: 0 !important;
        padding-top: 1rem !important;
        padding-bottom: 1rem !important;
        margin: 0 !important;
        width: 100% !important;
        max-width: 100% !important;
        border-radius: 0 !important;
        box-shadow: none !important;
        border: none !important;
        display: block !important;
    }

    /* Forza allineamento a sinistra e font-size leggibile per la lettura */
    .reading-text, .reading-text p, .reading-text li, 
    .interactive-container, .interactive-container p,
    .theory-section, .theory-section p, .instruction-box {
        font-size: 1.35rem !important;
        line-height: 1.7 !important;
        text-align: left !important;
        margin-bottom: 1.2rem !important;
        width: 100% !important;
        max-width: 100% !important;
    }

    .exercise-title {
        font-size: 1.4rem !important;
        padding: 1.2rem 0.5rem 0.5rem 0.5rem !important; /* Spazio per hamburger */
        margin-bottom: 1.2rem !important;
        border-bottom: 2px solid #f0f0f0 !important;
        text-align: left !important;
    }

    /* TRASFORMAZIONE GRID IN LISTE SLIM PER MOBILE */
    .materie-grid, .all-levels-container, .levels-list, [style*="display: grid"] {
        display: flex !important;
        flex-direction: column !important;
        gap: 0.8rem !important;
    }

    .materia-card, .menu-card, .level-row, .list-item {
        padding: 1.2rem 1.5rem !important;
        display: flex !important;
        flex-direction: row !important;
        align-items: center !important;
        justify-content: flex-start !important;
        text-align: left !important;
        border-radius: 20px !important;
        min-height: auto !important;
        gap: 1.2rem !important;
        box-shadow: 0 4px 10px rgba(0,0,0,0.03) !important;
        background: #fdfdfd !important;
        border: 1px solid #eee !important;
        margin: 0 !important;
        width: 100% !important;
        position: relative !important;
    }

    .materia-icon, .menu-card .icon, .list-item span:first-child, .level-row span:first-child {
        font-size: 1.8rem !important;
        margin-bottom: 0 !important;
        min-width: 45px !important;
        text-align: center !important;
        display: inline-flex !important;
        align-items: center !important;
        justify-content: center !important;
    }

    .materia-label, .materia-card h3, .menu-card h3, .list-item-content, .level-row span:not(:first-child):not(:last-child), .level-row span:nth-child(2) {
        font-size: 1.15rem !important;
        font-weight: 700 !important;
        margin: 0 !important;
        color: var(--text-color) !important;
        flex-grow: 1 !important;
        display: block !important;
    }

    /* Rimuoviamo descrizioni lunghe e frecce duplicate in modo mirato */
    .menu-card p, .materia-card p, .level-row span[style*="color: var(--primary-color)"] {
        display: none !important;
    }

    /* Aggiungiamo una freccia uniforme a destra solo dove serve */
    .materia-card::after, .menu-card::after {
        content: '➜';
        font-weight: 800;
        color: var(--primary-color);
        font-size: 1.2rem;
        margin-left: auto;
    }

    .options-grid {
        grid-template-columns: 1fr !important;
        gap: 0.8rem !important;
        padding: 0 0.5rem !important;
    }

    .btn-secondary {
        padding: 1.2rem !important;
        font-size: 1rem !important;
        text-align: left !important;
    }

    /* Sistemazione Header Profilo su Mobile */
    .profile-header {
        flex-direction: column !important;
        text-align: center !important;
        padding-top: 1rem !important;
        gap: 1.5rem !important;
    }
    
    .profile-avatar-large {
        width: 100px !important;
        height: 100px !important;
        margin: 0 auto 1rem !important;
    }
    
    .profile-name {
        font-size: 1.6rem !important;
        text-align: center !important;
    }
    
    .profile-badges {
        justify-content: center !important;
        margin-bottom: 1rem !important;
    }
    
    .profile-actions {
        flex-direction: row !important;
        gap: 0.5rem !important;
        margin-top: 1rem !important;
    }

    /* Avviciniamo il pulsante menu al bordo */
    .floating-toggle {
        top: 0.8rem !important;
        left: 0.8rem !important;
        width: 42px !important;
        height: 42px !important;
        border-radius: 10px !important;
    }
    
    #app {
        margin-top: 0.5rem !important;
    }
}

@media (max-width: 480px) {
    main {
        padding: 3.2rem 0.2rem 1rem 0.2rem !important;
    }
    
    .reading-text, .reading-text p {
        font-size: 1.25rem !important;
    }
}

/* --- READING HEADER --- */
.reading-header {
    background: var(--primary-color);
    color: white;
    padding: 1rem;
    border-radius: 15px;
    margin-bottom: 2rem;
    font-weight: 800;
    text-align: center;
    letter-spacing: 2px;
    text-transform: uppercase;
}

@media (max-width: 992px) {
    .reading-header {
        padding: 0.8rem !important;
        font-size: 0.85rem !important;
        border-radius: 10px !important;
        margin-bottom: 1.2rem !important;
        letter-spacing: 1px !important;
        width: 100% !important;
    }
}

/* ========================================================= */
/* TEST DI CULTURA GENERALE - NUOVA SEZIONE ISOLATA          */
/* ========================================================= */
.cg-container {
    max-width: 1000px;
    margin: 0 auto;
    padding: 2rem;
}
.cg-title {
    font-size: 2.2rem;
    font-weight: 800;
    color: var(--primary-color);
    margin-bottom: 1rem;
}
.cg-tabs {
    display: flex;
    gap: 1rem;
    margin-bottom: 2rem;
    border-bottom: 2px solid #eee;
}
.cg-tab {
    padding: 1rem 2rem;
    background: transparent;
    border: none;
    font-size: 1.1rem;
    font-weight: 700;
    color: #888;
    cursor: pointer;
    border-bottom: 3px solid transparent;
}
.cg-tab.active {
    color: var(--primary-color);
    border-bottom: 3px solid var(--primary-color);
}
.cg-library-grid, .cg-test-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 1.5rem;
}
.cg-level-section {
    margin-bottom: 2rem;
}
.cg-level-section .level-title {
    font-size: 1.5rem;
    font-weight: 800;
    margin-bottom: 1rem;
    border-bottom: 2px solid #eee;
    padding-bottom: 0.5rem;
}
.cg-card {
    background: white;
    border-radius: 12px;
    padding: 1.5rem;
    box-shadow: 0 4px 15px rgba(0,0,0,0.05);
    border: 1px solid #f0f0f0;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
}
.cg-card-completed {
    opacity: 0.7;
    background: #f9f9f9;
}
.cg-card h4, .cg-card h3 {
    margin: 0 0 1rem 0;
    color: #333;
    font-weight: 800;
}
.cg-btn {
    width: 100%;
    margin-top: 1rem;
    padding: 0.8rem;
    border-radius: 8px;
    font-weight: 700;
    cursor: pointer;
}
.cg-modal-overlay {
    position: fixed; top: 0; left: 0; width: 100%; height: 100%;
    background: rgba(0,0,0,0.5);
    display: flex; align-items: center; justify-content: center;
    z-index: 9999;
    padding: 1rem;
}
.cg-modal {
    background: white;
    border-radius: 15px;
    width: 100%; max-width: 600px;
    display: flex; flex-direction: column;
    max-height: 90vh;
}
.cg-modal-header {
    padding: 1.5rem; border-bottom: 1px solid #eee;
    display: flex; justify-content: space-between; align-items: center;
}
.cg-modal-header h3 { margin: 0; }
.cg-modal-close {
    background: none; border: none; font-size: 1.5rem; cursor: pointer;
}
.cg-modal-body {
    padding: 1.5rem;
    overflow-y: auto;
}
.cg-form-group {
    margin-bottom: 1rem;
}
.cg-form-row {
    display: flex; gap: 1rem;
}
.cg-form-row .cg-form-group { flex: 1; }
.cg-form-group label {
    display: block; font-weight: 700; margin-bottom: 0.5rem; color: #555;
}
.cg-form-group input, .cg-form-group textarea {
    width: 100%; padding: 0.8rem; border-radius: 8px; border: 1px solid #ccc; font-family: inherit;
}
.cg-modal-footer {
    padding: 1.5rem; border-top: 1px solid #eee;
    display: flex; justify-content: flex-end; gap: 1rem;
}

/* TEST UI */
.cg-test-page {
    max-width: 800px; margin: 0 auto; padding: 2rem 1rem;
}
.cg-protocollo {
    background: white; padding: 3rem; border-radius: 12px;
    box-shadow: 0 10px 30px rgba(0,0,0,0.1);
    border: 1px solid #e0e0e0;
}
.cg-prot-header {
    border-bottom: 2px solid #222; padding-bottom: 1.5rem; margin-bottom: 2rem;
}
.cg-prot-school {
    text-align: center; font-size: 1.2rem; font-weight: 800; letter-spacing: 1px; text-transform: uppercase; margin-bottom: 1rem;
}
.cg-prot-details {
    display: flex; justify-content: space-between; margin-bottom: 1rem; font-size: 0.95rem;
}
.cg-prot-student {
    font-size: 1.2rem; border: 1px solid #ccc; padding: 1rem; border-radius: 8px; background: #fafafa;
}
.cg-prot-title {
    text-align: center; margin-bottom: 3rem; font-size: 1.8rem;
}

/* QUESTIONS */
.cg-question-block {
    margin-bottom: 2.5rem;
}
.cg-q-text {
    font-size: 1.2rem; font-weight: 600; margin-bottom: 1rem; line-height: 1.5;
}
.cg-q-options {
    display: flex; flex-direction: column; gap: 0.8rem;
}
.cg-q-option {
    display: flex; align-items: center; gap: 1rem;
    padding: 1rem; border: 2px solid #eee; border-radius: 8px;
    cursor: pointer; transition: all 0.2s;
}
.cg-q-option:hover {
    background: #f9f9f9; border-color: #ddd;
}
.cg-q-option input[type="radio"] {
    transform: scale(1.3); cursor: pointer;
}
.cg-unanswered {
    border-left: 4px solid #e74c3c; padding-left: 1rem;
}
.cg-submit-area {
    margin-top: 4rem; text-align: center; border-top: 1px dashed #ccc; padding-top: 2rem;
}
.cg-btn-submit {
    padding: 1.2rem 3rem; font-size: 1.2rem; border-radius: 50px;
}

/* INTRO MODAL */
.cg-intro-modal {
    text-align: center; padding: 3rem;
}
.cg-intro-text {
    font-size: 1.2rem; line-height: 1.6; color: #444; margin: 2rem 0; font-weight: 500;
}

/* RESULTS & TABLES */
.cg-table {
    width: 100%; border-collapse: collapse; margin-top: 2rem;
}
.cg-table th, .cg-table td {
    padding: 1rem; text-align: left; border-bottom: 1px solid #eee;
}
.cg-table th {
    background: #f8f9fa; font-weight: 800;
}
.cg-actions {
    display: flex; gap: 1rem; margin-bottom: 2rem;
}
.cg-stats {
    display: flex; gap: 2rem; margin-bottom: 2rem;
}
.cg-stat-box {
    background: #f0f7fa; padding: 1.5rem; border-radius: 12px;
    display: flex; flex-direction: column; flex: 1; border: 1px solid #d0e7f2;
}
.cg-stat-box span { color: #555; font-size: 0.9rem; font-weight: 700; text-transform: uppercase; }
.cg-stat-box strong { font-size: 2rem; color: var(--primary-color); }

/* PRINT STYLES */
@media print {
    body * { visibility: hidden; }
    #cg-printable-area, #cg-printable-area * { visibility: visible; }
    #cg-printable-area { position: absolute; left: 0; top: 0; width: 100%; }
    .no-print { display: none !important; }
}
