/* =====================================================
   EDUCATIONAL PORTAL - MAIN STYLESHEET
   ===================================================== */

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

:root {
    --primary-color: #2563eb;
    --secondary-color: #1e40af;
    --success-color: #10b981;
    --danger-color: #ef4444;
    --warning-color: #f59e0b;
    --info-color: #06b6d4;
    --light-bg: #f9fafb;
    --dark-text: #1f2937;
    --border-color: #e5e7eb;
    --shadow: 0 1px 3px rgba(0, 0, 0, 0.1), 0 1px 2px rgba(0, 0, 0, 0.06);
    --shadow-lg: 0 10px 15px rgba(0, 0, 0, 0.1), 0 4px 6px rgba(0, 0, 0, 0.05);
}

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

/* Dashboard Layout */
.dashboard-container {
    display: flex;
    min-height: 100vh;
}

/* Sidebar */
.sidebar {
    width: 260px;
    background: white;
    color: var(--dark-text);
    padding: 0;
    position: fixed;
    height: 100vh;
    overflow-y: auto;
    transition: transform 0.3s ease;
    z-index: 1000;
    border-right: 1px solid var(--border-color);
    box-shadow: var(--shadow);
}

.sidebar-header {
    padding: 30px 20px;
    border-bottom: 1px solid var(--border-color);
    background: var(--primary-color);
    color: white;
}

.sidebar-header h2 {
    font-size: 22px;
    margin-bottom: 5px;
    font-weight: 600;
}

.sidebar-header .user-role {
    font-size: 14px;
    opacity: 0.9;
}

.sidebar-menu {
    list-style: none;
    padding: 10px 0;
}

.sidebar-menu li {
    margin-bottom: 2px;
}

.sidebar-menu a {
    display: flex;
    align-items: center;
    padding: 14px 20px;
    color: var(--dark-text);
    text-decoration: none;
    transition: all 0.3s;
    font-size: 15px;
    position: relative;
}

.sidebar-menu a:hover {
    background-color: #f0f7ff;
    color: var(--primary-color);
}

.sidebar-menu a.active {
    background-color: #e0f0ff;
    color: var(--primary-color);
    font-weight: 600;
    border-left: 4px solid var(--primary-color);
}

.sidebar-menu a i {
    margin-right: 12px;
    width: 20px;
    text-align: center;
    font-size: 16px;
}

.sidebar-menu a span {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    margin-right: 12px;
}

.sidebar-menu a span i {
    font-size: 18px;
}

.sidebar-footer {
    padding: 20px;
    border-top: 1px solid var(--border-color);
    margin-top: auto;
    position: absolute;
    bottom: 0;
    width: 100%;
    background: white;
}

.logout-btn {
    width: 100%;
    padding: 12px;
    background: white;
    color: var(--danger-color);
    border: 2px solid var(--danger-color);
    border-radius: 8px;
    cursor: pointer;
    font-size: 14px;
    font-weight: 600;
    transition: all 0.3s;
}

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

/* Main Content */
.main-content {
    flex: 1;
    margin-left: 260px;
    padding: 30px;
    transition: margin-left 0.3s ease;
}

/* Header */
.page-header {
    background: white;
    padding: 30px;
    border-radius: 12px;
    box-shadow: var(--shadow);
    margin-bottom: 30px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-left: 4px solid var(--primary-color);
}

.page-header h1 {
    font-size: 28px;
    color: var(--dark-text);
    margin-bottom: 5px;
    font-weight: 700;
}

.page-header p {
    color: #6b7280;
    font-size: 15px;
}

.header-actions {
    display: flex;
    gap: 15px;
}

/* Buttons */
.btn {
    padding: 12px 24px;
    border: none;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s;
    text-decoration: none;
    display: inline-flex;
    align-items: center;
    gap: 8px;
}

.btn i {
    font-size: 16px;
}

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

.btn-primary:hover {
    background: var(--secondary-color);
    transform: translateY(-2px);
    box-shadow: var(--shadow-lg);
}

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

.btn-success:hover {
    background: #059669;
    transform: translateY(-2px);
    box-shadow: var(--shadow-lg);
}

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

.btn-danger:hover {
    background: #dc2626;
    transform: translateY(-2px);
    box-shadow: var(--shadow-lg);
}

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

.btn-secondary:hover {
    background: #4b5563;
    transform: translateY(-2px);
    box-shadow: var(--shadow-lg);
}

.btn:disabled {
    opacity: 0.6;
    cursor: not-allowed;
    transform: none !important;
}

/* Cards */
.card {
    background: white;
    border-radius: 12px;
    padding: 25px;
    box-shadow: var(--shadow);
    margin-bottom: 20px;
    border: 1px solid var(--border-color);
}

