@import url('https://fonts.googleapis.com/css2?family=Cairo:wght@400;500;600;700;800;900&family=Tajawal:wght@400;500;700;800;900&family=Outfit:wght@500;600;700;800;900&display=swap');

:root {
    --portal-primary: #0F447E;
    --portal-primary-dark: #092342;
    --portal-primary-light: #2E84D8;
    --portal-primary-hover: #165EA6;
    
    --portal-accent: #E86A17;
    --portal-accent-light: #F37B24;
    --portal-accent-glow: rgba(232, 106, 23, 0.25);
    
    --portal-gold: #f59e0b;
    --portal-gold-light: #fef3c7;
    
    --portal-bg: #f1f5f9;
    --portal-card-bg: #ffffff;
    --portal-text: #0f172a;
    --portal-text-muted: #64748b;
    --portal-border: #e2e8f0;
    --portal-border-subtle: #f8fafc;
    
    --portal-success: #10b981;
    --portal-warning: #f59e0b;
    --portal-danger: #ef4444;
    --portal-info: #0284c7;
    
    --portal-radius: 20px;
    --portal-radius-md: 14px;
    --portal-radius-sm: 10px;
    
    --portal-shadow-sm: 0 2px 6px rgba(15, 23, 42, 0.04);
    --portal-shadow: 0 10px 25px -5px rgba(15, 23, 42, 0.08), 0 4px 10px -2px rgba(15, 23, 42, 0.04);
    --portal-shadow-hover: 0 20px 35px -10px rgba(15, 68, 126, 0.18), 0 8px 16px -4px rgba(15, 68, 126, 0.08);
}

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

body {
    font-family: 'Cairo', 'Tajawal', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
    background-color: var(--portal-bg);
    color: var(--portal-text);
    direction: rtl;
    text-align: right;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    -webkit-font-smoothing: antialiased;
    overflow-x: hidden;
}

