/* ===================================================
   Quiz Ruolo Conducenti — Premium Dark Theme CSS
   =================================================== */

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

:root {
    --bg-primary: #080e1e;
    --bg-secondary: #0d1529;
    --bg-card: rgba(20, 33, 61, 0.65);
    --bg-card-hover: rgba(26, 42, 78, 0.8);
    --bg-input: rgba(10, 20, 40, 0.7);
    --border: rgba(255, 255, 255, 0.08);
    --border-focus: rgba(240, 192, 64, 0.5);

    --text-primary: #e8edf5;
    --text-secondary: #8896b0;
    --text-muted: #5a6a84;

    --accent: #f0c040;
    --accent-dark: #d4a82c;
    --accent-glow: rgba(240, 192, 64, 0.15);

    --blue: #3b82f6;
    --blue-dark: #1e40af;
    --green: #22c55e;
    --green-dark: #166534;
    --red: #ef4444;
    --red-dark: #991b1b;
    --yellow: #eab308;
    --yellow-dark: #854d0e;

    --gradient-hero: linear-gradient(135deg, #0a1628 0%, #162242 50%, #1a365d 100%);
    --gradient-accent: linear-gradient(135deg, #f0c040, #e6a817);
    --gradient-blue: linear-gradient(135deg, #3b82f6, #1e40af);

    --glass-bg: rgba(15, 25, 50, 0.6);
    --glass-border: rgba(255, 255, 255, 0.06);
    --glass-shadow: 0 8px 32px rgba(0, 0, 0, 0.4);

    --radius: 12px;
    --radius-lg: 18px;
    --radius-sm: 8px;

    --transition: 0.2s ease;
    --transition-slow: 0.4s ease;

    --font-body: 'Inter', system-ui, -apple-system, sans-serif;
    --font-heading: 'Outfit', 'Inter', sans-serif;
}

html {
    font-size: 16px;
    scroll-behavior: smooth;
}

body {
    font-family: var(--font-body);
    background: var(--bg-primary);
    color: var(--text-primary);
    min-height: 100vh;
    line-height: 1.6;
    -webkit-font-smoothing: antialiased;
}

/* --- Glass Card --- */
.glass-card {
    background: var(--glass-bg);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border: 1px solid var(--glass-border);
    border-radius: var(--radius-lg);
    box-shadow: var(--glass-shadow);
}

/* --- Navbar --- */
.navbar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 14px 24px;
    background: rgba(8, 14, 30, 0.85);
    backdrop-filter: blur(12px);
    border-bottom: 1px solid var(--border);
    position: sticky;
    top: 0;
    z-index: 100;
}

.nav-brand {
    display: flex;
    align-items: center;
    gap: 10px;
}

.nav-logo {
    height: 36px;
    width: auto;
    max-width: 36px;
    border-radius: 6px;
    object-fit: contain;
    mix-blend-mode: lighten;
    opacity: 0.92;
    transition: opacity var(--transition);
}

.nav-logo:hover {
    opacity: 1;
}

.nav-title {
    font-family: var(--font-heading);
    font-weight: 600;
    font-size: 17px;
    color: var(--accent);
}

.nav-user {
    display: flex;
    align-items: center;
    gap: 12px;
}

.nav-name {
    color: var(--text-secondary);
    font-size: 14px;
}

/* --- Container --- */
.container {
    max-width: 1100px;
    margin: 0 auto;
    padding: 30px 20px;
}

/* --- Login Page --- */
.login-page {
    background: var(--gradient-hero);
    min-height: 100vh;
    display: flex;
    justify-content: center;
    align-items: center;
}

.login-container {
    width: 100%;
    max-width: 440px;
    padding: 20px;
}

.login-card {
    padding: 40px 32px;
    animation: slideUp 0.5s ease;
}

.login-header {
    text-align: center;
    margin-bottom: 30px;
}

.logo-icon {
    margin-bottom: 16px;
}

.logo-icon img {
    height: 90px;
    width: auto;
    max-width: 90px;
    border-radius: 12px;
    object-fit: contain;
    mix-blend-mode: lighten;
    filter: drop-shadow(0 0 20px rgba(240, 192, 64, 0.15));
}

.login-header h1 {
    font-family: var(--font-heading);
    font-size: 22px;
    font-weight: 700;
    color: var(--accent);
    margin-bottom: 6px;
}

.subtitle {
    color: var(--text-secondary);
    font-size: 14px;
}

.login-footer {
    text-align: center;
    margin-top: 20px;
}

.login-attribution {
    text-align: center;
    margin-top: 24px;
    color: var(--text-muted);
    font-size: 12px;
}

/* --- Forms --- */
.form-group {
    margin-bottom: 18px;
}

.form-group label {
    display: block;
    margin-bottom: 6px;
    font-size: 13px;
    font-weight: 500;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.input-wrapper {
    position: relative;
    display: flex;
    align-items: center;
}

.input-icon {
    position: absolute;
    left: 14px;
    font-size: 16px;
    z-index: 1;
}

.input-wrapper input {
    width: 100%;
    padding: 13px 14px 13px 44px;
    background: var(--bg-input);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    color: var(--text-primary);
    font-size: 15px;
    font-family: var(--font-body);
    transition: var(--transition);
}

.input-wrapper input:focus {
    outline: none;
    border-color: var(--border-focus);
    box-shadow: 0 0 0 3px var(--accent-glow);
}

.toggle-password {
    position: absolute;
    right: 12px;
    background: none;
    border: none;
    font-size: 16px;
    cursor: pointer;
    padding: 4px;
    opacity: 0.6;
    transition: var(--transition);
}

.toggle-password:hover {
    opacity: 1;
}

input,
select,
textarea {
    background: var(--bg-input);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    color: var(--text-primary);
    padding: 10px 14px;
    font-size: 14px;
    font-family: var(--font-body);
    transition: var(--transition);
    width: 100%;
}

input:focus,
select:focus,
textarea:focus {
    outline: none;
    border-color: var(--border-focus);
    box-shadow: 0 0 0 3px var(--accent-glow);
}

.form-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 16px;
}

.form-hint {
    margin-top: 10px;
    color: var(--text-muted);
    font-size: 12px;
}

/* --- Buttons --- */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    padding: 11px 22px;
    border-radius: var(--radius-sm);
    font-size: 14px;
    font-weight: 600;
    font-family: var(--font-body);
    cursor: pointer;
    border: none;
    transition: all var(--transition);
    text-decoration: none;
    line-height: 1;
    white-space: nowrap;
}

.btn:hover {
    transform: translateY(-1px);
}

.btn:active {
    transform: translateY(0);
}

.btn-primary {
    background: var(--gradient-accent);
    color: #0a1628;
}

.btn-primary:hover {
    box-shadow: 0 4px 20px rgba(240, 192, 64, 0.3);
}

.btn-outline {
    background: transparent;
    border: 1px solid var(--border);
    color: var(--text-secondary);
}

.btn-outline:hover {
    border-color: var(--accent);
    color: var(--accent);
}

.btn-ghost {
    background: transparent;
    color: var(--text-secondary);
    padding: 8px 14px;
}

.btn-ghost:hover {
    color: var(--text-primary);
}

.btn-danger {
    background: var(--red);
    color: white;
}

.btn-warning {
    background: var(--yellow-dark);
    color: white;
}

.btn-success {
    background: var(--green-dark);
    color: white;
}

.btn-full {
    width: 100%;
    padding: 14px;
}

.btn-sm {
    padding: 6px 12px;
    font-size: 12px;
}

/* --- Badges --- */
.badge {
    display: inline-flex;
    align-items: center;
    padding: 4px 10px;
    border-radius: 20px;
    font-size: 12px;
    font-weight: 600;
}

.badge-green {
    background: rgba(34, 197, 94, 0.15);
    color: var(--green);
}

.badge-yellow {
    background: rgba(234, 179, 8, 0.15);
    color: var(--yellow);
}

.badge-red {
    background: rgba(239, 68, 68, 0.15);
    color: var(--red);
}

.role-badge {
    font-size: 12px;
    padding: 3px 8px;
    border-radius: 6px;
}

.role-admin {
    background: rgba(240, 192, 64, .15);
    color: var(--accent);
}

.role-user {
    background: rgba(59, 130, 246, .1);
    color: var(--blue);
}

.status-active {
    color: var(--green);
    font-weight: 600;
}

.status-inactive {
    color: var(--red);
    font-weight: 600;
}

/* --- Flash Messages --- */
.flash-message {
    padding: 12px 18px;
    border-radius: var(--radius-sm);
    margin-bottom: 20px;
    font-size: 14px;
    animation: slideDown 0.3s ease;
}

.flash-success {
    background: rgba(34, 197, 94, .12);
    color: var(--green);
    border-left: 3px solid var(--green);
}

.flash-error {
    background: rgba(239, 68, 68, .12);
    color: var(--red);
    border-left: 3px solid var(--red);
}

.flash-warning {
    background: rgba(234, 179, 8, .12);
    color: var(--yellow);
    border-left: 3px solid var(--yellow);
}

.flash-info {
    background: rgba(59, 130, 246, .1);
    color: var(--blue);
    border-left: 3px solid var(--blue);
}

/* --- Links --- */
.link-subtle {
    color: var(--text-muted);
    font-size: 13px;
    text-decoration: none;
    transition: var(--transition);
}

.link-subtle:hover {
    color: var(--accent);
}

/* --- Hero Section --- */
.hero-section {
    text-align: center;
    margin-bottom: 35px;
}

.hero-title {
    font-family: var(--font-heading);
    font-size: 28px;
    font-weight: 700;
    margin-bottom: 6px;
}

.hero-subtitle {
    color: var(--text-secondary);
    font-size: 16px;
}

/* --- Quiz Mode Cards --- */
.quiz-modes {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 24px;
    margin-bottom: 40px;
}

.mode-card {
    padding: 30px 24px;
    cursor: pointer;
    transition: all var(--transition-slow);
    text-align: center;
}

.mode-card:hover {
    transform: translateY(-4px);
    border-color: var(--accent);
    box-shadow: 0 12px 40px rgba(240, 192, 64, 0.1);
}

.mode-icon {
    font-size: 48px;
    margin-bottom: 14px;
}

.mode-card h2 {
    font-family: var(--font-heading);
    font-size: 20px;
    margin-bottom: 10px;
    color: var(--accent);
}

.mode-card p {
    color: var(--text-secondary);
    font-size: 14px;
    margin-bottom: 16px;
    line-height: 1.5;
}

.mode-details {
    display: flex;
    justify-content: center;
    gap: 16px;
    margin-bottom: 18px;
    font-size: 13px;
    color: var(--text-muted);
}

/* --- Topic Buttons --- */
.topic-grid {
    display: flex;
    flex-direction: column;
    gap: 8px;
    margin-top: 12px;
}

.topic-btn {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 16px;
    background: var(--bg-input);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    color: var(--text-primary);
    cursor: pointer;
    transition: var(--transition);
    text-align: left;
    font-family: var(--font-body);
    font-size: 13px;
    width: 100%;
}

.topic-btn:hover {
    border-color: var(--accent);
    background: var(--bg-card-hover);
}

.topic-key {
    background: var(--gradient-accent);
    color: #0a1628;
    padding: 3px 9px;
    border-radius: 6px;
    font-weight: 700;
    font-size: 12px;
    min-width: 40px;
    text-align: center;
}

.topic-name {
    flex: 1;
    font-weight: 500;
}

.topic-count {
    color: var(--text-muted);
    font-size: 12px;
}

/* --- Stats --- */
.section-title {
    font-family: var(--font-heading);
    font-size: 18px;
    margin-bottom: 16px;
    color: var(--text-primary);
}

.stats-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 16px;
}

