:root {
    --primary: #4f46e5;
    --secondary: #6366f1;
    --success: #10b981;
    --info: #3b82f6;
    --warning: #f59e0b;
    --danger: #ef4444;
    --dark: #1e293b;
    --light: #f8fafc;
}

.text-primary { color: var(--primary) !important; }
.text-secondary { color: var(--secondary) !important; }
.text-success { color: var(--success) !important; }
.text-info { color: var(--info) !important; }
.text-warning { color: var(--warning) !important; }
.text-danger { color: var(--danger) !important; }
.bg-primary { background-color: var(--primary) !important; }
.bg-success { background-color: var(--success) !important; }
.bg-info { background-color: var(--info) !important; }

/* Universal Responsive Layout & Fullscreen Support */
html, body {
    width: 100%;
    min-height: 100vh;
    min-height: -webkit-fill-available;
    margin: 0;
    padding: 0;
    overflow-x: hidden;
    -webkit-text-size-adjust: 100%;
    -webkit-tap-highlight-color: transparent;
}

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, sans-serif;
    background-color: var(--light);
    color: var(--dark);
    padding-top: env(safe-area-inset-top, 0);
    padding-bottom: env(safe-area-inset-bottom, 0);
    padding-left: env(safe-area-inset-left, 0);
    padding-right: env(safe-area-inset-right, 0);
}

/* Fullscreen Mode Enhancements */
:fullscreen,
:-webkit-full-screen,
:-moz-full-screen,
:-ms-fullscreen {
    width: 100vw !important;
    height: 100vh !important;
    overflow-y: auto !important;
    overflow-x: hidden !important;
    background-color: #f8fafc;
}

:fullscreen .main-content,
:fullscreen .main-content-guru,
:fullscreen .main-content-wali {
    min-height: 100vh;
}

/* Floating Fullscreen Toggle Button */
.btn-floating-fullscreen {
    position: fixed;
    top: 14px;
    right: 14px;
    z-index: 1050;
    width: 42px;
    height: 42px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.9);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    border: 1px solid rgba(0, 0, 0, 0.08);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.12);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    color: #374151;
    font-size: 1.05rem;
    cursor: pointer;
    transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
}

.btn-floating-fullscreen:hover {
    background: #ffffff;
    transform: scale(1.08);
    box-shadow: 0 6px 16px rgba(0, 0, 0, 0.18);
    color: var(--primary);
}

.btn-floating-fullscreen:active {
    transform: scale(0.95);
}

/* Sidebar Universal Backdrop Overlay */
.sidebar-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    width: 100vw;
    height: 100vh;
    background: rgba(15, 23, 42, 0.6);
    backdrop-filter: blur(4px);
    -webkit-backdrop-filter: blur(4px);
    z-index: 998;
    display: none;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.sidebar-overlay.active {
    display: block;
    opacity: 1;
}

/* Mobile Sidebar Toggle Button */
.sidebar-toggle-btn,
.mobile-toggle-btn {
    width: 44px;
    height: 44px;
    border-radius: 12px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 1.15rem;
    cursor: pointer;
    border: none;
    transition: all 0.2s ease;
}

/* Sidebar Global Styles */
.sidebar {
    background: linear-gradient(180deg, #1e293b 0%, #0f172a 100%);
    color: #f8fafc;
    box-shadow: 2px 0 10px rgba(0,0,0,0.1);
}

.sidebar .nav-link {
    color: #cbd5e1;
    padding: 10px 20px;
    transition: all 0.2s ease;
    border-radius: 8px;
    margin: 2px 10px;
}

.sidebar .nav-link:hover, .sidebar .nav-link.active {
    background-color: rgba(255, 255, 255, 0.1);
    color: #ffffff;
}

.sidebar .nav-link i {
    width: 24px;
    text-align: center;
    margin-right: 8px;
}

.sidebar-menu-wrapper::-webkit-scrollbar {
    width: 4px;
}
.sidebar-menu-wrapper::-webkit-scrollbar-thumb {
    background: rgba(255,255,255,0.2);
    border-radius: 4px;
}

/* Card Styles */
.card {
    border: none;
    border-radius: 12px;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.05);
    transition: transform 0.3s, box-shadow 0.3s;
    background: #ffffff;
}

.card:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 15px rgba(0, 0, 0, 0.08);
}

.card-header {
    background-color: white;
    border-bottom: 1px solid #e5e7eb;
    border-radius: 12px 12px 0 0 !important;
    padding: 1rem 1.25rem;
}

/* Button Styles */
.btn {
    border-radius: 8px;
    font-weight: 500;
    padding: 0.55rem 1.1rem;
    transition: all 0.25s ease;
    min-height: 38px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
}

.btn-primary {
    background: linear-gradient(135deg, var(--primary) 0%, var(--secondary) 100%);
    border: none;
    color: white;
}

.btn-primary:hover {
    background: linear-gradient(135deg, var(--secondary) 0%, var(--primary) 100%);
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(102, 126, 234, 0.35);
    color: white;
}