/* Background Ambient Glow */
.portal-glow-bg {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    height: 380px;
    background: radial-gradient(circle at 50% 0%, #165EA6 0%, #0F447E 50%, #092342 100%);
    z-index: 0;
    border-bottom-left-radius: 40px;
    border-bottom-right-radius: 40px;
    box-shadow: 0 15px 40px rgba(9, 35, 66, 0.35);
}

.portal-container {
    position: relative;
    z-index: 1;
    max-width: 1280px;
    margin: 0 auto;
    padding: 20px 16px;
    width: 100%;
    flex: 1;
}

/* ==========================================================================
   Login Page Styling (Responsive & Ultra-Modern)
   ========================================================================== */
.login-wrapper {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 24px 16px;
    background: radial-gradient(circle at 50% 10%, #165EA6 0%, #0F447E 40%, #092342 80%, #051324 100%);
    position: relative;
    overflow: hidden;
}

.login-wrapper::before {
    content: '';
    position: absolute;
    width: 600px;
    height: 600px;
    background: radial-gradient(circle, rgba(232, 106, 23, 0.15) 0%, rgba(232, 106, 23, 0) 70%);
    top: -150px;
    right: -150px;
    border-radius: 50%;
    pointer-events: none;
}

.login-wrapper::after {
    content: '';
    position: absolute;
    width: 500px;
    height: 500px;
    background: radial-gradient(circle, rgba(46, 132, 216, 0.2) 0%, rgba(46, 132, 216, 0) 70%);
    bottom: -100px;
    left: -100px;
    border-radius: 50%;
    pointer-events: none;
}

.login-card {
    position: relative;
    z-index: 2;
    background: rgba(255, 255, 255, 0.98);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border-radius: 28px;
    padding: 40px 36px;
    max-width: 480px;
    width: 100%;
    box-shadow: 0 25px 60px -15px rgba(0, 0, 0, 0.35), 0 0 0 1px rgba(255, 255, 255, 0.8);
    animation: loginFadeUp 0.6s cubic-bezier(0.16, 1, 0.3, 1) forwards;
}

@keyframes loginFadeUp {
    from {
        opacity: 0;
        transform: translateY(30px) scale(0.96);
    }
    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

.login-header {
    text-align: center;
    margin-bottom: 28px;
}

.login-logo-img {
    height: 72px;
    max-width: 180px;
    object-fit: contain;
    margin-bottom: 14px;
    filter: drop-shadow(0 6px 12px rgba(15, 68, 126, 0.15));
}

.login-header h1 {
    font-size: 1.55rem;
    font-weight: 900;
    color: var(--portal-primary-dark);
    margin-bottom: 6px;
    line-height: 1.3;
}

.login-header p {
    font-size: 0.92rem;
    color: var(--portal-text-muted);
    font-weight: 600;
}

.portal-login-nav-back {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    color: rgba(255, 255, 255, 0.85);
    text-decoration: none;
    font-size: 0.88rem;
    font-weight: 700;
    margin-bottom: 16px;
    padding: 6px 14px;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 20px;
    transition: all 0.2s ease;
}

.portal-login-nav-back:hover {
    background: rgba(255, 255, 255, 0.2);
    color: #ffffff;
    transform: translateX(3px);
}

/* ==========================================================================
   Top Navigation Bar - Glassmorphic & Mobile Responsive
   ========================================================================== */
.portal-navbar {
    background: rgba(255, 255, 255, 0.96);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    border-radius: var(--portal-radius);
    padding: 12px 20px;
    margin-bottom: 24px;
    box-shadow: 0 12px 35px rgba(0, 0, 0, 0.08), 0 1px 3px rgba(0, 0, 0, 0.04);
    display: flex;
    justify-content: space-between;
    align-items: center;
    border: 1px solid rgba(255, 255, 255, 0.9);
    position: relative;
    z-index: 100;
}

.portal-brand {
    display: flex;
    align-items: center;
    gap: 12px;
    text-decoration: none;
    color: var(--portal-primary);
}

.portal-brand img {
    height: 46px;
    width: 46px;
    object-fit: contain;
    filter: drop-shadow(0 3px 6px rgba(0,0,0,0.1));
}

.portal-brand-title {
    font-size: 1.1rem;
    font-weight: 900;
    color: var(--portal-primary-dark);
    line-height: 1.25;
}

.portal-brand-subtitle {
    font-size: 0.78rem;
    color: var(--portal-text-muted);
    font-weight: 700;
}

.portal-mobile-toggle {
    display: none;
    background: #f1f5f9;
    border: 1px solid var(--portal-border);
    color: var(--portal-primary-dark);
    font-size: 1.25rem;
    padding: 8px 12px;
    border-radius: var(--portal-radius-sm);
    cursor: pointer;
    transition: all 0.2s ease;
}

.portal-mobile-toggle:hover {
    background: var(--portal-primary);
    color: #fff;
}

.portal-nav-links {
    display: flex;
    gap: 4px;
    list-style: none;
    align-items: center;
    flex-wrap: wrap;
}

.portal-nav-link {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 8px 12px;
    border-radius: var(--portal-radius-md);
    color: #475569;
    text-decoration: none;
    font-weight: 700;
    font-size: 0.88rem;
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    position: relative;
    white-space: nowrap;
}

.portal-nav-link:hover {
    color: var(--portal-primary);
    background: rgba(15, 68, 126, 0.08);
    transform: translateY(-1px);
}

.portal-nav-link.active {
    color: #ffffff;
    background: linear-gradient(135deg, var(--portal-primary) 0%, var(--portal-primary-light) 100%);
    box-shadow: 0 4px 12px rgba(15, 68, 126, 0.28);
}

.portal-user-badge {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 6px 14px;
    background: #f8fafc;
    border: 1px solid var(--portal-border);
    border-radius: 30px;
    transition: all 0.2s ease;
}

.portal-user-badge:hover {
    background: #f1f5f9;
    border-color: #cbd5e1;
    transform: translateY(-1px);
}

.portal-user-avatar {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--portal-accent) 0%, var(--portal-accent-light) 100%);
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 800;
    font-size: 0.95rem;
    box-shadow: 0 4px 10px rgba(232, 106, 23, 0.3);
}

/* ==========================================================================
   Student Hero Card - Luxury Mesh
   ========================================================================== */
.student-hero-card {
    background: linear-gradient(135deg, #092342 0%, #0F447E 60%, #165EA6 100%);
    color: #ffffff;
    border-radius: var(--portal-radius);
    padding: 26px 28px;
    margin-bottom: 24px;
    box-shadow: 0 15px 35px rgba(9, 35, 66, 0.3), 0 0 0 1px rgba(255, 255, 255, 0.12);
    position: relative;
    overflow: hidden;
}

.student-hero-card::after {
    content: '';
    position: absolute;
    width: 300px;
    height: 300px;
    background: radial-gradient(circle, rgba(232, 106, 23, 0.2) 0%, rgba(232, 106, 23, 0) 70%);
    top: -50px;
    left: -50px;
    border-radius: 50%;
    pointer-events: none;
}

.student-hero-info {
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 16px;
    position: relative;
    z-index: 2;
}

.student-pills {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
    margin-top: 10px;
}

.student-pill {
    background: rgba(255, 255, 255, 0.15);
    border: 1px solid rgba(255, 255, 255, 0.2);
    padding: 4px 12px;
    border-radius: 20px;
    font-size: 0.82rem;
    font-weight: 700;
    color: #ffffff;
}

.student-serial-badge {
    background: rgba(255, 255, 255, 0.12);
    backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 255, 255, 0.25);
    border-radius: 16px;
    padding: 12px 20px;
    text-align: center;
}

/* ==========================================================================
   Dashboard Quick Action Cards & Grids
   ========================================================================== */
.portal-stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
    gap: 18px;
    margin-bottom: 24px;
}