.stat-card {
    padding: 22px;
    text-align: center;
}

.stat-card.compact {
    padding: 16px;
}

.stat-value {
    font-family: var(--font-heading);
    font-size: 32px;
    font-weight: 700;
    color: var(--accent);
}

.stat-label {
    color: var(--text-secondary);
    font-size: 13px;
    margin-top: 4px;
}

.stat-bar {
    margin-top: 10px;
    height: 6px;
    background: var(--bg-input);
    border-radius: 3px;
    overflow: hidden;
}

.stat-fill {
    height: 100%;
    border-radius: 3px;
    transition: width 0.6s ease;
}

.stat-fill.badge-green {
    background: var(--green);
}

.stat-fill.badge-yellow {
    background: var(--yellow);
}

.stat-fill.badge-red {
    background: var(--red);
}

/* --- Alert --- */
.alert {
    padding: 20px 24px;
    border-radius: var(--radius);
    margin-bottom: 24px;
}

.alert-warning {
    background: rgba(234, 179, 8, 0.08);
    border: 1px solid rgba(234, 179, 8, 0.2);
}

.alert h3 {
    margin-bottom: 6px;
}

.alert p {
    color: var(--text-secondary);
    font-size: 14px;
}

/* --- Quiz Container --- */
.quiz-container {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 200;
    background: var(--bg-primary);
    display: flex;
    flex-direction: column;
    overflow-y: auto;
}

