/* ============================================
   AMBRA AREA UTENTE - Mobile-First Styles
   ============================================ */

:root {
    --primary: #6f42c1;
    --primary-light: #7952b3;
    --primary-dark: #59359a;
    --accent: #6f42c1;
    --accent-light: #7952b3;
    --success: #27ae60;
    --warning: #f39c12;
    --danger: #e74c3c;
    --gray-50: #f8f9fa;
    --gray-100: #f1f3f5;
    --gray-200: #e9ecef;
    --gray-300: #dee2e6;
    --gray-400: #ced4da;
    --gray-500: #adb5bd;
    --gray-600: #868e96;
    --gray-700: #495057;
    --gray-800: #343a40;
    --header-height: 56px;
    --alerts-banner-height: 0px;
    --bottom-nav-height: 64px;
    --sidebar-width: 240px;
    --safe-area-bottom: env(safe-area-inset-bottom, 0px);
}

/* ---- Reset & Base ---- */
* {
    box-sizing: border-box;
    -webkit-tap-highlight-color: transparent;
}

html, body {
    height: 100%;
    margin: 0;
    padding: 0;
    overflow: hidden;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    background: var(--gray-100);
    color: var(--gray-800);
}

/* ---- Bootstrap Primary Override ---- */
.bg-primary { background-color: var(--primary) !important; }
.btn-primary { background-color: var(--primary); border-color: var(--primary); }
.btn-primary:hover, .btn-primary:focus { background-color: var(--primary-dark); border-color: var(--primary-dark); }
.btn-outline-primary { color: var(--primary); border-color: var(--primary); }
.btn-outline-primary:hover { background-color: var(--primary); border-color: var(--primary); color: white; }
.text-primary { color: var(--primary) !important; }
.form-control:focus, .form-select:focus { border-color: var(--primary); box-shadow: 0 0 0 0.2rem rgba(111,66,193,0.15); }

/* ---- Splash Screen ---- */
.splash-screen {
    position: fixed;
    inset: 0;
    background: linear-gradient(135deg, var(--primary) 0%, var(--primary-dark) 100%);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 9999;
    transition: opacity 0.3s ease;
}

.splash-screen.fade-out {
    opacity: 0;
    pointer-events: none;
}

.splash-content {
    text-align: center;
    color: white;
}

.splash-icon { font-size: 4rem; margin-bottom: 1rem; }
.splash-content h1 { font-size: 2rem; font-weight: 700; margin: 0; }
.splash-content p { font-size: 1rem; opacity: 0.8; margin: 0.25rem 0 0; }

.letter-spacing-wide { letter-spacing: 0.4em; }

/* ---- Login ---- */
.login-container {
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 2rem;
    background: linear-gradient(135deg, var(--primary) 0%, var(--primary-dark) 100%);
}

.login-header {
    text-align: center;
    color: white;
    margin-bottom: 2rem;
}

.login-header i { font-size: 3rem; }
.login-logo { max-height: 80px; max-width: 200px; object-fit: contain; margin-bottom: 0.5rem; }
.login-header h1 { font-size: 1.8rem; font-weight: 700; margin: 0.5rem 0 0; }
.login-header p { opacity: 0.8; margin: 0.25rem 0 0; }

#login-form {
    width: 100%;
    max-width: 360px;
}

#login-form .input-group-text { background: white; border-right: 0; color: var(--gray-600); }
#login-form .form-control { border-left: 0; font-size: 1rem; padding: 0.75rem; }
#login-form .form-control:focus { box-shadow: none; border-color: var(--primary); }
#login-form .btn-primary { background: var(--primary); border-color: var(--primary); padding: 0.75rem; font-size: 1.1rem; font-weight: 600; }
#login-form .btn-primary:active { background: var(--primary-dark); }

/* ---- App Shell ---- */
#app-shell {
    height: 100%;
    display: flex;
    flex-direction: column;
}

/* ---- Header ---- */
#app-header {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    height: var(--header-height);
    background: var(--primary);
    color: white;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 1rem;
    z-index: 1000;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

