/* School Management System - Complete CSS */
/* Save this as assets/css/style.css */

:root {
    --primary-color: #FF9933;
    --secondary-color: #138808;
    --success-color: #10b981;
    --warning-color: #f59e0b;
    --danger-color: #ef4444;
    --info-color: #06b6d4;
    --sidebar-width: 280px;
    --header-height: 70px;
    --text-primary: #1e293b;
    --text-secondary: #64748b;
    --border-light: #e2e8f0;
    --bg-light: #f8fafc;
}

/* Reset and Base Styles */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html, body {
    height: 100%;
    overflow-x: hidden;
}

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background: var(--bg-light);
    color: var(--text-primary);
    line-height: 1.6;
}

/* Sidebar Styles */
.sidebar {
    position: fixed;
    left: 0;
    top: 0;
    width: var(--sidebar-width);
    height: 100vh;
    background: linear-gradient(135deg, #1e293b 0%, #334155 100%);
    color: white;
z-index: 1030;
    overflow-y: auto;
    transition: transform 0.3s ease;
    display: flex;
    flex-direction: column;
    box-shadow: 4px 0 10px rgba(0, 0, 0, 0.1);
}

.sidebar::-webkit-scrollbar {
    width: 4px;
}

.sidebar::-webkit-scrollbar-track {
    background: rgba(255, 255, 255, 0.1);
}

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

.sidebar.hidden {
    transform: translateX(-100%);
}

.sidebar-header {
    padding: 1.5rem;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    text-align: center;
    flex-shrink: 0;
    background: rgba(0, 0, 0, 0.1);
}

.sidebar-header h3 {
    font-size: 1.5rem;
    font-weight: 700;
    margin-bottom: 0.5rem;
    color: white;
}

.sidebar-header p {
    font-size: 0.9rem;
    opacity: 0.8;
    margin-bottom: 0.5rem;
}

.sidebar-header small {
    font-size: 0.8rem;
}

.sidebar-menu {
    padding: 1rem 0;
    flex: 1;
    overflow-y: auto;
}

.menu-section {
    margin-bottom: 1.5rem;
}

.menu-section-title {
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 1px;
    opacity: 0.7;
    padding: 0 1.5rem;
    margin-bottom: 0.75rem;
    color: rgba(255, 255, 255, 0.7);
}

.menu-item {
    display: flex;
    align-items: center;
    padding: 0.75rem 1.5rem;
    color: rgba(255, 255, 255, 0.8);
    text-decoration: none;
    transition: all 0.3s ease;
    cursor: pointer;
    border: none;
    background: none;
    width: 100%;
    text-align: left;
}

.menu-item:hover {
    background: rgba(255, 255, 255, 0.1);
    color: white;
    text-decoration: none;
    transform: translateX(5px);
}

.menu-item.active {
    background: rgba(255, 255, 255, 0.15);
    color: white;
    border-right: 4px solid var(--primary-color);
}

.menu-item i {
    width: 20px;
    margin-right: 1rem;
    font-size: 1.1rem;
    text-align: center;
}

.menu-item span {
    flex: 1;
    font-size: 0.9rem;
    font-weight: 500;
}

.menu-item .badge {
    margin-left: auto;
    background: var(--danger-color);
    color: white;
    font-size: 0.7rem;
    padding: 0.2rem 0.5rem;
    border-radius: 10px;
    min-width: 18px;
    text-align: center;
}

.menu-item.ps-5 {
    padding-left: 3rem;
    font-size: 0.85rem;
    opacity: 0.9;
}

/* Submenu Styles */
.menu-item-wrapper {
    position: relative;
}

.menu-item.submenu-toggle {
    position: relative;
    cursor: pointer;
}

.menu-item.submenu-toggle .submenu-arrow {
    position: absolute;
    right: 1rem;
    transition: transform 0.3s ease;
    font-size: 0.75rem;
}

.menu-item.submenu-toggle:not(.collapsed) .submenu-arrow {
    transform: rotate(180deg);
}

.submenu {
    background: rgba(0, 0, 0, 0.15);
    overflow: hidden;
}

.submenu-item {
    padding-left: 3.5rem !important;
    font-size: 0.9rem;
    opacity: 0.95;
    position: relative;
}

.submenu-item::before {
    content: "";
    position: absolute;
    left: 2rem;
    top: 50%;
    transform: translateY(-50%);
    width: 6px;
    height: 6px;
    background: rgba(255, 255, 255, 0.4);
    border-radius: 50%;
}

.submenu-item:hover::before,
.submenu-item.active::before {
    background: white;
}

.sidebar-footer {
    border-top: 1px solid rgba(255, 255, 255, 0.1);
    padding: 1rem 1.5rem;
    flex-shrink: 0;
    background: rgba(0, 0, 0, 0.1);
}

.user-avatar-small {
    width: 30px;
    height: 30px;
    background: rgba(255, 255, 255, 0.2);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.8rem;
    font-weight: 600;
}

/* Sidebar Overlay for Mobile */
.sidebar-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    z-index: 1020;
    display: none;
    opacity: 0;
    transition: opacity 0.3s ease;
}

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