.quiz-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 14px 24px;
    background: rgba(8, 14, 30, 0.95);
    backdrop-filter: blur(12px);
    border-bottom: 1px solid var(--border);
    position: sticky;
    top: 0;
    z-index: 10;
}

.quiz-info {
    display: flex;
    align-items: center;
    gap: 12px;
}

.quiz-mode-badge {
    padding: 4px 12px;
    background: var(--accent-glow);
    color: var(--accent);
    border-radius: 20px;
    font-size: 13px;
    font-weight: 600;
}

.quiz-progress {
    color: var(--text-secondary);
    font-size: 14px;
    font-weight: 500;
}

.quiz-timer {
    font-family: 'Courier New', monospace;
    font-size: 22px;
    font-weight: 700;
    color: var(--green);
    padding: 6px 16px;
    background: rgba(34, 197, 94, 0.1);
    border-radius: var(--radius-sm);
    min-width: 90px;
    text-align: center;
}

.quiz-timer.timer-warning {
    color: var(--yellow);
    background: rgba(234, 179, 8, 0.1);
}

.quiz-timer.timer-critical {
    color: var(--red);
    background: rgba(239, 68, 68, 0.1);
    animation: blink 1s infinite;
}

.quiz-content {
    flex: 1;
    display: flex;
    justify-content: center;
    padding: 30px 20px;
}