.btn-success {
    background: linear-gradient(135deg, var(--success) 0%, #34d399 100%);
    border: none;
    color: white;
}

.btn-info {
    background: linear-gradient(135deg, var(--info) 0%, #60a5fa 100%);
    border: none;
    color: white;
}

/* Table Styles - Responsive Touch Friendly */
.table-responsive {
    width: 100%;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    border-radius: 8px;
}

.table {
    --bs-table-bg: transparent;
    --bs-table-striped-bg: rgba(0, 0, 0, 0.02);
    width: 100%;
    vertical-align: middle;
}

.table-hover tbody tr:hover {
    background-color: rgba(102, 126, 234, 0.06);
}

/* Form Styles */
.form-control, .form-select {
    border-radius: 8px;
    border: 1px solid #d1d5db;
    padding: 0.55rem 0.85rem;
    font-size: 0.95rem;
    transition: all 0.2s ease;
}

.form-control:focus, .form-select:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.15);
}

/* Badge Styles */
.badge {
    border-radius: 20px;
    padding: 0.4rem 0.8rem;
    font-weight: 500;
}

.badge-soft-primary {
    background-color: rgba(79, 70, 229, 0.1);
    color: #4338ca;
    border: 1px solid rgba(79, 70, 229, 0.2);
}

.badge-soft-success {
    background-color: rgba(16, 185, 129, 0.1);
    color: #047857;
    border: 1px solid rgba(16, 185, 129, 0.2);
}

.badge-soft-info {
    background-color: rgba(59, 130, 246, 0.1);
    color: #1d4ed8;
    border: 1px solid rgba(59, 130, 246, 0.2);
}

.badge-soft-danger {
    background-color: rgba(239, 68, 68, 0.1);
    color: #b91c1c;
    border: 1px solid rgba(239, 68, 68, 0.2);
}

.badge-soft-secondary {
    background-color: rgba(100, 116, 139, 0.1);
    color: #475569;
    border: 1px solid rgba(100, 116, 139, 0.2);
}

/* Custom Scrollbar */
::-webkit-scrollbar {
    width: 6px;
    height: 6px;
}

::-webkit-scrollbar-track {
    background: #f1f1f1;
    border-radius: 4px;
}

::-webkit-scrollbar-thumb {
    background: linear-gradient(135deg, var(--primary) 0%, var(--secondary) 100%);
    border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
    background: linear-gradient(135deg, var(--secondary) 0%, var(--primary) 100%);
}

/* Alert Styles */
.alert {
    border-radius: 10px;
    border: none;
    padding: 0.9rem 1.2rem;
}

/* Modal Styles */
.modal-content {
    border-radius: 16px;
    border: none;
    box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.15);
}

/* Loading Spinner */
.spinner-border {
    width: 1.5rem;
    height: 1.5rem;
}

/* Animation */
@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(8px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.fade-in {
    animation: fadeIn 0.4s ease-out;
}

/* Responsive Design for Desktop, Tablet, and Android / Mobile */

/* Desktop Display (>= 992px) */
@media (min-width: 992px) {
    .container-fluid {
        padding-left: 24px;
        padding-right: 24px;
    }
    
    .main-content {
        margin-left: 250px;
        padding: 24px;
        transition: margin-left 0.3s ease;
    }
    
    .sidebar {
        width: 250px;
        transform: translateX(0) !important;
        position: fixed;
        top: 0;
        bottom: 0;
        left: 0;
        z-index: 990;
    }
    
    .sidebar-overlay {
        display: none !important;
    }
}

/* Tablet & Android Screens (< 992px) */
@media (max-width: 991.98px) {
    .main-content {
        margin-left: 0 !important;
        padding: 16px;
        width: 100% !important;
    }
    
    .sidebar {
        position: fixed;
        top: 0;
        left: 0;
        bottom: 0;
        width: 270px;
        max-width: 80vw;
        height: 100vh;
        z-index: 1000;
        transform: translateX(-100%);
        transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
        box-shadow: 4px 0 20px rgba(0, 0, 0, 0.15);
    }
    
    .sidebar.active {
        transform: translateX(0);
    }
    
    .navbar-custom {
        padding: 8px 12px;
    }
    
    /* Touch optimization */
    .btn, .nav-link, .dropdown-item {
        min-height: 44px;
        display: flex;
        align-items: center;
    }
    
    .card {
        margin-bottom: 12px;
    }
    
    .table-responsive {
        font-size: 0.85rem;
    }
    
    .table thead th,
    .table tbody td {
        padding: 8px 6px;
    }
}

/* Small Smartphone / Android (< 576px) */
@media (max-width: 575.98px) {
    .container-fluid {
        padding-left: 10px;
        padding-right: 10px;
    }
    
    .main-content {
        padding: 10px;
    }
    
    .stat-card {
        padding: 14px;
    }
    
    .stat-card h2 {
        font-size: 1.5rem !important;
    }
    
    .stat-card h5 {
        font-size: 0.85rem !important;
    }
    
    .modal-dialog {
        margin: 10px;
    }
}

/* Print Styles */
@media print {
    .no-print,
    .sidebar,
    .sidebar-overlay,
    .btn-floating-fullscreen,
    #sidebarToggle,
    #mobileSidebarToggle {
        display: none !important;
    }
    
    .main-content,
    .main-content-guru,
    .main-content-wali {
        margin-left: 0 !important;
        padding: 0 !important;
        width: 100% !important;
    }
    
    .card {
        box-shadow: none !important;
        border: 1px solid #dee2e6 !important;
    }
}