:root {
    --primary: #1a3a5c;
    --primary-light: #2563a8;
    --accent: #e8a020;
    --accent-dark: #c07800;
    --bg: #f0f4f8;
    --card-bg: #ffffff;
    --text: #1e293b;
    --text-muted: #64748b;
    --border: #d1dce9;
    --success: #16a34a;
    --danger: #dc2626;
    --warning: #d97706;
    --info: #0284c7;
    --mob-nav-h: 60px;
}

* { box-sizing: border-box; }

body {
    background: var(--bg);
    color: var(--text);
    font-family: 'Segoe UI', system-ui, -apple-system, sans-serif;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

/* ── NAVBAR ──────────────────────────────────────────── */
.navbar {
    background: linear-gradient(135deg, var(--primary) 0%, var(--primary-light) 100%);
    box-shadow: 0 2px 12px rgba(0,0,0,.25);
    padding: .75rem 1.5rem;
    position: sticky;
    top: 0;
    z-index: 1030;
}
.navbar-brand { font-size: 1.25rem; letter-spacing: .5px; }
.nav-link { color: rgba(255,255,255,.85) !important; font-weight: 500; border-radius: 6px; padding: .4rem .8rem !important; transition: background .2s, color .2s; }
.nav-link:hover, .nav-link.active { background: rgba(255,255,255,.15) !important; color: #fff !important; }
.dropdown-menu { border: none; box-shadow: 0 8px 30px rgba(0,0,0,.15); border-radius: 10px; padding: .5rem; }
.dropdown-item { border-radius: 6px; padding: .45rem .9rem; transition: background .15s; }
.dropdown-item:hover { background: var(--bg); color: var(--primary); }

/* ── MAIN CONTENT ────────────────────────────────────── */
.main-content { flex: 1; }
.main-content.with-nav { padding-top: 0; }

/* ── FOOTER ──────────────────────────────────────────── */
.footer-bar { background: var(--primary); color: #fff; padding: .6rem 0; margin-top: auto; }

/* ── PAGE TITLE ──────────────────────────────────────── */
.page-title {
    font-size: 1.6rem;
    font-weight: 700;
    color: var(--primary);
    margin-bottom: 1.5rem;
    display: flex;
    align-items: center;
    gap: .6rem;
}
.page-title i { color: var(--accent); }

/* ── CARDS ───────────────────────────────────────────── */
.card {
    border: 1px solid var(--border);
    border-radius: 12px;
    box-shadow: 0 2px 8px rgba(0,0,0,.06);
    background: var(--card-bg);
    margin-bottom: 1.25rem;
}
.card-header {
    background: linear-gradient(135deg, var(--primary), var(--primary-light));
    color: #fff;
    border-radius: 11px 11px 0 0 !important;
    padding: .9rem 1.2rem;
    font-weight: 600;
    font-size: 1rem;
    border: none;
}
.card-header.accent {
    background: linear-gradient(135deg, var(--accent-dark), var(--accent));
    color: #1a1a1a;
}
.card-body { padding: 1.25rem; }

/* ── STAT CARDS ──────────────────────────────────────── */
.stat-card {
    border-radius: 14px;
    padding: 1.4rem 1.5rem;
    color: #fff;
    position: relative;
    overflow: hidden;
    box-shadow: 0 4px 20px rgba(0,0,0,.12);
    transition: transform .2s;
}
.stat-card:hover { transform: translateY(-3px); }
.stat-card .stat-value { font-size: 2.2rem; font-weight: 700; line-height: 1; }
.stat-card .stat-label { font-size: .85rem; opacity: .85; margin-top: .3rem; }
.stat-card .stat-icon {
    position: absolute; right: 1.2rem; top: 50%;
    transform: translateY(-50%);
    font-size: 3rem; opacity: .2;
}
.stat-primary { background: linear-gradient(135deg, #1a3a5c, #2563a8); }
.stat-success { background: linear-gradient(135deg, #065f46, #16a34a); }
.stat-accent  { background: linear-gradient(135deg, #92400e, #d97706); }
.stat-info    { background: linear-gradient(135deg, #0c4a6e, #0284c7); }

/* ── LOGIN ───────────────────────────────────────────── */
.login-wrapper {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, var(--primary) 0%, var(--primary-light) 60%, #3b82f6 100%);
    padding: 2rem;
}
.login-card {
    background: #fff;
    border-radius: 20px;
    box-shadow: 0 20px 60px rgba(0,0,0,.3);
    padding: 2.5rem 2.5rem;
    width: 100%;
    max-width: 420px;
}
.login-logo { font-size: 2.5rem; font-weight: 800; color: var(--primary); text-align: center; margin-bottom: .25rem; }
.login-subtitle { text-align: center; color: var(--text-muted); font-size: .95rem; margin-bottom: 2rem; }

/* ── FORMS ───────────────────────────────────────────── */
.form-label { font-weight: 600; color: var(--text); font-size: .9rem; margin-bottom: .35rem; }
.form-control, .form-select {
    border: 1.5px solid var(--border);
    border-radius: 8px;
    padding: .5rem .9rem;
    transition: border-color .2s, box-shadow .2s;
    font-size: .95rem;
}
.form-control:focus, .form-select:focus {
    border-color: var(--primary-light);
    box-shadow: 0 0 0 3px rgba(37,99,168,.15);
    outline: none;
}

/* ── BUTTONS ─────────────────────────────────────────── */
.btn { border-radius: 8px; font-weight: 600; transition: all .2s; touch-action: manipulation; }
.btn-primary { background: var(--primary); border-color: var(--primary); }
.btn-primary:hover { background: var(--primary-light); border-color: var(--primary-light); }
.btn-accent { background: var(--accent); border-color: var(--accent); color: #1a1a1a; }
.btn-accent:hover { background: var(--accent-dark); border-color: var(--accent-dark); color: #fff; }
.btn-sm { font-size: .82rem; padding: .28rem .65rem; border-radius: 6px; }

/* ── SLOT TOGGLE BUTTONS (webkit fix) ───────────────── */
.slot-btn {
    -webkit-appearance: none;
    appearance: none;
    -webkit-tap-highlight-color: transparent;
    user-select: none;
    touch-action: manipulation;
}

/* ── TABLES ──────────────────────────────────────────── */
.table-container { overflow-x: auto; border-radius: 10px; -webkit-overflow-scrolling: touch; }
table.schedule-table { border-collapse: separate; border-spacing: 0; min-width: 900px; }
table.schedule-table th {
    background: var(--primary);
    color: #fff;
    font-weight: 600;
    font-size: .85rem;
    padding: .7rem .8rem;
    white-space: nowrap;
    text-align: center;
}
table.schedule-table th:first-child { border-radius: 10px 0 0 0; text-align: left; }
table.schedule-table th:last-child { border-radius: 0 10px 0 0; }
table.schedule-table td {
    padding: .5rem .6rem;
    border-bottom: 1px solid var(--border);
    vertical-align: middle;
    text-align: center;
    font-size: .88rem;
}
table.schedule-table tr:last-child td { border-bottom: none; }
table.schedule-table tr:hover td { background: rgba(37,99,168,.04); }
.slot-morning { background: #fffbeb !important; }
.slot-afternoon { background: #f0f9ff !important; }

/* ── SLOT CELLS ──────────────────────────────────────── */
.slot-cell { position: relative; }
.slot-badge {
    display: inline-block;
    padding: .25rem .55rem;
    border-radius: 6px;
    font-size: .78rem;
    font-weight: 600;
    white-space: nowrap;
}
.badge-available { background: #dcfce7; color: #15803d; border: 1px solid #86efac; }
.badge-confirmed { background: #dbeafe; color: #1d4ed8; border: 1px solid #93c5fd; }
.badge-empty { background: #f1f5f9; color: #94a3b8; border: 1px solid #e2e8f0; }
.badge-personal { background: #fef3c7; color: #92400e; border: 1px solid #fcd34d; }
.badge-gruppo { background: #e0f2fe; color: #0c4a6e; border: 1px solid #7dd3fc; }

/* ── WEEK NAVIGATION ─────────────────────────────────── */
.week-nav { display: flex; align-items: center; gap: 1rem; margin-bottom: 1.25rem; flex-wrap: wrap; }
.week-nav .week-label { font-weight: 700; font-size: 1.1rem; color: var(--primary); flex: 1; text-align: center; }

/* ── ADMIN TABLE ─────────────────────────────────────── */
.table { font-size: .9rem; }
.table thead th { background: var(--primary); color: #fff; border: none; font-weight: 600; }
.table-striped tbody tr:nth-of-type(odd) { background-color: rgba(37,99,168,.03); }
.table tbody td { vertical-align: middle; }

/* ── BADGES ──────────────────────────────────────────── */
.badge-role-admin { background: var(--accent); color: #1a1a1a; }
.badge-role-coach { background: var(--primary-light); }

/* ── SALARY ──────────────────────────────────────────── */
.salary-row td { font-size: .9rem; }
.salary-row.paid td { opacity: .65; }
.pay-progress { height: 8px; border-radius: 4px; }

/* ── ALERTS ──────────────────────────────────────────── */
.alert { border-radius: 10px; border: none; }
.alert-success { background: #dcfce7; color: #15803d; }
.alert-danger  { background: #fee2e2; color: #b91c1c; }
.alert-warning { background: #fef3c7; color: #92400e; }
.alert-info    { background: #e0f2fe; color: #0c4a6e; }

/* ── PERIOD SEPARATOR ────────────────────────────────── */
.period-header td {
    background: linear-gradient(90deg, #e8f0fe, #f0f9ff);
    font-weight: 700;
    font-size: .8rem;
    color: var(--primary);
    text-transform: uppercase;
    letter-spacing: .5px;
    padding: .4rem .8rem;
}

/* ── MODAL ───────────────────────────────────────────── */
.modal-header { background: var(--primary); color: #fff; border-radius: 11px 11px 0 0; }
.modal-header .btn-close { filter: invert(1); }
.modal-title { font-weight: 700; }

/* ── BREADCRUMB ──────────────────────────────────────── */
.breadcrumb { background: none; padding: 0; margin-bottom: 1rem; font-size: .88rem; }
.breadcrumb-item a { color: var(--primary-light); text-decoration: none; }
.breadcrumb-item.active { color: var(--text-muted); }

/* ═══════════════════════════════════════════════════════
   MOBILE — HAMBURGER BUTTON
   ═══════════════════════════════════════════════════════ */
.mob-hamburger-btn {
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    gap: 5px;
    width: 38px;
    height: 38px;
    padding: 0;
    border: none;
    border-radius: 8px;
    background: rgba(255,255,255,.15);
    cursor: pointer;
    flex-shrink: 0;
    -webkit-tap-highlight-color: transparent;
    -webkit-appearance: none;
}
.mob-hamburger-btn span {
    display: block;
    width: 20px;
    height: 2px;
    background: #fff;
    border-radius: 2px;
}

/* ═══════════════════════════════════════════════════════
   MOBILE OFFCANVAS MENU (Bootstrap nativo)
   ═══════════════════════════════════════════════════════ */

/* Etichetta sezione */
.mob-oc-section {
    font-size: .62rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: .9px;
    color: var(--text-muted);
    padding: .9rem 1.1rem .3rem;
}

/* Voce di menu — NON usare data-bs-dismiss sui link */
.mob-oc-link {
    display: flex;
    align-items: center;
    gap: .85rem;
    padding: .68rem 1.1rem;
    color: var(--text);
    text-decoration: none;
    font-size: .95rem;
    font-weight: 500;
    border-left: 3px solid transparent;
    -webkit-tap-highlight-color: transparent;
    transition: background .1s;
}
.mob-oc-link:active,
.mob-oc-link:hover { background: rgba(37,99,168,.07); }
.mob-oc-link.active {
    background: #eef3ff;
    border-left-color: var(--primary-light);
    color: var(--primary);
    font-weight: 700;
}

/* Box icona colorata (emoji sempre visibili) */
.mob-oc-icon {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
    border-radius: 10px;
    font-size: 1.1rem;
    flex-shrink: 0;
    line-height: 1;
}

/* Label testo */
.mob-oc-label {
    flex: 1;
    line-height: 1.2;
}

/* Voce logout */
.mob-oc-danger { color: var(--danger) !important; }

/* Separatore */
.mob-oc-sep {
    height: 1px;
    background: var(--border);
    margin: .45rem 1.1rem;
}

/* ═══════════════════════════════════════════════════════
   RESPONSIVE BREAKPOINTS
   ═══════════════════════════════════════════════════════ */

/* ── Tablet + Smartphone (< 992px = Bootstrap LG) ── */
@media (max-width: 991.98px) {

    /* Hide desktop navbar links + toggler */
    .navbar-collapse, .navbar-toggler { display: none !important; }

    /* Compact top navbar */
    .navbar { padding: .45rem .9rem; }
    .navbar-brand { font-size: 1rem; }

    /* Spacing */
    .container-fluid { padding-left: .75rem !important; padding-right: .75rem !important; }
    .py-4 { padding-top: .85rem !important; }

    /* Page title */
    .page-title { font-size: 1.2rem; margin-bottom: .9rem; }

    /* Cards */
    .card-body { padding: .85rem; }
    .card-header { padding: .7rem .9rem; font-size: .9rem; }
    .card { margin-bottom: .85rem; border-radius: 10px; }

    /* Stat cards */
    .stat-card { padding: 1.1rem 1.1rem; border-radius: 12px; }
    .stat-card .stat-value { font-size: 1.7rem; }
    .stat-card .stat-icon { font-size: 2.4rem; right: .8rem; }
    .stat-card .stat-label { font-size: .8rem; }

    /* Week navigation */
    .week-nav { gap: .4rem; margin-bottom: .8rem; }
    .week-nav .week-label { font-size: .88rem; }
    .week-nav .btn { font-size: .78rem; padding: .3rem .55rem; }

    /* Schedule table — horizontal scroll con colonna fissa */
    table.schedule-table { min-width: 540px; }
    table.schedule-table th { font-size: .72rem; padding: .5rem .35rem; }
    table.schedule-table td { padding: .38rem .3rem; font-size: .8rem; }

    /* Sticky colonna orario */
    table.schedule-table th:first-child,
    table.schedule-table td:first-child {
        position: sticky;
        left: 0;
        z-index: 3;
        box-shadow: 2px 0 5px rgba(0,0,0,.09);
        min-width: 76px;
    }
    table.schedule-table td:first-child { background: var(--card-bg) !important; }
    .slot-morning td:first-child  { background: #fffbeb !important; }
    .slot-afternoon td:first-child { background: #f0f9ff !important; }

    /* Forms — prevent iOS auto-zoom */
    .form-control, .form-select {
        font-size: 16px !important;
        min-height: 44px;
    }
    .form-label { font-size: .85rem; }

    /* Salary/schedule filter form: stack on mobile */
    .filter-form-wrap { flex-direction: column !important; }
    .filter-form-wrap > div { width: 100%; }
    .filter-form-wrap .form-select { width: 100% !important; }

    /* Buttons */
    .btn-sm { font-size: .8rem; padding: .35rem .7rem; }

    /* Admin tables */
    .table { font-size: .82rem; }
    .table td, .table th { padding: .4rem .45rem; }

    /* Alert */
    .alert { font-size: .87rem; padding: .6rem .85rem; }

    /* Modal */
    .modal-dialog { margin: .5rem; }

    /* Login */
    .login-card { padding: 1.75rem 1.25rem; border-radius: 16px; }
    .login-logo { font-size: 2rem; }

    /* Footer */
    .footer-bar { font-size: .78rem; padding: .45rem 0; }
}

/* ── Small phones (< 400px) ── */
@media (max-width: 399.98px) {
    .week-nav .week-label { font-size: .78rem; }
    .page-title { font-size: 1.05rem; }
    .stat-card .stat-value { font-size: 1.45rem; }
}

/* ── Desktop / laptop ── */
@media (min-width: 992px) {
    #mobNav { display: none !important; }
}

/* ── PRINT ───────────────────────────────────────────── */
@media print {
    .navbar, .footer-bar, .btn, .no-print,
    #mobNav { display: none !important; }
    .card { box-shadow: none !important; border: 1px solid #ccc !important; }
    .main-content { padding-bottom: 0 !important; }
    table.schedule-table { min-width: 0 !important; }
}