.question-card {
    max-width: 700px;
    width: 100%;
}

.question-meta {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 16px;
}

.section-badge {
    padding: 3px 10px;
    border-radius: 6px;
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
}

.section-A {
    background: rgba(59, 130, 246, .15);
    color: #60a5fa;
}

.section-B {
    background: rgba(239, 68, 68, .15);
    color: #f87171;
}

.section-C {
    background: rgba(34, 197, 94, .15);
    color: #4ade80;
}

.section-D {
    background: rgba(168, 85, 247, .15);
    color: #c084fc;
}

.section-D-bis {
    background: rgba(240, 192, 64, .15);
    color: var(--accent);
}

.question-number {
    color: var(--text-muted);
    font-size: 13px;
}

.question-text {
    font-size: 18px;
    line-height: 1.5;
    margin-bottom: 24px;
    color: var(--text-primary);
}

.options-list {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.option-item {
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 16px 18px;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    cursor: pointer;
    transition: all var(--transition);
}

.option-item:hover {
    border-color: rgba(240, 192, 64, 0.3);
    background: var(--bg-card-hover);
}

.option-item.selected {
    border-color: var(--accent);
    background: var(--accent-glow);
    box-shadow: 0 0 0 1px var(--accent);
}

.option-number {
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--bg-input);
    border-radius: 50%;
    font-weight: 700;
    font-size: 14px;
    color: var(--text-secondary);
    flex-shrink: 0;
}

.option-item.selected .option-number {
    background: var(--accent);
    color: #0a1628;
}

.option-text {
    flex: 1;
    font-size: 15px;
}

.option-check {
    font-size: 18px;
    color: var(--text-muted);
    transition: var(--transition);
}

.option-item.selected .option-check {
    color: var(--accent);
}