.portal-stat-card {
    background: var(--portal-card-bg);
    border: 1px solid var(--portal-border);
    border-radius: var(--portal-radius-md);
    padding: 20px;
    box-shadow: var(--portal-shadow-sm);
    display: flex;
    align-items: center;
    gap: 16px;
    transition: all 0.25s ease;
    text-decoration: none;
    color: inherit;
}

.portal-stat-card:hover {
    transform: translateY(-3px);
    box-shadow: var(--portal-shadow-hover);
    border-color: var(--portal-primary-light);
}

.portal-stat-icon {
    width: 52px;
    height: 52px;
    border-radius: 14px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.4rem;
    color: #fff;
    flex-shrink: 0;
}

.portal-stat-title {
    font-size: 0.84rem;
    color: var(--portal-text-muted);
    font-weight: 700;
    margin-bottom: 4px;
}

.portal-stat-value {
    font-size: 1.35rem;
    font-weight: 900;
    color: var(--portal-primary-dark);
}

/* ==========================================================================
   Portal Cards, Tables & Responsive Containers
   ========================================================================== */
.portal-card {
    background: var(--portal-card-bg);
    border: 1px solid var(--portal-border);
    border-radius: var(--portal-radius);
    padding: 24px;
    box-shadow: var(--portal-shadow-sm);
    margin-bottom: 24px;
}

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

.portal-card-title {
    font-size: 1.2rem;
    font-weight: 800;
    color: var(--portal-primary-dark);
    display: flex;
    align-items: center;
    gap: 10px;
}

.portal-table-responsive,
.portal-table-wrapper {
    width: 100%;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    border-radius: var(--portal-radius-sm);
    border: 1px solid var(--portal-border);
    margin-bottom: 16px;
}

.portal-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.92rem;
}

.portal-table th {
    background: #f8fafc;
    color: var(--portal-primary-dark);
    padding: 13px 16px;
    font-weight: 800;
    border-bottom: 2px solid var(--portal-border);
    white-space: nowrap;
    text-align: right;
}

.portal-table td {
    padding: 13px 16px;
    border-bottom: 1px solid var(--portal-border-subtle);
    color: var(--portal-text);
    vertical-align: middle;
}

.portal-table tbody tr:hover {
    background-color: #f8fafc;
}

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

/* ==========================================================================
   Form Controls & Buttons
   ========================================================================== */
.portal-form-group {
    margin-bottom: 18px;
}

