:root {
    --primary-gradient: linear-gradient(135deg, #1e3c72 0%, #2a5298 100%);
    --accent-color: #3b82f6;
    --success-color: #10b981;
    --danger-color: #ef4444;
    --warning-color: #f59e0b;
    --card-shadow: 0 4px 6px -1px rgb(0 0 0 / 0.05), 0 2px 4px -2px rgb(0 0 0 / 0.05);
    --hover-shadow: 0 10px 15px -3px rgb(0 0 0 / 0.1), 0 4px 6px -4px rgb(0 0 0 / 0.1);
}

body {
    min-height: 100vh;
    background-color: #f8fafc;
    font-family: 'Inter', system-ui, -apple-system, sans-serif;
    color: #334155;
    overscroll-behavior-x: none;
}

/* Navbar Styling */
.navbar {
    padding: 0.75rem 0;
    background: linear-gradient(135deg, #1e3c72 0%, #2a5298 100%) !important;
}
.navbar-brand {
    font-size: 1.25rem;
    letter-spacing: 0.5px;
}
.nav-link {
    font-weight: 500;
    transition: all 0.2s ease;
}
.navbar-nav .nav-link.active {
    background-color: rgba(255, 255, 255, 0.15);
    border-radius: 0.5rem;
}

/* Cards & Containers */
.card {
    border: none;
    border-radius: 1rem;
    box-shadow: var(--card-shadow);
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    background-color: #ffffff;
}
.card:hover {
    box-shadow: var(--hover-shadow);
}
.card-header {
    border-bottom: 1px solid #f1f5f9;
    padding: 1.25rem 1.5rem;
}

/* Stats Cards */
.stat-card {
    border-radius: 1rem;
    border: 1px solid #e2e8f0;
}
.stat-icon {
    width: 48px;
    height: 48px;
    border-radius: 0.75rem;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.25rem;
}

/* Login Page */
.login-page {
    min-height: 100vh;
    display: flex;
    align-items: center;
    background: var(--primary-gradient);
}
.login-card {
    border-radius: 1.5rem;
    box-shadow: 0 20px 25px -5px rgb(0 0 0 / 0.1), 0 8px 10px -6px rgb(0 0 0 / 0.1);
}

/* Schedules Grid & Cards */
.schedule-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 1.25rem;
}
.schedule-card {
    border-left: 5px solid var(--accent-color);
}
.schedule-card.present {
    border-left-color: var(--success-color);
}
.schedule-card.absent {
    border-left-color: var(--danger-color);
}
.saturday-badge {
    background-color: #eff6ff;
    color: var(--accent-color);
    font-weight: 600;
    border: 1px solid #dbeafe;
}

/* Form Controls */
.form-control, .form-select {
    padding: 0.6rem 1rem;
    border-radius: 0.5rem;
    border: 1px solid #cbd5e1;
    transition: all 0.2s ease;
}
.form-control:focus, .form-select:focus {
    border-color: var(--accent-color);
    box-shadow: 0 0 0 4px rgba(59, 130, 246, 0.1);
}

/* Custom Table View on Mobile */
@media (max-width: 768px) {
    /* Hide Table Headers */
    .table:not(.schedule-grid-table) thead {
        display: none;
    }
    
    /* Convert table, tbody, tr, td to block elements */
    .table:not(.schedule-grid-table), 
    .table:not(.schedule-grid-table) tbody, 
    .table:not(.schedule-grid-table) tr, 
    .table:not(.schedule-grid-table) td {
        display: block;
        width: 100%;
    }
    
    .table:not(.schedule-grid-table) tr {
        margin-bottom: 1.25rem;
        background: #ffffff;
        border: 1px solid #e2e8f0;
        border-radius: 1rem;
        padding: 0.75rem 1rem;
        box-shadow: var(--card-shadow);
    }
    
    .table:not(.schedule-grid-table) td {
        text-align: right;
        padding: 0.75rem 0.5rem;
        padding-left: 45% !important;
        position: relative;
        border: none;
        border-bottom: 1px solid #f1f5f9;
    }
    
    .table:not(.schedule-grid-table) td:last-child {
        border-bottom: none;
        text-align: center;
        padding-top: 1rem;
    }
    
    /* Display data-label attribute as the label on the left */
    .table:not(.schedule-grid-table) td[data-label]::before {
        content: attr(data-label);
        position: absolute;
        left: 0.5rem;
        top: 50%;
        transform: translateY(-50%);
        font-weight: 600;
        font-size: 0.85rem;
        color: #64748b;
        text-align: left;
    }
    
    /* Align align-middle properly inside flex context on mobile */
    .table:not(.schedule-grid-table) td > * {
        display: inline-block;
    }
    
    /* Buttons in table cells */
    .table:not(.schedule-grid-table) td .d-flex {
        justify-content: center;
        width: 100%;
    }
}

/* Page Headers */
.page-header {
    margin-bottom: 2rem;
}
.page-header h1 {
    font-size: 1.75rem;
    font-weight: 800;
    color: #1e293b;
    margin-bottom: 0.25rem;
}

/* Utilities */
.btn {
    padding: 0.6rem 1.25rem;
    font-weight: 600;
    border-radius: 0.5rem;
    transition: all 0.2s ease;
}
.btn-sm {
    padding: 0.4rem 0.75rem;
    font-size: 0.875rem;
}
.rounded-pill {
    border-radius: 50rem !important;
}

/* Badge Tweaks */
.badge {
    padding: 0.4rem 0.75rem;
    font-weight: 600;
}

@media (max-width: 576px) {
    .page-header h1 {
        font-size: 1.4rem;
    }
    .stat-card .card-body {
        padding: 1rem;
    }
    .schedule-grid {
        grid-template-columns: 1fr;
    }
    .container {
        padding-left: 1rem;
        padding-right: 1rem;
    }
}

@media print {
    .navbar, .btn, .alert, form {
        display: none !important;
    }
    .card {
        box-shadow: none;
        border: 1px solid #dee2e6;
    }
}

@media (min-width: 992px) {
    .sticky-lg-custom {
        position: sticky !important;
        top: 20px !important;
        z-index: 1020;
    }
}

/* Prevent long name badges from overflowing card container on mobile */
.accordion-body .badge {
    white-space: normal !important;
    text-align: left;
    word-break: break-word;
    max-width: 100%;
    display: inline-block;
}