/* --- Quiz Nav --- */
.quiz-nav {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 14px 24px;
    background: rgba(8, 14, 30, 0.95);
    border-top: 1px solid var(--border);
    position: sticky;
    bottom: 0;
}

.question-dots {
    display: flex;
    gap: 6px;
    flex-wrap: wrap;
    justify-content: center;
    max-width: 400px;
}

.dot {
    width: 12px;
    height: 12px;
    border-radius: 50%;
    background: var(--bg-input);
    border: 1px solid var(--border);
    cursor: pointer;
    transition: var(--transition);
}

.dot.active {
    background: var(--accent);
    border-color: var(--accent);
    box-shadow: 0 0 8px rgba(240, 192, 64, 0.4);
}

.dot.answered {
    background: var(--blue);
    border-color: var(--blue);
}

.dot.active.answered {
    background: var(--accent);
    border-color: var(--accent);
}

/* --- Result --- */
.result-container {
    min-height: 100vh;
    padding: 40px 20px;
    display: flex;
    flex-direction: column;
    align-items: center;
}

.result-card {
    max-width: 600px;
    width: 100%;
    text-align: center;
    padding: 40px 30px;
    margin-bottom: 30px;
}

.result-header {
    margin-bottom: 24px;
}

.result-icon {
    font-size: 64px;
    margin-bottom: 12px;
}

.result-status {
    font-family: var(--font-heading);
    font-size: 36px;
    font-weight: 700;
}

.result-passed .result-status {
    color: var(--green);
}

.result-failed .result-status {
    color: var(--red);
}

.result-score {
    color: var(--text-secondary);
    font-size: 16px;
    margin-top: 8px;
}

.result-bar {
    height: 8px;
    background: var(--bg-input);
    border-radius: 4px;
    margin-bottom: 24px;
    overflow: hidden;
}

.result-fill {
    height: 100%;
    border-radius: 4px;
    transition: width 1s ease;
}

.result-fill.result-passed {
    background: var(--green);
}

.result-fill.result-failed {
    background: var(--red);
}

.result-actions {
    display: flex;
    gap: 12px;
    justify-content: center;
}

/* --- Correction --- */
.correction-details {
    max-width: 800px;
    width: 100%;
    padding: 0 20px;
}

.correction-details h2 {
    font-family: var(--font-heading);
    margin-bottom: 20px;
    text-align: center;
}

.correction-item {
    background: var(--glass-bg);
    border: 1px solid var(--glass-border);
    border-radius: var(--radius);
    padding: 20px;
    margin-bottom: 14px;
}

.correction-item.correct {
    border-left: 3px solid var(--green);
}

.correction-item.wrong {
    border-left: 3px solid var(--red);
}

.correction-header {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 10px;
}

.correction-num {
    background: var(--bg-input);
    width: 28px;
    height: 28px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    font-weight: 700;
    font-size: 13px;
}

.correction-question {
    font-size: 15px;
    margin-bottom: 12px;
    line-height: 1.5;
}

.correction-answers {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.answer-row {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px 12px;
    border-radius: var(--radius-sm);
    font-size: 14px;
}

.answer-num {
    font-weight: 700;
    color: var(--text-muted);
    min-width: 20px;
}

.answer-correct {
    background: rgba(34, 197, 94, 0.1);
    border: 1px solid rgba(34, 197, 94, 0.2);
}

.answer-wrong {
    background: rgba(239, 68, 68, 0.1);
    border: 1px solid rgba(239, 68, 68, 0.2);
}

.answer-tag {
    margin-left: auto;
    font-size: 12px;
    font-weight: 600;
    color: var(--green);
}

.answer-tag.wrong-tag {
    color: var(--red);
}

/* --- Admin --- */
.admin-stats-row {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
    gap: 16px;
    margin-bottom: 30px;
}

.admin-section {
    margin-bottom: 30px;
}

.admin-section .section-title {
    cursor: pointer;
    user-select: none;
}

.admin-form {
    padding: 24px;
    margin-top: 12px;
}

.table-responsive {
    overflow-x: auto;
    padding: 0;
}

.admin-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 13px;
}

