:root {
    --primary: #2c5aa0;
    --primary-light: #3a6bc5;
    --secondary: #1a3a6b;
    --accent: #f39c12;
    --success: #27ae60;
    --warning: #e67e22;
    --danger: #e74c3c;
    --light: #f8f9fa;
    --dark: #2c3e50;
    --gray: #95a5a6;
    --light-gray: #ecf0f1;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-family: 'Cairo', sans-serif;
}

body {
    background: linear-gradient(135deg, #f5f7fa 0%, #e4e8ed 100%);
    color: #333;
    line-height: 1.6;
    min-height: 100vh;
}

.container {
    display: flex;
    min-height: 100vh;
}

/* Sidebar */
.sidebar {
    width: 280px;
    background: linear-gradient(180deg, var(--secondary) 0%, var(--primary) 100%);
    color: white;
    position: fixed;
    height: 100vh;
    overflow-y: auto;
    z-index: 1000;
    box-shadow: 3px 0 15px rgba(0, 0, 0, 0.1);
}

body.loaded .sidebar {
    transition: all 0.3s;
}

.sidebar-header {
    padding: 25px 20px;
    background: rgba(0, 0, 0, 0.2);
    text-align: center;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.logo {
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 15px;
}

.logo-img {
    width: 60px;
    height: 60px;
    background: white;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-left: 10px;
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.2);
}

.logo-img i {
    font-size: 28px;
    color: var(--primary);
}

.sidebar-header h2 {
    font-size: 1.3rem;
    margin-bottom: 5px;
    font-weight: 700;
}

.sidebar-header p {
    font-size: 0.85rem;
    opacity: 0.8;
}

.sidebar-menu {
    padding: 20px 0;
}

.sidebar-menu ul {
    list-style: none;
}

.sidebar-menu li {
    margin-bottom: 5px;
}

.sidebar-menu a {
    display: flex;
    align-items: center;
    padding: 14px 25px;
    color: rgba(255, 255, 255, 0.9);
    text-decoration: none;
    transition: all 0.3s;
    border-right: 4px solid transparent;
    font-weight: 500;
}

.sidebar-menu a:hover, .sidebar-menu a.active {
    background: rgba(255, 255, 255, 0.1);
    border-right-color: var(--accent);
    color: white;
}

.sidebar-menu i {
    margin-left: 12px;
    width: 20px;
    text-align: center;
    font-size: 1.1rem;
}

.menu-badge {
    background: var(--accent);
    color: white;
    border-radius: 12px;
    padding: 2px 8px;
    font-size: 0.75rem;
    margin-left: auto;
}

.menu-divider {
    height: 1px;
    background: rgba(255, 255, 255, 0.2);
    margin: 15px 20px;
}

/* Logout Link */
.sidebar-menu a.logout-link {
    color: #ffcccc;
}

.sidebar-menu a.logout-link:hover {
    background: rgba(231, 76, 60, 0.3);
    color: #ff6b6b;
    border-right-color: #e74c3c;
}

/* Main Content */
.main-content {
    flex: 1;
    margin-right: 280px;
}

body.loaded .main-content {
    transition: all 0.3s;
}

.header {
    background: white;
    padding: 18px 30px;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.08);
    display: flex;
    justify-content: space-between;
    align-items: center;
    position: sticky;
    top: 0;
    z-index: 100;
}

.toggle-sidebar {
    background: none;
    border: none;
    font-size: 1.5rem;
    color: var(--dark);
    cursor: pointer;
    display: none;
}

.page-title {
    color: var(--secondary);
    font-size: 1.8rem;
    font-weight: 700;
}

.user-info {
    display: flex;
    align-items: center;
}

.user-info img {
    width: 42px;
    height: 42px;
    border-radius: 50%;
    margin-left: 12px;
    border: 2px solid var(--light-gray);
}

.user-details {
    display: flex;
    flex-direction: column;
}

.user-name {
    font-weight: 600;
    color: var(--dark);
}

