/* School Management System - Main Stylesheet */
/* ============================================== */
@import url('app-layout.css');

/* Global Styles */
:root {
    --primary-color: #667eea;
    --secondary-color: #764ba2;
    --success-color: #56ab2f;
    --warning-color: #f093fb;
    --danger-color: #f5576c;
    --info-color: #4facfe;
    --light-color: #f8f9fa;
    --dark-color: #343a40;
    --border-radius: 10px;
    --box-shadow: 0 5px 15px rgba(0, 0, 0, 0.08);
    --transition: all 0.3s ease;
    --header-color: #ffffff;
    --sidebar-color: #0F2233; 
    --text-color: #212529;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

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

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

/* Typography */
h1, h2, h3, h4, h5, h6 {
    font-weight: 600;
    margin-bottom: 1rem;
}

.text-gradient {
    background: linear-gradient(135deg, var(--primary-color) 0%, var(--secondary-color) 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

/* Buttons */
.btn {
    border-radius: var(--border-radius);
    font-weight: 500;
    transition: var(--transition);
    border: none;
    padding: 10px 20px;
}

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

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(102, 126, 234, 0.4);
    color: white;
}

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

.btn-warning {
    background: linear-gradient(135deg, var(--warning-color) 0%, var(--danger-color) 100%);
    color: white;
}

.btn-danger {
    background: linear-gradient(135deg, #fa709a 0%, #fee140 100%);
    color: white;
}

.btn-info {
    background: linear-gradient(135deg, var(--info-color) 0%, #00f2fe 100%);
    color: white;
}

/* Cards */
.card {
    border-radius: var(--border-radius);
    box-shadow: var(--box-shadow);
    border: none;
    transition: var(--transition);
}

.card:hover {
    transform: translateY(-2px);
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.15);
}

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

/* Forms */
.form-control {
    border-radius: var(--border-radius);
    border: 2px solid #e9ecef;
    padding: 12px 15px;
    transition: var(--transition);
}

.form-control:focus {
    border-color: var(--primary-color);
    box-shadow: 0 0 0 0.2rem rgba(102, 126, 234, 0.25);
}

.form-label {
    font-weight: 500;
    color: var(--dark-color);
}

/* Tables */
.table {
    border-radius: var(--border-radius);
    overflow: hidden;
    box-shadow: var(--box-shadow);
}

.table thead th {
    background: linear-gradient(135deg, var(--primary-color) 0%, var(--secondary-color) 100%);
    color: white;
    border: none;
    font-weight: 600;
    padding: 15px;
}

.table tbody tr {
    transition: var(--transition);
}

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

/* Alerts */
.alert {
    border-radius: var(--border-radius);
    border: none;
    padding: 15px 20px;
}

.alert-success {
    background: linear-gradient(135deg, var(--success-color) 0%, #a8e6cf 100%);
    color: white;
}

.alert-warning {
    background: linear-gradient(135deg, var(--warning-color) 0%, var(--danger-color) 100%);
    color: white;
}

.alert-danger {
    background: linear-gradient(135deg, #fa709a 0%, #fee140 100%);
    color: white;
}

.alert-info {
    background: linear-gradient(135deg, var(--info-color) 0%, #00f2fe 100%);
    color: white;
}

/* Navigation */
.navbar {
    background: white;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
    position: sticky;
    top: 0;
    z-index: 1030;
}

/* Sticky Header Styles */
.navbar-expand-lg {
    position: sticky;
    top: 0;
    z-index: 1030;
    background: white;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
}

/* Sticky Sidebar */
.sidebar {
    background: var(--sidebar-color, linear-gradient(135deg, var(--primary-color) 0%, var(--secondary-color) 100%));
    color: var(--text-color, white);
    min-height: 100vh;
    position: sticky;
    top: 0;
    height: 100vh;
    overflow-y: auto;
}

/* Sticky Card Headers */
.card-header {
    background: linear-gradient(135deg, var(--primary-color) 0%, var(--secondary-color) 100%);
    color: white;
    border-radius: var(--border-radius) var(--border-radius) 0 0 !important;
    border: none;
    position: sticky;
    top: 0;
    z-index: 1020;
}

/* Sticky Table Headers */
.table thead {
    position: sticky;
    top: 0;
    z-index: 1010;
    background: linear-gradient(135deg, var(--primary-color) 0%, var(--secondary-color) 100%);
}

.table thead th {
    background: linear-gradient(135deg, var(--primary-color) 0%, var(--secondary-color) 100%);
    color: white;
    border: none;
    font-weight: 600;
    padding: 15px;
    position: sticky;
    top: 0;
    z-index: 1010;
}

/* Sticky Modal Headers */
.modal-header {
    background: linear-gradient(135deg, var(--primary-color) 0%, var(--secondary-color) 100%);
    color: white;
    border-radius: var(--border-radius) var(--border-radius) 0 0;
    border: none;
    position: sticky;
    top: 0;
    z-index: 1050;
}

/* Sticky Page Headers */
.page-header {
    position: sticky;
    top: 0;
    z-index: 1025;
    background: white;
    padding: 15px 0;
    border-bottom: 1px solid #e9ecef;
    margin-bottom: 20px;
}

/* Sticky Navigation Container */
.nav-container {
    position: sticky;
    top: 0;
    z-index: 1030;
    background: white;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
}

/* Stats Cards */
.stats-card {
    background: white;
    border-radius: var(--border-radius);
    box-shadow: var(--box-shadow);
    transition: var(--transition);
    border: none;
    overflow: hidden;
}

.stats-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.15);
}

.stats-icon {
    width: 60px;
    height: 60px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 24px;
    color: white;
}

/* Gradients */
.bg-gradient-primary {
    background: linear-gradient(135deg, var(--primary-color) 0%, var(--secondary-color) 100%);
}

.bg-gradient-success {
    background: linear-gradient(135deg, var(--success-color) 0%, #a8e6cf 100%);
}

.bg-gradient-warning {
    background: linear-gradient(135deg, var(--warning-color) 0%, var(--danger-color) 100%);
}

.bg-gradient-info {
    background: linear-gradient(135deg, var(--info-color) 0%, #00f2fe 100%);
}

.bg-gradient-danger {
    background: linear-gradient(135deg, #fa709a 0%, #fee140 100%);
}

.bg-gradient-dark {
    background: linear-gradient(135deg, var(--primary-color) 0%, var(--secondary-color) 100%);
}

/* User Avatar */
.user-avatar {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--primary-color) 0%, var(--secondary-color) 100%);
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-weight: bold;
}

/* Notification Badge */
.notification-badge {
    position: absolute;
    top: -5px;
    right: -5px;
    background: var(--danger-color);
    color: white;
    border-radius: 50%;
    width: 20px;
    height: 20px;
    font-size: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
}

/* Activity Items */
.activity-item {
    padding: 15px 0;
    border-bottom: 1px solid #eee;
    transition: var(--transition);
}

.activity-item:hover {
    background-color: rgba(102, 126, 234, 0.05);
    padding-left: 10px;
}

.activity-item:last-child {
    border-bottom: none;
}

/* Modal */
.modal-content {
    border-radius: var(--border-radius);
    border: none;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.2);
}

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

.modal-title {
    color: white;
}

/* Pagination */
.page-link {
    border-radius: var(--border-radius);
    border: none;
    margin: 0 2px;
    color: var(--primary-color);
    transition: var(--transition);
}

.page-link:hover {
    background: linear-gradient(135deg, var(--primary-color) 0%, var(--secondary-color) 100%);
    color: white;
}

.page-item.active .page-link {
    background: linear-gradient(135deg, var(--primary-color) 0%, var(--secondary-color) 100%);
    border: none;
}

/* Badges */
.badge {
    border-radius: 20px;
    padding: 5px 12px;
    font-weight: 500;
}

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

.badge-success {
    background: linear-gradient(135deg, var(--success-color) 0%, #a8e6cf 100%);
}

.badge-warning {
    background: linear-gradient(135deg, var(--warning-color) 0%, var(--danger-color) 100%);
}

.badge-danger {
    background: linear-gradient(135deg, #fa709a 0%, #fee140 100%);
}

/* Loading Spinner */
.spinner-border {
    color: var(--primary-color);
}

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

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

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

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

/* Responsive Design */
@media (max-width: 768px) {
    .sidebar {
        position: fixed;
        top: 0;
        left: -100%;
        width: 250px;
        z-index: 1000;
        transition: var(--transition);
    }
    
    .sidebar.show {
        left: 0;
    }
    
    .main-content {
        margin-left: 0;
    }
    
    .stats-card {
        margin-bottom: 20px;
    }
}

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

/* Dark Mode Support */
@media (prefers-color-scheme: dark) {
    :root {
        --light-color: #1a1a1a;
        --dark-color: #ffffff;
    }
    
    body {
        background-color: var(--light-color);
        color: var(--dark-color);
    }
    
    .card {
        background-color: #2d2d2d;
        color: var(--dark-color);
    }
    
    .form-control {
        background-color: #2d2d2d;
        color: var(--dark-color);
        border-color: #444;
    }
}

/* Animation Classes */
.fade-in {
    animation: fadeIn 0.5s ease-in;
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.slide-in {
    animation: slideIn 0.3s ease-out;
}

@keyframes slideIn {
    from {
        transform: translateX(-100%);
    }
    to {
        transform: translateX(0);
    }
}

/* Utility Classes */
.text-truncate-2 {
    display: -webkit-box;
    -webkit-line-clamp: 2;
    line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.cursor-pointer {
    cursor: pointer;
}

.border-gradient {
    border: 2px solid;
    border-image: linear-gradient(135deg, var(--primary-color) 0%, var(--secondary-color) 100%) 1;
}

.shadow-custom {
    box-shadow: 0 10px 30px rgba(102, 126, 234, 0.2);
}

/* Status Indicators */
.status-indicator {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    display: inline-block;
    margin-right: 8px;
}

.status-active {
    background-color: var(--success-color);
}

.status-inactive {
    background-color: var(--danger-color);
}

.status-pending {
    background-color: var(--warning-color);
}

/* Progress Bars */
.progress {
    height: 8px;
    border-radius: 10px;
    background-color: #e9ecef;
}

.progress-bar {
    background: linear-gradient(135deg, var(--primary-color) 0%, var(--secondary-color) 100%);
    border-radius: 10px;
}

/* Tooltips */
.tooltip {
    font-size: 12px;
}

.tooltip-inner {
    background: linear-gradient(135deg, var(--primary-color) 0%, var(--secondary-color) 100%);
    border-radius: var(--border-radius);
}

/* Dropdown */
.dropdown-menu {
    border-radius: var(--border-radius);
    border: none;
    box-shadow: var(--box-shadow);
    padding: 10px 0;
}

.dropdown-item {
    padding: 8px 20px;
    transition: var(--transition);
}

.dropdown-item:hover {
    background-color: rgba(102, 126, 234, 0.1);
    color: var(--primary-color);
}

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

.search-box .form-control {
    padding-left: 40px;
}

.search-box .search-icon {
    position: absolute;
    left: 15px;
    top: 50%;
    transform: translateY(-50%);
    color: #6c757d;
}

/* File Upload */
.file-upload {
    position: relative;
    display: inline-block;
    cursor: pointer;
    width: 100%;
}

.file-upload input[type=file] {
    position: absolute;
    opacity: 0;
    width: 100%;
    height: 100%;
    cursor: pointer;
}

.file-upload-label {
    display: block;
    padding: 20px;
    border: 2px dashed #ddd;
    border-radius: var(--border-radius);
    text-align: center;
    transition: var(--transition);
}

.file-upload:hover .file-upload-label {
    border-color: var(--primary-color);
    background-color: rgba(102, 126, 234, 0.05);
} 

/* ============================================== */
/* SIDEBAR STYLING - Clean & Organized */
/* ============================================== */

/* Sidebar Container */
.sidebar {
    position: sticky;
    top: 0;
    height: 100vh;
    overflow-y: auto;
    z-index: 1020;
    background: var(--sidebar-color, linear-gradient(135deg, #667eea 0%, #764ba2 100%));
    color: white;
    scrollbar-width: thin;
    scrollbar-color: rgba(255, 255, 255, 0.3) transparent;
}

/* Fallback for browsers that don't support CSS variables */
@supports not (background: var(--sidebar-color)) {
    .sidebar {
        background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    }
}

/* Custom Scrollbar for Webkit browsers */
.sidebar::-webkit-scrollbar {
    width: 6px;
}

.sidebar::-webkit-scrollbar-track {
    background: transparent;
}

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

.sidebar::-webkit-scrollbar-thumb:hover {
    background: rgba(255, 255, 255, 0.5);
}

/* Sidebar Header - stays at top inside scrollable sidebar */
@media (max-width: 991.98px) {
.sidebar .text-center {
    position: sticky;
    top: 0;
    z-index: 1025;
    background: var(--sidebar-color, linear-gradient(135deg, #667eea 0%, #764ba2 100%));
    padding: 20px 15px;
    margin-bottom: 0;
    border-bottom: 1px solid rgba(255, 255, 255, 0.2);
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
}
}

/* Sidebar Header Layout */
.sidebar-header {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 15px;
}

.sidebar-icon {
    font-size: 4rem !important;
    color: white !important;
    margin: 0 !important;
    text-align: center;
    display: block;
}

.sidebar-title {
    margin: 0 !important;
    font-size: 1.5rem;
    font-weight: 600;
    text-align: center;
    line-height: 1.2;
}

/* Sidebar Navigation Container */
.sidebar .nav {
    padding: 20px 0;
    margin-top: 0;
}

/* Sidebar Navigation Links */
.sidebar .nav-link {
    color: rgba(255, 255, 255, 0.9);
    padding: 15px 20px;
    margin: 3px 15px;
    border-radius: 10px;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    text-decoration: none;
    font-weight: 500;
    position: relative;
    overflow: hidden;
}

/* Hover Effects */
.sidebar .nav-link:hover {
    color: white;
    background: rgba(255, 255, 255, 0.15);
    transform: translateX(8px);
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.2);
}

/* Active State */
.sidebar .nav-link.active {
    color: white;
    background: rgba(255, 255, 255, 0.2);
    transform: translateX(8px);
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.3);
    border-left: 4px solid #fff;
}

/* Icons in sidebar */
.sidebar .nav-link i {
    width: 20px;
    margin-right: 12px;
    font-size: 16px;
    transition: transform 0.3s ease;
}

/* Icon animation on hover */
.sidebar .nav-link:hover i {
    transform: scale(1.1);
}

/* Sidebar content spacing */
.sidebar .nav-item {
    margin-bottom: 5px;
}

/* Ensure proper text color inheritance */
.sidebar * {
    color: inherit;
}

/* ============================================== */
/* RESPONSIVE SIDEBAR BEHAVIOR */
/* ============================================== */

@media (max-width: 768px) {
    .sidebar {
        position: fixed;
        top: 0;
        left: -100%;
        width: 280px;
        z-index: 1000;
        transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
        height: 100vh;
        box-shadow: 2px 0 20px rgba(0, 0, 0, 0.3);
    }
    
    .sidebar.show {
        left: 0;
    }
    
    /* Mobile sidebar overlay */
    .sidebar::before {
        content: '';
        position: fixed;
        top: 0;
        left: 0;
        width: 100vw;
        height: 100vh;
        background: rgba(0, 0, 0, 0.5);
        z-index: -1;
        opacity: 0;
        transition: opacity 0.3s ease;
    }
    
    .sidebar.show::before {
        opacity: 1;
    }
}

/* ============================================== */
/* SIDEBAR ANIMATIONS & ENHANCEMENTS */
/* ============================================== */

/* Smooth entrance animation for sidebar items (mobile only — breaks fixed desktop sidebar) */
@media (max-width: 991.98px) {
.sidebar .nav-item {
    opacity: 0;
    animation: slideInLeft 0.5s ease forwards;
}

.sidebar .nav-item:nth-child(1) { animation-delay: 0.1s; }
.sidebar .nav-item:nth-child(2) { animation-delay: 0.2s; }
.sidebar .nav-item:nth-child(3) { animation-delay: 0.3s; }
.sidebar .nav-item:nth-child(4) { animation-delay: 0.4s; }
.sidebar .nav-item:nth-child(5) { animation-delay: 0.5s; }
.sidebar .nav-item:nth-child(6) { animation-delay: 0.6s; }
.sidebar .nav-item:nth-child(7) { animation-delay: 0.7s; }
.sidebar .nav-item:nth-child(8) { animation-delay: 0.8s; }
}

@keyframes slideInLeft {
    from {
        opacity: 0;
        transform: translateX(-30px);
    }
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

/* ============================================== */
/* UNIFIED HEADER STYLES */
/* ============================================== */

/* Main Header Container */
.school-header {
    position: sticky !important;
    top: 0 !important;
    z-index: 1030 !important;
    background: var(--header-color, white) !important;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1) !important;
    border-bottom: 1px solid #e9ecef !important;
    min-height: 60px !important; /* Reduced from default */
}

/* Ensure header background color takes precedence */
.school-header,
.school-header.navbar,
.school-header .navbar {
    background: var(--header-color, white) !important;
    color: var(--text-color, var(--dark-color, #343a40)) !important;
    position: sticky !important;
    top: 0 !important;
}

/* Header Logo */
.header-logo {
    width: 40px; /* Reduced from 50px */
    height: 40px; /* Reduced from 50px */
    background: linear-gradient(135deg, var(--primary-color, #667eea) 0%, var(--secondary-color, #764ba2) 100%);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-size: 1.2rem; /* Reduced from 1.5rem */
    box-shadow: 0 4px 15px rgba(102, 126, 234, 0.3);
}

/* Header Logo Image (uploaded) */
.header-logo-img {
    max-height: 40px;
    width: auto;
    display: block;
}

/* Header Brand Text */
.header-brand-text h5 {
    color: var(--dark-color, #343a40);
    font-weight: 600;
    margin: 0;
    font-size: 1.0rem; /* Slightly smaller for long names */
    max-width: 200px; /* Prevent overflow into actions */
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.header-brand-text small {
    color: #6c757d;
    font-size: 0.8rem; /* Reduced from 0.875rem */
}

/* Header Navigation */
.school-header .navbar {
    padding: 0.5rem 1rem !important; /* Reduced from 0.75rem */
    position: sticky !important;
    top: 0 !important;
    z-index: 1030 !important;
}

.school-header .navbar-nav .nav-link {
    color: var(--text-color, var(--dark-color, #343a40));
    font-weight: 500;
    padding: 0.4rem 0.8rem; /* Reduced from 0.5rem 1rem */
    border-radius: 8px;
    transition: all 0.3s ease;
    margin: 0 0.25rem;
    font-size: 0.9rem; /* Reduced font size */
}

.school-header .navbar-nav .nav-link:hover {
    color: var(--primary-color, #667eea); /* Changed to primary color on hover */
    background: rgba(102, 126, 234, 0.1);
    transform: translateY(-1px);
}

.school-header .navbar-nav .nav-link i {
    margin-right: 0.4rem; /* Reduced from 0.5rem */
    font-size: 0.8rem; /* Reduced from 0.9rem */
}

/* User Info Section */
.user-info {
    display: flex;
    align-items: center;
    gap: 0.5rem; /* Reduced from 0.75rem */
    padding: 0.3rem; /* Reduced from 0.5rem */
    border-radius: 8px;
    transition: background-color 0.3s ease;
    position: relative; /* For dropdown positioning */
    flex-direction: column; /* Stack avatar and name vertically */
    align-items: center;
    min-width: 80px; /* Ensure consistent width */
    margin-right: 0.5rem; /* Spacing between avatar/name and dropdown */
}

.user-info:hover {
    background: rgba(0, 0, 0, 0.05);
}

.user-avatar {
    width: 35px; /* Reduced from 40px */
    height: 35px; /* Reduced from 40px */
    border-radius: 50%;
    background: linear-gradient(135deg, var(--primary-color, #667eea) 0%, var(--secondary-color, #764ba2) 100%);
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-weight: bold;
    font-size: 1rem; /* Reduced from 1.1rem */
    box-shadow: 0 2px 8px rgba(102, 126, 234, 0.3);
    margin-bottom: 0.2rem; /* Space between avatar and name */
}

.user-name {
    color: var(--text-color, var(--dark-color, #343a40));
    font-weight: 500;
    font-size: 0.75rem; /* Reduced further for better fit */
    text-align: center;
    line-height: 1.1;
    max-width: 80px; /* Limit width for better layout */
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

/* Dropdown toggle button styling */
.user-info .dropdown-toggle {
    position: absolute;
    right: -0.5rem;
    top: 50%;
    transform: translateY(-50%);
    color: var(--dark-color, #343a40);
    font-size: 0.8rem;
    padding: 0.2rem;
    border-radius: 50%;
    transition: all 0.3s ease;
    z-index: 1001; /* Ensure it's above other elements */
}

.user-info .dropdown-toggle:hover {
    background: rgba(0, 0, 0, 0.1);
    color: var(--primary-color, #667eea);
}

/* Dropdown toggle placed as sibling of user-info */
.nav-item.dropdown > .dropdown-toggle {
    position: static;
    margin-left: 0.5rem;
    color: var(--dark-color, #343a40);
    font-size: 0.85rem;
    padding: 0.25rem;
    border-radius: 50%;
    z-index: 1001;
    line-height: 1;
}
.nav-item.dropdown > .dropdown-toggle:hover {
    background: rgba(0, 0, 0, 0.1);
    color: var(--primary-color, #667eea);
}

/* Ensure dropdown menu is properly positioned and clickable */
.nav-item.dropdown {
    position: relative;
}

.nav-item.dropdown .dropdown-menu {
    margin-top: 0.5rem; /* Add margin from the toggle */
    z-index: 1002; /* Ensure dropdown is above other elements */
    min-width: 200px; /* Ensure dropdown has proper width */
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.15);
    border: 1px solid rgba(0, 0, 0, 0.1);
}

/* Notification dropdown positioning */
.nav-item.dropdown.me-3 .dropdown-menu {
    margin-top: 0.5rem;
    z-index: 1002;
}

/* Notification Badge */
.notification-badge {
    position: absolute;
    top: -5px;
    right: -5px;
    background: #dc3545;
    color: white;
    border-radius: 50%;
    width: 18px;
    height: 18px;
    font-size: 0.7rem;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: bold;
    border: 2px solid white;
}

/* Dropdown Enhancements */
.school-header .dropdown-menu {
    border: none;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.15);
    border-radius: 12px;
    padding: 0.5rem 0;
    margin-top: 0.5rem;
}

.school-header .dropdown-item {
    padding: 0.75rem 1.5rem;
    color: var(--dark-color, #343a40);
    transition: all 0.3s ease;
    border-radius: 8px;
    margin: 0 0.5rem;
    width: calc(100% - 1rem);
}

.school-header .dropdown-item:hover {
    background: rgba(102, 126, 234, 0.1);
    color: var(--primary-color, #667eea);
    transform: translateX(5px);
}

.school-header .dropdown-item i {
    margin-right: 0.75rem;
    width: 16px;
    text-align: center;
}

/* Mobile Responsiveness */
@media (max-width: 768px) {
    .school-header .navbar-brand {
        flex-direction: column;
        align-items: center;
        text-align: center;
    }
    
    .header-logo {
        margin-bottom: 0.5rem;
    }
    
    .school-header .navbar-nav .nav-link {
        text-align: center;
        padding: 0.75rem 1rem;
        margin: 0.25rem 0;
    }
    
    .user-name {
        display: block; /* Show name on mobile */
        font-size: 0.7rem; /* Smaller font for mobile */
        max-width: 60px; /* Smaller width for mobile */
    }
    
    .user-info {
        min-width: 60px; /* Smaller width for mobile */
        gap: 0.3rem; /* Reduced gap for mobile */
    }
    
    .user-avatar {
        width: 30px; /* Smaller avatar for mobile */
        height: 30px;
        font-size: 0.9rem;
    }
    
    .user-info .dropdown-toggle {
        right: -0.3rem; /* Adjust position for mobile */
        font-size: 0.7rem;
    }
    
    .school-header .dropdown-menu {
        position: fixed;
        top: 60px;
        left: 0;
        right: 0;
        width: 100%;
        border-radius: 0;
        margin: 0;
        box-shadow: 0 5px 15px rgba(0, 0, 0, 0.2);
    }
}

/* Mobile Sidebar Behavior (overlay) */
@media (max-width: 991.98px) {
    .sidebar {
        position: fixed;
        top: 60px; /* matches .school-header min-height */
        left: -260px; /* hidden by default */
        width: 240px;
        height: calc(100vh - 60px);
        overflow-y: auto;
        z-index: 1040;
        box-shadow: 2px 0 12px rgba(0, 0, 0, 0.2);
        transition: left 0.3s cubic-bezier(0.4, 0, 0.2, 1);
        transform: translateX(0);
    }
    .sidebar.show {
        left: 0; /* slide in when expanded */
        transform: translateX(0);
    }
    .main-content {
        margin-left: 0 !important; /* content full-width on mobile */
    }
    
    /* Mobile sidebar overlay */
    .sidebar::before {
        content: '';
        position: fixed;
        top: 0;
        left: 0;
        width: 100vw;
        height: 100vh;
        background: rgba(0, 0, 0, 0.5);
        z-index: -1;
        opacity: 0;
        transition: opacity 0.3s ease;
        pointer-events: none;
    }
    
    .sidebar.show::before {
        opacity: 1;
        pointer-events: auto;
    }
}

/* Sidebar Logo Image */
.sidebar-logo-img {
    max-height: 60px;
    width: auto;
}

/* Ensure header stays above sidebar on mobile */
@media (max-width: 768px) {
    .school-header {
        z-index: 1040;
    }
}

/* Global container and navbar stickiness */
.container-fluid {
    position: relative;
}

/* Only apply sticky to main .navbar when not inside .school-header */
main .navbar:not(.school-header .navbar) {
    position: sticky !important;
    top: 0 !important;
    z-index: 1030 !important;
}

/* Page Header Styling */
.page-header {
    background: white;
    border-bottom: 1px solid #e9ecef;
    margin-bottom: 1.5rem;
    padding: 1rem 1.5rem;
    border-radius: 0 0 12px 12px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.05);
}

.page-header h2 {
    color: var(--dark-color, #343a40);
    font-weight: 600;
    margin: 0;
    font-size: 1.75rem;
}

.page-header i {
    color: var(--primary-color, #667eea);
} 

/* Notifications */
.nav-item.dropdown.me-3 {
    margin-right: 1rem !important; /* Reduce right margin */
}

.nav-item.dropdown.me-3 .nav-link {
    padding: 0.4rem 0.6rem; /* Adjust padding */
    border-radius: 50%;
    transition: all 0.3s ease;
}

.nav-item.dropdown.me-3 .nav-link:hover {
    background: rgba(0, 0, 0, 0.1);
    color: var(--primary-color, #667eea);
} 

/* User Profile Dropdown */
.nav-item.dropdown:last-child {
    margin-left: 0.5rem; /* Add left margin to separate from notifications */
}

.nav-item.dropdown:last-child .dropdown-menu {
    right: 0;
    left: auto;
    margin-top: 0.5rem;
    z-index: 1002;
    min-width: 220px; /* Ensure dropdown has proper width */
}

/* Ensure proper spacing in the navbar */
.navbar-nav.ms-auto {
    gap: 0.5rem; /* Add consistent gap between elements */
}

/* Mobile responsiveness for dropdowns */
@media (max-width: 768px) {
    .user-info {
        margin-right: 1rem; /* Reduce margin on mobile */
        min-width: 60px; /* Smaller width for mobile */
    }
    
    .nav-item.dropdown.me-3 {
        margin-right: 0.5rem !important; /* Reduce margin on mobile */
    }
    
    .navbar-nav.ms-auto {
        gap: 0.25rem; /* Reduce gap on mobile */
    }
    
    .nav-item.dropdown:last-child {
        margin-left: 0.25rem; /* Reduce margin on mobile */
    }
}

/* Mobile sidebar close button */
.sidebar .btn-close {
    position: absolute;
    top: 15px;
    right: 15px;
    z-index: 1060;
    background: rgba(255, 255, 255, 0.2);
    border: none;
    border-radius: 50%;
    width: 30px;
    height: 30px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-size: 1.2rem;
    transition: all 0.3s ease;
}

.sidebar .btn-close:hover {
    background: rgba(255, 255, 255, 0.3);
    transform: scale(1.1);
}

/* Tablet portrait optimizations */
@media (min-width: 768px) and (max-width: 1024px) and (orientation: portrait) {
    .container-fluid {
        padding-left: 0;
        padding-right: 0;
        max-width: 100%;
    }

    .main-content {
        margin: 0;
        padding-left: 0;
        padding-right: 0;
        max-width: 100%;
        width: 100%;
    }

    .row {
        margin-left: 0;
        margin-right: 0;
    }
}

/* Mobile sidebar toggle button */
.navbar-toggler {
    border: none;
    padding: 0.25rem 0.5rem;
    background: transparent;
    transition: all 0.3s ease;
}

.navbar-toggler:focus {
    box-shadow: none;
}

.navbar-toggler:hover {
    background: rgba(255, 255, 255, 0.1);
    border-radius: 4px;
}

/* Enhanced mobile sidebar transitions */
@media (max-width: 991.98px) {
    .sidebar .nav-item {
        opacity: 0;
        transform: translateX(-20px);
        animation: slideInFromLeft 0.4s ease forwards;
    }
    
    .sidebar .nav-item:nth-child(1) { animation-delay: 0.1s; }
    .sidebar .nav-item:nth-child(2) { animation-delay: 0.2s; }
    .sidebar .nav-item:nth-child(3) { animation-delay: 0.3s; }
    .sidebar .nav-item:nth-child(4) { animation-delay: 0.4s; }
    .sidebar .nav-item:nth-child(5) { animation-delay: 0.5s; }
    .sidebar .nav-item:nth-child(6) { animation-delay: 0.6s; }
    .sidebar .nav-item:nth-child(7) { animation-delay: 0.7s; }
    .sidebar .nav-item:nth-child(8) { animation-delay: 0.8s; }
}

@keyframes slideInFromLeft {
    from {
        opacity: 0;
        transform: translateX(-20px);
    }
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

/* App shell layout lives in assets/css/app-layout.css (imported at top) */

/* Ensure management sidebar is never hidden on desktop */
@media (min-width: 992px) {
    #sidebarMenu,
    #sidebar.sidebar {
        display: block !important;
        visibility: visible !important;
        width: var(--app-sidebar-width, 240px) !important;
        min-width: var(--app-sidebar-width, 240px) !important;
        max-width: var(--app-sidebar-width, 240px) !important;
    }

    /* Sticky header blocks inside a fixed sidebar break backgrounds — disable them */
    #sidebarMenu .text-center,
    #sidebar .text-center {
        position: relative !important;
        top: auto !important;
        width: 100% !important;
    }

    #sidebarMenu .nav-item,
    #sidebar .nav-item {
        opacity: 1 !important;
        transform: none !important;
        animation: none !important;
    }
}