:root {
    --primary: #6366f1;
    /* Indigo */
    --primary-hover: #4f46e5;
    --danger: #ef4444;
    --success: #10b981;
    --bg-dark: #0f172a;
    --bg-card: rgba(30, 41, 59, 0.7);
    --text-primary: #f8fafc;
    --text-secondary: #94a3b8;
    --border-color: rgba(255, 255, 255, 0.1);
    --glass-bg: rgba(255, 255, 255, 0.05);
    --glass-border: 1px solid rgba(255, 255, 255, 0.1);
    --radius: 12px;
    --shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
    font-family: 'Inter', system-ui, -apple-system, sans-serif;
}

body {
    background: linear-gradient(135deg, #0f172a 0%, #1e293b 100%);
    color: var(--text-primary);
    min-height: 100vh;
    display: flex;
    /* Sidebar layout */
}

/* Sidebar */
.sidebar {
    width: 250px;
    background: rgba(15, 23, 42, 0.95);
    border-right: var(--glass-border);
    padding: 2rem;
    height: 100vh;
    position: fixed;
    top: 0;
    left: 0;
    z-index: 100;
}

.logo h2 {
    color: var(--primary);
    margin-bottom: 2rem;
    font-weight: 700;
    letter-spacing: -0.5px;
}

.nav-links {
    list-style: none;
}

.nav-links li {
    margin-bottom: 1rem;
}

.nav-links a {
    color: var(--text-secondary);
    text-decoration: none;
    font-size: 1rem;
    display: flex;
    align-items: center;
    padding: 0.75rem 1rem;
    border-radius: var(--radius);
    transition: all 0.3s ease;
}

.nav-links a:hover,
.nav-links a.active {
    background: var(--glass-bg);
    color: var(--text-primary);
    border-left: 3px solid var(--primary);
}

.nav-links i {
    margin-right: 10px;
}

/* Main Content */
.content {
    margin-left: 250px;
    padding: 2rem;
    width: 100%;
    min-height: 100vh;
}

header {
    margin-bottom: 2rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

h1 {
    font-size: 2rem;
    background: linear-gradient(to right, #fff, #cbd5e1);
    background-clip: text;
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

/* Grid & Cards */
.grid-container {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 1.5rem;
}

.full-width {
    grid-column: 1 / -1;
}

.card {
    background: var(--bg-card);
    backdrop-filter: blur(12px);
    border: var(--glass-border);
    border-radius: var(--radius);
    padding: 1.5rem;
    box-shadow: var(--shadow);
    transition: transform 0.2s ease;
}

.card:hover {
    transform: translateY(-2px);
    border-color: rgba(99, 102, 241, 0.3);
}

.card h3 {
    margin-bottom: 1rem;
    font-size: 1.25rem;
    color: var(--text-primary);
    border-bottom: 1px solid var(--border-color);
    padding-bottom: 0.5rem;
}

/* Forms */
.form-group {
    margin-bottom: 1rem;
}

label {
    display: block;
    margin-bottom: 0.5rem;
    color: var(--text-secondary);
    font-size: 0.875rem;
}

input[type="text"],
input[type="date"],
select,
textarea {
    width: 100%;
    padding: 0.75rem;
    background: rgba(15, 23, 42, 0.5);
    border: 1px solid var(--border-color);
    border-radius: var(--radius);
    color: white;
    font-size: 1rem;
    transition: border-color 0.3s ease;
}

input:focus,
select:focus,
textarea:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 2px rgba(99, 102, 241, 0.2);
}

/* Buttons */
.btn {
    padding: 0.75rem 1.5rem;
    border: none;
    border-radius: var(--radius);
    cursor: pointer;
    font-weight: 600;
    transition: all 0.3s ease;
    width: 100%;
}

.btn.primary {
    background: var(--primary);
    color: white;
}

.btn.primary:hover {
    background: var(--primary-hover);
    box-shadow: 0 4px 12px rgba(99, 102, 241, 0.3);
}

.btn-sm {
    padding: 0.4rem 0.8rem;
    font-size: 0.8rem;
    border-radius: 6px;
    cursor: pointer;
    border: none;
}

.delete {
    background: rgba(239, 68, 68, 0.1);
    color: var(--danger);
    border: 1px solid rgba(239, 68, 68, 0.2);
}

.delete:hover {
    background: var(--danger);
    color: white;
}

/* Calendar Specifics */
#calendar {
    margin-top: 1rem;
    background: var(--bg-card);
    padding: 1rem;
    border-radius: var(--radius);
    min-height: 700px;
}

.fc-toolbar-title {
    color: white !important;
}

.fc-button-primary {
    background-color: var(--primary) !important;
    border-color: var(--primary) !important;
}

.fc-daygrid-day {
    transition: background 0.2s;
}

.fc-daygrid-day:hover {
    background: rgba(255, 255, 255, 0.03);
    cursor: pointer;
}

/* Modal */
.modal {
    display: none;
    position: fixed;
    z-index: 1000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    overflow: auto;
    background-color: rgba(0, 0, 0, 0.6);
    backdrop-filter: blur(5px);
}

.modal-content {
    background-color: #1e293b;
    margin: 10% auto;
    padding: 2rem;
    border: 1px solid var(--border-color);
    width: 90%;
    max-width: 500px;
    border-radius: var(--radius);
    box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.3);
    animation: slideIn 0.3s ease-out;
}

@keyframes slideIn {
    from {
        transform: translateY(-20px);
        opacity: 0;
    }

    to {
        transform: translateY(0);
        opacity: 1;
    }
}

.close {
    color: #aaa;
    float: right;
    font-size: 28px;
    font-weight: bold;
    cursor: pointer;
}

.close:hover,
.close:focus {
    color: white;
    text-decoration: none;
    cursor: pointer;
}

.badge {
    padding: 4px 8px;
    border-radius: 4px;
    font-size: 0.8rem;
    font-weight: 600;
    color: white;
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.3);
}

