/* ============================================
   منصة يمن طالب - التصميم الرئيسي
   Yemen Student Platform - Main Stylesheet
   ============================================ */

:root {
    --primary: #1e3a5f;
    --primary-light: #2a5080;
    --primary-dark: #142a45;
    --secondary: #c8a951;
    --secondary-light: #dcc06e;
    --accent: #e74c3c;
    --success: #27ae60;
    --warning: #f39c12;
    --info: #3498db;
    --danger: #e74c3c;
    --bg-main: #f0f2f5;
    --bg-card: #ffffff;
    --bg-sidebar: #1e3a5f;
    --text-primary: #2c3e50;
    --text-secondary: #6c757d;
    --text-light: #ffffff;
    --border-color: #e0e4e8;
    --shadow-sm: 0 1px 3px rgba(0,0,0,0.08);
    --shadow-md: 0 4px 12px rgba(0,0,0,0.1);
    --shadow-lg: 0 8px 24px rgba(0,0,0,0.12);
    --radius-sm: 6px;
    --radius-md: 10px;
    --radius-lg: 16px;
    --sidebar-width: 260px;
    --header-height: 64px;
    --transition: all 0.3s ease;
}

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

body {
    font-family: 'Tajawal', sans-serif;
    background: var(--bg-main);
    color: var(--text-primary);
    line-height: 1.7;
    font-size: 15px;
    overflow-x: hidden;
}

a { text-decoration: none; color: inherit; }
img { max-width: 100%; height: auto; }

/* ============ Scrollbar ============ */
::-webkit-scrollbar { width: 6px; }
::-webkit-scrollbar-track { background: #f1f1f1; }
::-webkit-scrollbar-thumb { background: var(--primary-light); border-radius: 3px; }

/* ============ Sidebar ============ */
.sidebar {
    position: fixed;
    right: 0;
    top: 0;
    width: var(--sidebar-width);
    height: 100vh;
    background: linear-gradient(180deg, var(--primary-dark) 0%, var(--primary) 100%);
    color: var(--text-light);
    z-index: 1000;
    display: flex;
    flex-direction: column;
    transition: var(--transition);
    box-shadow: -4px 0 20px rgba(0,0,0,0.15);
}

.sidebar-header {
    padding: 20px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    border-bottom: 1px solid rgba(255,255,255,0.1);
}

.sidebar-logo {
    display: flex;
    align-items: center;
    gap: 12px;
}

.sidebar-logo i {
    font-size: 28px;
    color: var(--secondary);
}

.sidebar-brand {
    font-size: 20px;
    font-weight: 800;
    color: var(--text-light);
}

.sidebar-toggle {
    background: none;
    border: none;
    color: var(--text-light);
    font-size: 20px;
    cursor: pointer;
}

.sidebar-user {
    padding: 20px;
    display: flex;
    align-items: center;
    gap: 12px;
    border-bottom: 1px solid rgba(255,255,255,0.1);
}

.user-avatar {
    width: 44px;
    height: 44px;
    border-radius: 50%;
    background: rgba(255,255,255,0.15);
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
}

.user-avatar img { width: 100%; height: 100%; object-fit: cover; }
.user-avatar i { font-size: 28px; color: rgba(255,255,255,0.7); }

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

.user-name {
    font-weight: 700;
    font-size: 14px;
}

.user-role {
    font-size: 12px;
    color: var(--secondary-light);
}

.sidebar-nav {
    flex: 1;
    overflow-y: auto;
    padding: 10px 0;
}

.nav-list {
    list-style: none;
    padding: 0;
    margin: 0;
}

.nav-item {
    margin: 2px 8px;
}

.nav-link {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 16px;
    color: rgba(255,255,255,0.75);
    border-radius: var(--radius-sm);
    transition: var(--transition);
    font-size: 14px;
    font-weight: 500;
}

.nav-link:hover {
    background: rgba(255,255,255,0.1);
    color: var(--text-light);
}

.nav-item.active .nav-link {
    background: rgba(200,169,81,0.2);
    color: var(--secondary-light);
    font-weight: 700;
}

.nav-link i {
    width: 22px;
    text-align: center;
    font-size: 16px;
}

.sidebar-footer {
    padding: 16px;
    border-top: 1px solid rgba(255,255,255,0.1);
}

.btn-logout {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 16px;
    color: rgba(255,255,255,0.7);
    border-radius: var(--radius-sm);
    transition: var(--transition);
    font-size: 14px;
}

.btn-logout:hover {
    background: rgba(231,76,60,0.2);
    color: #e74c3c;
}

.sidebar-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.5);
    z-index: 999;
}