#app-header h1 { font-size: 1.2rem; font-weight: 600; margin: 0; }
.header-left, .header-right { display: flex; align-items: center; gap: 0.5rem; }
.header-right .btn-link { font-size: 1.3rem; padding: 0.25rem; text-decoration: none; }

#chat-badge {
    position: absolute;
    top: -2px;
    right: -4px;
    font-size: 0.65rem;
    padding: 0.2em 0.45em;
}

/* ---- Main Content ---- */
#app-content {
    flex: 1;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    margin-top: calc(var(--header-height) + var(--alerts-banner-height));
    margin-bottom: calc(var(--bottom-nav-height) + var(--safe-area-bottom));
    padding: 1rem;
}

/* ---- Bottom Navigation ---- */
#bottom-nav {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    height: calc(var(--bottom-nav-height) + var(--safe-area-bottom));
    padding-bottom: var(--safe-area-bottom);
    background: white;
    display: flex;
    align-items: center;
    justify-content: space-around;
    border-top: 1px solid var(--gray-200);
    z-index: 1000;
    box-shadow: 0 -2px 8px rgba(0,0,0,0.06);
}

#bottom-nav .nav-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    flex: 1;
    padding: 0.4rem 0;
    color: var(--gray-500);
    text-decoration: none;
    font-size: 0.7rem;
    font-weight: 500;
    transition: color 0.2s;
}

#bottom-nav .nav-item i { font-size: 1.4rem; margin-bottom: 0.15rem; }
#bottom-nav .nav-item.active { color: var(--accent); }
#bottom-nav .nav-item:active { color: var(--accent-light); }

/* ---- Cards ---- */
.card {
    border: none;
    border-radius: 12px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.08);
    margin-bottom: 1rem;
}

.card-header {
    background: white;
    border-bottom: 1px solid var(--gray-200);
    font-weight: 600;
    border-radius: 12px 12px 0 0 !important;
    padding: 0.875rem 1rem;
}

.card-body { padding: 1rem; }

/* ---- Stat Cards (Dashboard) ---- */
.stat-card { text-align: center; padding: 1.25rem 0.75rem; }
.stat-card .stat-icon { font-size: 2rem; margin-bottom: 0.5rem; }
.stat-card .stat-value { font-size: 1.75rem; font-weight: 700; line-height: 1; }
.stat-card .stat-label { font-size: 0.8rem; color: var(--gray-600); margin-top: 0.25rem; }