/* Header Styles */
.header {
    position: fixed;
    top: 0;
    left: var(--sidebar-width);
    right: 0;
    height: var(--header-height);
    background: white;
    border-bottom: 1px solid var(--border-light);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 2rem;
    z-index: 1025;
    transition: left 0.3s ease;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.05);
}

.header.expanded {
    left: 0;
}

.header-left {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.sidebar-toggle {
    background: none;
    border: none;
    font-size: 1.2rem;
    color: var(--secondary-color);
    cursor: pointer;
    padding: 0.5rem;
    border-radius: 8px;
    transition: all 0.3s ease;
}

.sidebar-toggle:hover {
    background: var(--bg-light);
    color: var(--primary-color);
}

.header-left h4 {
    font-size: 1.25rem;
    font-weight: 600;
    color: var(--text-primary);
    margin: 0;
}

.header-right {
    display: flex;
    align-items: center;
    gap: 1rem;
}

/* Search Box */
.search-box {
    position: relative;
    display: block;
}

.search-box input {
    border: 1px solid var(--border-light);
    border-radius: 25px;
    padding: 0.5rem 1rem 0.5rem 2.5rem;
    width: 280px;
    font-size: 0.9rem;
    background: var(--bg-light);
    transition: all 0.3s ease;
}

.search-box input:focus {
    background: white;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.1);
    outline: none;
    width: 320px;
}

.search-box i {
    position: absolute;
    left: 1rem;
    top: 50%;
    transform: translateY(-50%);
    color: var(--secondary-color);
}

/* User Profile */
.user-profile {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    cursor: pointer;
    padding: 0.5rem;
    border-radius: 8px;
    transition: all 0.3s ease;
}

.user-profile:hover {
    background: var(--bg-light);
}

.user-avatar {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--primary-color), #6366f1);
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-weight: 600;
    font-size: 0.9rem;
}

.user-info {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
}

.user-name {
    font-weight: 600;
    font-size: 0.9rem;
    color: var(--text-primary);
    margin: 0;
}

.user-role {
    font-size: 0.8rem;
    color: var(--secondary-color);
    margin: 0;
}

/* Notification Icon */
.notification-icon {
    position: relative;
    border: none;
    background: none;
    padding: 0.5rem;
    border-radius: 8px;
    transition: all 0.3s ease;
}

.notification-icon:hover {
    background: var(--bg-light);
}

.notification-badge {
    position: absolute;
    top: 0;
    right: 0;
    background: var(--danger-color);
    color: white;
    border-radius: 50%;
    width: 18px;
    height: 18px;
    font-size: 0.7rem;
    display: flex;
    align-items: center;
    justify-content: center;
    animation: pulse 2s infinite;
}

@keyframes pulse {
    0% { transform: scale(1); }
    50% { transform: scale(1.1); }
    100% { transform: scale(1); }
}

/* Main Content */
.main-content {
    margin-left: var(--sidebar-width);
    margin-top: var(--header-height);
    padding: 2rem 1.5rem;
    min-height: calc(100vh - var(--header-height));
    transition: margin-left 0.3s ease;
    display: block !important;
    position: relative;
    z-index: 1;
    background: var(--bg-light);
}

/* Add spacing for content wrapper */
.main-content .container-fluid {
    padding-left: 1rem;
    padding-right: 1rem;
}

.main-content.expanded {
    margin-left: 0;
}

/* Page Header */
.page-header {
    margin-bottom: 2rem;
}

.page-title {
    font-size: 2rem;
    font-weight: 700;
    color: var(--text-primary);
    margin-bottom: 0.5rem;
}

.page-subtitle {
    color: var(--secondary-color);
    font-size: 1.1rem;
    margin: 0;
}

/* Cards */
.card {
    background: white;
    border-radius: 16px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.08);
    border: 1px solid #f1f5f9;
    margin-bottom: 1.5rem;
    position: relative;
    z-index: 1;
}

.card-header {
    padding: 1.5rem;
    border-bottom: 1px solid #f1f5f9;
    background: white;
    border-radius: 16px 16px 0 0;
}

.card-body {
    padding: 1.5rem;
}