/* When toggled via JavaScript the overlay receives the .show class */
.sidebar-overlay.show {
    display: block;
}

/* Prevent background scrolling when sidebar is open */
body.no-scroll {
    overflow: hidden;
}

/* ============ Main Content ============ */
.main-content {
    margin-right: var(--sidebar-width);
    min-height: 100vh;
    transition: var(--transition);
}

.top-header {
    background: var(--bg-card);
    height: var(--header-height);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 24px;
    box-shadow: var(--shadow-sm);
    position: sticky;
    top: 0;
    z-index: 100;
}

.header-right {
    display: flex;
    align-items: center;
    gap: 16px;
}

.menu-toggle {
    display: none;
    background: none;
    border: none;
    font-size: 22px;
    color: var(--text-primary);
    cursor: pointer;
}

.page-title {
    font-size: 18px;
    font-weight: 700;
    color: var(--text-primary);
}

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

.header-btn {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    border: none;
    background: var(--bg-main);
    color: var(--text-secondary);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    position: relative;
    transition: var(--transition);
}

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

.badge-count {
    position: absolute;
    top: -2px;
    left: -2px;
    width: 18px;
    height: 18px;
    border-radius: 50%;
    background: var(--danger);
    color: white;
    font-size: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
}

.content-area {
    padding: 24px;
}

/* ============ Cards ============ */
.card {
    background: var(--bg-card);
    border-radius: var(--radius-md);
    border: none;
    box-shadow: var(--shadow-sm);
    transition: var(--transition);
}

.card:hover {
    box-shadow: var(--shadow-md);
}

.card-header {
    background: transparent;
    border-bottom: 1px solid var(--border-color);
    padding: 16px 20px;
    font-weight: 700;
}

.card-body { padding: 20px; }

/* ============ Stat Cards ============ */
.stat-card {
    background: var(--bg-card);
    border-radius: var(--radius-md);
    padding: 20px;
    display: flex;
    align-items: center;
    gap: 16px;
    box-shadow: var(--shadow-sm);
    transition: var(--transition);
    border-right: 4px solid var(--primary);
}

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

.stat-card.success { border-right-color: var(--success); }
.stat-card.warning { border-right-color: var(--warning); }
.stat-card.danger { border-right-color: var(--danger); }
.stat-card.info { border-right-color: var(--info); }
.stat-card.secondary { border-right-color: var(--secondary); }

.stat-icon {
    width: 56px;
    height: 56px;
    border-radius: var(--radius-md);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 24px;
    flex-shrink: 0;
}

.stat-icon.primary { background: rgba(30,58,95,0.1); color: var(--primary); }
.stat-icon.success { background: rgba(39,174,96,0.1); color: var(--success); }
.stat-icon.warning { background: rgba(243,156,18,0.1); color: var(--warning); }
.stat-icon.danger { background: rgba(231,76,60,0.1); color: var(--danger); }
.stat-icon.info { background: rgba(52,152,219,0.1); color: var(--info); }
.stat-icon.secondary { background: rgba(200,169,81,0.1); color: var(--secondary); }

.stat-info { flex: 1; }
.stat-value { font-size: 28px; font-weight: 800; line-height: 1.2; }
.stat-label { font-size: 13px; color: var(--text-secondary); font-weight: 500; }

/* ============ Tables ============ */
.table-container {
    background: var(--bg-card);
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-sm);
    overflow: hidden;
}