.portal-label {
    display: block;
    font-weight: 800;
    margin-bottom: 8px;
    font-size: 0.92rem;
    color: var(--portal-primary-dark);
}

.portal-input {
    width: 100%;
    padding: 12px 16px;
    border-radius: var(--portal-radius-sm);
    border: 1.5px solid var(--portal-border);
    font-family: inherit;
    font-size: 0.95rem;
    transition: all 0.2s ease;
    background: #ffffff;
    color: var(--portal-text);
}

.portal-input:focus {
    outline: none;
    border-color: var(--portal-primary-light);
    box-shadow: 0 0 0 4px rgba(46, 132, 216, 0.15);
}

.portal-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 11px 22px;
    border-radius: var(--portal-radius-sm);
    font-weight: 800;
    font-size: 0.95rem;
    border: none;
    cursor: pointer;
    text-decoration: none;
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    box-sizing: border-box;
}

.portal-btn-primary {
    background: linear-gradient(135deg, var(--portal-primary) 0%, var(--portal-primary-light) 100%);
    color: #ffffff !important;
    box-shadow: 0 6px 16px rgba(15, 68, 126, 0.25);
}

.portal-btn-primary:hover {
    background: linear-gradient(135deg, var(--portal-primary) 0%, var(--portal-primary-hover) 100%);
    transform: translateY(-2px);
    box-shadow: 0 8px 22px rgba(15, 68, 126, 0.35);
    color: #ffffff !important;
}

.portal-btn-danger {
    background: linear-gradient(135deg, #ef4444 0%, #dc2626 100%);
    color: #ffffff !important;
    box-shadow: 0 4px 12px rgba(239, 68, 68, 0.25);
}

.portal-btn-danger:hover {
    background: linear-gradient(135deg, #dc2626 0%, #b91c1c 100%);
    transform: translateY(-2px);
    box-shadow: 0 6px 18px rgba(239, 68, 68, 0.35);
    color: #ffffff !important;
}

/* Footer */
.portal-footer {
    margin-top: auto;
    background: #ffffff;
    border-top: 1px solid var(--portal-border);
    padding: 18px 20px;
    text-align: center;
    font-size: 0.86rem;
    color: var(--portal-text-muted);
    font-weight: 700;
}

/* ==========================================================================
   Master Responsive Media Queries (Mobile, Tablet, Laptop, Desktop)
   ========================================================================== */
/* ==========================================================================
   Master Responsive Media Queries (Mobile, Tablet, Laptop, Desktop)
   ========================================================================== */
@media (max-width: 991px) {
    .portal-navbar {
        flex-direction: column;
        align-items: stretch;
        gap: 12px;
        padding: 14px 16px;
    }

    .portal-mobile-toggle {
        display: inline-flex;
        align-items: center;
        justify-content: center;
    }

    .portal-nav-links {
        display: none;
        flex-direction: column;
        align-items: stretch;
        width: 100%;
        gap: 6px;
        padding-top: 10px;
        border-top: 1px solid var(--portal-border);
    }

    .portal-nav-links.show-mobile {
        display: flex;
        animation: portalFadeIn 0.25s ease forwards;
    }

    .portal-nav-link {
        padding: 10px 14px;
        font-size: 0.95rem;
        border-radius: 10px;
    }

    .d-none-mobile {
        display: none !important;
    }
}

@media (max-width: 640px) {
    .portal-container {
        padding: 12px 10px;
    }
    .login-card {
        padding: 28px 18px;
        border-radius: 22px;
    }
    .login-logo-img {
        height: 60px;
    }
    .login-header h1 {
        font-size: 1.3rem;
    }
    .login-header p {
        font-size: 0.84rem;
    }
    .student-hero-card {
        padding: 20px 16px;
    }
    .student-hero-info {
        flex-direction: column;
        align-items: flex-start;
        text-align: right;
    }
    .student-serial-badge {
        width: 100%;
        text-align: center;
    }
    .portal-stats-grid {
        grid-template-columns: 1fr;
    }
    .portal-card {
        padding: 18px 14px;
    }
}
