:root {
    --lux-gold: #d4af37;
    --lux-gold-glow: rgba(212, 175, 55, 0.4);
    --islamic-primary: #064e3b;
    --islamic-gradient: linear-gradient(135deg, #065f46, #064e3b);
    
    --reading-primary: #92400e;
    --reading-gradient: linear-gradient(135deg, #b45309, #92400e);
    
    --science-primary: #0f766e;
    --science-gradient: linear-gradient(135deg, #14b8a6, #0f766e);
    
    --math-primary: #3730a3;
    --math-gradient: linear-gradient(135deg, #4f46e5, #3730a3);
    
    --slate-900: #0f172a;
    --slate-800: #1e293b;
    --slate-100: #f1f5f9;
    
    --glass: rgba(255, 255, 255, 0.03);
    --glass-border: rgba(255, 255, 255, 0.1);
    --glass-shine: rgba(255, 255, 255, 0.05);
    
    --transition-lux: all 0.5s cubic-bezier(0.22, 1, 0.36, 1);
}

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

body {
    font-family: 'Cairo', 'Outfit', sans-serif;
    background-color: var(--slate-900);
    color: white;
    min-height: 100vh;
    overflow-x: hidden;
    display: flex;
    justify-content: center;
    align-items: center;
}

body.locked {
    overflow: hidden;
    height: 100vh;
}

/* Luxurious Mesh Background */
.mesh-background {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: -1;
    background: radial-gradient(circle at 50% 50%, #1e293b, #0f172a);
    overflow: hidden;
}

.mesh-sphere {
    position: absolute;
    filter: blur(120px);
    border-radius: 50%;
    opacity: 0.3;
    animation: floating 25s infinite alternate ease-in-out;
}

.mesh-1 { width: 600px; height: 600px; background: #312e81; top: -100px; right: -100px; }
.mesh-2 { width: 500px; height: 500px; background: #134e4a; bottom: -100px; left: -100px; animation-delay: -5s; }
.mesh-3 { width: 400px; height: 400px; background: #7c2d12; top: 30%; left: 20%; animation-delay: -10s; }
.mesh-4 { width: 500px; height: 500px; background: #4c1d95; bottom: 20%; right: 10%; animation-delay: -15s; }

@keyframes floating {
    0% { transform: translate(0, 0) scale(1); }
    50% { transform: translate(50px, 80px) scale(1.1); }
    100% { transform: translate(-30px, 40px) scale(0.9); }
}

/* Login Overlay Styles - FIXED TO COVER FULL SCREEN */
.login-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background: rgba(15, 23, 42, 0.98);
    backdrop-filter: blur(40px);
    -webkit-backdrop-filter: blur(40px);
    z-index: 99999; /* Ultra high priority */
    display: flex;
    justify-content: center;
    align-items: center;
    transition: opacity 0.8s ease, visibility 0.8s;
}

.login-overlay.hide {
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
}

.login-box {
    background: var(--glass);
    border: 1px solid var(--glass-border);
    padding: 60px 40px;
    border-radius: 40px;
    text-align: center;
    max-width: 500px;
    width: 90%;
    box-shadow: 0 30px 60px rgba(0,0,0,0.5);
    animation: zoomIn 0.6s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

.lock-icon {
    width: 80px;
    height: 80px;
    background: var(--lux-gold);
    border-radius: 24px;
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto 30px;
    box-shadow: 0 0 30px var(--lux-gold-glow);
}

.lock-icon i { width: 40px; height: 40px; color: var(--slate-900); }

.login-box h2 {
    font-size: 2.2rem;
    margin-bottom: 15px;
    color: white;
}

.login-box p {
    color: #94a3b8;
    margin-bottom: 35px;
    font-size: 1.1rem;
}

.input-group {
    display: flex;
    flex-direction: column;
    gap: 20px;
}

#access-code {
    background: rgba(255,255,255,0.05);
    border: 1px solid var(--glass-border);
    padding: 20px;
    border-radius: 20px;
    color: white;
    font-size: 1.5rem;
    text-align: center;
    letter-spacing: 5px;
    outline: none;
    transition: var(--transition-lux);
}

#access-code:focus {
    background: rgba(255,255,255,0.1);
    border-color: var(--lux-gold);
    box-shadow: 0 0 20px var(--lux-gold-glow);
}

#login-btn {
    background: var(--lux-gold);
    color: var(--slate-900);
    border: none;
    padding: 20px;
    border-radius: 20px;
    font-size: 1.2rem;
    font-weight: 800;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 15px;
    transition: var(--transition-lux);
}

#login-btn:hover {
    transform: translateY(-5px);
    box-shadow: 0 10px 25px var(--lux-gold-glow);
}

.error-msg {
    color: #f87171 !important;
    margin-top: 20px;
    min-height: 24px;
    font-weight: 600;
}

.login-footer {
    margin-top: 40px;
    padding-top: 30px;
    border-top: 1px solid var(--glass-border);
    font-size: 0.9rem;
    color: #64748b;
}

@keyframes zoomIn {
    from { opacity: 0; transform: scale(0.8); }
    to { opacity: 1; transform: scale(1); }
}

/* --- Content Wrapper (Portal) --- */
.portal-wrapper {
    width: 100%;
    max-width: 1300px;
    padding: 60px 40px;
    z-index: 1;
}

/* Luxurious Header */
.main-portal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 80px;
    animation: fadeInDown 1s ease-out;
}

.profile-section {
    display: flex;
    align-items: center;
    gap: 25px;
}

.avatar-glow {
    width: 80px;
    height: 80px;
    background: linear-gradient(135deg, var(--lux-gold), #fbbf24);
    border-radius: 24px;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 0 30px var(--lux-gold-glow);
    position: relative;
    border: 2px solid rgba(255,255,255,0.2);
}

.avatar-emoji { font-size: 2.2rem; }

.greeting {
    font-size: 1rem;
    color: #94a3b8;
    text-transform: uppercase;
    letter-spacing: 2px;
    margin-bottom: 5px;
}

.student-name {
    font-size: 2.8rem;
    font-weight: 900;
    color: white;
    text-shadow: 0 5px 15px rgba(0,0,0,0.3);
}

.brand-badge {
    background: var(--glass);
    backdrop-filter: blur(10px);
    border: 1px solid var(--glass-border);
    padding: 12px 25px;
    border-radius: 100px;
    display: flex;
    align-items: center;
    gap: 12px;
}

.badge-text {
    font-weight: 700;
    color: var(--lux-gold);
    letter-spacing: 1px;
}

/* Intro Section */
.portal-intro {
    text-align: center;
    margin-bottom: 60px;
    animation: fadeIn 1.2s ease-out;
}

.section-title {
    font-size: 2rem;
    font-weight: 700;
    color: #e2e8f0;
    margin-bottom: 15px;
}

.title-underline {
    width: 80px;
    height: 4px;
    background: var(--lux-gold);
    margin: 0 auto;
    border-radius: 2px;
    box-shadow: 0 0 15px var(--lux-gold-glow);
}

/* Luxury Grid */
.lux-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 35px;
    perspective: 1000px;
}

.lux-card {
    text-decoration: none;
    color: white;
    background: var(--glass);
    backdrop-filter: blur(25px);
    -webkit-backdrop-filter: blur(25px);
    border: 1px solid var(--glass-border);
    border-radius: 40px;
    padding: 3px; /* For the gradient border effect */
    transition: var(--transition-lux);
    position: relative;
    overflow: hidden;
    animation: slideUp 1s ease-out forwards;
    opacity: 0;
}

.lux-card::before {
    content: '';
    position: absolute;
    top: 0; left: 0; right: 0; bottom: 0;
    background: radial-gradient(circle at top right, rgba(255,255,255,0.08), transparent);
    z-index: 0;
}

.lux-card:nth-child(1) { animation-delay: 0.1s; }
.lux-card:nth-child(2) { animation-delay: 0.2s; }
.lux-card:nth-child(3) { animation-delay: 0.3s; }
.lux-card:nth-child(4) { animation-delay: 0.4s; }

.lux-card-inner {
    padding: 50px 35px;
    border-radius: 38px;
    background: rgba(15, 23, 42, 0.8);
    height: 100%;
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    z-index: 1;
    position: relative;
    transition: var(--transition-lux);
}

.lux-card:hover {
    transform: translateY(-15px) rotateX(5deg);
    border-color: rgba(255,255,255,0.3);
}

.lux-card:hover .lux-card-inner {
    background: rgba(15, 23, 42, 0.4);
}

.lux-icon {
    width: 100px;
    height: 100px;
    border-radius: 30px;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 30px;
    box-shadow: 0 15px 35px rgba(0,0,0,0.3);
    transition: var(--transition-lux);
}

.lux-icon i {
    width: 48px;
    height: 48px;
    color: white;
}

.lux-card h3 {
    font-size: 1.7rem;
    font-weight: 800;
    margin-bottom: 15px;
    letter-spacing: -0.5px;
}

.lux-card p {
    color: #94a3b8;
    font-size: 1rem;
    line-height: 1.6;
    margin-bottom: 40px;
    min-height: 50px;
}

.lux-action {
    display: flex;
    align-items: center;
    gap: 12px;
    font-weight: 700;
    font-size: 0.95rem;
    color: white;
    opacity: 0.7;
    transition: var(--transition-lux);
    margin-top: auto;
}

.lux-action i {
    width: 18px;
    height: 18px;
    transition: var(--transition-lux);
}

.lux-card:hover .lux-action {
    opacity: 1;
    color: var(--lux-gold);
}

.lux-card:hover .lux-action i {
    transform: translateX(-8px);
}

/* Card Specific Luxury Themes */
.islamic-lux .lux-icon { background: var(--islamic-gradient); border: 2px solid #059669; }
.islamic-lux:hover { box-shadow: 0 25px 60px rgba(6, 78, 59, 0.4); }

.reading-lux .lux-icon { background: var(--reading-gradient); border: 2px solid #d97706; }
.reading-lux:hover { box-shadow: 0 25px 60px rgba(146, 64, 14, 0.4); }

.science-lux .lux-icon { background: var(--science-gradient); border: 2px solid #0d9488; }
.science-lux:hover { box-shadow: 0 25px 60px rgba(15, 118, 110, 0.4); }

.math-lux .lux-icon { background: var(--math-gradient); border: 2px solid #4f46e5; }
.math-lux:hover { box-shadow: 0 25px 60px rgba(55, 48, 163, 0.4); }

/* Footer */
.lux-footer {
    margin-top: 100px;
    text-align: center;
    padding-bottom: 40px;
}

.footer-line {
    width: 100px;
    height: 1px;
    background: linear-gradient(90deg, transparent, var(--glass-border), transparent);
    margin: 0 auto 30px;
}

.lux-footer p {
    font-size: 0.9rem;
    color: #64748b;
    letter-spacing: 1px;
}

/* Animations */
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }
@keyframes fadeInDown { from { opacity: 0; transform: translateY(-30px); } to { opacity: 1; transform: translateY(0); } }
@keyframes slideUp { from { opacity: 0; transform: translateY(50px); } to { opacity: 1; transform: translateY(0); } }

/* Responsive */
@media (max-width: 1024px) {
    .portal-wrapper { padding: 40px 20px; }
    .student-name { font-size: 2.2rem; }
}

@media (max-width: 768px) {
    .main-portal-header { flex-direction: column; gap: 30px; text-align: center; }
    .profile-section { flex-direction: column; }
    .lux-grid { grid-template-columns: 1fr; }
}