.card-title {
    font-size: 1.25rem;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 0.5rem;
}

/* Stats Grid */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 1.5rem;
    margin-bottom: 2rem;
}

.stat-card {
    background: white;
    border-radius: 16px;
    padding: 1.5rem;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.08);
    border: 1px solid #f1f5f9;
    position: relative;
    overflow: hidden;
    transition: transform 0.3s ease, box-shadow 0.3s ease;
}

.stat-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 8px 30px rgba(0, 0, 0, 0.12);
}

.stat-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 4px;
}

.stat-card.primary::before { background: var(--primary-color); }
.stat-card.success::before { background: var(--success-color); }
.stat-card.warning::before { background: var(--warning-color); }
.stat-card.danger::before { background: var(--danger-color); }

.stat-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1rem;
}

.stat-title {
    font-size: 0.9rem;
    color: var(--secondary-color);
    font-weight: 500;
    margin: 0;
}

.stat-icon {
    width: 48px;
    height: 48px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-size: 1.2rem;
}

.stat-icon.primary { background: linear-gradient(135deg, var(--primary-color), #6366f1); }
.stat-icon.success { background: linear-gradient(135deg, var(--success-color), #34d399); }
.stat-icon.warning { background: linear-gradient(135deg, var(--warning-color), #fbbf24); }
.stat-icon.danger { background: linear-gradient(135deg, var(--danger-color), #f87171); }

.stat-value {
    font-size: 2.2rem;
    font-weight: 700;
    color: var(--text-primary);
    margin-bottom: 0.5rem;
}

.stat-change {
    font-size: 0.85rem;
    display: flex;
    align-items: center;
    gap: 0.25rem;
    margin: 0;
}

.stat-change.positive { color: var(--success-color); }
.stat-change.negative { color: var(--danger-color); }

/* Tables */
.table-responsive {
    border-radius: 12px;
    overflow-x: auto;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch; /* Smooth scrolling on iOS */
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.05);
    width: 100%;
    max-width: 100%;
}

/* Mobile table scrolling */
@media (max-width: 768px) {
    .table-responsive {
        overflow-x: auto !important;
        display: block;
        width: 100%;
        -webkit-overflow-scrolling: touch;
    }
    
    .table-responsive table {
        min-width: 100%;
        white-space: nowrap;
    }
}

.data-table {
    width: 100%;
    border-collapse: collapse;
    background: white;
    margin: 0;
}

.data-table th {
    background: #f8fafc;
    text-align: left;
    padding: 1rem;
    border-bottom: 2px solid var(--border-light);
    color: var(--secondary-color);
    font-weight: 600;
    font-size: 0.9rem;
}

.data-table td {
    padding: 1rem;
    border-bottom: 1px solid #f1f5f9;
    color: #374151;
    vertical-align: middle;
}

.data-table tr:hover {
    background: #f8fafc;
}

.data-table tr:last-child td {
    border-bottom: none;
}

/* Buttons */
.btn {
    border-radius: 8px;
    font-weight: 500;
    padding: 0.6rem 1.2rem;
    border: none;
    transition: all 0.3s ease;
    cursor: pointer;
    text-decoration: none;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
}

.btn:hover {
    transform: translateY(-1px);
    text-decoration: none;
}

.btn-primary {
    background: var(--primary-color);
    color: white;
}

.btn-primary:hover {
    background: #1d4ed8;
    color: white;
}

.btn-success {
    background: var(--success-color);
    color: white;
}

.btn-success:hover {
    background: #059669;
    color: white;
}

.btn-warning {
    background: var(--warning-color);
    color: white;
}

.btn-warning:hover {
    background: #d97706;
    color: white;
}

.btn-danger {
    background: var(--danger-color);
    color: white;
}

.btn-danger:hover {
    background: #dc2626;
    color: white;
}

.btn-outline-primary {
    background: white;
    color: var(--primary-color);
    border: 1px solid var(--primary-color);
}

.btn-outline-primary:hover {
    background: var(--primary-color);
    color: white;
}

.btn-outline-secondary {
    background: white;
    color: var(--secondary-color);
    border: 1px solid var(--border-light);
}

.btn-outline-secondary:hover {
    background: var(--secondary-color);
    color: white;
}

/* Status Badges */
.status-badge {
    padding: 0.25rem 0.75rem;
    border-radius: 20px;
    font-size: 0.8rem;
    font-weight: 500;
    display: inline-flex;
    align-items: center;
    gap: 0.25rem;
}

.status-badge.active {
    background: rgba(16, 185, 129, 0.1);
    color: var(--success-color);
}

.status-badge.inactive {
    background: rgba(239, 68, 68, 0.1);
    color: var(--danger-color);
}

.status-badge.pending {
    background: rgba(245, 158, 11, 0.1);
    color: var(--warning-color);
}

/* Forms */
.form-group {
    margin-bottom: 1.5rem;
}

.form-label {
    display: block;
    font-weight: 500;
    color: #374151;
    margin-bottom: 0.5rem;
}

.form-control {
    width: 100%;
    padding: 0.75rem;
    border: 1px solid #d1d5db;
    border-radius: 8px;
    font-size: 0.9rem;
    transition: border-color 0.3s ease, box-shadow 0.3s ease;
}

.form-control:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.1);
}

/* Alerts */
.alert {
    padding: 1rem;
    border-radius: 8px;
    margin-bottom: 1rem;
    border: 1px solid transparent;
    display: flex;
    align-items: center;
}

.alert-success {
    background: rgba(16, 185, 129, 0.1);
    color: var(--success-color);
    border-color: rgba(16, 185, 129, 0.2);
}

.alert-danger {
    background: rgba(239, 68, 68, 0.1);
    color: var(--danger-color);
    border-color: rgba(239, 68, 68, 0.2);
}

.alert-warning {
    background: rgba(245, 158, 11, 0.1);
    color: var(--warning-color);
    border-color: rgba(245, 158, 11, 0.2);
}

.alert-info {
    background: rgba(6, 182, 212, 0.1);
    color: var(--info-color);
    border-color: rgba(6, 182, 212, 0.2);
}

/* Footer */
.main-footer {
    margin-left: var(--sidebar-width);
    margin-top: 2rem;
    background: white;
    border-top: 1px solid var(--border-light);
    padding: 1rem 2rem;
    transition: margin-left 0.3s ease;
}

.main-footer.expanded {
    margin-left: 0;
}

/* Dropdown Menus */
.dropdown-menu {
    border-radius: 12px;
    border: 1px solid var(--border-light);
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.15);
    padding: 0.5rem 0;
    z-index: 1050;
}

.dropdown-item {
    padding: 0.75rem 1rem;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.dropdown-item:hover {
    background: var(--bg-light);
    color: var(--primary-color);
}

.dropdown-header {
    padding: 0.75rem 1rem;
    font-weight: 600;
    color: var(--text-primary);
    background: var(--bg-light);
}

/* Loading Animation */
.loading {
    display: inline-block;
    width: 20px;
    height: 20px;
    border: 2px solid #f3f3f3;
    border-top: 2px solid var(--primary-color);
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* Mobile Responsive Styles */
@media (max-width: 991px) {
    /* Hide sidebar by default on mobile/tablet */
    .sidebar {
        transform: translateX(-100%);
    }
    
    /* Show sidebar when toggled */
    .sidebar.show {
        transform: translateX(0);
    }
    
    /* Adjust header for mobile/tablet */
    .header {
        left: 0 !important;
        padding: 0 1rem;
    }
    
    .header-left h4 {
        font-size: 1.1rem;
        display: none;
    }
    
    /* Adjust main content for mobile/tablet */
    .main-content {
        margin-left: 0 !important;
        padding: 1rem 0.75rem;
        margin-top: var(--header-height);
    }
    
    /* Add spacing to cards and elements on mobile */
    .main-content .card {
        margin-bottom: 1rem;
        margin-left: 0.25rem;
        margin-right: 0.25rem;
    }
    
    .main-content .row {
        margin-left: -0.25rem;
        margin-right: -0.25rem;
    }
    
    .main-content .row > [class*="col-"] {
        padding-left: 0.25rem;
        padding-right: 0.25rem;
    }
    
    /* Modal spacing on mobile */
    .modal-body {
        padding: 1rem 1.25rem !important;
    }
    
    .modal-body .row {
        margin-left: -0.25rem !important;
        margin-right: -0.25rem !important;
    }
    
    .modal-body .row > [class*="col-"] {
        padding-left: 0.25rem !important;
        padding-right: 0.25rem !important;
    }
    
    /* Hide search box on mobile */
    .search-box {
        display: none !important;
    }
    
    /* Hide user info on mobile */
    .user-info {
        display: none;
    }
    
    /* Adjust stats grid for mobile */
    .stats-grid {
        grid-template-columns: 1fr;
        gap: 1rem;
    }
    
    /* Adjust page title for mobile */
    .page-title {
        font-size: 1.5rem;
    }
    
    /* Adjust footer for mobile */
    .main-footer {
        margin-left: 0 !important;
        text-align: center;
        padding: 1rem;
    }
    
    .main-footer .col-md-6 {
        text-align: center !important;
        margin-bottom: 0.5rem;
    }
    
    /* Adjust dropdowns for mobile */
    .dropdown .btn {
        padding: 0.4rem 0.8rem;
        font-size: 0.8rem;
    }
    
    /* Stack cards on mobile */
    .row .col-md-8,
    .row .col-md-4 {
        margin-bottom: 1rem;
    }
}

/* Tablet Responsive */
@media (min-width: 769px) and (max-width: 1024px) {
    .sidebar {
        width: 250px;
    }
    
    :root {
        --sidebar-width: 250px;
    }
    
    .search-box input {
        width: 200px;
    }
    
    .search-box input:focus {
        width: 240px;
    }
}

/* Large Desktop */
@media (min-width: 1200px) {
    .main-content {
        padding: 2.5rem;
    }
    
    .search-box input {
        width: 320px;
    }
    
    .search-box input:focus {
        width: 380px;
    }
}

/* Print Styles */
@media print {
    .sidebar,
    .header,
    .sidebar-overlay {
        display: none !important;
    }
    
    .main-content {
        margin: 0 !important;
        padding: 1rem !important;
    }
    
    .card {
        box-shadow: none;
        border: 1px solid #ddd;
    }
}

/* Accessibility */
.sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

/* Focus styles for accessibility */
.menu-item:focus,
.btn:focus,
.form-control:focus {
    outline: 2px solid var(--primary-color);
    outline-offset: 2px;
}

/* High contrast mode support */
@media (prefers-contrast: high) {
    .card {
        border: 2px solid #000;
    }
    
    .btn {
        border: 2px solid currentColor;
    }
}

/* Reduced motion support */
@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
}
/* ==============================================
   MODAL FIXES - Add this to the end of your style.css
   ============================================== */

/* Force Bootstrap modals to appear above everything */
.modal {
    z-index: 99999 !important;
}

.modal-backdrop {
    z-index: 99998 !important;
}

/* Ensure modal dialog is properly positioned */
.modal-dialog {
    z-index: 100000 !important;
    position: relative;
}

.modal-content {
    z-index: 100001 !important;
    position: relative;
    border-radius: 16px;
    border: none;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
}

/* Make sure all interactive elements in modal are clickable */
.modal .btn, 
.modal .form-control, 
.modal .form-select,
.modal input,
.modal textarea,
.modal select,
.modal .dropdown-toggle,
.modal .btn-close {
    position: relative !important;
    z-index: 100002 !important;
    pointer-events: auto !important;
}

/* Fix for dropdown menus inside modals */
.modal .dropdown-menu {
    z-index: 100003 !important;
}

/* Ensure modal header and footer are interactive */
.modal-header,
.modal-body,
.modal-footer {
    position: relative;
    z-index: 100001 !important;
}

/* Fix modal backdrop to not block interactions */
.modal-backdrop {
    pointer-events: auto !important;
}

.modal-backdrop.show {
    opacity: 0.5;
    pointer-events: auto !important;
}

/* Ensure sidebar elements don't interfere with modals */
.sidebar, 
.sidebar-overlay, 
.header {
    z-index: 1030 !important; /* Lower than modal */
}

/* Modal animation improvements */
.modal.fade .modal-dialog {
    transition: transform 0.3s ease-out;
    transform: translate(0, -50px);
}

.modal.show .modal-dialog {
    transform: none;
}

/* Modal header styling */
.modal-header {
    background: #f8fafc;
    border-bottom: 1px solid #e2e8f0;
    border-radius: 16px 16px 0 0;
    padding: 1.5rem;
}

.modal-title {
    font-size: 1.25rem;
    font-weight: 600;
    color: var(--text-primary);
    margin: 0;
}

.modal-body {
    padding: 1.5rem 2rem;
    max-height: 70vh;
    overflow-y: auto;
}

/* Modal Form Styling */
.modal-body .row {
    margin-left: -0.5rem;
    margin-right: -0.5rem;
}

.modal-body .row > [class*="col-"] {
    padding-left: 0.5rem;
    padding-right: 0.5rem;
}

.modal-body .form-label {
    font-weight: 500;
    margin-bottom: 0.5rem;
    font-size: 0.9rem;
    color: var(--text-primary);
}

.modal-body .form-control,
.modal-body .form-select {
    border-radius: 8px;
    border: 1px solid #e2e8f0;
    padding: 0.625rem 0.875rem;
    font-size: 0.95rem;
}

.modal-body .form-control:focus,
.modal-body .form-select:focus {
    border-color: var(--primary-color);
    box-shadow: 0 0 0 0.2rem rgba(37, 99, 235, 0.1);
}

.modal-body .mb-3 {
    margin-bottom: 1.25rem !important;
}

.modal-footer {
    background: #f8fafc;
    border-top: 1px solid #e2e8f0;
    border-radius: 0 0 16px 16px;
    padding: 1rem 1.5rem;
    gap: 0.75rem;
}

/* Form styling inside modals */
.modal .form-group,
.modal .mb-3 {
    margin-bottom: 1.5rem;
}

.modal .form-label {
    font-weight: 500;
    color: #374151;
    margin-bottom: 0.5rem;
}

.modal .form-control,
.modal .form-select {
    border: 1px solid #d1d5db;
    border-radius: 8px;
    padding: 0.75rem;
    font-size: 0.9rem;
    transition: border-color 0.3s ease, box-shadow 0.3s ease;
}

.modal .form-control:focus,
.modal .form-select:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.1);
}

/* Required field indicator */
.modal .text-danger {
    color: var(--danger-color) !important;
}

/* Button styling in modal */
.modal .btn {
    border-radius: 8px;
    font-weight: 500;
    padding: 0.6rem 1.2rem;
    transition: all 0.3s ease;
}

.modal .btn:hover {
    transform: translateY(-1px);
}

/* Specific button colors in modal */
.modal .btn-primary {
    background: var(--primary-color);
    border-color: var(--primary-color);
}

.modal .btn-primary:hover {
    background: #1d4ed8;
    border-color: #1d4ed8;
}

.modal .btn-secondary {
    background: #6b7280;
    border-color: #6b7280;
}

.modal .btn-secondary:hover {
    background: #4b5563;
    border-color: #4b5563;
}

/* Close button styling */
.modal .btn-close {
    background: none;
    border: none;
    font-size: 1.2rem;
    opacity: 0.6;
    padding: 0.5rem;
    border-radius: 4px;
    transition: opacity 0.3s ease;
}

.modal .btn-close:hover {
    opacity: 1;
    background: rgba(0, 0, 0, 0.1);
}

/* Textarea styling in modal */
.modal textarea.form-control {
    resize: vertical;
    min-height: 80px;
}

/* Select dropdown styling in modal */
.modal .form-select {
    background-image: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' fill='none' viewBox='0 0 20 20'%3e%3cpath stroke='%236b7280' stroke-linecap='round' stroke-linejoin='round' stroke-width='1.5' d='m6 8 4 4 4-4'/%3e%3c/svg%3e");
    background-position: right 0.75rem center;
    background-repeat: no-repeat;
    background-size: 16px 12px;
    padding-right: 2.5rem;
}

/* Loading state for modal buttons */
.modal .btn:disabled {
    opacity: 0.6;
    cursor: not-allowed;
    transform: none;
}

/* Alert styling inside modals */
.modal .alert {
    border-radius: 8px;
    padding: 0.75rem 1rem;
    margin-bottom: 1rem;
}

.modal .alert-success {
    background: rgba(16, 185, 129, 0.1);
    border-color: rgba(16, 185, 129, 0.2);
    color: var(--success-color);
}

.modal .alert-danger {
    background: rgba(239, 68, 68, 0.1);
    border-color: rgba(239, 68, 68, 0.2);
    color: var(--danger-color);
}

/* Mobile responsiveness for modals */
@media (max-width: 768px) {
    .modal-dialog {
        margin: 1rem;
        max-width: calc(100% - 2rem);
    }
    
    .modal-dialog-lg {
        max-width: calc(100% - 2rem);
    }
    
    .modal-header,
    .modal-body,
    .modal-footer {
        padding: 1rem;
    }
    
    .modal-body {
        max-height: 60vh;
    }
    
    .modal-title {
        font-size: 1.1rem;
    }
}

/* High contrast mode support for modals */
@media (prefers-contrast: high) {
    .modal-content {
        border: 2px solid #000;
    }
    
    .modal .btn {
        border: 2px solid currentColor;
    }
}

/* Prevent body scroll when modal is open */
body.modal-open {
    overflow: hidden;
    padding-right: 0 !important; /* Prevent scrollbar shift */
}

/* Fix for potential backdrop click issues */
.modal[data-bs-backdrop="static"] .modal-dialog {
    pointer-events: auto;
}

/* Custom scrollbar for modal body */
.modal-body::-webkit-scrollbar {
    width: 6px;
}

.modal-body::-webkit-scrollbar-track {
    background: #f1f1f1;
    border-radius: 3px;
}

.modal-body::-webkit-scrollbar-thumb {
    background: #c1c1c1;
    border-radius: 3px;
}

.modal-body::-webkit-scrollbar-thumb:hover {
    background: #a8a8a8;
}
.modal,
.modal * {
    z-index: 999999 !important;
    pointer-events: auto !important;
}

.modal-backdrop {
    z-index: 999998 !important;
}

/* Force all Bootstrap modal elements to be interactive */
.modal .modal-dialog,
.modal .modal-content,
.modal .modal-header,
.modal .modal-body,
.modal .modal-footer,
.modal .btn,
.modal .form-control,
.modal .form-select {
    z-index: 999999 !important;
    pointer-events: auto !important;
    position: relative !important;
}

.sidebar.hidden {
    transform: translateX(-100%);
}

.main-content.expanded {
    margin-left: 0;
}

.header.expanded {
    left: 0;
}

.main-footer.expanded {
    margin-left: 0;
}

/* Full screen mode */
.header.fullscreen {
    display: none;
}

.sidebar.fullscreen {
    display: none;
}

.main-content.fullscreen {
    margin-left: 0;
    margin-top: 0;
    padding: 1rem;
}

/* Toggle buttons */
.toggle-buttons {
    position: fixed;
    top: 10px;
    right: 1300px;
    z-index: 9999; /* Higher than everything */
    display: flex;
    gap: 5px;
    opacity: 0.3;
    transition: opacity 0.3s ease;
}

.toggle-btn {
    background: rgba(37, 99, 235, 0.9);
    color: white;
    border: none;
    border-radius: 50%;
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 2px 10px rgba(0,0,0,0.2);
    transition: all 0.3s ease;
    cursor: pointer;
}
body.fullscreen .toggle-buttons {
    display: flex !important;
    opacity: 1;
}
.toggle-btn:hover {
    background: rgba(37, 99, 235, 1);
    transform: scale(1.1);
}

.sidebar-toggle {
    margin-left: 10px;
}

/* Improved sidebar toggle positioning */
.header-left {
    position: relative;
}

.header-left .sidebar-toggle {
    margin-right: 15px;
    padding: 8px;
    border-radius: 6px;
    transition: background 0.3s ease;
}

.header-left .sidebar-toggle:hover {
    background: #f1f5f9;
}

/* Session Selector Styles */
.session-selector {
    padding: 0.75rem;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 8px;
    margin: 0.5rem;
}

.session-selector .form-label {
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 0.5rem;
}

.session-dropdown {
    background: rgba(255, 255, 255, 0.9);
    border: 1px solid rgba(255, 255, 255, 0.3);
    color: #333;
    font-size: 0.875rem;
    border-radius: 6px;
    transition: all 0.3s ease;
}

.session-dropdown:focus {
    background: rgba(255, 255, 255, 0.95);
    border-color: rgba(255, 255, 255, 0.5);
    box-shadow: 0 0 0 2px rgba(255, 255, 255, 0.2);
}

.session-dropdown:disabled {
    background: rgba(255, 255, 255, 0.5);
    opacity: 0.7;
}

.session-selector small {
    font-size: 0.7rem;
    line-height: 1.2;
}

/* Mobile responsive */
@media (max-width: 991px) {
    .session-selector {
        margin: 0.25rem;
        padding: 0.5rem;
    }
    
    .session-dropdown {
        font-size: 0.8rem;
    }
}

/* ==============================================
   MOBILE SIDEBAR FIXES - ADD TO END OF STYLE.CSS
   ============================================== */

/* Force mobile/tablet sidebar behavior */
@media (max-width: 991px) {
    /* Force sidebar positioning and behavior */
    .sidebar {
        transform: translateX(-100%) !important;
        z-index: 1030 !important;
        position: fixed !important;
        width: var(--sidebar-width) !important;
        transition: transform 0.3s ease !important;
    }
    
    /* Show sidebar when toggled */
    .sidebar.show {
        transform: translateX(0) !important;
    }
    
    /* Force overlay styles */
    .sidebar-overlay {
        position: fixed !important;
        top: 0 !important;
        left: 0 !important;
        width: 100% !important;
        height: 100% !important;
        background: rgba(0, 0, 0, 0.5) !important;
        z-index: 1020 !important;
        display: none !important;
        opacity: 0 !important;
        visibility: hidden !important;
        transition: opacity 0.3s ease, visibility 0.3s ease !important;
    }
    
    /* Force overlay to show when needed */
    .sidebar-overlay[style*="block"],
    .sidebar-overlay.show {
        display: block !important;
        opacity: 1 !important;
        visibility: visible !important;
    }
    
    /* Lock body when sidebar is open */
    body.sidebar-open-mobile {
        overflow: hidden !important;
        position: fixed !important;
        width: 100% !important;
        height: 100% !important;
    }
    
    /* Force header positioning on mobile */
    .header {
        left: 0 !important;
        z-index: 1025 !important;
    }
    
    /* Force main content positioning on mobile */
    .main-content {
        margin-left: 0 !important;
        z-index: 1 !important;
    }
    
    /* Ensure sidebar appears above everything on mobile */
    .sidebar {
        z-index: 1030 !important;
    }
    
    /* Hide non-essential elements on mobile */
    .search-box {
        display: none !important;
    }
    
    .user-info {
        display: none !important;
    }
    
    .header-left h4 {
        display: none !important;
    }
}

/* Force desktop sidebar behavior */
@media (min-width: 769px) {
    .sidebar.hidden {
        transform: translateX(-100%) !important;
    }
    
    .header.expanded {
        left: 0 !important;
    }
    
    .main-content.expanded {
        margin-left: 0 !important;
    }
    
    .main-footer.expanded {
        margin-left: 0 !important;
    }
    
    /* Ensure overlay is hidden on desktop */
    .sidebar-overlay {
        display: none !important;
    }
    
    /* Ensure body is not locked on desktop */
    body.sidebar-open-mobile {
        overflow: auto !important;
        position: static !important;
        width: auto !important;
        height: auto !important;
    }
}

/* Debug styles - remove after testing */
.debug-mobile .sidebar {
    border: 3px solid red !important;
}

.debug-mobile .sidebar-overlay {
    border: 3px solid blue !important;
}
/* ===================================
   HEADER STYLES
   =================================== */

/* Header Container */
.header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 20px;
    height: 70px;
    background: white;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    z-index: 1000;
}

.header-left {
    display: flex;
    align-items: center;
    gap: 15px;
}

.header-center {
    flex: 1;
    max-width: 600px;
    margin: 0 20px;
}

/* Search Bar */
.header-search {
    position: relative;
    width: 100%;
}

.header-search i {
    position: absolute;
    left: 15px;
    top: 50%;
    transform: translateY(-50%);
    color: #999;
}

.header-search input {
    width: 100%;
    padding: 10px 15px 10px 45px;
    border: 1px solid #ddd;
    border-radius: 25px;
    outline: none;
    font-size: 14px;
}

.header-search input:focus {
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(255, 153, 51, 0.1);
}

/* Header Right Section */
.header-right {
    display: flex;
    align-items: center;
    gap: 10px;
}

/* Header Icon Buttons */
.header-icon-btn {
    display: flex;
    align-items: center;
    gap: 5px;
    padding: 8px 15px;
    background: transparent;
    border: 1px solid #ddd;
    border-radius: 5px;
    cursor: pointer;
    font-size: 14px;
    color: #333;
    text-decoration: none;
    position: relative;
    transition: all 0.3s;
}

.header-icon-btn:hover {
    background: #f8f9fa;
    border-color: var(--primary-color);
    color: var(--primary-color);
}

/* Badge Count */
.badge-count {
    position: absolute;
    top: -5px;
    right: -5px;
    background: #dc3545;
    color: white;
    border-radius: 10px;
    padding: 2px 6px;
    font-size: 11px;
    font-weight: 600;
}

/* DateTime Display */
.header-datetime {
    display: flex;
    align-items: center;
    padding: 8px 12px;
    background: #f8f9fa;
    border-radius: 5px;
    font-size: 13px;
    color: #666;
}

/* User Button */
.header-user-btn {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 5px 10px;
    background: white;
    border: 1px solid #ddd;
    border-radius: 25px;
    cursor: pointer;
    transition: all 0.3s;
}

.header-user-btn:hover {
    border-color: var(--primary-color);
    box-shadow: 0 2px 8px rgba(255, 153, 51, 0.2);
}

.user-avatar-img {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    object-fit: cover;
}

.user-info-header {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
}

.user-name-header {
    font-size: 14px;
    font-weight: 600;
    color: #333;
}

.user-role-header {
    font-size: 12px;
    color: #999;
}

/* User Dropdown Menu */
.user-dropdown-menu {
    min-width: 280px;
    padding: 10px 0;
}

.user-dropdown-menu .dropdown-header {
    padding: 15px;
    background: #f8f9fa;
    margin-bottom: 10px;
}

.user-avatar-large {
    width: 60px;
    height: 60px;
    border-radius: 50%;
    object-fit: cover;
}

/* Header Mobile Responsive */
@media (max-width: 768px) {
    .header-center {
        display: none;
    }
    .header-icon-btn span {
        display: none;
    }
    .header-datetime {
        display: none;
    }
    .user-info-header {
        display: none;
    }
}

/* Body and Main Content Adjustments for Fixed Header */
body {
    padding-top: 70px;
}

.main-content {
    padding-top: 20px;
}
