:root {
    --primary: #e23636;
    --primary-dark: #8b0000;
    --primary-light: #ff6b6b;
    --secondary: #003366;
    --secondary-dark: #001f3f;
    --secondary-light: #336699;
    --accent: #00a8ff;
    --accent-glow: rgba(0, 168, 255, 0.6);
    --spidey-glow: rgba(226, 54, 54, 0.6);
    
    --bg-dark: #070f1c;
    --glass: rgba(15, 23, 42, 0.65);
    --glass-border: rgba(226, 54, 54, 0.35);
    
    --transition-lux: all 0.4s cubic-bezier(0.25, 0.46, 0.45, 0.94);
}

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

body {
    font-family: 'Outfit', 'Cairo', sans-serif;
    background-color: var(--bg-dark);
    background-image: radial-gradient(circle at 50% 0%, var(--secondary-dark), var(--bg-dark) 80%);
    color: #ffffff;
    min-height: 100vh;
    overflow-x: hidden;
    display: flex;
    justify-content: center;
    align-items: center;
}

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

/* Spider-Man Web Background */
.lab-background {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: -1;
    overflow: hidden;
    background-color: var(--bg-dark);
    background-image: 
        radial-gradient(circle at center, rgba(226, 54, 54, 0.1) 0%, transparent 60%),
        url('data:image/svg+xml;utf8,<svg width="200" height="200" xmlns="http://www.w3.org/2000/svg"><path d="M100 0 L100 200 M0 100 L200 100 M30 30 L170 170 M30 170 L170 30" stroke="rgba(255,255,255,0.02)" stroke-width="1"/><circle cx="100" cy="100" r="40" fill="none" stroke="rgba(255,255,255,0.02)"/><circle cx="100" cy="100" r="80" fill="none" stroke="rgba(255,255,255,0.02)"/></svg>');
    background-size: 200px 200px, 200px 200px;
    animation: pulseBg 10s ease-in-out infinite alternate;
}

@keyframes pulseBg {
    0% { opacity: 0.8; }
    100% { opacity: 1; }
}

/* Glassmorphism Login Overlay */
.login-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background: rgba(0, 0, 0, 0.85);
    backdrop-filter: blur(15px);
    -webkit-backdrop-filter: blur(15px);
    z-index: 99999;
    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: 24px;
    text-align: center;
    max-width: 500px;
    width: 90%;
    box-shadow: 0 30px 60px rgba(0,0,0,0.8), inset 0 0 0 1px rgba(255,255,255,0.1);
    animation: popIn 0.8s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    position: relative;
    overflow: hidden;
}

.login-box::before {
    content: '';
    position: absolute;
    top: -50%;
    left: -50%;
    width: 200%;
    height: 200%;
    background: radial-gradient(circle, rgba(226, 54, 54, 0.1) 0%, transparent 60%);
    pointer-events: none;
}

@keyframes popIn {
    from { opacity: 0; transform: scale(0.9) translateY(20px); }
    to { opacity: 1; transform: scale(1) translateY(0); }
}

.lock-icon {
    width: 120px;
    height: 120px;
    background: var(--secondary-dark);
    border: 4px solid var(--primary);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto 30px;
    box-shadow: 0 0 40px var(--spidey-glow);
    padding: 0;
    overflow: hidden;
    position: relative;
    z-index: 2;
}

.lock-icon::after {
    content: '';
    position: absolute;
    inset: -5px;
    border-radius: 50%;
    background: conic-gradient(from 0deg, transparent, var(--primary), transparent 40%);
    animation: spin 3s linear infinite;
    z-index: -1;
}

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

.lock-icon img { width: 100%; height: 100%; object-fit: cover; border-radius: 50%; z-index: 2; position: relative; }

.login-box h2 {
    font-size: 2.4rem;
    margin-bottom: 10px;
    color: #ffffff;
    font-weight: 900;
    text-shadow: 0 0 15px var(--spidey-glow);
}

.login-box h3 {
    text-shadow: 0 0 10px rgba(0,0,0,0.5);
}

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

.input-group {
    display: flex;
    flex-direction: column;
    gap: 20px;
    position: relative;
    z-index: 2;
}

#access-code {
    background: rgba(0, 0, 0, 0.6);
    border: 2px solid rgba(255,255,255,0.1);
    padding: 20px;
    border-radius: 16px;
    color: #ffffff;
    font-size: 1.6rem;
    text-align: center;
    letter-spacing: 6px;
    outline: none;
    transition: var(--transition-lux);
    font-weight: bold;
    font-family: monospace;
    box-shadow: inset 0 2px 10px rgba(0,0,0,0.5);
}

#access-code:focus {
    background: rgba(0, 0, 0, 0.8);
    border-color: var(--primary);
    box-shadow: 0 0 20px var(--spidey-glow), inset 0 2px 10px rgba(0,0,0,0.5);
}

#login-btn {
    background: linear-gradient(135deg, var(--primary), var(--primary-dark));
    color: #ffffff;
    border: none;
    padding: 20px;
    border-radius: 16px;
    font-size: 1.4rem;
    font-weight: 900;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 15px;
    transition: var(--transition-lux);
    box-shadow: 0 10px 25px rgba(226, 54, 54, 0.4);
    font-family: 'Cairo', sans-serif;
    text-transform: uppercase;
}

#login-btn:hover {
    transform: translateY(-3px);
    box-shadow: 0 15px 30px rgba(226, 54, 54, 0.6);
    background: linear-gradient(135deg, var(--primary-light), var(--primary));
}