.admin-table th {
    padding: 12px 14px;
    text-align: left;
    font-weight: 600;
    color: var(--text-muted);
    text-transform: uppercase;
    font-size: 11px;
    letter-spacing: 0.5px;
    border-bottom: 1px solid var(--border);
}

.admin-table td {
    padding: 12px 14px;
    border-bottom: 1px solid var(--border);
    vertical-align: middle;
}

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

.admin-table tr:hover td {
    background: rgba(255, 255, 255, 0.02);
}

.row-disabled {
    opacity: 0.5;
}

.text-muted {
    color: var(--text-muted);
    font-size: 12px;
}

.actions-cell {
    display: flex;
    gap: 4px;
    flex-wrap: wrap;
}

.inline-form {
    display: inline-flex;
    align-items: center;
    gap: 4px;
}

.input-mini {
    width: 60px;
    padding: 4px 8px;
    font-size: 12px;
    text-align: center;
}

.collapsible {
    animation: slideDown 0.3s ease;
}

.toggle-arrow {
    font-size: 12px;
    color: var(--text-muted);
}

/* --- Animations --- */
@keyframes slideUp {
    from {
        opacity: 0;
        transform: translateY(20px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes slideDown {
    from {
        opacity: 0;
        transform: translateY(-10px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes pulse {

    0%,
    100% {
        transform: scale(1);
    }

    50% {
        transform: scale(1.05);
    }
}

@keyframes blink {

    0%,
    100% {
        opacity: 1;
    }

    50% {
        opacity: 0.5;
    }
}

.animate-in {
    animation: slideUp 0.3s ease;
}

/* --- Responsive --- */
@media (max-width: 768px) {
    .quiz-modes {
        grid-template-columns: 1fr;
    }

    .stats-grid {
        grid-template-columns: 1fr;
    }

    .form-row {
        grid-template-columns: 1fr;
    }

    .navbar {
        flex-direction: column;
        gap: 10px;
        padding: 12px 16px;
    }

    .nav-user {
        flex-wrap: wrap;
        justify-content: center;
    }

    .hero-title {
        font-size: 22px;
    }

    .question-text {
        font-size: 16px;
    }

    .option-item {
        padding: 14px;
    }

    .quiz-nav {
        flex-wrap: wrap;
        gap: 10px;
        justify-content: center;
    }

    .question-dots {
        order: -1;
        width: 100%;
    }

    .result-status {
        font-size: 28px;
    }

    .admin-table {
        font-size: 12px;
    }

    .admin-table th,
    .admin-table td {
        padding: 8px 10px;
    }

    .actions-cell {
        flex-direction: column;
    }

    .result-actions {
        flex-direction: column;
    }

    .batch-toolbar {
        flex-direction: column;
        align-items: stretch;
    }

    .batch-actions {
        justify-content: center;
    }

    .user-card-actions {
        flex-wrap: wrap;
        justify-content: center;
    }

    .admin-tabs {
        gap: 0;
    }

    .admin-tab {
        font-size: 12px;
        padding: 10px 12px;
    }
}

@media (max-width: 480px) {
    .login-card {
        padding: 28px 20px;
    }

    .mode-details {
        flex-direction: column;
        gap: 6px;
    }

    .quiz-header {
        padding: 10px 16px;
    }

    .quiz-timer {
        font-size: 18px;
        padding: 4px 12px;
    }

    .auth-card {
        padding: 28px 18px;
    }

    .form-row {
        grid-template-columns: 1fr;
    }

    .user-grid {
        grid-template-columns: 1fr;
    }

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

/* ===================================================
   Admin Panel v2 — Tabs, Cards, Batch, Inviti
   =================================================== */

/* --- Admin Tabs --- */
.admin-tabs {
    display: flex;
    gap: 4px;
    margin-bottom: 28px;
    background: var(--bg-card);
    border-radius: var(--radius);
    padding: 5px;
    border: 1px solid var(--border);
}

.admin-tab {
    flex: 1;
    text-align: center;
    padding: 12px 18px;
    border-radius: var(--radius-sm);
    font-size: 14px;
    font-weight: 600;
    color: var(--text-secondary);
    text-decoration: none;
    transition: all var(--transition);
}

.admin-tab:hover {
    color: var(--text-primary);
    background: var(--bg-card-hover);
}

.admin-tab.active {
    background: var(--gradient-accent);
    color: #0a1628;
}

/* --- Admin Stats Row --- */
.admin-stats-row {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 12px;
    margin-bottom: 24px;
}

/* --- Admin Sections --- */
.admin-section {
    margin-bottom: 30px;
}

.admin-section .section-title {
    cursor: pointer;
    user-select: none;
    display: flex;
    align-items: center;
    gap: 8px;
}

.toggle-arrow {
    font-size: 12px;
    color: var(--text-muted);
    transition: transform var(--transition);
}

.admin-form {
    padding: 24px;
    margin-top: 12px;
}

/* --- User Cards Grid --- */
.user-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(340px, 1fr));
    gap: 14px;
}

.user-card {
    padding: 18px;
    transition: all var(--transition);
}

.user-card.inactive {
    opacity: 0.55;
}

.user-card:hover {
    border-color: rgba(240, 192, 64, 0.2);
}

.user-card-header {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 12px;
}

.user-checkbox {
    display: flex;
    align-items: center;
}

.user-checkbox input[type="checkbox"] {
    width: 18px;
    height: 18px;
    cursor: pointer;
    accent-color: var(--accent);
}

.user-info {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.user-info strong {
    font-size: 14px;
}

.user-username {
    font-size: 12px;
    color: var(--text-muted);
}

.user-card-body {
    display: flex;
    flex-direction: column;
    gap: 6px;
    margin-bottom: 12px;
    padding-bottom: 12px;
    border-bottom: 1px solid var(--border);
}

.user-stat {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 13px;
    color: var(--text-secondary);
}

.user-stat span:first-child {
    font-size: 14px;
    width: 22px;
    text-align: center;
}

.user-card-actions {
    display: flex;
    gap: 6px;
    flex-wrap: wrap;
}

/* --- Batch Toolbar --- */
.batch-toolbar {
    display: flex;
    align-items: center;
    gap: 16px;
    padding: 12px 18px;
    margin-bottom: 16px;
}

.batch-select-all {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 13px;
    cursor: pointer;
    color: var(--text-secondary);
    white-space: nowrap;
}

.batch-select-all input[type="checkbox"] {
    width: 18px;
    height: 18px;
    cursor: pointer;
    accent-color: var(--accent);
}

.batch-actions {
    display: flex;
    align-items: center;
    gap: 10px;
    flex: 1;
}

.batch-amount {
    width: auto;
    min-width: 130px;
}

.batch-count {
    font-size: 12px;
    color: var(--text-muted);
    white-space: nowrap;
}

/* --- Additional Badges --- */
.badge-success {
    background: rgba(34, 197, 94, 0.15);
    color: var(--green);
}

.badge-danger {
    background: rgba(239, 68, 68, 0.15);
    color: var(--red);
}

.badge-warning {
    background: rgba(234, 179, 8, 0.15);
    color: var(--yellow);
}

.badge-info {
    background: rgba(59, 130, 246, 0.15);
    color: var(--blue);
}

.badge-admin {
    background: rgba(240, 192, 64, 0.15);
    color: var(--accent);
}

.badge-segreteria {
    background: rgba(168, 85, 247, 0.15);
    color: #c084fc;
}

.badge-insegnante {
    background: rgba(59, 130, 246, 0.15);
    color: #60a5fa;
}

.badge-cliente {
    background: rgba(34, 197, 94, 0.15);
    color: #4ade80;
}

/* --- Extra Buttons --- */
.btn-xs {
    padding: 4px 8px;
    font-size: 11px;
    border-radius: 6px;
}

.btn-accent {
    background: var(--gradient-blue);
    color: white;
}

.btn-accent:hover {
    box-shadow: 0 4px 20px rgba(59, 130, 246, 0.3);
}

/* --- Invite Result --- */
.invite-result {
    padding: 24px;
    border: 1px solid rgba(34, 197, 94, 0.3);
    background: rgba(34, 197, 94, 0.06);
}

.invite-result h3 {
    margin-bottom: 14px;
    color: var(--green);
}

.invite-url-box {
    display: flex;
    gap: 10px;
    margin-bottom: 10px;
}

.invite-url-box input {
    flex: 1;
    font-family: monospace;
    font-size: 13px;
    background: var(--bg-input);
    border: 1px solid var(--border);
    padding: 10px 14px;
    border-radius: var(--radius-sm);
    color: var(--accent);
}

/* --- Admin Table --- */
.admin-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 13px;
}

.admin-table thead {
    position: sticky;
    top: 0;
}

.admin-table th {
    background: var(--bg-secondary);
    padding: 12px 14px;
    text-align: left;
    font-weight: 600;
    color: var(--text-secondary);
    text-transform: uppercase;
    font-size: 11px;
    letter-spacing: 0.5px;
    border-bottom: 1px solid var(--border);
}

.admin-table td {
    padding: 12px 14px;
    border-bottom: 1px solid var(--border);
    color: var(--text-primary);
}

.admin-table tr:hover td {
    background: rgba(255, 255, 255, 0.02);
}

.admin-table .row-used td {
    opacity: 0.5;
}

/* --- Auth Page (Registration) --- */
.auth-page {
    background: var(--gradient-hero);
    min-height: 100vh;
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 30px 20px;
}

.auth-container {
    width: 100%;
    max-width: 520px;
}

.auth-card {
    padding: 40px 32px;
    animation: slideUp 0.5s ease;
}

.auth-logo {
    text-align: center;
    margin-bottom: 16px;
}

.auth-logo img {
    height: 90px;
    width: auto;
    max-width: 90px;
    border-radius: 12px;
    object-fit: contain;
    mix-blend-mode: lighten;
    filter: drop-shadow(0 0 20px rgba(240, 192, 64, 0.15));
}

.auth-card h1 {
    font-family: var(--font-heading);
    font-size: 22px;
    font-weight: 700;
    color: var(--accent);
    text-align: center;
    margin-bottom: 6px;
}

.auth-subtitle {
    font-family: var(--font-heading);
    font-size: 17px;
    text-align: center;
    margin-bottom: 6px;
    color: var(--text-primary);
}

.auth-hint {
    text-align: center;
    color: var(--text-secondary);
    font-size: 14px;
    margin-bottom: 20px;
}

.auth-form .form-group {
    margin-bottom: 16px;
}

.password-wrapper {
    position: relative;
    display: flex;
    align-items: center;
}

.password-wrapper input {
    padding-right: 44px;
}

.password-toggle {
    position: absolute;
    right: 10px;
    background: none;
    border: none;
    font-size: 18px;
    cursor: pointer;
    padding: 4px;
    opacity: 0.6;
    transition: var(--transition);
}

.password-toggle:hover {
    opacity: 1;
}

.auth-footer {
    text-align: center;
    margin-top: 20px;
    color: var(--text-muted);
    font-size: 13px;
}

.auth-footer a {
    color: var(--accent);
    text-decoration: none;
}

.auth-footer a:hover {
    text-decoration: underline;
}

/* --- Alert Variants --- */
.alert-success {
    background: rgba(34, 197, 94, 0.08);
    border: 1px solid rgba(34, 197, 94, 0.2);
    color: var(--green);
}

.alert-error {
    background: rgba(239, 68, 68, 0.08);
    border: 1px solid rgba(239, 68, 68, 0.2);
    color: var(--red);
}

.alert-info {
    background: rgba(59, 130, 246, 0.08);
    border: 1px solid rgba(59, 130, 246, 0.2);
    color: var(--blue);
}

/* --- Classroom CTA --- */
.classroom-cta {
    margin-bottom: 24px;
}

.classroom-card {
    border: 2px solid rgba(59, 130, 246, 0.3);
    background: rgba(59, 130, 246, 0.05);
}

.classroom-card:hover {
    border-color: var(--blue);
    box-shadow: 0 12px 40px rgba(59, 130, 246, 0.15);
}

/* --- Collapsible --- */
.collapsible {
    animation: slideDown 0.3s ease;
}