.user-role {
    font-size: 0.85rem;
    color: var(--gray);
}

.content {
    padding: 30px;
}

/* Cards */
.card {
    background: white;
    border-radius: 12px;
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.05);
    margin-bottom: 25px;
    overflow: hidden;
    transition: transform 0.3s, box-shadow 0.3s;
    border: none;
}

.card:hover {
    transform: translateY(-5px);
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.1);
}

.card-header {
    background: linear-gradient(135deg, var(--primary) 0%, var(--primary-light) 100%);
    color: white;
    padding: 18px 25px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.card-header h3 {
    font-size: 1.3rem;
    font-weight: 600;
}

.card-body {
    padding: 25px;
}

/* Tables */
.table-responsive {
    overflow-x: auto;
    border-radius: 8px;
}

table {
    width: 100%;
    border-collapse: collapse;
}

table th, table td {
    padding: 14px 16px;
    text-align: right;
    border-bottom: 1px solid #eaeaea;
}

table th {
    background-color: #f8fafc;
    font-weight: 600;
    color: var(--dark);
}

table tr:hover {
    background-color: #f8fafc;
}

/* Buttons */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 12px 22px;
    background: var(--primary);
    color: white;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    font-size: 1rem;
    font-weight: 600;
    transition: all 0.3s;
    text-decoration: none;
}

.btn:hover {
    opacity: 0.9;
    transform: translateY(-2px);
}

.btn i {
    margin-left: 8px;
}

.btn-success {
    background: var(--success);
}

.btn-warning {
    background: var(--warning);
}

.btn-danger {
    background: var(--danger);
}

.btn-sm {
    padding: 8px 14px;
    font-size: 0.875rem;
}

.btn-group {
    display: flex;
    gap: 6px;
}

.btn-outline {
    background: transparent;
    border: 2px solid var(--primary);
    color: var(--primary);
}

.btn-outline:hover {
    background: var(--primary);
    color: white;
}

/* Forms */
.form-group {
    margin-bottom: 22px;
}

.form-group label {
    display: block;
    margin-bottom: 8px;
    font-weight: 600;
    color: var(--dark);
}

.form-control {
    width: 100%;
    padding: 12px 16px;
    border: 1px solid #ddd;
    border-radius: 8px;
    font-size: 1rem;
    transition: all 0.3s;
    background: #fdfdfd;
}

.form-control:focus {
    border-color: var(--primary);
    outline: none;
    box-shadow: 0 0 0 3px rgba(44, 90, 160, 0.1);
    background: white;
}

.form-control:disabled,
.form-control[readonly] {
    background-color: #f5f5f5;
    cursor: not-allowed;
}

.form-row {
    display: flex;
    flex-wrap: wrap;
    margin: 0 -10px;
}

.form-col {
    flex: 1;
    padding: 0 10px;
    min-width: 200px;
}

/* Modal */
.modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    z-index: 2000;
    align-items: center;
    justify-content: center;
}

.modal.show {
    display: flex;
}

.modal-content {
    background: white;
    border-radius: 12px;
    width: 90%;
    max-width: 600px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.3);
    overflow: hidden;
    animation: modalSlideIn 0.3s ease;
}