.table-header {
    padding: 16px 20px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 12px;
    border-bottom: 1px solid var(--border-color);
}

.table-title {
    font-size: 16px;
    font-weight: 700;
}

.table {
    margin-bottom: 0;
}

.table thead th {
    background: var(--bg-main);
    font-weight: 700;
    font-size: 13px;
    color: var(--text-secondary);
    border-bottom: 2px solid var(--border-color);
    padding: 12px 16px;
    white-space: nowrap;
}

.table tbody td {
    padding: 12px 16px;
    vertical-align: middle;
    font-size: 14px;
    border-bottom: 1px solid var(--border-color);
}

.table tbody tr:hover {
    background: rgba(30,58,95,0.02);
}

/* ============ Buttons ============ */
.btn-primary {
    background: var(--primary);
    border-color: var(--primary);
    font-weight: 600;
}

.btn-primary:hover {
    background: var(--primary-light);
    border-color: var(--primary-light);
}

.btn-secondary-custom {
    background: var(--secondary);
    border-color: var(--secondary);
    color: var(--primary-dark);
    font-weight: 600;
}

.btn-secondary-custom:hover {
    background: var(--secondary-light);
    border-color: var(--secondary-light);
    color: var(--primary-dark);
}

.btn-sm { font-size: 13px; padding: 4px 12px; }

/* ============ Badges ============ */
.badge-status {
    padding: 4px 12px;
    border-radius: 20px;
    font-size: 12px;
    font-weight: 600;
}

.badge-active { background: rgba(39,174,96,0.1); color: var(--success); }
.badge-inactive { background: rgba(108,117,125,0.1); color: var(--text-secondary); }
.badge-pending { background: rgba(243,156,18,0.1); color: var(--warning); }
.badge-danger { background: rgba(231,76,60,0.1); color: var(--danger); }

/* ============ Forms ============ */
.form-control, .form-select {
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    padding: 10px 14px;
    font-family: 'Tajawal', sans-serif;
    font-size: 14px;
    transition: var(--transition);
}

.form-control:focus, .form-select:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(30,58,95,0.1);
}

.form-label {
    font-weight: 600;
    font-size: 14px;
    margin-bottom: 6px;
    color: var(--text-primary);
}

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

.search-box input {
    padding-right: 40px;
    border-radius: 20px;
    background: var(--bg-main);
    border: 1px solid transparent;
}

.search-box input:focus {
    background: white;
    border-color: var(--primary);
}

.search-box i {
    position: absolute;
    right: 14px;
    top: 50%;
    transform: translateY(-50%);
    color: var(--text-secondary);
}

/* ============ Landing Page ============ */
.landing-hero {
    /* Use a high-resolution background image blended with the brand gradient */
    background: linear-gradient(135deg, var(--primary-dark) 0%, var(--primary) 50%, var(--primary-light) 100%), url('/assets/img/hero-bg.png') center/cover no-repeat;
    background-blend-mode: overlay;
    min-height: 100vh;
    display: flex;
    align-items: center;
    position: relative;
    overflow: hidden;
    color: white;
}

.landing-hero::before {
    content: '';
    position: absolute;
    width: 600px;
    height: 600px;
    border-radius: 50%;
    background: rgba(200,169,81,0.08);
    top: -200px;
    left: -200px;
}

.landing-hero::after {
    content: '';
    position: absolute;
    width: 400px;
    height: 400px;
    border-radius: 50%;
    background: rgba(200,169,81,0.05);
    bottom: -100px;
    right: -100px;
}

.hero-content {
    position: relative;
    z-index: 2;
}

.hero-badge {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    background: rgba(200,169,81,0.2);
    color: var(--secondary-light);
    padding: 6px 16px;
    border-radius: 20px;
    font-size: 14px;
    font-weight: 600;
    margin-bottom: 20px;
}

.hero-title {
    font-size: 48px;
    font-weight: 900;
    line-height: 1.3;
    margin-bottom: 20px;
}