/* ---- List Items ---- */
.list-item {
    display: flex;
    align-items: center;
    padding: 0.875rem 1rem;
    border-bottom: 1px solid var(--gray-100);
    text-decoration: none;
    color: inherit;
    transition: background 0.15s;
}
.list-item:last-child { border-bottom: none; }
.list-item:active { background: var(--gray-50); }
.list-item-icon {
    width: 40px; height: 40px; border-radius: 10px;
    display: flex; align-items: center; justify-content: center;
    font-size: 1.2rem; margin-right: 0.875rem; flex-shrink: 0;
}
.list-item-body { flex: 1; min-width: 0; }
.list-item-title { font-weight: 600; font-size: 0.95rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.list-item-subtitle { font-size: 0.8rem; color: var(--gray-600); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.list-item-right { text-align: right; flex-shrink: 0; margin-left: 0.5rem; }

/* ---- Page Container & Header ---- */
.page-container {
    padding: 0;
    max-width: 800px;
    margin: 0 auto;
}

.page-header {
    margin-bottom: 1.25rem;
}

.page-header h1 { font-size: 1.5rem; font-weight: 700; margin-bottom: 4px; }
.page-header p { color: var(--gray-600); font-size: 0.9rem; margin-bottom: 0; }

/* ---- Section Header ---- */
.section-header {
    display: flex; align-items: center; justify-content: space-between; margin-bottom: 0.75rem;
}
.section-header h2 { font-size: 1.1rem; font-weight: 700; margin: 0; }
.section-header a { font-size: 0.85rem; text-decoration: none; color: var(--accent); }

/* ---- Badges ---- */
.badge-stato { font-size: 0.75rem; padding: 4px 10px; border-radius: 20px; }

/* ---- Empty State ---- */
.empty-state { text-align: center; padding: 3rem 1rem; color: var(--gray-500); }
.empty-state i { font-size: 3rem; margin-bottom: 1rem; opacity: 0.5; display: block; }
.empty-state p { margin: 0; font-size: 0.95rem; }

/* ---- Profile ---- */
.profile-avatar {
    width: 80px; height: 80px; border-radius: 50%;
    object-fit: cover; border: 3px solid white;
    box-shadow: 0 2px 8px rgba(0,0,0,0.15);
}

.profile-avatar-upload {
    position: relative;
    display: inline-block;
    cursor: pointer;
}

.profile-avatar-upload .overlay {
    position: absolute;
    bottom: 0; right: 0;
    background: var(--primary);
    color: white;
    width: 28px; height: 28px;
    border-radius: 50%;
    display: flex; align-items: center; justify-content: center;
    font-size: 0.8rem;
    cursor: pointer;
}

/* ---- Lesson Cards ---- */
.lesson-card { border-left: 4px solid var(--primary); }
.lesson-card.completed { border-left-color: #198754; }
.lesson-card.cancelled { border-left-color: #dc3545; opacity: 0.7; }
.lesson-card.absent { border-left-color: #ffc107; }

/* ---- Chat ---- */

/* Lista */
.chat-list-item {
    padding: 12px 16px;
    border-bottom: 1px solid var(--gray-100);
    cursor: pointer;
    transition: background 0.15s;
    display: block;
    color: inherit;
    text-decoration: none;
    background: white;
}
.chat-list-item:last-child { border-bottom: none; }
.chat-list-item:hover { background: var(--gray-50); }
.chat-list-item.unread .chat-list-name { font-weight: 700; color: var(--gray-800); }
.chat-list-item.unread .chat-list-preview { font-weight: 600; color: var(--gray-700); }
.chat-list-name { font-size: 0.95rem; color: var(--gray-800); }
.chat-list-preview { font-size: 0.82rem; color: var(--gray-500); }
.chat-list-time { font-size: 0.75rem; color: var(--gray-500); white-space: nowrap; }

/* Avatar */
.chat-avatar {
    display: flex; align-items: center; justify-content: center;
    border-radius: 50%;
    font-weight: 700;
    flex-shrink: 0;
}
.chat-avatar-md { width: 48px; height: 48px; font-size: 1rem; }
.chat-avatar-sm { width: 36px; height: 36px; font-size: 0.8rem; }
.chat-avatar-segreteria { background: #ede7f6; color: var(--primary); }
.chat-avatar-docente { background: #e3f2fd; color: #1565c0; }

/* Container */
.chat-container {
    display: flex;
    flex-direction: column;
    height: calc(100vh - var(--header-height) - var(--alerts-banner-height) - var(--bottom-nav-height) - var(--safe-area-bottom));
    overflow: hidden;
    position: relative;
}

/* Header conversazione */
.chat-header {
    background: white;
    border-bottom: 1px solid var(--gray-200);
    padding: 8px 12px;
    display: flex;
    align-items: center;
    flex-shrink: 0;
    gap: 6px;
}

/* Area messaggi */
.chat-messages-wrap {
    flex: 1;
    position: relative;
    overflow: hidden;
}
.chat-messages {
    position: absolute;
    inset: 0;
    overflow-y: auto;
    padding: 12px 12px 8px;
    display: flex;
    flex-direction: column;
    background: #f0ebfc;
}

/* Separatore data */
.chat-date-sep {
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 10px 0 6px;
}
.chat-date-sep span {
    background: rgba(255,255,255,0.85);
    color: var(--gray-600);
    font-size: 0.72rem;
    font-weight: 600;
    padding: 3px 12px;
    border-radius: 20px;
    box-shadow: 0 1px 2px rgba(0,0,0,0.08);
}

/* Bolle */
.chat-bubble {
    max-width: 78%;
    padding: 8px 12px;
    border-radius: 18px;
    font-size: 0.9rem;
    line-height: 1.45;
    box-shadow: 0 1px 2px rgba(0,0,0,0.1);
    margin-bottom: 2px;
    word-wrap: break-word;
}
.chat-bubble.sent {
    align-self: flex-end;
    background: var(--primary);
    color: white;
}
.chat-bubble.received {
    align-self: flex-start;
    background: white;
    color: var(--gray-800);
}
/* Coda (ultimo del gruppo) */
.chat-bubble.tail.sent { border-bottom-right-radius: 4px; }
.chat-bubble.tail.received { border-bottom-left-radius: 4px; }
/* Raggruppato (non-primo): angolo superiore ridotto */
.chat-bubble.grouped.sent { border-top-right-radius: 6px; margin-top: 1px; }
.chat-bubble.grouped.received { border-top-left-radius: 6px; margin-top: 1px; }

.chat-bubble .time {
    font-size: 0.65rem;
    opacity: 0.7;
    margin-top: 3px;
    text-align: right;
}
.chat-bubble.received .time { text-align: left; }

/* Empty state messaggi */
.chat-empty {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    color: var(--gray-500);
    font-size: 0.88rem;
    text-align: center;
    padding: 2rem;
}
.chat-empty i { font-size: 2.5rem; margin-bottom: 0.75rem; opacity: 0.4; }

/* Pulsante scendi in fondo */
.chat-scroll-down {
    position: absolute;
    bottom: 12px;
    right: 12px;
    width: 38px;
    height: 38px;
    border-radius: 50%;
    background: white;
    border: none;
    box-shadow: 0 2px 8px rgba(0,0,0,0.2);
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--primary);
    font-size: 1rem;
    z-index: 5;
    cursor: pointer;
    transition: transform 0.15s;
}
.chat-scroll-down:hover { transform: scale(1.08); }
.chat-scroll-down.d-none { display: none !important; }

/* Input bar */
.chat-input-bar {
    background: white;
    border-top: 1px solid var(--gray-200);
    padding: 8px 12px;
    padding-bottom: calc(8px + env(safe-area-inset-bottom, 0));
    flex-shrink: 0;
}
.chat-form-row {
    display: flex;
    align-items: flex-end;
    gap: 8px;
}
.chat-textarea {
    flex: 1;
    border: 1.5px solid var(--gray-300);
    border-radius: 22px;
    padding: 9px 16px;
    font-size: 0.9rem;
    resize: none;
    max-height: 120px;
    overflow-y: auto;
    line-height: 1.45;
    outline: none;
    transition: border-color 0.15s;
    font-family: inherit;
    background: var(--gray-50);
}
.chat-textarea:focus { border-color: var(--primary); background: white; box-shadow: 0 0 0 3px rgba(111,66,193,0.1); }
.chat-send-btn {
    width: 42px;
    height: 42px;
    flex-shrink: 0;
    border-radius: 50%;
    background: var(--primary);
    color: white;
    border: none;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.95rem;
    cursor: pointer;
    transition: background 0.15s, transform 0.1s;
}
.chat-send-btn:hover { background: var(--primary-dark); }
.chat-send-btn:active { transform: scale(0.92); }

/* ---- Chiusure struttura ---- */
.chiusura-item:last-child { border-bottom: none !important; }
.chiusura-data { width: 44px; }

/* ---- Menu List ---- */
.menu-list { list-style: none; padding: 0; margin: 0; }
.menu-list-item {
    display: flex; align-items: center;
    padding: 14px 16px;
    text-decoration: none; color: var(--gray-800);
    border-bottom: 1px solid var(--gray-100);
    transition: background 0.15s;
}
.menu-list-item:last-child { border-bottom: none; }
.menu-list-item:hover { background: var(--gray-50); }
.menu-list-item i { font-size: 1.2rem; width: 32px; color: var(--primary); }
.menu-list-item .menu-label { flex: 1; font-weight: 500; }
.menu-list-item .bi-chevron-right { color: var(--gray-400); font-size: 0.9rem; }

/* ---- Skeleton loading ---- */
.skeleton {
    background: linear-gradient(90deg, var(--gray-200) 25%, var(--gray-100) 50%, var(--gray-200) 75%);
    background-size: 200% 100%;
    animation: skeleton-loading 1.5s infinite;
    border-radius: 6px;
}
@keyframes skeleton-loading {
    0% { background-position: 200% 0; }
    100% { background-position: -200% 0; }
}
.skeleton-text { height: 1em; margin-bottom: 0.5em; }
.skeleton-text.w-75 { width: 75%; }
.skeleton-text.w-50 { width: 50%; }

/* ---- Toast ---- */
.toast-container {
    position: fixed;
    top: calc(var(--header-height) + var(--alerts-banner-height) + 0.5rem);
    left: 50%;
    transform: translateX(-50%);
    z-index: 2000;
    width: calc(100% - 2rem);
    max-width: 400px;
}

/* ---- Alerts Banner ---- */
.alerts-banner {
    position: fixed;
    top: var(--header-height);
    left: 0;
    right: 0;
    z-index: 1010;
    background: white;
    box-shadow: 0 2px 8px rgba(0,0,0,0.12);
    max-height: 40vh;
    overflow-y: auto;
}

.alert-item {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.65rem 1rem;
    cursor: pointer;
    border-bottom: 1px solid var(--gray-200);
    transition: background 0.15s;
}
.alert-item:last-child { border-bottom: none; }
.alert-item:active { background: var(--gray-100); }

.alert-item--danger {
    background: #fff5f5;
    border-left: 4px solid var(--danger);
}
.alert-item--warning {
    background: #fffbf0;
    border-left: 4px solid var(--warning);
}

.alert-item__icon {
    font-size: 1.2rem;
    flex-shrink: 0;
}
.alert-item--danger .alert-item__icon { color: var(--danger); }
.alert-item--warning .alert-item__icon { color: var(--warning); }

.alert-item__body {
    flex: 1;
    min-width: 0;
}
.alert-item__title {
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--gray-800);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.alert-item__desc {
    font-size: 0.78rem;
    color: var(--gray-600);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.alert-item__chevron {
    font-size: 0.75rem;
    color: var(--gray-400);
    flex-shrink: 0;
}

.alert-item__close {
    background: none;
    border: none;
    padding: 0.1rem 0.25rem;
    color: var(--gray-500);
    font-size: 1rem;
    line-height: 1;
    cursor: pointer;
    flex-shrink: 0;
    border-radius: 4px;
}
.alert-item__close:hover { color: var(--gray-800); background: var(--gray-200); }

/* ---- Utilities ---- */
.text-accent { color: var(--accent) !important; }
.bg-accent { background-color: var(--accent) !important; }
.bg-accent-light { background-color: rgba(111,66,193,0.1) !important; }
.bg-success-light { background-color: rgba(39,174,96,0.1) !important; }
.bg-warning-light { background-color: rgba(243,156,18,0.1) !important; }
.bg-danger-light { background-color: rgba(231,76,60,0.1) !important; }
.text-success { color: var(--success) !important; }
.text-warning { color: var(--warning) !important; }
.text-danger { color: var(--danger) !important; }
.fw-600 { font-weight: 600; }
.fs-sm { font-size: 0.85rem; }
.truncate { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.clickable { cursor: pointer; }

/* ---- Form ---- */
.form-label { font-weight: 600; font-size: 0.85rem; color: var(--gray-700); }
.form-control, .form-select { border-radius: 8px; padding: 0.625rem 0.875rem; border-color: var(--gray-300); }

/* ============================================
   SIDEBAR (hidden on mobile, visible on desktop)
   ============================================ */
#sidebar { display: none; }

.sidebar-brand {
    display: flex; align-items: center; gap: 0.75rem;
    padding: 1rem 1.25rem; font-size: 1.1rem; font-weight: 700;
    color: white; border-bottom: 1px solid rgba(255,255,255,0.1);
}
.sidebar-brand i { font-size: 1.5rem; }
.sidebar-nav { flex: 1; padding: 0.5rem 0; overflow-y: auto; }
.sidebar-footer { border-top: 1px solid rgba(255,255,255,0.1); padding: 0.5rem 0; }

.sidebar-item {
    display: flex; align-items: center; gap: 0.75rem;
    padding: 0.65rem 1.25rem;
    color: rgba(255,255,255,0.7); text-decoration: none;
    font-size: 0.9rem; font-weight: 500;
    transition: background 0.15s, color 0.15s;
    border-left: 3px solid transparent;
}
.sidebar-item:hover { background: rgba(255,255,255,0.08); color: white; }
.sidebar-item.active { background: rgba(255,255,255,0.12); color: white; border-left-color: rgba(255,255,255,0.6); }
.sidebar-item i { font-size: 1.15rem; width: 1.5rem; text-align: center; }

/* ============================================
   DESKTOP LAYOUT (>=992px)
   ============================================ */
@media (min-width: 992px) {
    #sidebar {
        display: flex; flex-direction: column;
        position: fixed; top: 0; left: 0; bottom: 0;
        width: var(--sidebar-width);
        background: var(--primary);
        z-index: 1100;
        box-shadow: 2px 0 8px rgba(0,0,0,0.1);
    }
    #bottom-nav { display: none !important; }
    #app-header { left: var(--sidebar-width); }
    .alerts-banner { left: var(--sidebar-width); }
    #app-content {
        margin-left: var(--sidebar-width);
        margin-bottom: 0;
        padding: 1.5rem 2rem;
        max-width: calc(900px + var(--sidebar-width));
    }
    .toast-container {
        left: calc(var(--sidebar-width) + 50%);
        transform: translateX(calc(-50% - var(--sidebar-width) / 2));
    }
    html, body { overflow: auto; }
    .login-container { background: var(--gray-100); }
    #login-form {
        background: white; padding: 2rem;
        border-radius: 16px; box-shadow: 0 4px 24px rgba(0,0,0,0.1);
        max-width: 400px;
    }
    .login-header { color: var(--primary); }
    .stat-card .stat-value { font-size: 2rem; }
    .chat-container {
        height: calc(100vh - var(--header-height) - var(--alerts-banner-height));
    }
    .chat-bubble { max-width: 60%; }
}

/* ============================================
   CALENDARIO
   ============================================ */

.cal-nav {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0.5rem 0 0.75rem;
}

.cal-month-label {
    font-size: 1.05rem;
    font-weight: 600;
    color: var(--gray-800);
    text-transform: capitalize;
}

.btn-icon {
    background: none;
    border: none;
    color: var(--gray-600);
    padding: 0.4rem 0.6rem;
    border-radius: 8px;
    font-size: 1rem;
    line-height: 1;
}
.btn-icon:hover { background: var(--gray-100); }

.cal-grid {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    gap: 2px;
}

.cal-header {
    margin-bottom: 4px;
}

.cal-header > div {
    text-align: center;
    font-size: 0.7rem;
    font-weight: 600;
    color: var(--gray-600);
    padding: 2px 0;
    text-transform: uppercase;
    letter-spacing: 0.03em;
}

.cal-day {
    position: relative;
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 4px 2px;
    border-radius: 10px;
    cursor: pointer;
    min-height: 48px;
    transition: background 0.15s;
    -webkit-tap-highlight-color: transparent;
}

.cal-day:hover { background: var(--gray-100); }

.cal-day--empty { cursor: default; }
.cal-day--empty:hover { background: none; }

.cal-day--weekend .cal-day-num { color: var(--gray-600); }

.cal-day--today .cal-day-num {
    background: var(--primary);
    color: #fff;
    border-radius: 50%;
    width: 26px;
    height: 26px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
}

.cal-day--selected {
    background: rgba(111,66,193,0.08);
    border: 1.5px solid var(--primary);
}

.cal-day-num {
    font-size: 0.82rem;
    font-weight: 500;
    line-height: 26px;
    width: 26px;
    text-align: center;
}

.cal-dots {
    display: flex;
    gap: 3px;
    justify-content: center;
    flex-wrap: wrap;
    margin-top: 2px;
}

.cal-dot {
    width: 6px;
    height: 6px;
    border-radius: 50%;
    flex-shrink: 0;
}

.cal-loading {
    grid-column: span 7;
    text-align: center;
    padding: 2rem;
}

.cal-day-events {
    margin-top: 0.75rem;
    border-radius: 12px;
    overflow: hidden;
    background: #fff;
    border: 1px solid var(--gray-200);
}

.cal-day-header {
    padding: 0.6rem 1rem;
    font-weight: 600;
    font-size: 0.85rem;
    color: var(--gray-600);
    background: var(--gray-100);
    text-transform: capitalize;
    border-bottom: 1px solid var(--gray-200);
}

@media (min-width: 992px) {
    .cal-grid { gap: 4px; }
    .cal-day { min-height: 60px; padding: 6px 4px; }
    .cal-day-num { font-size: 0.9rem; }
}

/* ============================================
   WIZARD PRENOTAZIONE
   ============================================ */

.wizard-steps {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0;
}

.wizard-step {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
}

.wizard-step-num {
    width: 28px;
    height: 28px;
    border-radius: 50%;
    background: var(--gray-200);
    color: var(--gray-600);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.78rem;
    font-weight: 700;
    transition: background 0.2s;
}

.wizard-step--active .wizard-step-num {
    background: var(--primary);
    color: #fff;
}

.wizard-step--done .wizard-step-num {
    background: #198754;
    color: #fff;
}

.wizard-step-label {
    font-size: 0.68rem;
    color: var(--gray-500);
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.03em;
}

.wizard-step--active .wizard-step-label { color: var(--primary); }
.wizard-step--done .wizard-step-label { color: #198754; }

.wizard-step-line {
    flex: 1;
    height: 2px;
    background: var(--gray-200);
    margin: 0 6px;
    margin-bottom: 14px;
    min-width: 24px;
}

/* Docente cards */
.docenti-list {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.docente-card {
    display: block;
    padding: 0.85rem 1rem;
    border-radius: 12px;
    border: 2px solid var(--gray-200);
    background: #fff;
    cursor: pointer;
    transition: border-color 0.15s, background 0.15s;
}

.docente-card:hover { border-color: var(--primary-light); background: rgba(111,66,193,0.04); }
.docente-card--usuale { border-color: var(--primary); background: rgba(111,66,193,0.05); }
.docente-card--selected { border-color: var(--primary); background: rgba(111,66,193,0.08); }

/* Prima data disponibile */
.prima-data-card {
    border-radius: 14px;
    background: linear-gradient(135deg, var(--primary) 0%, var(--primary-light) 100%);
    color: #fff;
    padding: 1rem 1.25rem;
    transition: opacity 0.15s;
}
.prima-data-card:hover { opacity: 0.92; }
.prima-data-card .prima-data-icon {
    font-size: 1.8rem;
    opacity: 0.9;
}
.prima-data-card .text-muted { color: rgba(255,255,255,0.75) !important; }

/* ============================================
   QR CODE OVERLAY
   ============================================ */

.qr-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.65);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 9999;
    padding: 1rem;
}

.qr-box {
    background: #fff;
    border-radius: 20px;
    padding: 1.5rem 2rem 1.75rem;
    text-align: center;
    max-width: 300px;
    width: 100%;
    box-shadow: 0 8px 40px rgba(0,0,0,0.25);
}

.qr-box-title {
    font-weight: 700;
    font-size: 1rem;
    margin-bottom: 1.25rem;
    color: var(--gray-800);
}

#qr-canvas-container img,
#qr-canvas-container canvas {
    max-width: 100%;
    height: auto;
    display: block;
    margin: 0 auto;
    border-radius: 8px;
}


/* ---- Topbar alert dot ---- */
.topbar-alert-dot {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 1.2rem;
    height: 1.2rem;
    background: #dc3545;
    color: #fff;
    border-radius: 50%;
    font-size: 0.7rem;
    font-weight: 700;
    cursor: pointer;
    flex-shrink: 0;
    line-height: 1;
    border: 2px solid rgba(255,255,255,0.5);
}

/* ---- Mini calendario prenota lezione ---- */
.mini-cal {
    border: 1px solid #dee2e6;
    border-radius: 0.5rem;
    overflow: hidden;
}
.mini-cal__header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: .4rem .75rem;
    background: #f8f9fa;
    border-bottom: 1px solid #dee2e6;
}
.mini-cal__weekdays, .mini-cal__grid {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
}
.mini-cal__weekdays {
    background: #f1f3f5;
}
.cal-weekday {
    text-align: center;
    font-size: .7rem;
    font-weight: 600;
    color: #6c757d;
    padding: .25rem 0;
}
.cal-cell {
    text-align: center;
    padding: .4rem 0;
    font-size: .82rem;
    border-radius: 4px;
    cursor: default;
    color: #adb5bd;
}
.cal-cell--clickable {
    color: #212529;
    cursor: pointer;
}
.cal-cell--clickable:hover {
    background: #e9ecef;
}
.cal-cell--prima {
    background: #cff4fc;
    color: #0a58ca;
    font-weight: 600;
}
.cal-cell--selected {
    background: var(--primary-color, #0d6efd) !important;
    color: #fff !important;
    font-weight: 700;
}
@keyframes ctBounce {
    0%, 60%, 100% { transform: translateY(0); }
    30% { transform: translateY(-4px); }
}
/* Calendario slot picker — stesso stile del backend */
.cs-cal-header { display:flex; align-items:center; justify-content:space-between; margin-bottom:.5rem; }
.cs-cal-title { font-weight:600; font-size:.95rem; }
.cs-cal-nav { background:none; border:1px solid #dee2e6; border-radius:.375rem; width:32px; height:32px; cursor:pointer; font-size:1.2rem; line-height:1; display:inline-flex; align-items:center; justify-content:center; }
.cs-cal-nav:disabled { opacity:.3; cursor:default; pointer-events:none; }
.cs-cal-grid { display:grid; grid-template-columns:repeat(7,1fr); gap:3px; }
.cs-cal-wd { text-align:center; font-size:.7rem; font-weight:600; color:#6c757d; padding:2px 0; }
.cs-cal-day { position:relative; text-align:center; font-size:.82rem; padding:5px 2px 3px; border:1px solid transparent; border-radius:.3rem; cursor:default; min-height:36px; display:flex; flex-direction:column; align-items:center; }
.cs-cal-day.cs-empty { cursor:default; }
.cs-cal-day.cs-past { opacity:.3; cursor:default; pointer-events:none; }
.cs-cal-day.cs-unavail { color:#d1d5db; }
.cs-cal-day.cs-avail { color:#212529; cursor:pointer; border-color:#dee2e6; }
.cs-cal-day.cs-avail:hover { background:#dbeafe; border-color:#0d6efd; }
.cs-cal-day.cs-today:not(.active) { border:2px solid #0d6efd !important; font-weight:700; }
.cs-cal-day.active { background:#0d6efd !important; color:#fff !important; border-color:#0d6efd !important; }
.cs-cal-dot { width:5px; height:5px; border-radius:50%; background:#0d6efd; margin-top:2px; }
.cs-cal-day.active .cs-cal-dot { background:rgba(255,255,255,.7); }
.cs-cal-day.skeleton { background:linear-gradient(90deg,#e0e0e0 25%,#f0f0f0 50%,#e0e0e0 75%); background-size:200% 100%; animation:cs-shimmer 1.2s infinite; }
@keyframes cs-shimmer { to { background-position:-200% 0; } }
.cs-slot-card { padding:.6rem .8rem; border:1.5px solid #dee2e6; border-radius:.4rem; cursor:pointer; background:#fff; transition:border-color .12s,background .12s; min-width:80px; }
.cs-slot-card:hover { border-color:#0d6efd; background:#f0f4ff; }
.cs-slot-card.active { border-color:#0d6efd; background:#eff6ff; }
.cs-card-time { font-size:1.05rem; font-weight:700; color:#0d6efd; }
.cs-card-end { font-size:.78rem; color:#6c757d; }
.cs-card-aula { font-size:.72rem; color:#495057; margin-top:.2rem; }