.card-header {
    border-bottom: 2px solid var(--border-color);
    padding-bottom: 15px;
    margin-bottom: 20px;
}

.card-header h3 {
    font-size: 20px;
    color: var(--dark-text);
    font-weight: 600;
}

.card-body {
    padding: 0;
}

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

.stat-card {
    background: white;
    border-radius: 12px;
    padding: 25px;
    box-shadow: var(--shadow);
    display: flex;
    align-items: center;
    justify-content: space-between;
    border: 1px solid var(--border-color);
    transition: all 0.3s;
}

.stat-card:hover {
    transform: translateY(-4px);
    box-shadow: var(--shadow-lg);
}

.stat-card-content {
    flex: 1;
}

.stat-card h4 {
    font-size: 13px;
    color: #6b7280;
    margin-bottom: 10px;
    text-transform: uppercase;
    font-weight: 600;
    letter-spacing: 0.5px;
}

.stat-card .stat-number {
    font-size: 32px;
    font-weight: 700;
    color: var(--primary-color);
}

.stat-card-icon {
    font-size: 48px;
    color: var(--primary-color);
    opacity: 0.2;
}

.stat-card-icon i {
    font-size: 48px;
    color: var(--primary-color);
    opacity: 1;
}

/* Tables */
.table-container {
    overflow-x: auto;
}

table {
    width: 100%;
    border-collapse: collapse;
}

table thead {
    background: var(--light-bg);
}

table th {
    padding: 15px;
    text-align: left;
    font-weight: 600;
    color: var(--dark-text);
    border-bottom: 2px solid var(--border-color);
    font-size: 14px;
}

table td {
    padding: 15px;
    border-bottom: 1px solid var(--border-color);
    font-size: 14px;
}

table tbody tr:hover {
    background: var(--light-bg);
}

/* Badges */
.badge {
    display: inline-block;
    padding: 6px 12px;
    border-radius: 20px;
    font-size: 12px;
    font-weight: 600;
}

.badge-success {
    background: #d1fae5;
    color: #065f46;
}

.badge-warning {
    background: #fef3c7;
    color: #92400e;
}

.badge-danger {
    background: #fee2e2;
    color: #991b1b;
}

.badge-info {
    background: #cffafe;
    color: #155e75;
}

.badge-primary {
    background: #dbeafe;
    color: var(--primary-color);
}

/* Alerts/Messages */
.alert {
    padding: 16px 20px;
    border-radius: 10px;
    margin-bottom: 20px;
    display: flex;
    align-items: center;
    font-size: 14px;
    font-weight: 500;
}

.alert-success {
    background: #d1fae5;
    color: #065f46;
    border: 1px solid #6ee7b7;
}

.alert-error {
    background: #fee2e2;
    color: #991b1b;
    border: 1px solid #fca5a5;
}

.alert-info {
    background: #dbeafe;
    color: #1e40af;
    border: 1px solid #93c5fd;
}

.alert-warning {
    background: #fef3c7;
    color: #92400e;
    border: 1px solid #fcd34d;
}

/* Modal */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.5);
    display: none;
    justify-content: center;
    align-items: center;
    z-index: 2000;
}

.modal-overlay.show {
    display: flex;
}

.modal {
    background: white;
    border-radius: 12px;
    padding: 30px;
    max-width: 500px;
    width: 90%;
    max-height: 90vh;
    overflow-y: auto;
    box-shadow: var(--shadow-lg);
}

.modal-header {
    border-bottom: 2px solid var(--border-color);
    padding-bottom: 15px;
    margin-bottom: 20px;
}

.modal-header h3 {
    font-size: 22px;
    color: var(--dark-text);
    font-weight: 600;
}

.modal-close {
    position: absolute;
    top: 15px;
    right: 15px;
    background: none;
    border: none;
    font-size: 24px;
    cursor: pointer;
    color: #999;
}

.modal-close:hover {
    color: var(--dark-text);
}

/* Form Elements */
.form-group {
    margin-bottom: 20px;
}

.form-group label {
    display: block;
    margin-bottom: 8px;
    font-weight: 600;
    color: var(--dark-text);
    font-size: 14px;
}

.form-control {
    width: 100%;
    padding: 12px 15px;
    border: 2px solid var(--border-color);
    border-radius: 8px;
    font-size: 15px;
    transition: border-color 0.3s;
}

.form-control:focus {
    outline: none;
    border-color: var(--primary-color);
}

textarea.form-control {
    resize: vertical;
    min-height: 100px;
}

