:root {
    --primary: #6C5CE7;
    --primary-light: #A29BFE;
    --secondary: #00CEC9;
    --accent: #FFD700;
    --accent-glow: rgba(255, 215, 0, 0.4);
    
    --islamic-gradient: linear-gradient(135deg, #065f46, #064e3b);
    --reading-gradient: linear-gradient(135deg, #b45309, #92400e);
    --science-gradient: linear-gradient(135deg, #6C5CE7, #4A2511);
    --math-gradient: linear-gradient(135deg, #4f46e5, #3730a3);
    
    --bg-dark: #1A1A2E;
    --bg-card: linear-gradient(145deg, #2D1500, #4A2511);
    --wood-border: #D2B48C;
    
    --glass: rgba(255, 255, 255, 0.05);
    --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(--bg-dark);
    background-image: 
        radial-gradient(circle at 15% 50%, rgba(108, 92, 231, 0.15), transparent 25%),
        radial-gradient(circle at 85% 30%, rgba(253, 121, 168, 0.15), transparent 25%),
        radial-gradient(circle at 50% 80%, rgba(0, 206, 201, 0.1), transparent 20%);
    color: #E8E4D9;
    min-height: 100vh;
    overflow-x: hidden;
    display: flex;
    justify-content: center;
    align-items: center;
}

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

/* Magical Background */
.magical-background {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: -1;
    overflow: hidden;
}

.star {
    position: absolute;
    background: #FFF;
    border-radius: 50%;
    box-shadow: 0 0 10px #FFF, 0 0 20px var(--accent);
    animation: twinkle 4s infinite alternate;
}

.star-1 { width: 4px; height: 4px; top: 20%; left: 10%; animation-delay: 0s; }
.star-2 { width: 6px; height: 6px; top: 50%; left: 80%; animation-delay: 1s; }
.star-3 { width: 3px; height: 3px; top: 80%; left: 30%; animation-delay: 2s; }
.star-4 { width: 5px; height: 5px; top: 15%; right: 20%; animation-delay: 0.5s; }

@keyframes twinkle {
    0% { opacity: 0.2; transform: scale(0.8); }
    100% { opacity: 1; transform: scale(1.2); }
}

/* Login Overlay Styles - FIXED TO COVER FULL SCREEN */
.login-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background: rgba(26, 26, 46, 0.95);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    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(--bg-card);
    border: 5px solid var(--accent);
    padding: 60px 40px;
    border-radius: 30px;
    text-align: center;
    max-width: 500px;
    width: 90%;
    box-shadow: 0 15px 40px rgba(0,0,0,0.6), inset 0 0 20px rgba(255,215,0,0.1);
    animation: zoomIn 0.6s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

.lock-icon {
    width: 80px;
    height: 80px;
    background: var(--primary);
    border: 3px solid var(--accent);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto 30px;
    box-shadow: 0 0 20px var(--accent-glow);
}

.lock-icon i { width: 40px; height: 40px; color: #FFF; }

.login-box h2 {
    font-size: 2.2rem;
    margin-bottom: 15px;
    color: var(--accent);
    text-shadow: 0 0 5px rgba(255,215,0,0.5);
}

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

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

#access-code {
    background: rgba(0,0,0,0.4);
    border: 2px solid var(--wood-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(0,0,0,0.6);
    border-color: var(--accent);
    box-shadow: 0 0 20px var(--accent-glow);
}

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

#login-btn:hover {
    transform: translateY(-5px) scale(1.02);
    box-shadow: 0 10px 25px var(--accent-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: white;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 0 30px var(--accent-glow);
    position: relative;
    border: 4px solid var(--accent);
}

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

.greeting {
    font-size: 1rem;
    color: var(--secondary);
    text-transform: uppercase;
    letter-spacing: 2px;
    margin-bottom: 5px;
}

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

.brand-badge {
    background: rgba(255,255,255,0.1);
    backdrop-filter: blur(10px);
    border: 2px solid var(--accent);
    padding: 12px 25px;
    border-radius: 100px;
    display: flex;
    align-items: center;
    gap: 12px;
}

.badge-text {
    font-weight: 700;
    color: var(--accent);
    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: #E8E4D9;
    margin-bottom: 15px;
}

.title-underline {
    width: 80px;
    height: 4px;
    background: var(--accent);
    margin: 0 auto;
    border-radius: 2px;
    box-shadow: 0 0 15px var(--accent-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(--bg-card);
    border-radius: 10px 30px 30px 10px;
    padding: 2rem;
    transition: var(--transition-lux);
    position: relative;
    border: none;
    border-right: 15px solid var(--wood-border);
    border-left: 8px solid #1A0D00;
    box-shadow: -5px 10px 20px rgba(0, 0, 0, 0.5), inset 0 0 10px rgba(255,215,0,0.1);
    display: flex;
    flex-direction: column;
    animation: slideUp 1s ease-out forwards;
    opacity: 0;
}

.lux-card::before {
    display: none;
}
.lux-card::after { 
    content: ''; 
    position: absolute; 
    bottom: -15px; 
    left: -15px; 
    right: -25px; 
    height: 15px; 
    background: linear-gradient(to right, #3E2723, #5D4037); 
    border-radius: 5px; 
    box-shadow: 0 8px 15px rgba(0,0,0,0.6); 
    z-index: -1; 
}

.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 {
    height: 100%;
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    z-index: 1;
    position: relative;
}

.lux-card:hover {
    transform: translateY(-10px) scale(1.02);
    box-shadow: -5px 15px 30px rgba(255, 215, 0, 0.3), inset 0 0 15px rgba(255,215,0,0.3);
    border-right-color: var(--accent);
}

.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; }
}