.team-item {
    padding: 0.5rem;
    background: rgba(255, 255, 255, 0.05);
    margin-bottom: 0.5rem;
    border-radius: 4px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.data-table {
    width: 100%;
    border-collapse: collapse;
}

.data-table th,
.data-table td {
    padding: 1rem;
    text-align: left;
    border-bottom: 1px solid var(--border-color);
}

.data-table th {
    color: var(--text-secondary);
    font-weight: 600;
}

/* Checkbox List Styling */
.checkbox-list {
    max-height: 150px;
    overflow-y: auto;
    background: rgba(15, 23, 42, 0.5);
    border: 1px solid var(--border-color);
    border-radius: var(--radius);
    padding: 0.5rem;
}

.checkbox-item {
    display: flex;
    align-items: center;
    padding: 0.5rem;
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
    cursor: pointer;
    transition: background 0.2s;
}

.checkbox-item:hover {
    background: rgba(255, 255, 255, 0.05);
}

.checkbox-item:last-child {
    border-bottom: none;
}

.checkbox-item input[type="checkbox"] {
    margin-right: 10px;
    width: 18px;
    height: 18px;
    cursor: pointer;
    accent-color: var(--primary);
}

.select-all-container {
    padding: 0.5rem;
    border-bottom: 1px solid var(--border-color);
    margin-bottom: 0.5rem;
    font-weight: bold;
    color: var(--primary);
}

/* Hamburger Menu Button */
.hamburger {
    display: none;
    position: fixed;
    top: 1rem;
    left: 1rem;
    z-index: 1001;
    background: var(--primary);
    border: none;
    padding: 0.75rem;
    border-radius: 8px;
    cursor: pointer;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.3);
    transition: all 0.3s ease;
}

.hamburger:hover {
    background: var(--primary-hover);
    transform: scale(1.05);
}

.hamburger span {
    display: block;
    width: 25px;
    height: 3px;
    background: white;
    margin: 5px 0;
    border-radius: 2px;
    transition: all 0.3s ease;
}

.hamburger.active span:nth-child(1) {
    transform: rotate(45deg) translate(8px, 8px);
}

.hamburger.active span:nth-child(2) {
    opacity: 0;
}

.hamburger.active span:nth-child(3) {
    transform: rotate(-45deg) translate(7px, -7px);
}

/* Mobile Overlay */
.mobile-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.7);
    backdrop-filter: blur(5px);
    z-index: 99;
}

