/* ==========================================================================
   🕷️ PURE MARVEL SPIDER-MAN THEME - DIRASATI PLATFORM - HASSAN (GRADE 3)
   ثيم سبايدرمان الخارق الجذري والاحترافي لمنصة البطل حسن - الصف الثالث
   ========================================================================== */

:root {
    /* Marvel Spider-Man Signature Palette */
    --spidey-red: #E2231A;
    --spidey-red-dark: #8F120B;
    --spidey-red-glow: rgba(226, 35, 26, 0.55);
    
    --spidey-blue: #0088FF;
    --spidey-blue-dark: #003D82;
    --spidey-blue-glow: rgba(0, 136, 255, 0.5);
    
    --spidey-cyan: #00E5FF;
    --spidey-cyan-glow: rgba(0, 229, 255, 0.45);
    
    --spidey-gold: #FFD700;
    --spidey-gold-glow: rgba(255, 215, 0, 0.55);

    /* Dark Comic Cosmic Environment */
    --spidey-bg: #12182D;
    --spidey-panel: rgba(26, 36, 68, 0.96);
    --spidey-card: rgba(30, 42, 78, 0.94);
    --spidey-card-hover: rgba(42, 58, 106, 0.98);
    --spidey-border: rgba(226, 35, 26, 0.35);

    --text-white: #FFFFFF;
    --text-muted: #CBD5E1;
    --text-dim: #94A3B8;

    --radius-sm: 10px;
    --radius-md: 16px;
    --radius-lg: 24px;
    --radius-xl: 30px;
    --transition: all 0.35s cubic-bezier(0.16, 1, 0.3, 1);
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    -webkit-tap-highlight-color: transparent;
    letter-spacing: normal !important;
}

body {
    font-family: 'Cairo', 'Tajawal', sans-serif;
    background-color: var(--spidey-bg);
    color: var(--text-white);
    line-height: 1.6;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    overflow-x: hidden;
    direction: rtl;
    position: relative;
}

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

/* =========================================
   Atmospheric Spider-Man World Background
   ========================================= */