#login-btn:active {
    transform: translateY(2px);
    box-shadow: 0 5px 15px rgba(226, 54, 54, 0.4);
}

.error-msg {
    color: #ff6b6b !important;
    margin-top: 20px;
    min-height: 24px;
    font-weight: 700;
    text-shadow: 0 0 10px rgba(255, 107, 107, 0.5);
}

.login-footer {
    margin-top: 40px;
    padding-top: 25px;
    border-top: 1px solid rgba(255,255,255,0.1);
    font-size: 0.95rem;
    color: #64748b;
    font-weight: 600;
}

/* --- 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: 30px;
}

.avatar-glow {
    width: 110px;
    height: 110px;
    background: var(--secondary-dark);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 0 30px var(--spidey-glow);
    position: relative;
    border: 4px solid var(--primary);
    padding: 0;
    overflow: hidden;
}

.avatar-glow img { width: 100%; height: 100%; object-fit: cover; border-radius: 50%; }

.greeting {
    font-size: 1.2rem;
    color: var(--primary-light);
    text-transform: uppercase;
    letter-spacing: 2px;
    margin-bottom: 5px;
    font-weight: 800;
}

.student-name {
    font-size: 3rem;
    font-weight: 900;
    color: #ffffff;
    text-shadow: 0 0 20px rgba(226, 54, 54, 0.8);
    background: linear-gradient(to left, #ffffff, var(--primary-light));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

.brand-badge {
    background: rgba(15, 23, 42, 0.8);
    border: 1px solid var(--glass-border);
    backdrop-filter: blur(10px);
    padding: 15px 30px;
    border-radius: 50px;
    display: flex;
    align-items: center;
    gap: 15px;
    box-shadow: 0 10px 25px rgba(0,0,0,0.5);
    transition: var(--transition-lux);
}

.brand-badge:hover {
    box-shadow: 0 15px 35px var(--spidey-glow);
    border-color: var(--primary);
}

.badge-text {
    font-weight: 800;
    color: #fff;
    letter-spacing: 1px;
    font-size: 1.1rem;
}

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

.section-title {
    font-size: 2.2rem;
    font-weight: 900;
    color: #ffffff;
    text-shadow: 0 0 15px var(--spidey-glow);
    margin-bottom: 20px;
}

.title-underline {
    width: 100px;
    height: 4px;
    background: linear-gradient(90deg, transparent, var(--primary), transparent);
    margin: 0 auto;
    border-radius: 2px;
    box-shadow: 0 0 15px var(--primary);
}

/* Luxury Grid */
.lux-grid {
    display: flex;
    justify-content: center;
    flex-wrap: wrap;
    gap: 40px;
    perspective: 1000px;
}

.lux-card {
    width: 100%;
    max-width: 450px;
    text-decoration: none;
    color: #ffffff;
    background: var(--glass);
    border: 1px solid rgba(255,255,255,0.1);
    backdrop-filter: blur(10px);
    border-radius: 24px;
    padding: 3rem 2.5rem;
    transition: var(--transition-lux);
    position: relative;
    box-shadow: 0 15px 35px rgba(0,0,0,0.4);
    display: flex;
    flex-direction: column;
    animation: slideUp 1s ease-out forwards;
    opacity: 0;
    overflow: hidden;
}

.lux-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 50%;
    height: 100%;
    background: linear-gradient(to right, transparent, rgba(255,255,255,0.1), transparent);
    transform: skewX(-20deg);
    transition: 0.5s;
}

.lux-card:hover::before {
    left: 150%;
}

.lux-card:nth-child(1) { animation-delay: 0.1s; }

.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(-15px);
    box-shadow: 0 25px 50px rgba(0,0,0,0.6), 0 0 40px var(--spidey-glow);
    border-color: var(--primary);
}

.lux-icon {
    width: 100px;
    height: 100px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--secondary-light), var(--secondary-dark));
    border: 3px solid var(--accent);
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 35px;
    box-shadow: 0 0 25px var(--accent-glow);
    transition: var(--transition-lux);
}

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

.lux-card:hover .lux-icon {
    transform: scale(1.1) rotate(10deg);
    box-shadow: 0 0 35px var(--spidey-glow);
    border-color: var(--primary);
    background: linear-gradient(135deg, var(--primary), var(--primary-dark));
}

.lux-card h3 {
    font-size: 1.8rem;
    font-weight: 900;
    margin-bottom: 15px;
    color: #ffffff;
    text-shadow: 0 0 10px rgba(0,0,0,0.8);
}

.lux-card p {
    color: #cbd5e1;
    font-size: 1.15rem;
    line-height: 1.7;
    margin-bottom: 40px;
    min-height: 50px;
    font-weight: 600;
}

.lux-action {
    display: flex;
    align-items: center;
    gap: 12px;
    font-weight: 900;
    font-size: 1.15rem;
    color: var(--primary-light);
    transition: var(--transition-lux);
    margin-top: auto;
}

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

.lux-card:hover .lux-action {
    color: #fff;
    text-shadow: 0 0 10px var(--primary-light);
}

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

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

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

.lux-footer p {
    font-size: 1.05rem;
    color: #94a3b8;
    letter-spacing: 1px;
    font-weight: 700;
}

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

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

@media (max-width: 768px) {
    .main-portal-header { flex-direction: column; gap: 40px; text-align: center; }
    .profile-section { flex-direction: column; }
    .student-name { font-size: 2.2rem; }
    .lux-grid { grid-template-columns: 1fr; }
    .login-box { padding: 40px 20px; }
}
