/* =====================================================
   GESTIONALE NUBES — main.css v3.0
   Sostituisce: style.css + global.css + custom-dashboard.css
   ===================================================== */

/* ── 1. GOOGLE FONTS ─────────────────────────────── */
@import url('https://fonts.googleapis.com/css2?family=Poppins:wght@300;400;500;600;700;800&display=swap');

/* ── 2. VARIABILI CSS (unica fonte di verità) ────── */
:root {
    /* Brand */
    --brand-main:       #40447b;
    --brand-accent:     #49b7af;
    --brand-hover:      #2d3060;
    --brand-light:      #e8f7f6;
    --brand-gradient:   linear-gradient(135deg, #40447b 0%, #49b7af 100%);

    /* Sidebar */
    --sidebar-bg:       #2e3270;
    --sidebar-bg2:      #40447b;
    --sidebar-gradient: linear-gradient(180deg, #2e3270 0%, #40447b 100%);
    --sidebar-width:    260px;
    --sidebar-text:     rgba(255,255,255,0.82);
    --sidebar-active:   rgba(73, 183, 175, 0.22);
    --sidebar-border:   rgba(255,255,255,0.10);

    /* Layout */
    --topbar-height:    64px;
    --bg-body:          #f0f2f7;
    --card-bg:          #ffffff;
    --text-dark:        #1e2030;
    --text-muted:       #6c757d;

    /* Shadows */
    --shadow-sm:        0 2px 8px rgba(0,0,0,0.06);
    --shadow-md:        0 6px 20px rgba(0,0,0,0.08);
    --shadow-lg:        0 12px 40px rgba(0,0,0,0.12);
    --shadow-brand:     0 8px 24px rgba(73,183,175,0.30);

    /* Radii */
    --radius-sm:        8px;
    --radius-md:        14px;
    --radius-lg:        20px;

    /* Legacy (compatibilità viste esistenti — ora allineato a Nubes) */
    --esplo-primary:    #40447b;
    --esplo-secondary:  #2e3270;
    --esplo-light:      #e8f7f6;
    --esplo-bg:         #f0f2f7;
    --primary-brand:    #40447b;
    --primary-hover:    #2d3060;
    --bg-page:          #f0f2f7;
    --card-shadow:      0 6px 20px rgba(0,0,0,0.08);

    /* Bootstrap override */
    --bs-primary:           #40447b;
    --bs-primary-rgb:       64, 68, 123;
    --bs-link-color:        #40447b;
    --bs-link-hover-color:  #2d3060;
}

/* Legacy class helpers */
.text-esplo { color: var(--brand-main) !important; }

/* ── 3. RESET & BASE ──────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; }

html { scroll-behavior: smooth; }

body {
    font-family: 'Poppins', sans-serif;
    background-color: var(--bg-body);
    color: var(--text-dark);
    margin: 0;
    padding: 0;
    overflow-x: hidden;
    font-size: 0.92rem;
}

h1,h2,h3,h4,h5,h6 {
    font-family: 'Poppins', sans-serif;
    font-weight: 700;
    color: var(--text-dark);
    margin-bottom: 0.5rem;
}
h1 span, h2 span, h3 span { color: var(--brand-main); }

a {
    color: var(--brand-main);
    text-decoration: none;
    transition: color 0.2s;
}
a:hover { color: var(--brand-hover); }

/* ── 4. LAYOUT: WRAPPER PRINCIPALE ───────────────── */
.app-layout {
    display: flex;
    min-height: 100vh;
}

/* ── 5. SIDEBAR ───────────────────────────────────── */
.sidebar {
    width: var(--sidebar-width);
    height: 100vh;
    background: var(--sidebar-gradient);
    position: fixed;
    top: 0;
    left: 0;
    z-index: 1000;
    display: flex;
    flex-direction: column;
    transition: transform 0.3s ease;
    box-shadow: 4px 0 24px rgba(0,0,0,0.18);
    overflow: hidden;
}

/* Logo area */
.sidebar-brand {
    padding: 24px 20px 20px;
    border-bottom: 1px solid var(--sidebar-border);
    display: flex;
    align-items: center;
    gap: 12px;
    min-height: 76px;
}
.sidebar-brand img {
    height: 38px;
    width: auto;
    
    object-fit: contain;
}
.sidebar-brand-text {
    color: #fff;
    font-size: 0.75rem;
    font-weight: 600;
    letter-spacing: 1.5px;
    text-transform: uppercase;
    opacity: 0.6;
    line-height: 1.2;
}

/* Nav scroll */
.sidebar-nav {
    flex: 1;
    overflow-y: auto;
    overflow-x: hidden;
    padding: 16px 0;
    min-height: 0; /* fondamentale per flex scroll */
    scrollbar-width: thin;
    scrollbar-color: rgba(255,255,255,0.2) transparent;
}
.sidebar-nav::-webkit-scrollbar { width: 4px; }
.sidebar-nav::-webkit-scrollbar-track { background: transparent; }
.sidebar-nav::-webkit-scrollbar-thumb { background: rgba(255,255,255,0.2); border-radius: 2px; }

/* Section labels */
.nav-section-title {
    font-size: 0.65rem;
    font-weight: 700;
    letter-spacing: 2px;
    text-transform: uppercase;
    color: rgba(255,255,255,0.3);
    padding: 16px 20px 6px;
    margin-top: 8px;
}

/* Nav items */
.sidebar-nav-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 11px 20px;
    color: var(--sidebar-text);
    font-size: 0.88rem;
    font-weight: 500;
    border-radius: 0;
    transition: all 0.2s ease;
    position: relative;
    margin: 1px 10px;
    border-radius: var(--radius-sm);
    text-decoration: none !important;
}
.sidebar-nav-item:hover {
    background: rgba(255,255,255,0.07);
    color: #fff;
    text-decoration: none;
}
.sidebar-nav-item.active {
    background: var(--sidebar-active);
    color: #fff;
    font-weight: 600;
}
.sidebar-nav-item.active::before {
    content: '';
    position: absolute;
    left: 0;
    top: 6px;
    bottom: 6px;
    width: 3px;
    background: var(--brand-main);
    border-radius: 0 3px 3px 0;
    margin-left: -10px;
}
.sidebar-nav-item .nav-icon {
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: var(--radius-sm);
    background: rgba(255,255,255,0.07);
    font-size: 0.85rem;
    flex-shrink: 0;
    transition: background 0.2s;
}
.sidebar-nav-item.active .nav-icon {
    background: var(--brand-main);
    color: #fff;
}
.sidebar-nav-item:hover .nav-icon {
    background: rgba(255,255,255,0.14);
}

/* Sidebar footer (user info) */
.sidebar-footer {
    padding: 14px 16px;
    border-top: 1px solid var(--sidebar-border);
    display: flex;
    align-items: center;
    gap: 10px;
}
.sidebar-user-avatar {
    width: 36px;
    height: 36px;
    background: var(--brand-gradient);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #fff;
    font-size: 0.85rem;
    font-weight: 700;
    flex-shrink: 0;
}
.sidebar-user-info { flex: 1; min-width: 0; }
.sidebar-user-name {
    color: #fff;
    font-size: 0.82rem;
    font-weight: 600;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.sidebar-user-role {
    color: rgba(255,255,255,0.4);
    font-size: 0.7rem;
}
.sidebar-logout {
    color: rgba(255,255,255,0.4);
    font-size: 1rem;
    transition: color 0.2s;
    padding: 4px;
}
.sidebar-logout:hover { color: #ff6b6b; }

/* ── 6. MAIN PANEL ────────────────────────────────── */
.main-panel {
    flex: 1;
    margin-left: var(--sidebar-width);
    display: flex;
    flex-direction: column;
    min-height: 100vh;
    transition: margin-left 0.3s ease;
}

/* ── 7. TOPBAR ────────────────────────────────────── */
.topbar {
    height: var(--topbar-height);
    background: #fff;
    border-bottom: 1px solid #eef0f4;
    display: flex;
    align-items: center;
    padding: 0 28px;
    gap: 16px;
    position: sticky;
    top: 0;
    z-index: 900;
    box-shadow: var(--shadow-sm);
}

/* Hamburger (mobile) */
.topbar-toggle {
    display: none;
    background: none;
    border: none;
    color: var(--text-dark);
    font-size: 1.2rem;
    cursor: pointer;
    padding: 6px;
    border-radius: var(--radius-sm);
    transition: background 0.2s;
}
.topbar-toggle:hover { background: #f0f2f7; }

/* Page title in topbar */
.topbar-page-title {
    flex: 1;
    font-size: 1.05rem;
    font-weight: 700;
    color: var(--text-dark);
}

/* Search in topbar */
.topbar-search {
    position: relative;
    margin-left: auto;
}
.topbar-search-input {
    border: 1.5px solid #eef0f4;
    border-radius: 50px;
    padding: 7px 14px 7px 36px;
    font-size: 0.85rem;
    background: #f7f8fc;
    width: 240px;
    transition: all 0.3s;
    outline: none;
    font-family: 'Poppins', sans-serif;
}
.topbar-search-input:focus {
    width: 300px;
    border-color: var(--brand-main);
    background: #fff;
    box-shadow: 0 0 0 3px rgba(64,68,123,0.08);
}
.topbar-search-icon {
    position: absolute;
    left: 12px;
    top: 50%;
    transform: translateY(-50%);
    color: #aaa;
    font-size: 0.8rem;
    pointer-events: none;
}

/* Topbar right area */
.topbar-right {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-left: 16px;
}
.topbar-user {
    display: flex;
    align-items: center;
    gap: 8px;
    text-decoration: none !important;
    padding: 5px 10px;
    border-radius: 50px;
    border: 1.5px solid #eef0f4;
    transition: all 0.2s;
    background: #fff;
}
.topbar-user:hover {
    border-color: var(--brand-light);
    background: var(--brand-light);
}
.topbar-user-avatar {
    width: 30px;
    height: 30px;
    background: var(--brand-gradient);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #fff;
    font-size: 0.75rem;
    font-weight: 700;
}
.topbar-user-name {
    font-size: 0.82rem;
    font-weight: 600;
    color: var(--text-dark);
    max-width: 140px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* Search results dropdown */
#globalSearchResults {
    position: absolute;
    top: calc(100% + 6px);
    left: 0;
    right: 0;
    background: white;
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-lg);
    z-index: 1050;
    display: none;
    overflow: hidden;
    border: 1px solid #eef0f4;
    min-width: 320px;
}
.search-result-item {
    padding: 9px 14px;
    border-bottom: 1px solid #f5f5f5;
    cursor: pointer;
    display: flex;
    align-items: center;
    text-decoration: none !important;
    color: var(--text-dark);
    transition: background 0.15s;
    font-size: 0.85rem;
}
.search-result-item:hover { background: var(--brand-light); }
.result-icon {
    width: 28px;
    height: 28px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-right: 10px;
    font-size: 0.75rem;
    flex-shrink: 0;
}
.result-name { font-weight: 600; font-size: 0.85rem; line-height: 1.2; }
.result-meta { font-size: 0.72rem; color: var(--text-muted); }
.bg-student { background: rgba(64,68,123,0.1); color: #40447b; }
.bg-teacher { background: rgba(73,183,175,0.12); color: #49b7af; }
.bg-tutor   { background: rgba(64,68,123,0.1); color: #40447b; }
.bg-course  { background: rgba(73,183,175,0.12); color: #3a9e97; }
.bg-lead    { background: rgba(64,68,123,0.08); color: #40447b; }
.bg-company { background: rgba(73,183,175,0.1); color: #49b7af; }

/* ── 8. CONTENT AREA ─────────────────────────────── */
.content-wrapper {
    flex: 1;
    padding: 28px 32px;
}

/* Page header */
.page-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 28px;
    flex-wrap: wrap;
    gap: 12px;
}
.page-header-left h2 {
    font-size: 1.6rem;
    font-weight: 800;
    margin: 0;
}
.page-header-left .breadcrumb {
    font-size: 0.78rem;
    color: var(--text-muted);
    margin: 2px 0 0;
    list-style: none;
    padding: 0;
    display: flex;
    gap: 4px;
}
.page-header-left .breadcrumb li + li::before {
    content: '/';
    margin-right: 4px;
    opacity: 0.5;
}

/* ── 9. CARDS ─────────────────────────────────────── */
.card, .card-esplo {
    background: var(--card-bg);
    border: none !important;
    border-radius: var(--radius-md) !important;
    box-shadow: var(--shadow-md);
    overflow: hidden;
    transition: transform 0.2s, box-shadow 0.2s;
}
.card:hover { box-shadow: var(--shadow-lg); }

.card-header-esplo {
    background: linear-gradient(135deg, var(--text-dark) 0%, #2d2f4a 100%);
    color: #fff;
    padding: 14px 20px;
    font-weight: 600;
    font-size: 0.9rem;
    border-bottom: none;
}

/* ── 10. STAT CARDS (Dashboard) ───────────────────── */
.stat-card {
    background: var(--card-bg);
    border-radius: var(--radius-md) !important;
    padding: 22px 20px;
    display: flex;
    align-items: center;
    gap: 18px;
    box-shadow: var(--shadow-md);
    transition: transform 0.25s, box-shadow 0.25s;
    border: none !important;
    position: relative;
    overflow: hidden;
}
.stat-card:hover {
    transform: translateY(-4px);
    box-shadow: var(--shadow-lg);
}
.stat-card::after {
    content: '';
    position: absolute;
    bottom: 0; left: 0; right: 0;
    height: 3px;
    background: var(--brand-gradient);
    opacity: 0;
    transition: opacity 0.25s;
}
.stat-card:hover::after { opacity: 1; }

.stat-card-gradient {
    background: var(--brand-gradient) !important;
    color: #fff;
}
.stat-card-gradient .stat-icon-wrapper { background: rgba(255,255,255,0.15) !important; }
.stat-card-gradient .stat-icon-wrapper i { color: #fff !important; }
.stat-card-gradient .stat-content h3,
.stat-card-gradient .stat-content p { color: #fff !important; }

.stat-icon-wrapper {
    width: 56px;
    height: 56px;
    background: var(--brand-light);
    border-radius: var(--radius-md);
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}
.stat-icon-wrapper i { font-size: 1.5rem; color: var(--brand-main); }

.stat-content h3 {
    font-size: 2rem;
    font-weight: 800;
    margin: 0;
    line-height: 1;
    color: var(--text-dark);
}
.stat-content p {
    margin: 4px 0 0;
    color: var(--text-muted);
    font-size: 0.78rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.8px;
}

/* ── 11. TABELLE ──────────────────────────────────── */
table {
    border-radius: var(--radius-md) !important;
    overflow: hidden;
    border: none !important;
}
thead {
    background: linear-gradient(135deg, #1e2030 0%, #2d2f4a 100%) !important;
    color: #fff !important;
}
th {
    font-weight: 600;
    padding: 14px 16px !important;
    font-size: 0.8rem;
    letter-spacing: 0.5px;
    text-transform: uppercase;
    color: rgba(255,255,255,0.85) !important;
    border: none !important;
    white-space: nowrap;
}
td {
    padding: 13px 16px !important;
    vertical-align: middle !important;
    border-bottom: 1px solid #f0f2f7 !important;
    color: var(--text-dark);
    font-size: 0.88rem;
}
tbody tr:hover { background: #fafbff; }
tbody tr:last-child td { border-bottom: none !important; }

/* ── 12. BOTTONI ─────────────────────────────────── */
.btn {
    font-family: 'Poppins', sans-serif;
    font-weight: 600;
    border-radius: 50px !important;
    font-size: 0.82rem;
    letter-spacing: 0.3px;
    transition: all 0.2s ease;
}

.btn-esplo, .btn-primary {
    background: var(--brand-gradient) !important;
    border: none !important;
    color: #fff !important;
    padding: 9px 22px;
    box-shadow: 0 4px 14px rgba(64,68,123,0.3);
}
.btn-esplo:hover, .btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-brand) !important;
    color: #fff !important;
}
.btn-outline-primary {
    color: var(--brand-main) !important;
    border-color: var(--brand-main) !important;
    background: transparent !important;
}
.btn-outline-primary:hover {
    background: var(--brand-gradient) !important;
    color: #fff !important;
    border-color: transparent !important;
    transform: translateY(-2px);
}
.btn-sm {
    padding: 5px 14px;
    font-size: 0.78rem;
}
.btn-xs {
    padding: 3px 10px;
    font-size: 0.73rem;
}

/* Icon buttons */
.btn-icon {
    width: 32px;
    height: 32px;
    padding: 0;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: var(--radius-sm) !important;
    font-size: 0.78rem;
}

/* ── 13. FORM CONTROLS ──────────────────────────── */
.form-control, .form-select {
    border: 1.5px solid #e8eaf0;
    border-radius: var(--radius-sm) !important;
    padding: 9px 14px;
    font-size: 0.88rem;
    font-family: 'Poppins', sans-serif;
    background: #fafbff;
    color: var(--text-dark);
    transition: all 0.2s;
}
.form-control:focus, .form-select:focus {
    border-color: var(--brand-main);
    background: #fff;
    box-shadow: 0 0 0 3px rgba(64,68,123,0.08);
    outline: none;
}
.form-label {
    font-weight: 600;
    font-size: 0.82rem;
    color: var(--text-dark);
    margin-bottom: 6px;
}
.form-text { font-size: 0.78rem; color: var(--text-muted); }

/* ── 14. BADGES ──────────────────────────────────── */
.badge {
    font-family: 'Poppins', sans-serif;
    font-weight: 600;
    font-size: 0.72rem;
    padding: 4px 10px;
    border-radius: 50px;
}
.badge.bg-primary { background: var(--brand-gradient) !important; }
.badge.bg-success { background: linear-gradient(135deg, #3a9e97, #49b7af) !important; }
.badge.bg-warning { background: linear-gradient(135deg, #f57c00, #ffa726) !important; color: #fff !important; }
.badge.bg-danger  { background: linear-gradient(135deg, #c62828, #e53935) !important; }
.badge.bg-info    { background: linear-gradient(135deg, #40447b, #5a5f9e) !important; }
.badge.bg-secondary { background: linear-gradient(135deg, #455a64, #607d8b) !important; }

/* ── 15. ALERTS ──────────────────────────────────── */
.alert {
    border: none;
    border-radius: var(--radius-md) !important;
    font-size: 0.88rem;
    padding: 14px 18px;
}
.alert-success { background: #e8f5e9; color: #2e7d32; }
.alert-danger   { background: #fce4ec; color: #880e4f; }
.alert-warning  { background: #fff8e1; color: #e65100; }
.alert-info     { background: #e3f2fd; color: #01579b; }

/* ── 16. PAGINAZIONE ─────────────────────────────── */
.page-link {
    color: var(--brand-main);
    border-radius: var(--radius-sm) !important;
    border: 1.5px solid #eef0f4;
    margin: 0 2px;
    font-size: 0.85rem;
    font-weight: 500;
}
.page-item.active .page-link {
    background: var(--brand-gradient);
    border-color: transparent;
    box-shadow: 0 4px 12px rgba(64,68,123,0.3);
}
.page-link:hover { background: var(--brand-light); color: var(--brand-main); }

/* ── 17. TABS ─────────────────────────────────────── */
.nav-tabs {
    border-bottom: 2px solid #eef0f4;
    gap: 4px;
}
.nav-tabs .nav-link {
    border: none;
    border-radius: var(--radius-sm) var(--radius-sm) 0 0;
    padding: 8px 18px;
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--text-muted);
    background: transparent;
    transition: all 0.2s;
}
.nav-tabs .nav-link:hover { color: var(--brand-main); background: var(--brand-light); }
.nav-tabs .nav-link.active {
    color: var(--brand-main);
    background: #fff;
    border-bottom: 2px solid var(--brand-main);
    margin-bottom: -2px;
}

/* ── 18. MODAL ────────────────────────────────────── */
.modal-content {
    border: none;
    border-radius: var(--radius-lg) !important;
    box-shadow: var(--shadow-lg);
    overflow: hidden;
}
.modal-header {
    background: linear-gradient(135deg, #1e2030, #2d2f4a);
    color: #fff;
    border-bottom: none;
    padding: 18px 24px;
}
.modal-header .btn-close { filter: invert(1); opacity: 0.7; }
.modal-footer { border-top: 1px solid #f0f2f7; padding: 14px 24px; }

/* ── 19. DROPDOWN ────────────────────────────────── */
.dropdown-menu {
    border: none;
    border-radius: var(--radius-md) !important;
    box-shadow: var(--shadow-lg);
    padding: 8px;
    font-size: 0.85rem;
}
.dropdown-item {
    border-radius: var(--radius-sm);
    padding: 8px 12px;
    font-weight: 500;
    transition: background 0.15s;
}
.dropdown-item:hover { background: var(--brand-light); color: var(--brand-main); }
.dropdown-item.text-danger:hover { background: #fce4ec; }

/* ── 20. DASHBOARD SPECIFICS ─────────────────────── */
.dashboard-wrapper {
    padding: 0;
    background: transparent;
    min-height: auto;
}
.stats-row {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(230px, 1fr));
    gap: 20px;
    margin-bottom: 28px;
}
.content-box {
    background: var(--card-bg);
    border-radius: var(--radius-md);
    padding: 22px;
    box-shadow: var(--shadow-md);
}
.box-header {
    display: flex;
    align-items: center;
    margin-bottom: 18px;
    padding-bottom: 14px;
    border-bottom: 2px solid #f0f2f7;
}
.box-title {
    font-size: 1rem;
    font-weight: 700;
    margin: 0;
    display: flex;
    align-items: center;
    gap: 10px;
}
.date-badge {
    background: var(--brand-light);
    padding: 7px 16px;
    border-radius: 50px;
    font-weight: 700;
    color: var(--brand-main);
    font-size: 0.82rem;
    display: flex;
    align-items: center;
    gap: 6px;
}
.action-btn {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 13px 18px;
    background: #fff;
    color: var(--brand-main);
    border: 1.5px solid #eef0f4;
    border-radius: var(--radius-sm);
    text-decoration: none !important;
    font-weight: 600;
    font-size: 0.88rem;
    transition: all 0.2s ease;
    margin-bottom: 10px;
}
.action-btn:hover {
    background: var(--brand-light);
    border-color: var(--brand-main);
    color: var(--brand-main);
    transform: translateX(4px);
}
.actions-list { display: flex; flex-direction: column; }
.content-area { display: grid; grid-template-columns: 3fr 1fr; gap: 22px; }
.dash-title { font-size: 1.8rem; font-weight: 800; }
.dash-subtitle { color: var(--text-muted); font-size: 0.92rem; margin-top: 2px; }
.dash-header { display: flex; justify-content: space-between; align-items: flex-start; margin-bottom: 28px; }

/* ── 21. LOGIN PAGE ──────────────────────────────── */
.login-wrapper {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, #12132a 0%, #1c1d3a 50%, #2d1b35 100%);
    padding: 20px;
    position: relative;
    overflow: hidden;
}
.login-wrapper::before {
    content: '';
    position: absolute;
    width: 600px; height: 600px;
    background: radial-gradient(circle, rgba(64,68,123,0.15) 0%, transparent 70%);
    top: -200px; right: -200px;
    pointer-events: none;
}
.login-wrapper::after {
    content: '';
    position: absolute;
    width: 400px; height: 400px;
    background: radial-gradient(circle, rgba(64,68,123,0.08) 0%, transparent 70%);
    bottom: -100px; left: -100px;
    pointer-events: none;
}
.login-card {
    background: rgba(255,255,255,0.97);
    border-radius: var(--radius-lg);
    box-shadow: 0 30px 80px rgba(0,0,0,0.4);
    width: 100%;
    max-width: 420px;
    overflow: hidden;
    position: relative;
    z-index: 1;
}
.login-card-header {
    background: var(--brand-gradient);
    padding: 32px 36px 28px;
    text-align: center;
}
.login-card-header img {
    height: 44px;
}
.login-card-header p {
    color: rgba(255,255,255,0.75);
    font-size: 0.82rem;
    margin: 8px 0 0;
    letter-spacing: 0.5px;
}
.login-card-body { padding: 32px 36px 28px; }

/* Legacy login card */
.card-login { border: none; box-shadow: none; }

/* ── 22. FOOTER ──────────────────────────────────── */
.app-footer {
    background: #fff;
    border-top: 1px solid #eef0f4;
    padding: 14px 32px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    font-size: 0.78rem;
    color: var(--text-muted);
    flex-wrap: wrap;
    gap: 8px;
}
.app-footer a { color: var(--text-muted); }
.app-footer a:hover { color: var(--brand-main); }

/* ── 23. MISC UTILITIES ──────────────────────────── */
.text-primary { color: var(--brand-main) !important; }
.bg-primary   { background: var(--brand-gradient) !important; }
.border-primary { border-color: var(--brand-main) !important; }

.divider {
    height: 1px;
    background: linear-gradient(90deg, transparent, #e0e0e0, transparent);
    margin: 20px 0;
}

/* Slide cards */
.slide-card {
    border-radius: var(--radius-md);
    overflow: hidden;
    box-shadow: var(--shadow-md);
    transition: transform 0.2s, box-shadow 0.2s;
    background: #fff;
}
.slide-card:hover { transform: translateY(-4px); box-shadow: var(--shadow-lg); }

/* Custom table (dashboard) */
.custom-table { width: 100%; border-collapse: collapse; }
.custom-table th {
    text-align: left;
    color: var(--text-dark);
    font-weight: 700;
    padding: 10px 6px;
    border-bottom: 2px solid #eef0f4;
    font-size: 0.8rem;
}
.custom-table td {
    padding: 10px 6px !important;
    border-bottom: 1px solid #f5f5f5 !important;
    font-size: 0.85rem;
}
.empty-placeholder {
    text-align: center;
    padding: 3rem 1rem;
    color: var(--text-muted);
}
.empty-placeholder i {
    font-size: 3rem;
    margin-bottom: 1rem;
    opacity: 0.15;
}

/* Scroll to top button */
#scrollTopBtn {
    position: fixed;
    bottom: 28px;
    right: 28px;
    width: 42px;
    height: 42px;
    background: var(--brand-gradient);
    color: #fff;
    border: none;
    border-radius: 50%;
    box-shadow: var(--shadow-brand);
    cursor: pointer;
    display: none;
    align-items: center;
    justify-content: center;
    font-size: 1rem;
    z-index: 999;
    transition: transform 0.2s;
}
#scrollTopBtn:hover { transform: translateY(-3px); }

/* ── 24. SIDEBAR OVERLAY (mobile) ────────────────── */
.sidebar-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.5);
    z-index: 999;
    backdrop-filter: blur(2px);
}

/* ── 25. RESPONSIVE ──────────────────────────────── */

/* ── Tablet (≤992px) ──────────────────────────────── */
@media (max-width: 992px) {
    .content-area { grid-template-columns: 1fr; }
    .stats-row { grid-template-columns: repeat(2, 1fr); }

    /* Sidebar: ridotta ma visibile su tablet */
    .sidebar { width: 220px; }
    .main-panel { margin-left: 220px; }
    .sidebar-logo span,
    .nav-label { font-size: 0.82rem; }
}

/* ── Mobile (≤768px) ──────────────────────────────── */
@media (max-width: 768px) {

    /* ── Sidebar off-canvas ── */
    .sidebar {
        transform: translateX(-100%);
        width: 260px;
        z-index: 1001;
        transition: transform 0.28s ease;
    }
    .sidebar.open { transform: translateX(0); }
    .sidebar-overlay.open { display: block; }
    .main-panel { margin-left: 0; }

    /* ── Topbar ── */
    .topbar-toggle { display: flex; }
    .topbar-user-name { display: none; }
    .topbar { padding: 0 14px; gap: 10px; }
    .topbar-search-input { width: 150px; }
    .topbar-search-input:focus { width: 200px; }

    /* ── Content ── */
    .content-wrapper { padding: 16px 14px; }

    /* ── Page header: stack su mobile ── */
    .page-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 10px;
    }
    .page-header .btn,
    .page-header .btn-esplo,
    .page-header a.btn {
        width: 100%;
        text-align: center;
        justify-content: center;
    }

    /* ── Stats ── */
    .stats-row { grid-template-columns: 1fr 1fr; gap: 10px; }
    .stat-card { padding: 14px 12px; }
    .stat-content h3 { font-size: 1.5rem; }
    .stat-icon { width: 42px; height: 42px; font-size: 1.1rem; }
    .dash-title { font-size: 1.3rem; }

    /* ── Cards ── */
    .card-esplo,
    .card { border-radius: 10px; }
    .card-body { padding: 16px; }

    /* ── Form layouts: forza colonna singola ── */
    .row > [class*="col-md-"],
    .row > [class*="col-lg-"],
    .row > [class*="col-xl-"] {
        flex: 0 0 100%;
        max-width: 100%;
    }

    /* ── Bottoni azioni nelle tabelle ── */
    .btn-group .btn,
    td .btn-sm { 
        padding: 4px 8px;
        font-size: 0.75rem;
    }

    /* ── Login card ── */
    .login-card-body { padding: 24px 20px 20px; }
    .login-card-header { padding: 24px 20px 20px; }

    /* ── Tabelle: nascondi colonne secondarie ── */
    .table th.d-mobile-none,
    .table td.d-mobile-none { display: none !important; }

    /* ── Calendar ── */
    #calendar .fc-toolbar {
        flex-direction: column;
        gap: 8px;
    }
    #calendar .fc-toolbar-title { font-size: 1rem; }
    #calendar .fc-button { padding: 4px 8px; font-size: 0.8rem; }

    /* ── Attendance register ── */
    .attendance-student-info { flex-direction: column; gap: 4px; }

    /* ── Breadcrumb ── */
    .breadcrumb { font-size: 0.78rem; }
    .breadcrumb-item + .breadcrumb-item::before { padding: 0 4px; }

    /* ── Modal ── */
    .modal-dialog { margin: 10px; }
    .modal-body { padding: 16px; }

    /* ── Course creation form: steps ── */
    .wizard-step-label { display: none; }
}

/* ── Small mobile (≤480px) ── */
@media (max-width: 480px) {
    .stats-row { grid-template-columns: 1fr; }
    .content-wrapper { padding: 12px 10px; }
    .page-header { margin-bottom: 14px; }

    /* Topbar: solo icone essenziali */
    .topbar-search { display: none; }

    /* Bottone primario full-width */
    .btn-esplo { width: 100%; justify-content: center; }

    /* Tabella: compatta */
    .table td, .table th { padding: 8px 6px; font-size: 0.82rem; }

    /* Stat cards: full width */
    .stat-card-title { font-size: 0.75rem; }

    /* Login */
    .login-card { border-radius: 12px; }
    .login-card-header img { height: 36px; }
}

/* ── 26. ANIMAZIONI ──────────────────────────────── */
@keyframes fadeInUp {
    from { opacity: 0; transform: translateY(16px); }
    to   { opacity: 1; transform: translateY(0); }
}
.animate-in {
    animation: fadeInUp 0.35s ease forwards;
}
.animate-delay-1 { animation-delay: 0.05s; }
.animate-delay-2 { animation-delay: 0.10s; }
.animate-delay-3 { animation-delay: 0.15s; }
.animate-delay-4 { animation-delay: 0.20s; }

/* Skeleton loader */
.skeleton {
    background: linear-gradient(90deg, #f0f2f7 25%, #e8eaf0 50%, #f0f2f7 75%);
    background-size: 200% 100%;
    animation: skeleton-shimmer 1.4s infinite;
    border-radius: var(--radius-sm);
}
@keyframes skeleton-shimmer {
    0%   { background-position: 200% 0; }
    100% { background-position: -200% 0; }
}

/* ── 27. iOS & SAFE AREA ─────────────────────────── */

/* Previene zoom automatico su input iOS (min 16px) */
@media (max-width: 768px) {
    input[type='text'],
    input[type='email'],
    input[type='password'],
    input[type='number'],
    input[type='search'],
    input[type='tel'],
    input[type='date'],
    select,
    textarea {
        font-size: 16px !important;
    }
}

/* Safe area per iPhone con notch */
@supports (padding: env(safe-area-inset-bottom)) {
    .sidebar {
        padding-bottom: env(safe-area-inset-bottom);
    }
    .topbar {
        padding-left: max(14px, env(safe-area-inset-left));
        padding-right: max(14px, env(safe-area-inset-right));
    }
}

/* Touch target minimo 44px per accessibilità mobile */
@media (max-width: 768px) {
    .btn, .nav-item a, .topbar-toggle {
        min-height: 44px;
        display: inline-flex;
        align-items: center;
    }
    .nav-item a {
        min-height: 44px;
    }
}
/* ── NUBES ACCENT TEAL (#49b7af) ─────────────────── */
.sidebar-nav-item.active {
    border-left: 3px solid #49b7af !important;
}
.sidebar-nav-item.active .nav-icon {
    color: #49b7af !important;
}
.stat-card .stat-icon { background: linear-gradient(135deg, #40447b 0%, #49b7af 100%); }
.page-header h2 span { color: #49b7af; }
h1 span, h2 span, h3 span { color: #49b7af; }
.nav-section-title { color: rgba(73,183,175,0.7) !important; }
a { color: #40447b; }
a:hover { color: #49b7af; }
.topbar { border-bottom: 2px solid #49b7af; }