.spidey-world-bg {
    position: fixed;
    inset: 0;
    width: 100%;
    height: 100%;
    background: 
        radial-gradient(circle at 10% 15%, rgba(226, 35, 26, 0.22), transparent 40%),
        radial-gradient(circle at 90% 85%, rgba(0, 136, 255, 0.2), transparent 45%),
        radial-gradient(circle at 50% 50%, rgba(255, 215, 0, 0.04), transparent 60%),
        linear-gradient(180deg, #060811 0%, #16203B 50%, #0E1426 100%);
    pointer-events: none;
    z-index: 0;
    overflow: hidden;
}

.spidey-sparkles {
    position: absolute;
    inset: 0;
    pointer-events: none;
}

.sparkle {
    position: absolute;
    font-size: 2.2rem;
    opacity: 0.2;
    filter: drop-shadow(0 0 10px rgba(226, 35, 26, 0.6));
    animation: floatSpideySparkle 7s ease-in-out infinite alternate;
}

.s1 { top: 10%; right: 8%; animation-delay: 0s; }
.s2 { top: 32%; left: 6%; animation-delay: 1.2s; font-size: 2.5rem; }
.s3 { top: 70%; right: 10%; animation-delay: 2.4s; }
.s4 { top: 85%; left: 12%; animation-delay: 3s; font-size: 2rem; }
.s5 { top: 20%; left: 45%; animation-delay: 4.2s; }
.s6 { top: 58%; right: 48%; animation-delay: 1.8s; font-size: 1.8rem; }
.s7 { top: 40%; right: 5%; animation-delay: 5s; }

@keyframes floatSpideySparkle {
    0% { transform: translateY(0) rotate(0deg); opacity: 0.15; }
    50% { transform: translateY(-20px) rotate(12deg); opacity: 0.3; }
    100% { transform: translateY(0) rotate(0deg); opacity: 0.15; }
}

.bg-web {
    position: absolute;
    width: 280px;
    height: 280px;
    opacity: 0.18;
    filter: drop-shadow(0 0 15px rgba(0, 136, 255, 0.4));
}

.web-top-left { top: -40px; left: -40px; }
.web-top-right { top: -40px; right: -40px; transform: scaleX(-1); }
.web-bottom-left { bottom: -40px; left: -40px; transform: scaleY(-1); }
.web-bottom-right { bottom: -40px; right: -40px; transform: scale(-1); }

/* =========================================
   Spider-Man Secret Vault Login Overlay
   ========================================= */
.spidey-login-overlay {
    position: fixed;
    inset: 0;
    width: 100%;
    height: 100%;
    background: radial-gradient(circle at center, rgba(10, 15, 30, 0.94) 0%, rgba(4, 6, 12, 0.98) 100%);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    z-index: 99999;
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 20px;
    transition: opacity 0.6s cubic-bezier(0.16, 1, 0.3, 1), transform 0.6s cubic-bezier(0.16, 1, 0.3, 1);
}

.spidey-login-overlay.hide {
    opacity: 0;
    transform: scale(1.06);
    pointer-events: none;
}

/* Hanging Spider */
.hanging-spider-thread {
    position: absolute;
    top: 0;
    left: 12%;
    display: flex;
    flex-direction: column;
    align-items: center;
    animation: swingSpiderThread 4.5s ease-in-out infinite alternate;
    transform-origin: top center;
    z-index: 10;
    pointer-events: none;
}

.web-line {
    width: 2px;
    height: 180px;
    background: linear-gradient(180deg, rgba(255, 255, 255, 0.6) 0%, rgba(0, 229, 255, 0.8) 100%);
    box-shadow: 0 0 8px rgba(0, 229, 255, 0.6);
}

.hanging-spider-img {
    width: 58px;
    height: 58px;
    object-fit: contain;
    filter: drop-shadow(0 6px 14px rgba(226, 35, 26, 0.8));
    transform: translateY(-8px);
}

@keyframes swingSpiderThread {
    0% { transform: rotate(8deg); }
    100% { transform: rotate(-8deg); }
}

/* The Vault Card */
.spidey-vault-card {
    position: relative;
    background: linear-gradient(165deg, rgba(18, 25, 48, 0.96) 0%, rgba(9, 13, 26, 0.98) 100%);
    border: 2px solid rgba(226, 35, 26, 0.5);
    border-radius: var(--radius-xl);
    width: 450px;
    max-width: 95vw;
    box-shadow: 
        0 0 50px rgba(226, 35, 26, 0.35),
        0 0 80px rgba(0, 136, 255, 0.25),
        0 25px 60px rgba(0, 0, 0, 0.9);
    overflow: hidden;
    z-index: 12;
    animation: vaultEntrance 0.7s cubic-bezier(0.16, 1, 0.3, 1) both;
}

@keyframes vaultEntrance {
    0% { transform: scale(0.9) translateY(40px); opacity: 0; }
    100% { transform: scale(1) translateY(0); opacity: 1; }
}

.vault-header {
    padding: 30px 24px 20px;
    text-align: center;
    background: radial-gradient(circle at 50% 0%, rgba(226, 35, 26, 0.28) 0%, transparent 75%);
    border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}

.hero-avatar-box {
    position: relative;
    width: 104px;
    height: 104px;
    margin: 0 auto 16px;
    display: flex;
    justify-content: center;
    align-items: center;
}

.hero-photo {
    width: 94px;
    height: 94px;
    border-radius: 50%;
    object-fit: cover;
    border: 3px solid var(--spidey-red);
    box-shadow: 0 0 24px var(--spidey-red-glow);
    z-index: 2;
    background: #16203B;
}

.spider-sense-ring {
    position: absolute;
    inset: -6px;
    border-radius: 50%;
    border: 2px dashed var(--spidey-cyan);
    animation: rotateWebRing 14s linear infinite;
    opacity: 0.8;
}

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

.hero-mask-pin {
    position: absolute;
    bottom: -6px;
    left: -4px;
    width: 38px;
    height: 38px;
    z-index: 4;
    filter: drop-shadow(0 0 10px rgba(226, 35, 26, 0.8));
    animation: maskBob 3s ease-in-out infinite alternate;
}

@keyframes maskBob {
    0% { transform: translateY(0) rotate(0deg); }
    100% { transform: translateY(-4px) rotate(-6deg); }
}

.vault-title {
    font-size: 1.45rem;
    font-weight: 900;
    color: #FFF;
    margin-bottom: 4px;
    text-shadow: 0 0 16px rgba(255, 255, 255, 0.4);
}

.vault-subtitle {
    font-size: 0.95rem;
    font-weight: 700;
    color: var(--spidey-gold);
    margin-bottom: 12px;
}

.hero-badge-pill {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    background: rgba(0, 136, 255, 0.15);
    border: 1px solid rgba(0, 136, 255, 0.4);
    padding: 5px 16px;
    border-radius: 20px;
    font-size: 0.78rem;
    font-weight: 800;
    color: var(--spidey-cyan);
}

.spidey-logo-icon {
    width: 18px;
    height: 18px;
    object-fit: contain;
}

/* Vault Body */
.vault-body {
    padding: 24px 28px 28px;
    text-align: center;
}

.welcome-text {
    font-size: 0.96rem;
    color: var(--text-muted);
    margin-bottom: 22px;
    line-height: 1.6;
}

.spidey-code-box {
    display: flex;
    align-items: center;
    background: rgba(7, 10, 20, 0.95);
    border: 2px solid rgba(0, 136, 255, 0.45);
    border-radius: var(--radius-md);
    padding: 4px 16px;
    margin-bottom: 20px;
    transition: var(--transition);
    box-shadow: inset 0 2px 10px rgba(0, 0, 0, 0.8);
}

.spidey-code-box:focus-within {
    border-color: var(--spidey-red);
    box-shadow: 0 0 25px var(--spidey-red-glow), inset 0 2px 10px rgba(0, 0, 0, 0.8);
}

.code-icon {
    font-size: 1.4rem;
    margin-left: 10px;
}

.spidey-code-box input {
    width: 100%;
    background: transparent;
    border: none;
    outline: none;
    color: #FFF;
    font-family: 'Cairo', sans-serif;
    font-size: 1.05rem;
    font-weight: 700;
    padding: 12px 6px;
    text-align: center;
}

.spidey-code-box input::placeholder {
    color: rgba(255, 255, 255, 0.35);
    font-weight: 600;
}

.spidey-launch-btn {
    position: relative;
    width: 100%;
    background: linear-gradient(135deg, var(--spidey-red) 0%, #B71C1C 50%, var(--spidey-blue-dark) 100%);
    border: 2px solid rgba(255, 255, 255, 0.25);
    border-radius: var(--radius-md);
    padding: 16px 24px;
    color: #FFF;
    font-family: 'Cairo', sans-serif;
    font-size: 1.05rem;
    font-weight: 900;
    cursor: pointer;
    overflow: hidden;
    transition: var(--transition);
    box-shadow: 0 6px 25px rgba(226, 35, 26, 0.5);
    outline: none;
}

.spidey-launch-btn:hover {
    transform: translateY(-2px) scale(1.02);
    box-shadow: 0 10px 35px rgba(226, 35, 26, 0.7);
    border-color: #FFF;
}

.spidey-launch-btn:active {
    transform: scale(0.98);
}

.btn-content {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 10px;
    position: relative;
    z-index: 2;
}

.spidey-error-text {
    color: #FF5252;
    font-size: 0.9rem;
    font-weight: 700;
    min-height: 24px;
    margin-top: 10px;
}

.vault-footer {
    border-top: 1px solid rgba(255, 255, 255, 0.08);
    padding-top: 16px;
    margin-top: 16px;
    font-size: 0.8rem;
    font-weight: 800;
    color: var(--text-dim);
}

/* =========================================
   Main Superhero Portal Layout
   ========================================= */
.portal-main-container {
    position: relative;
    z-index: 5;
    flex: 1;
    display: flex;
    flex-direction: column;
    min-height: 100vh;
}

/* Main Header */
.spidey-main-header {
    background: rgba(12, 18, 36, 0.82);
    border-bottom: 2px solid rgba(226, 35, 26, 0.4);
    box-shadow: 0 10px 35px rgba(0, 0, 0, 0.7);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    padding: 22px 40px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

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

.header-avatar-frame {
    position: relative;
    width: 82px;
    height: 82px;
}

.header-avatar-img {
    width: 82px;
    height: 82px;
    border-radius: 50%;
    object-fit: cover;
    border: 3px solid var(--spidey-red);
    box-shadow: 0 0 20px var(--spidey-red-glow);
    background: #080C16;
}

.avatar-web-ring {
    position: absolute;
    inset: -6px;
    border-radius: 50%;
    border: 2px solid var(--spidey-blue);
    animation: webRingPulsate 2.5s infinite alternate;
}

@keyframes webRingPulsate {
    0% { transform: scale(1); opacity: 0.6; }
    100% { transform: scale(1.08); opacity: 1; filter: drop-shadow(0 0 10px var(--spidey-blue)); }
}

.avatar-spider-icon {
    position: absolute;
    bottom: -6px;
    right: -4px;
    font-size: 1.2rem;
    background: #080C16;
    border-radius: 50%;
    padding: 2px;
    border: 1px solid var(--spidey-gold);
}

.header-name-box {
    display: flex;
    flex-direction: column;
}

.hero-level-tag {
    display: inline-block;
    align-self: flex-start;
    background: linear-gradient(135deg, rgba(255, 215, 0, 0.2), rgba(226, 35, 26, 0.2));
    border: 1px solid var(--spidey-gold);
    color: var(--spidey-gold);
    padding: 3px 14px;
    border-radius: 12px;
    font-size: 0.75rem;
    font-weight: 900;
    margin-bottom: 4px;
}

.header-student-name {
    font-size: 1.85rem;
    font-weight: 900;
    color: #FFF;
    text-shadow: 0 0 18px rgba(255, 255, 255, 0.4);
    line-height: 1.2;
}

.header-grade-name {
    font-size: 0.88rem;
    font-weight: 800;
    color: var(--spidey-cyan);
}

/* Spider-Man Game Button */
.spidey-game-button {
    display: inline-flex;
    align-items: center;
    gap: 12px;
    background: linear-gradient(135deg, var(--spidey-red) 0%, var(--spidey-blue-dark) 100%);
    border: 2px solid rgba(255, 255, 255, 0.3);
    border-radius: var(--radius-lg);
    padding: 14px 24px;
    color: #FFF;
    text-decoration: none;
    box-shadow: 0 6px 25px rgba(226, 35, 26, 0.45);
    transition: var(--transition);
}

.spidey-game-button:hover {
    transform: translateY(-3px) scale(1.03);
    box-shadow: 0 10px 35px rgba(226, 35, 26, 0.7);
    border-color: #FFF;
}

.spidey-lock-btn {
    background: rgba(226, 35, 26, 0.15);
    border: 1.5px solid rgba(226, 35, 26, 0.45);
    color: #FFF;
    padding: 12px 18px;
    border-radius: var(--radius-lg);
    cursor: pointer;
    font-family: 'Cairo', sans-serif;
    font-weight: 800;
    font-size: 0.88rem;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    transition: var(--transition);
}

.spidey-lock-btn:hover {
    background: var(--spidey-red);
    box-shadow: 0 0 20px var(--spidey-red-glow);
    transform: translateY(-2px);
}

.game-btn-icon {
    font-size: 1.8rem;
}

.game-btn-text {
    display: flex;
    flex-direction: column;
    text-align: right;
}

.game-btn-main {
    font-size: 1rem;
    font-weight: 900;
}

.game-btn-sub {
    font-size: 0.72rem;
    font-weight: 700;
    color: var(--spidey-gold);
}

/* =========================================
   3D Subject Cards Section
   ========================================= */
.spidey-cards-section {
    max-width: 1320px;
    margin: 0 auto;
    width: 100%;
    padding: 40px 24px;
    flex: 1;
}

.section-intro {
    text-align: center;
    margin-bottom: 36px;
}

.section-intro-title {
    font-size: 1.7rem;
    font-weight: 900;
    color: #FFF;
    margin-bottom: 8px;
}

.section-spider-divider {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 14px;
}

.section-spider-divider span {
    width: 80px;
    height: 2px;
    background: linear-gradient(90deg, transparent, var(--spidey-red), transparent);
}

.divider-spider {
    width: 28px;
    height: 28px;
    object-fit: contain;
}

/* Cards Grid */
.spidey-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(340px, 1fr));
    gap: 32px;
}

.spidey-grid.single-card-grid {
    display: flex !important;
    justify-content: center !important;
    max-width: 580px !important;
    margin: 0 auto !important;
    width: 100% !important;
}

.spidey-grid.single-card-grid .spidey-card {
    width: 100% !important;
}

/* Single 3D Card */
.spidey-card {
    position: relative;
    background: linear-gradient(165deg, rgba(20, 28, 54, 0.88) 0%, rgba(10, 15, 32, 0.98) 100%);
    border: 2px solid rgba(255, 255, 255, 0.12);
    border-radius: var(--radius-xl);
    padding: 30px 26px 26px;
    text-decoration: none;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    transition: var(--transition);
    box-shadow: 0 16px 45px rgba(0, 0, 0, 0.65);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
}

.card-reading {
    border-color: rgba(226, 35, 26, 0.45);
}

.card-reading:hover {
    border-color: var(--spidey-red);
    box-shadow: 0 20px 55px rgba(226, 35, 26, 0.45), 0 0 30px var(--spidey-red-glow);
    transform: translateY(-10px);
}

.card-english {
    border-color: rgba(0, 136, 255, 0.45);
}

.card-english:hover {
    border-color: var(--spidey-blue);
    box-shadow: 0 20px 55px rgba(0, 136, 255, 0.45), 0 0 30px var(--spidey-blue-glow);
    transform: translateY(-10px);
}

.card-math {
    border-color: rgba(255, 215, 0, 0.45);
}

.card-math:hover {
    border-color: var(--spidey-gold);
    box-shadow: 0 20px 55px rgba(255, 215, 0, 0.45), 0 0 30px var(--spidey-gold-glow);
    transform: translateY(-10px);
}

/* 3D Visual Box */
.card-3d-visual {
    position: relative;
    width: 100%;
    height: 200px;
    display: flex;
    justify-content: center;
    align-items: center;
    margin-bottom: 20px;
}

.visual-img {
    max-width: 90%;
    max-height: 190px;
    object-fit: contain;
    transition: transform 0.45s cubic-bezier(0.16, 1, 0.3, 1);
    z-index: 2;
}

.hero-swing-img {
    max-height: 200px;
    filter: drop-shadow(0 15px 30px rgba(226, 35, 26, 0.55));
}

.gadget-shoot-img {
    max-height: 180px;
    filter: drop-shadow(0 15px 30px rgba(0, 136, 255, 0.6));
}

.spider-cyber-img {
    max-height: 180px;
    filter: drop-shadow(0 15px 30px rgba(255, 215, 0, 0.55));
}

.spidey-card:hover .visual-img {
    transform: scale(1.14) translateY(-8px);
}

.visual-shadow {
    position: absolute;
    bottom: 8px;
    width: 75%;
    height: 18px;
    border-radius: 50%;
    background: radial-gradient(ellipse at center, rgba(0, 0, 0, 0.7) 0%, transparent 75%);
    filter: blur(8px);
    z-index: 1;
}

/* Card Content */
.card-content {
    display: flex;
    flex-direction: column;
    flex: 1;
}

.card-badge {
    display: inline-block;
    align-self: flex-start;
    padding: 5px 14px;
    border-radius: 12px;
    font-size: 0.78rem;
    font-weight: 800;
    margin-bottom: 12px;
}

.red-badge {
    background: rgba(226, 35, 26, 0.2);
    border: 1px solid rgba(226, 35, 26, 0.55);
    color: #FF5252;
}

.blue-badge {
    background: rgba(0, 136, 255, 0.2);
    border: 1px solid rgba(0, 136, 255, 0.55);
    color: var(--spidey-cyan);
}

.gold-badge {
    background: rgba(255, 215, 0, 0.2);
    border: 1px solid rgba(255, 215, 0, 0.55);
    color: var(--spidey-gold);
}

.subject-title {
    font-size: 1.5rem;
    font-weight: 900;
    color: #FFF;
    margin-bottom: 8px;
}

.subject-desc {
    font-size: 0.94rem;
    color: var(--text-muted);
    line-height: 1.6;
    margin-bottom: 20px;
    flex-grow: 1;
}

.subject-features {
    display: flex;
    gap: 8px;
    margin-bottom: 24px;
    flex-wrap: wrap;
}

.feature-tag {
    background: rgba(255, 255, 255, 0.06);
    border: 1px solid rgba(255, 255, 255, 0.12);
    color: #FFF;
    padding: 4px 12px;
    border-radius: 10px;
    font-size: 0.76rem;
    font-weight: 800;
}

/* Action Button */
.card-action-btn {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 15px 22px;
    border-radius: var(--radius-md);
    font-weight: 900;
    font-size: 1rem;
    color: #FFF;
    transition: var(--transition);
}

.red-btn {
    background: linear-gradient(135deg, var(--spidey-red), #921712);
    box-shadow: 0 4px 20px rgba(226, 35, 26, 0.45);
}

.blue-btn {
    background: linear-gradient(135deg, var(--spidey-blue), #0050A0);
    box-shadow: 0 4px 20px rgba(0, 136, 255, 0.45);
}

.gold-btn {
    background: linear-gradient(135deg, #FFB300, #E65100);
    box-shadow: 0 4px 20px rgba(255, 179, 0, 0.45);
}

.spidey-card:hover .card-action-btn {
    transform: scale(1.02);
    filter: brightness(1.15);
}

/* =========================================
   Footer
   ========================================= */
.spidey-footer {
    text-align: center;
    padding: 26px 20px;
    border-top: 1px solid rgba(255, 255, 255, 0.08);
}

.spidey-footer-link {
    color: var(--text-dim);
    text-decoration: none;
    font-weight: 800;
    font-size: 0.88rem;
    transition: color 0.2s;
}

.spidey-footer-link:hover {
    color: var(--spidey-cyan);
}

/* =========================================
   Responsive Design
   ========================================= */
@media (max-width: 900px) {
    .spidey-main-header {
        flex-direction: column;
        gap: 18px;
        padding: 20px;
        text-align: center;
    }
    .header-profile-section {
        flex-direction: column;
    }
    .hero-level-tag {
        align-self: center;
    }
}

@media (max-width: 640px) {
    .header-student-name {
        font-size: 1.5rem;
    }
    .spidey-grid {
        grid-template-columns: 1fr;
    }
    .spidey-vault-card {
        width: 100%;
    }
    .hanging-spider-thread {
        display: none;
    }
}