.hero-subtitle {
    font-size: 18px;
    opacity: 0.85;
    line-height: 1.8;
    margin-bottom: 32px;
    max-width: 540px;
}

.hero-buttons {
    display: flex;
    gap: 16px;
    flex-wrap: wrap;
}

.btn-hero {
    padding: 14px 32px;
    border-radius: var(--radius-sm);
    font-weight: 700;
    font-size: 16px;
    transition: var(--transition);
    display: inline-flex;
    align-items: center;
    gap: 8px;
}

.btn-hero-primary {
    background: var(--secondary);
    color: var(--primary-dark);
    border: 2px solid var(--secondary);
}

.btn-hero-primary:hover {
    background: var(--secondary-light);
    color: var(--primary-dark);
    transform: translateY(-2px);
}

.btn-hero-outline {
    background: transparent;
    color: white;
    border: 2px solid rgba(255,255,255,0.3);
}

.btn-hero-outline:hover {
    background: rgba(255,255,255,0.1);
    border-color: rgba(255,255,255,0.5);
    color: white;
    transform: translateY(-2px);
}

.hero-stats {
    display: flex;
    gap: 40px;
    margin-top: 48px;
    padding-top: 32px;
    border-top: 1px solid rgba(255,255,255,0.15);
}

.hero-stat-value {
    font-size: 32px;
    font-weight: 900;
    color: var(--secondary);
}

.hero-stat-label {
    font-size: 14px;
    opacity: 0.7;
}

.hero-image {
    position: relative;
    z-index: 2;
}

.hero-image-card {
    background: rgba(255,255,255,0.1);
    backdrop-filter: blur(10px);
    border-radius: var(--radius-lg);
    padding: 32px;
    border: 1px solid rgba(255,255,255,0.15);
}

/* ============ Features Section ============ */
.features-section {
    padding: 80px 0;
    background: white;
}

.section-title {
    font-size: 36px;
    font-weight: 800;
    text-align: center;
    margin-bottom: 12px;
    color: var(--primary);
}

.section-subtitle {
    text-align: center;
    color: var(--text-secondary);
    font-size: 16px;
    margin-bottom: 48px;
}

.feature-card {
    background: var(--bg-card);
    border-radius: var(--radius-md);
    padding: 32px 24px;
    text-align: center;
    transition: var(--transition);
    border: 1px solid var(--border-color);
    height: 100%;
}

.feature-card:hover {
    transform: translateY(-4px);
    box-shadow: var(--shadow-lg);
    border-color: var(--primary);
}

.feature-icon {
    width: 72px;
    height: 72px;
    border-radius: var(--radius-md);
    background: linear-gradient(135deg, var(--primary), var(--primary-light));
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 28px;
    margin: 0 auto 20px;
}

.feature-title {
    font-size: 18px;
    font-weight: 700;
    margin-bottom: 8px;
    color: var(--primary);
}

.feature-desc {
    font-size: 14px;
    color: var(--text-secondary);
    line-height: 1.7;
}

/* ============ Login Page ============ */
.login-page {
    min-height: 100vh;
    display: flex;
    background: var(--bg-main);
}

.login-sidebar {
    width: 45%;
    background: linear-gradient(135deg, var(--primary-dark), var(--primary));
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    padding: 40px;
    position: relative;
    overflow: hidden;
}

.login-sidebar::before {
    content: '';
    position: absolute;
    width: 400px;
    height: 400px;
    border-radius: 50%;
    background: rgba(200,169,81,0.08);
    top: -100px;
    right: -100px;
}

.login-form-side {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 40px;
}

.login-card {
    width: 100%;
    max-width: 440px;
}

.login-card h2 {
    font-size: 28px;
    font-weight: 800;
    color: var(--primary);
    margin-bottom: 8px;
}

.login-card p {
    color: var(--text-secondary);
    margin-bottom: 32px;
}

/* ============ Pagination ============ */
.pagination .page-link {
    color: var(--primary);
    border-color: var(--border-color);
    font-weight: 600;
    font-size: 14px;
}