@keyframes modalSlideIn {
    from {
        opacity: 0;
        transform: translateY(-50px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.modal-header {
    background: linear-gradient(135deg, var(--primary) 0%, var(--primary-light) 100%);
    color: white;
    padding: 20px 25px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.modal-header h3 {
    font-size: 1.4rem;
    font-weight: 600;
}

.modal-close {
    background: none;
    border: none;
    color: white;
    font-size: 1.5rem;
    cursor: pointer;
    opacity: 0.8;
    transition: opacity 0.3s;
}

.modal-close:hover {
    opacity: 1;
}

.modal-body {
    padding: 25px;
    max-height: 70vh;
    overflow-y: auto;
}

.modal-footer {
    padding: 20px 25px;
    background: #f8f9fa;
    display: flex;
    justify-content: flex-end;
    gap: 12px;
    border-top: 1px solid #eaeaea;
}

/* Stats Cards */
.stats-cards {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
    gap: 20px;
    margin-bottom: 30px;
}

.stat-card {
    background: white;
    border-radius: 12px;
    padding: 25px;
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.05);
    display: flex;
    align-items: center;
    transition: transform 0.3s, box-shadow 0.3s;
}

.stat-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.1);
}

.stat-icon {
    width: 60px;
    height: 60px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-left: 15px;
    font-size: 24px;
    color: white;
}

.stat-icon.primary {
    background: linear-gradient(135deg, var(--primary) 0%, var(--primary-light) 100%);
}

.stat-icon.success {
    background: linear-gradient(135deg, var(--success) 0%, #2ecc71 100%);
}

.stat-icon.warning {
    background: linear-gradient(135deg, var(--warning) 0%, #e67e22 100%);
}

.stat-icon.danger {
    background: linear-gradient(135deg, var(--danger) 0%, #e74c3c 100%);
}

.stat-info {
    flex: 1;
}

.stat-value {
    font-size: 1.8rem;
    font-weight: 700;
    color: var(--dark);
    line-height: 1;
    margin-bottom: 5px;
}

.stat-label {
    font-size: 0.9rem;
    color: var(--gray);
}

/* Progress Bar */
.progress-container {
    width: 100%;
    background: #e0e0e0;
    border-radius: 10px;
    overflow: hidden;
    height: 20px;
    margin: 5px 0;
}

.progress-bar {
    height: 100%;
    border-radius: 10px;
    transition: width 0.5s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-size: 0.75rem;
    font-weight: 600;
}

.progress-bar.success {
    background: linear-gradient(90deg, var(--success), #2ecc71);
}

.progress-bar.warning {
    background: linear-gradient(90deg, var(--warning), #f39c12);
}

.progress-bar.danger {
    background: linear-gradient(90deg, var(--danger), #e74c3c);
}

.progress-bar.primary {
    background: linear-gradient(90deg, var(--primary), var(--primary-light));
}

/* Toast Notifications */
#toastContainer {
    position: fixed;
    top: 20px;
    left: 20px;
    z-index: 3000;
    pointer-events: none;
}

.toast-item {
    pointer-events: auto;
    color: #fff;
    margin: 6px 0;
    padding: 12px 20px;
    border-radius: 8px;
    font-weight: 600;
    box-shadow: 0 6px 18px rgba(0, 0, 0, 0.12);
    animation: toastSlide 0.3s ease;
    display: flex;
    align-items: center;
    gap: 10px;
}

@keyframes toastSlide {
    from {
        opacity: 0;
        transform: translateX(-100%);
    }
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

.toast-success {
    background: var(--success);
}

.toast-error {
    background: var(--danger);
}

.toast-warning {
    background: var(--warning);
}

.toast-info {
    background: var(--primary);
}

/* Badge */
.badge {
    display: inline-block;
    padding: 4px 10px;
    border-radius: 20px;
    font-size: 0.8rem;
    font-weight: 600;
}

.badge-success {
    background: rgba(39, 174, 96, 0.15);
    color: var(--success);
}

.badge-warning {
    background: rgba(230, 126, 34, 0.15);
    color: var(--warning);
}

.badge-danger {
    background: rgba(231, 76, 60, 0.15);
    color: var(--danger);
}

.badge-primary {
    background: rgba(44, 90, 160, 0.15);
    color: var(--primary);
}

.badge-info {
    background: rgba(52, 152, 219, 0.15);
    color: #3498db;
}

.badge-secondary {
    background: rgba(108, 117, 125, 0.15);
    color: #6c757d;
}

/* Page Transitions */
.page {
    display: none;
}

.page.active {
    display: block;
    animation: fadeIn 0.5s ease-in;
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Upload Area */
.upload-area {
    border: 3px dashed var(--light-gray);
    border-radius: 12px;
    padding: 40px;
    text-align: center;
    transition: all 0.3s;
    cursor: pointer;
    background: var(--light);
}

.upload-area:hover,
.upload-area.dragover {
    border-color: var(--primary);
    background: rgba(44, 90, 160, 0.05);
}

.upload-area i {
    font-size: 48px;
    color: var(--primary);
    margin-bottom: 15px;
}

.upload-area p {
    color: var(--gray);
    margin-bottom: 10px;
}

.upload-area input[type="file"] {
    display: none;
}

/* Reports Filters */
.reports-filters {
    background: var(--light);
    padding: 20px;
    border-radius: 10px;
    margin-bottom: 20px;
}

.filter-row {
    display: flex;
    flex-wrap: wrap;
    gap: 15px;
    align-items: flex-end;
}

.filter-group {
    flex: 1;
    min-width: 150px;
}

.filter-group label {
    display: block;
    margin-bottom: 5px;
    font-size: 0.9rem;
    font-weight: 600;
    color: var(--dark);
}

.filter-group select,
.filter-group input {
    width: 100%;
    padding: 10px;
    border: 1px solid #ddd;
    border-radius: 8px;
    font-size: 0.95rem;
}

/* Alerts */
.alert {
    padding: 12px 16px;
    border-radius: 8px;
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 15px;
}

.alert-info {
    background: linear-gradient(135deg, #e3f2fd 0%, #bbdefb 100%);
    color: #1565c0;
    border: 1px solid #90caf9;
}

.alert-success {
    background: linear-gradient(135deg, #e8f5e9 0%, #c8e6c9 100%);
    color: #2e7d32;
    border: 1px solid #a5d6a7;
}

.alert-warning {
    background: linear-gradient(135deg, #fff3e0 0%, #ffe0b2 100%);
    color: #ef6c00;
    border: 1px solid #ffcc80;
}

.alert-danger {
    background: linear-gradient(135deg, #ffebee 0%, #ffcdd2 100%);
    color: #c62828;
    border: 1px solid #ef9a9a;
}

/* Student Portal Specific */
.student-results-header {
    background: linear-gradient(135deg, var(--secondary) 0%, var(--primary) 100%);
    color: white;
    padding: 30px;
    border-radius: 12px;
    margin-bottom: 25px;
}

.student-results-header h2 {
    margin-bottom: 20px;
    display: flex;
    align-items: center;
    gap: 10px;
}

.student-info-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 15px;
}

.info-item {
    background: rgba(255, 255, 255, 0.1);
    padding: 12px 15px;
    border-radius: 8px;
}

.info-label {
    font-size: 0.85rem;
    opacity: 0.8;
    margin-bottom: 5px;
}

.info-value {
    font-weight: 600;
    font-size: 1.1rem;
}

.grade-card {
    background: white;
    border-radius: 10px;
    padding: 18px 20px;
    margin-bottom: 12px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    box-shadow: 0 3px 10px rgba(0, 0, 0, 0.05);
    transition: transform 0.2s, box-shadow 0.2s;
}

.grade-card:hover {
    transform: translateY(-3px);
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.1);
}

.subject-name {
    font-weight: 600;
    font-size: 1.1rem;
    color: var(--dark);
}

.grade-info {
    display: flex;
    align-items: center;
    gap: 20px;
}

.grade-value {
    font-size: 1.6rem;
    font-weight: 700;
}

.grade-passed {
    color: var(--success);
}

.grade-failed {
    color: var(--danger);
}

/* Login Page Styles */
.login-container {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, var(--secondary) 0%, var(--primary) 100%);
    padding: 30px;
}

.login-card {
    background: white;
    border-radius: 20px;
    padding: 40px;
    width: 100%;
    max-width: 420px;
    box-shadow: 0 15px 50px rgba(0, 0, 0, 0.3);
    position: relative;
    overflow: hidden;
}

.login-header {
    text-align: center;
    margin-bottom: 30px;
}

.login-logo-img {
    width: 80px;
    height: 80px;
    background: linear-gradient(135deg, var(--primary) 0%, var(--primary-light) 100%);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto 20px;
    box-shadow: 0 8px 25px rgba(44, 90, 160, 0.3);
}

.login-logo-img i {
    font-size: 36px;
    color: white;
}

.login-header h1 {
    color: var(--dark);
    font-size: 1.5rem;
    margin-bottom: 8px;
}

.login-header p {
    color: var(--gray);
    font-size: 0.95rem;
}

.login-body .form-group label {
    display: flex;
    align-items: center;
    gap: 8px;
}

.login-body .form-control {
    padding: 14px 16px;
}

.btn-login {
    width: 100%;
    padding: 14px;
    background: linear-gradient(135deg, var(--primary) 0%, var(--primary-light) 100%);
    color: white;
    border: none;
    border-radius: 10px;
    font-size: 1.1rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
}

.btn-login:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 25px rgba(44, 90, 160, 0.3);
}

.login-footer {
    text-align: center;
    margin-top: 25px;
    padding-top: 20px;
    border-top: 1px solid var(--light-gray);
    color: var(--gray);
    font-size: 0.85rem;
}

/* Empty State */
.empty-state {
    text-align: center;
    padding: 50px 20px;
    color: var(--gray);
}

.empty-state i {
    font-size: 60px;
    margin-bottom: 15px;
    opacity: 0.5;
}

.empty-state h3 {
    margin-bottom: 10px;
    color: var(--dark);
}

/* Quick Access Cards */
.quick-access-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 20px;
}

.quick-access-card {
    background: white;
    border-radius: 12px;
    padding: 30px 20px;
    text-align: center;
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.05);
    transition: all 0.3s;
    text-decoration: none;
    color: var(--dark);
}

.quick-access-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.1);
}

.quick-access-card i {
    font-size: 40px;
    margin-bottom: 15px;
    display: block;
}

.quick-access-card span {
    font-weight: 600;
    font-size: 1rem;
}

/* Responsive */
@media (max-width: 992px) {
    .sidebar {
        width: 80px;
        text-align: center;
    }
    
    .sidebar-header h2,
    .sidebar-header p,
    .sidebar-menu span,
    .menu-badge {
        display: none;
    }
    
    .sidebar-menu i {
        margin-left: 0;
        font-size: 1.2rem;
    }
    
    .logo-img {
        margin-left: 0;
    }
    
    .main-content {
        margin-right: 80px;
    }
    
    .toggle-sidebar {
        display: block;
    }
}

@media (max-width: 768px) {
    .sidebar {
        transform: translateX(100%);
        width: 280px;
    }
    
    .sidebar.active {
        transform: translateX(0);
    }
    
    .sidebar-header h2,
    .sidebar-header p,
    .sidebar-menu span,
    .menu-badge {
        display: block;
    }
    
    .logo-img {
        margin-left: 10px;
    }
    
    .main-content {
        margin-right: 0;
    }
    
    .stats-cards {
        grid-template-columns: 1fr;
    }
    
    .form-col {
        flex: 100%;
    }
    
    .header {
        padding: 15px 20px;
    }
    
    .page-title {
        font-size: 1.4rem;
    }
    
    .content {
        padding: 20px;
    }
    
    .filter-row {
        flex-direction: column;
    }
}

@media (max-width: 480px) {
    .stats-cards {
        grid-template-columns: 1fr;
    }
    
    .stat-card {
        padding: 20px;
    }
    
    .modal-content {
        width: 95%;
        margin: 10px;
    }
    
    .login-card {
        padding: 30px 20px;
    }
}

/* Print Styles */
@media print {
    .sidebar,
    .header,
    .btn,
    .toggle-sidebar {
        display: none !important;
    }
    
    .main-content {
        margin-right: 0 !important;
    }
    
    .content {
        padding: 0 !important;
    }
    
    .card {
        box-shadow: none !important;
        break-inside: avoid;
    }
}