/* Loading Spinner */
.spinner {
    border: 4px solid var(--border-color);
    border-top: 4px solid var(--primary-color);
    border-radius: 50%;
    width: 40px;
    height: 40px;
    animation: spin 1s linear infinite;
    margin: 20px auto;
}

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

.loading-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(255, 255, 255, 0.9);
    display: none;
    justify-content: center;
    align-items: center;
    z-index: 3000;
}

.loading-overlay.show {
    display: flex;
}

.loading-state {
    text-align: center;
    padding: 40px 20px;
}

.loading-state p {
    margin-top: 15px;
    color: #6b7280;
}

/* Empty State */
.empty-state {
    text-align: center;
    padding: 60px 20px;
    color: #6b7280;
}

.empty-state-icon {
    font-size: 64px;
    margin-bottom: 20px;
    opacity: 0.3;
    color: var(--primary-color);
}

.empty-state-icon i {
    font-size: 64px;
    color: var(--primary-color);
    opacity: 1;
}

.empty-state h3 {
    font-size: 20px;
    margin-bottom: 10px;
    color: var(--dark-text);
    font-weight: 600;
}

.empty-state p {
    font-size: 14px;
    margin-bottom: 20px;
}

/* Progress Bar */
.progress-bar {
    width: 100%;
    height: 8px;
    background: var(--border-color);
    border-radius: 10px;
    overflow: hidden;
}

.progress-fill {
    height: 100%;
    background: var(--primary-color);
    transition: width 0.3s ease;
}

/* Tabs */
.tabs {
    display: flex;
    border-bottom: 2px solid var(--border-color);
    margin-bottom: 20px;
}

.tab {
    padding: 12px 24px;
    background: none;
    border: none;
    border-bottom: 3px solid transparent;
    cursor: pointer;
    font-size: 15px;
    font-weight: 600;
    color: #6b7280;
    transition: all 0.3s;
}

.tab.active {
    color: var(--primary-color);
    border-bottom-color: var(--primary-color);
}

.tab:hover {
    color: var(--primary-color);
}

/* Students Grid */
.students-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 20px;
}

/* Responsive Design */
@media (max-width: 768px) {
    .sidebar {
        transform: translateX(-100%);
        width: 260px;
    }
    
    .sidebar.mobile-open {
        transform: translateX(0);
    }
    
    .main-content {
        margin-left: 0;
    }
    
    .stats-grid {
        grid-template-columns: 1fr;
    }
    
    .page-header {
        flex-direction: column;
        align-items: flex-start;
    }
    
    .header-actions {
        margin-top: 15px;
        width: 100%;
    }
    
    .header-actions .btn {
        flex: 1;
    }
    
    table {
        font-size: 14px;
    }
    
    table th,
    table td {
        padding: 10px;
    }
    
    .students-grid {
        grid-template-columns: 1fr;
    }
}

/* Mobile Menu Toggle */
.mobile-menu-toggle {
    display: none;
    position: fixed;
    bottom: 20px;
    right: 20px;
    width: 60px;
    height: 60px;
    background: var(--primary-color);
    color: white;
    border: none;
    border-radius: 50%;
    font-size: 24px;
    cursor: pointer;
    box-shadow: var(--shadow-lg);
    z-index: 999;
    transition: background 0.2s;
}

.mobile-menu-toggle:hover {
    background: var(--secondary-color);
}

@media (max-width: 768px) {
    .mobile-menu-toggle {
        display: flex;
        align-items: center;
        justify-content: center;
    }
}

/* RTL Support */
.rtl {
    direction: rtl;
}

.rtl .sidebar {
    right: 0;
    left: auto;
}

.rtl .main-content {
    margin-right: 260px;
    margin-left: 0;
}

.rtl .sidebar-menu a i {
    margin-left: 10px;
    margin-right: 0;
}

@media (max-width: 768px) {
    .rtl .sidebar {
        transform: translateX(100%);
    }
    
    .rtl .sidebar.mobile-open {
        transform: translateX(0);
    }
    
    .rtl .main-content {
        margin-right: 0;
    }
}

/* Utility Classes */
.text-center { text-align: center; }
.text-right { text-align: right; }
.text-left { text-align: left; }
.mt-10 { margin-top: 10px; }
.mt-20 { margin-top: 20px; }
.mt-30 { margin-top: 30px; }
.mb-10 { margin-bottom: 10px; }
.mb-20 { margin-bottom: 20px; }
.mb-30 { margin-bottom: 30px; }
.hidden { display: none; }
.flex { display: flex; }
.flex-center { display: flex; justify-content: center; align-items: center; }
.flex-between { display: flex; justify-content: space-between; align-items: center; }
.gap-10 { gap: 10px; }
.gap-20 { gap: 20px; }