/* Modern UI Design System - Sensip */
:root {
    /* Refined Color Palette - Minimalist & Professional */
    --primary-bg: #f8fafc;
    --neutral-50: #f8fafc;
    --neutral-100: #f1f5f9;
    --neutral-200: #e2e8f0;
    --neutral-300: #cbd5e1;
    --neutral-400: #94a3b8;
    --neutral-500: #64748b;
    --neutral-600: #475569;
    --neutral-700: #334155;
    --neutral-800: #1e293b;
    --neutral-900: #0f172a;

    --primary-color: #3b82f6;
    --primary-dark: #2563eb;
    --student-accent: #10b981;
    --teacher-accent: #f59e0b;

    --success-color: #22c55e;
    --info-color: #0ea5e9;
    --warning-color: #f59e0b;
    --danger-color: #ef4444;

    /* Shadows & Borders */
    --shadow-sm: 0 1px 2px 0 rgb(0 0 0 / 0.05);
    --shadow-md: 0 4px 6px -1px rgb(0 0 0 / 0.1), 0 2px 4px -2px rgb(0 0 0 / 0.1);
    --shadow-lg: 0 10px 15px -3px rgb(0 0 0 / 0.1), 0 4px 6px -4px rgb(0 0 0 / 0.1);
    --border-color: var(--neutral-200);

    /* Layout */
    --sidebar-width: 270px;
    --box-shadow: var(--shadow-md);
    --transition-speed: 0.2s;
    --admin-gradient: linear-gradient(90deg, #4e73df 0%, #224abe 100%);
    --success-gradient: linear-gradient(90deg, #1cc88a 0%, #13855c 100%);
    --info-gradient: linear-gradient(90deg, #36b9cc 0%, #258391 100%);
    --warning-gradient: linear-gradient(90deg, #f6c23e 0%, #dda20a 100%);
    --danger-gradient: linear-gradient(90deg, #e74a3b 0%, #be2617 100%);
}

body {
    font-family: 'Poppins', sans-serif;
    background-color: var(--primary-bg);
    color: var(--neutral-800);
    overflow-x: hidden;
    line-height: 1.6;
}

/* --- Layout Wrappers --- */
.login-wrapper {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background: url('../image/login-bg-pattern.svg'), var(--admin-gradient);
    /* Fallback to gradient */
    background-size: cover;
    background-position: center;
}

/* --- Components: Cards --- */
.modern-card {
    background: #fff;
    border: 1px solid var(--border-color);
    border-radius: 12px;
    box-shadow: var(--shadow-sm);
    transition: all var(--transition-speed);
}

.modern-card:hover {
    box-shadow: var(--shadow-md);
    transform: translateY(-2px);
}

.card-header-clean {
    background: transparent;
    padding: 1.5rem;
    border-bottom: 1px solid var(--border-color);
    font-weight: 600;
}

/* --- Components: Buttons --- */
.btn-modern {
    padding: 0.6rem 1.5rem;
    border-radius: 8px;
    font-weight: 500;
    transition: all var(--transition-speed);
    border: none;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
}

.btn-primary-modern {
    background: var(--primary-color);
    color: white;
}

.btn-primary-modern:hover {
    background: var(--primary-dark);
}

/* --- Components: Inputs --- */
.form-control-modern {
    background: #fff;
    border: 1px solid var(--neutral-300);
    border-radius: 8px;
    padding: 0.6rem 1rem;
    transition: all 0.2s;
    width: 100%;
}

.form-control-modern:focus {
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.1);
    outline: none;
}

/* --- Typography Helpers --- */
.text-gradient {
    background: var(--admin-gradient);
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
}

/* --- Sidebar Modernization Overrides (if stuck with sb-admin-2 structure) --- */
.sidebar-modern {
    background: #fff !important;
    /* Move away from dark sidebar? Or keep it dark but premium? Let's go Dark Premium */
    background: linear-gradient(180deg, #2c3e50 0%, #000000 100%) !important;
}

.sidebar-brand-text {
    font-weight: 700;
    letter-spacing: 1px;
}

.nav-link {
    border-radius: 0 25px 25px 0;
    margin-right: 15px;
    transition: all 0.2s;
}

.nav-link:hover {
    background: rgba(255, 255, 255, 0.1);
    padding-left: 20px !important;
}

/* --- Responsive Utilities --- */

@media (max-width: 768px) {
    .sidebar-modern {
        width: 0 !important;
        overflow: hidden;
        position: fixed;
        z-index: 1050;
        /* Higher than topbar */
        height: 100vh;
        transition: width 0.3s ease;
        box-shadow: 5px 0 15px rgba(0, 0, 0, 0.1);
    }

    .sidebar-modern.toggled {
        width: 260px !important;
        overflow: visible;
    }

    /* Overlay when sidebar is open */
    .sidebar-modern.toggled::before {
        content: '';
        position: fixed;
        top: 0;
        left: 0;
        width: 100vw;
        height: 100vh;
        background: rgba(0, 0, 0, 0.5);
        z-index: -1;
    }


    #content-wrapper {
        margin-left: 0 !important;
    }

    .modern-card {
        margin-bottom: 1rem;
    }

    .container-fluid {
        padding-left: 1rem;
        padding-right: 1rem;
    }

    /* Stack headers for mobile */
    .d-sm-flex {
        display: block !important;
    }

    .d-sm-flex h1 {
        margin-bottom: 1rem;
    }

    /* Modal full-width on mobile */
    .modal-dialog {
        margin: 0.5rem;
        max-width: none;
    }

    .modal-content {
        border-radius: 12px;
    }

    /* Table adjustments */
    .table-responsive {
        border: 0;
        margin-bottom: 0;
    }

    /* Hide less important columns on very small screens if needed */
    .hide-on-mobile {
        display: none !important;
    }
}

/* --- Dashboard Specific Mobile Fixes --- */
@media (max-width: 576px) {

    .h2,
    h2 {
        font-size: 1.5rem;
    }

    .h3,
    h3 {
        font-size: 1.25rem;
    }

    .btn-modern {
        width: 100%;
        margin-bottom: 0.5rem;
    }

    .input-group {
        flex-direction: column;
    }

    .input-group>.form-control,
    .input-group>.btn {
        width: 100% !important;
        border-radius: 8px !important;
        margin-bottom: 5px;
    }
}

/* --- Attendance Calendar & Timeline --- */
.attendance-grid {
    display: flex;
    flex-wrap: nowrap;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    padding-bottom: 10px;
    gap: 10px;
}

.attendance-day-card {
    min-width: 60px;
    text-align: center;
    padding: 10px;
    border-radius: 12px;
    background: #fff;
    border: 1px solid #e3e6f0;
}

@media (max-width: 768px) {
    .attendance-day-card {
        min-width: 50px;
        padding: 8px;
    }

    .modal-xl {
        max-width: 100vw !important;
        margin: 0 !important;
    }

    .modal-body {
        padding: 0.75rem !important;
    }

    .modal-footer {
        flex-direction: column;
        gap: 10px;
    }

    .modal-footer .btn {
        width: 100%;
        margin: 0 !important;
    }

    .card-body {
        padding: 1rem !important;
    }
}

/* --- Selection Enhancements --- */
.select2-container {
    width: 100% !important;
}

.table-responsive {
    -webkit-overflow-scrolling: touch;
}

/* Fix for long subject names in filters */
.nav-pills .nav-link {
    text-align: center;
}