.pagination .page-item.active .page-link {
    background: var(--primary);
    border-color: var(--primary);
}

/* ============ Empty State ============ */
.empty-state {
    text-align: center;
    padding: 60px 20px;
    color: var(--text-secondary);
}

.empty-state i {
    font-size: 64px;
    margin-bottom: 16px;
    opacity: 0.3;
}

.empty-state h4 {
    font-weight: 700;
    margin-bottom: 8px;
}

/* ============ Responsive ============ */
@media (max-width: 991.98px) {
    .sidebar {
        transform: translateX(100%);
    }
    .sidebar.show {
        transform: translateX(0);
    }
    /* The overlay visibility is now controlled via the .show class (see .sidebar-overlay.show) */
    .main-content {
        margin-right: 0;
    }
    .menu-toggle {
        display: block;
    }
    .hero-title { font-size: 36px; }
    .hero-stats { gap: 24px; }
    .login-sidebar { display: none; }
    .login-form-side { padding: 24px; }
}

@media (max-width: 767.98px) {
    .content-area { padding: 16px; }
    .hero-title { font-size: 28px; }
    .hero-subtitle { font-size: 15px; }
    .hero-stats { flex-wrap: wrap; gap: 16px; }
    .stat-card { padding: 16px; }
    .stat-value { font-size: 22px; }
    .table-header { flex-direction: column; align-items: stretch; }
    .section-title { font-size: 28px; }
}

@media (max-width: 575.98px) {
    .hero-buttons { flex-direction: column; }
    .btn-hero { width: 100%; justify-content: center; }
}

/* ============ Animations ============ */
@keyframes fadeInUp {
    from { opacity: 0; transform: translateY(20px); }
    to { opacity: 1; transform: translateY(0); }
}

.fade-in-up {
    animation: fadeInUp 0.5s ease forwards;
}

/* ============ Footer ============ */
.landing-footer {
    background: var(--primary-dark);
    color: rgba(255,255,255,0.7);
    padding: 48px 0 24px;
}

.footer-brand {
    font-size: 24px;
    font-weight: 800;
    color: white;
    margin-bottom: 12px;
}

.footer-desc {
    font-size: 14px;
    line-height: 1.8;
    max-width: 320px;
}

.footer-title {
    font-size: 16px;
    font-weight: 700;
    color: white;
    margin-bottom: 16px;
}

.footer-links {
    list-style: none;
    padding: 0;
}

.footer-links li { margin-bottom: 8px; }

.footer-links a {
    color: rgba(255,255,255,0.6);
    font-size: 14px;
    transition: var(--transition);
}

.footer-links a:hover {
    color: var(--secondary);
}

.footer-bottom {
    border-top: 1px solid rgba(255,255,255,0.1);
    padding-top: 24px;
    margin-top: 32px;
    text-align: center;
    font-size: 13px;
}

/* ============ Navbar Landing ============ */
.landing-nav {
    position: fixed;
    top: 0;
    width: 100%;
    z-index: 1000;
    padding: 16px 0;
    transition: var(--transition);
}

.landing-nav.scrolled {
    background: rgba(30,58,95,0.95);
    backdrop-filter: blur(10px);
    padding: 10px 0;
    box-shadow: var(--shadow-md);
}

.nav-brand {
    display: flex;
    align-items: center;
    gap: 10px;
    color: white;
    font-weight: 800;
    font-size: 20px;
}

.nav-brand i {
    color: var(--secondary);
    font-size: 24px;
}

/* ============ Modal ============ */
.modal-header {
    background: var(--primary);
    color: white;
    border-radius: var(--radius-md) var(--radius-md) 0 0;
}

.modal-header .btn-close {
    filter: invert(1);
}

/* ============ Loading ============ */
.loading-spinner {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 40px;
}

.spinner {
    width: 40px;
    height: 40px;
    border: 3px solid var(--border-color);
    border-top-color: var(--primary);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}