.mobile-overlay.active {
    display: block;
}

/* ========================================
   FORCE FULLCALENDAR TO EXPAND ON MOBILE
   ======================================== */
@media (max-width: 768px) {

    /* Force calendar container to full width */
    #calendar {
        width: 100% !important;
        max-width: 100% !important;
    }

    /* Force FullCalendar internal elements to expand */
    .fc,
    .fc-view-harness,
    .fc-view-harness-active,
    .fc-daygrid,
    .fc-scrollgrid,
    .fc-scrollgrid-sync-table {
        width: 100% !important;
        max-width: 100% !important;
    }

    /* Remove any fixed widths */
    .fc-daygrid-body,
    .fc-scrollgrid-sync-inner {
        width: 100% !important;
    }

    /* Make table cells responsive */
    .fc-daygrid-day-frame {
        width: auto !important;
    }
}

/* ========================================
   MOBILE RESPONSIVE STYLES
   ======================================== */

/* ============================================
   MOBILE RESPONSIVE STYLES
   ============================================ */

@media (max-width: 768px) {

    /* Show hamburger menu */
    .hamburger {
        display: block;
    }

    /* Sidebar mobile styles */
    .sidebar {
        position: fixed;
        left: -280px;
        width: 280px;
        height: 100vh;
        transition: left 0.3s ease;
        z-index: 100;
        box-shadow: 4px 0 10px rgba(0, 0, 0, 0.3);
        overflow-y: auto;
    }

    .sidebar.active {
        left: 0;
    }

    /* Main content takes full width */
    .content {
        margin-left: 0;
        padding: 4.5rem 0.5rem 1rem 0.5rem;
        width: 100%;
    }

    /* Header adjustments */
    header {
        flex-direction: column;
        align-items: flex-start;
        gap: 0.75rem;
        margin-bottom: 1rem;
    }

    h1 {
        font-size: 1.75rem;
        line-height: 1.2;
    }

    /* Grid becomes single column */
    .grid-container {
        grid-template-columns: 1fr;
        gap: 1rem;
    }

    /* Cards */
    .card {
        padding: 1rem;
        margin-bottom: 1rem;
    }

    .card h3 {
        font-size: 1.1rem;
    }

    /* Forms */
    .form-group {
        margin-bottom: 1rem;
    }

    input[type="text"],
    input[type="date"],
    input[type="password"],
    select,
    textarea {
        font-size: 16px;
        /* Prevents zoom on iOS */
        padding: 1rem;
    }

    /* Buttons - MOLTO PIÙ GRANDI */
    .btn {
        padding: 1rem 1.5rem;
        font-size: 1.1rem;
        font-weight: 600;
    }

    .btn-sm {
        padding: 0.75rem 1rem;
        font-size: 1rem;
    }

    /* Tables - make them scrollable */
    .data-table-wrapper {
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
        margin: 0 -0.5rem;
        padding: 0 0.5rem;
    }

    .data-table {
        min-width: 600px;
    }

    .data-table th,
    .data-table td {
        padding: 0.75rem 0.5rem;
        font-size: 0.875rem;
    }

    /* ========================================
       CALENDARIO MOBILE - COMPLETAMENTE RIDISEGNATO
       ======================================== */

    #calendar {
        min-height: calc(100vh - 200px);
        padding: 0;
        margin: 0 -0.5rem;
        background: transparent;
    }

    /* Toolbar del calendario */
    .fc-toolbar {
        flex-direction: column !important;
        gap: 0.75rem !important;
        padding: 1rem 0.5rem !important;
        background: var(--bg-card);
        border-radius: 12px 12px 0 0;
        margin-bottom: 0 !important;
    }

    .fc-toolbar-chunk {
        width: 100% !important;
        display: flex !important;
        justify-content: center !important;
        align-items: center !important;
    }

    /* Titolo mese/anno più grande */
    .fc-toolbar-title {
        font-size: 1.5rem !important;
        font-weight: 700 !important;
        margin: 0 !important;
    }

    /* Bottoni navigazione più grandi e touch-friendly */
    .fc-button {
        padding: 0.75rem 1.25rem !important;
        font-size: 1rem !important;
        min-width: 50px !important;
        min-height: 50px !important;
        border-radius: 10px !important;
    }

    .fc-button-group {
        gap: 0.5rem;
    }

    /* Vista calendario */
    .fc-view-harness {
        background: var(--bg-card);
        border-radius: 0 0 12px 12px;
        padding: 0.5rem;
    }

    /* Header giorni settimana */
    .fc-col-header-cell {
        padding: 0.75rem 0.25rem !important;
        font-size: 0.9rem !important;
        font-weight: 600 !important;
    }

    /* Celle del calendario */
    .fc-daygrid-day {
        min-height: 60px !important;
        font-size: 1rem !important;
    }

    .fc-daygrid-day-number {
        padding: 0.5rem !important;
        font-size: 1.1rem !important;
        font-weight: 600 !important;
    }

    /* Eventi nel calendario */
    .fc-event {
        font-size: 0.75rem !important;
        padding: 2px 4px !important;
        margin: 1px 2px !important;
        border-radius: 4px !important;
        white-space: nowrap !important;
        overflow: hidden !important;
        text-overflow: ellipsis !important;
    }

    .fc-event-title {
        font-weight: 600 !important;
    }

    /* Rimuovi bordi sottili che rendono difficile la lettura */
    .fc-scrollgrid {
        border-width: 2px !important;
    }

    .fc-scrollgrid td,
    .fc-scrollgrid th {
        border-width: 1px !important;
    }

    /* Oggi evidenziato meglio */
    .fc-day-today {
        background: rgba(99, 102, 241, 0.15) !important;
    }

    .fc-day-today .fc-daygrid-day-number {
        background: var(--primary);
        color: white;
        border-radius: 50%;
        width: 32px;
        height: 32px;
        display: flex;
        align-items: center;
        justify-content: center;
        margin: 0.25rem;
    }

    /* Modal adjustments */
    .modal-content {
        width: 95%;
        max-width: 95%;
        margin: 2rem auto;
        padding: 1.5rem;
    }

    .modal-content h2 {
        font-size: 1.5rem;
        margin-bottom: 1.5rem;
    }

    /* Navigation links più grandi */
    .nav-links a {
        font-size: 1.1rem;
        padding: 1rem 1.25rem;
    }

    .nav-links i {
        font-size: 1.2rem;
        margin-right: 12px;
    }

    /* User info in sidebar */
    .sidebar .user-info {
        font-size: 0.9rem;
    }

    /* Checkbox list */
    .checkbox-list {
        max-height: 250px;
    }

    .checkbox-item {
        padding: 1rem 0.75rem;
        font-size: 1rem;
    }

    .checkbox-item input[type="checkbox"] {
        width: 22px;
        height: 22px;
        margin-right: 12px;
    }

    /* Badge adjustments */
    .badge {
        font-size: 0.8rem;
        padding: 4px 8px;
    }

    /* Team items */
    .team-item {
        flex-direction: column;
        align-items: flex-start;
        gap: 0.5rem;
        padding: 0.75rem;
    }

    /* Sidebar filters (legenda) */
    .sidebar-filters {
        margin-top: 1.5rem !important;
    }

    .sidebar-filters ul li {
        padding: 0.5rem 0;
        font-size: 1rem;
    }

    .sidebar-filters ul li span {
        font-size: 1.2rem;
        margin-right: 8px;
    }
}

/* Extra small devices (phones in portrait, less than 375px) */
@media (max-width: 374px) {
    .content {
        padding: 4rem 0.25rem 0.5rem 0.25rem;
    }

    h1 {
        font-size: 1.5rem;
    }

    .card {
        padding: 0.75rem;
    }

    .btn {
        padding: 0.875rem 1.25rem;
        font-size: 1rem;
    }

    .fc-toolbar-title {
        font-size: 1.25rem !important;
    }

    .fc-daygrid-day {
        min-height: 50px !important;
    }

    .fc-daygrid-day-number {
        font-size: 1rem !important;
    }

    .fc-event {
        font-size: 0.7rem !important;
    }
}

/* Tablet landscape and small desktops */
@media (min-width: 769px) and (max-width: 1024px) {
    .sidebar {
        width: 220px;
    }

    .content {
        margin-left: 220px;
    }

    .grid-container {
        grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    }
}