/* ==========================================================================
   ⚡ SUPER SONIC THEME - DIRASATI PLATFORM PORTAL - AYOUB (GRADE 3) 🦔
   ========================================================================== */

:root {
    /* Super Sonic Palette */
    --sonic-gold: #FFE600;
    --sonic-gold-bright: #FFF585;
    --sonic-gold-deep: #D4A000;
    --sonic-gold-glow: rgba(255, 230, 0, 0.45);

    --sonic-blue-royal: #0051FF;
    --sonic-blue-electric: #00C8FF;
    --sonic-blue-glow: rgba(0, 200, 255, 0.45);

    --chaos-green: #00E676;
    --shadow-red: #FF1744;
    --tails-orange: #FF9100;

    /* Backgrounds & Cards */
    --bg-main: #060A18;
    --bg-card: #121A33;
    --bg-card-hover: #182345;
    --border-card: 1.5px solid rgba(0, 200, 255, 0.25);
    --border-card-hover: 1.5px solid #FFE600;

    /* Text */
    --text-main: #FFFFFF;
    --text-white: #FFFFFF;
    --text-muted: #9BB0D6;
    --text-dim: #6B7EA5;

    /* Compatibility mapping */
    --roblox-red: #FF1744;
    --roblox-blue: #00C8FF;
    --roblox-green: #00E676;
    --roblox-gold: #FFE600;
    --roblox-border: rgba(0, 200, 255, 0.25);

    --border-radius: 16px;
    --radius-xl: 24px;
    --radius-lg: 18px;
    --transition-speed: 0.25s;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    -webkit-tap-highlight-color: transparent;
}

body.supersonic-theme, body.roblox-theme {
    font-family: 'Cairo', 'Changa', 'Tajawal', sans-serif;
    background: radial-gradient(circle at 50% 10%, #14224A 0%, #091026 45%, #040714 100%);
    background-attachment: fixed;
    color: var(--text-main);
    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;
}

/* =========================================
   Floating Sonic Rings & Gems Background
   ========================================= */
.sonic-floating-bg, .roblox-floating-bg {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 0;
    overflow: hidden;
}

.s-particle, .r-blox {
    position: absolute;
    font-size: 2.2rem;
    opacity: 0.28;
    filter: drop-shadow(0 0 12px rgba(255, 230, 0, 0.5));
    animation: floatSonicParticle 7s ease-in-out infinite alternate;
}

.sp-1, .blox-1 { top: 12%; right: 7%; animation-delay: 0s; font-size: 2.6rem; }
.sp-2, .blox-2 { top: 32%; left: 7%; animation-delay: 1.5s; font-size: 2.8rem; }
.sp-3, .blox-3 { top: 74%; right: 10%; animation-delay: 3s; font-size: 2.4rem; }
.sp-4, .blox-4 { top: 52%; right: 5%; animation-delay: 2s; }
.sp-5, .blox-5 { top: 20%; left: 16%; animation-delay: 4s; font-size: 2.0rem; }
.sp-6, .blox-6 { top: 82%; left: 12%; animation-delay: 2.5s; font-size: 2.5rem; }
.sp-7, .blox-7 { top: 65%; left: 46%; animation-delay: 5s; }
.sp-8, .blox-8 { top: 8%; left: 38%; animation-delay: 3.5s; font-size: 2.7rem; }

@keyframes floatSonicParticle {
    0% { transform: translateY(0) rotate(0deg) scale(1); }
    50% { transform: translateY(-24px) rotate(18deg) scale(1.08); }
    100% { transform: translateY(10px) rotate(-14deg) scale(0.96); }
}

/* =========================================
   Login Overlay (Super Sonic HUD Console)
   ========================================= */
.login-overlay {
    position: fixed;
    top: 0; 
    left: 0; 
    width: 100vw; 
    height: 100vh;
    background: rgba(4, 7, 20, 0.90);
    backdrop-filter: blur(14px);
    -webkit-backdrop-filter: blur(14px);
    z-index: 99999;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 1.2rem;
    transition: opacity 0.4s ease, visibility 0.4s ease;
}

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

.sonic-login-card, .roblox-login-card {
    background: linear-gradient(160deg, #121A33 0%, #080E20 100%);
    border-radius: 26px;
    border: 2px solid rgba(0, 200, 255, 0.35);
    border-top: 5px solid var(--sonic-gold);
    max-width: 470px;
    width: 100%;
    box-shadow: 
        0 25px 65px rgba(0, 0, 0, 0.85),
        0 0 35px var(--sonic-blue-glow),
        0 0 15px var(--sonic-gold-glow);
    animation: sonicCardPop 0.4s cubic-bezier(0.34, 1.56, 0.64, 1);
    overflow: hidden;
    position: relative;
    text-align: center;
}

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

.sonic-card-header, .roblox-card-header {
    background: linear-gradient(180deg, #182345 0%, #121A33 100%);
    padding: 26px 20px 18px;
    position: relative;
    border-bottom: 2px solid rgba(0, 200, 255, 0.2);
}

.sonic-avatar-outer, .roblox-avatar-outer {
    width: 100px;
    height: 100px;
    border-radius: 50%;
    background: #080D1F;
    border: 3.5px solid var(--sonic-gold);
    box-shadow: 0 0 25px rgba(255, 230, 0, 0.6), inset 0 2px 8px rgba(0,0,0,0.8);
    margin: 0 auto 12px;
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
}

.sonic-avatar-outer img, .roblox-avatar-outer img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    border-radius: 50%;
    display: block;
}

.sonic-super-pill, .gamer-pro-pill {
    position: absolute;
    bottom: -8px;
    background: linear-gradient(135deg, var(--sonic-gold), var(--tails-orange));
    color: #121A33;
    font-size: 0.72rem;
    font-weight: 900;
    padding: 2px 12px;
    border-radius: 10px;
    border: 1.5px solid #FFFFFF;
    font-family: 'Changa', sans-serif;
    letter-spacing: 0.5px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.6), 0 0 10px rgba(255, 230, 0, 0.6);
}

.sonic-card-header h2, .roblox-card-header h2 {
    font-family: 'Changa', sans-serif;
    font-size: 1.7rem;
    color: #FFFFFF;
    font-weight: 800;
    margin: 0 0 6px 0;
    text-shadow: 0 0 18px rgba(0, 200, 255, 0.7);
}

.sonic-login-tag, .roblox-login-tag {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    background: rgba(0, 200, 255, 0.12);
    color: #00C8FF;
    font-family: 'Changa', sans-serif;
    font-weight: 800;
    font-size: 0.85rem;
    padding: 4px 16px;
    border-radius: 20px;
    border: 1px solid rgba(0, 200, 255, 0.4);
    box-shadow: 0 0 12px rgba(0, 200, 255, 0.25);
}

.sonic-card-body, .roblox-card-body {
    padding: 24px 26px 22px;
}

.sonic-card-body p, .roblox-card-body p {
    color: var(--text-muted);
    font-size: 1.05rem;
    margin-bottom: 20px;
    font-weight: 700;
    font-family: 'Cairo', 'Tajawal', sans-serif;
    line-height: 1.5;
}

.sonic-input-wrap, .roblox-input-wrap {
    margin-bottom: 18px;
}

#access-code {
    width: 100%;
    background: #080E22;
    border: 2px solid rgba(0, 200, 255, 0.35);
    padding: 14px 18px;
    border-radius: 16px;
    color: #FFFFFF;
    font-size: 1.8rem;
    text-align: center;
    letter-spacing: 6px;
    font-family: 'Changa', monospace;
    font-weight: 800;
    outline: none;
    transition: all 0.25s ease;
    box-shadow: inset 0 2px 10px rgba(0, 0, 0, 0.8);
}

#access-code:focus {
    background: #0C1530;
    border-color: var(--sonic-gold);
    box-shadow: 0 0 25px rgba(255, 230, 0, 0.5), inset 0 2px 8px rgba(0,0,0,0.8);
}

#access-code::placeholder {
    color: #556B96;
    font-size: 1.05rem;
    letter-spacing: normal;
    font-family: 'Cairo', sans-serif;
    font-weight: 600;
}

/* 3D Super Sonic Login Button */
.sonic-login-btn, .roblox-login-btn {
    width: 100%;
    background: linear-gradient(135deg, var(--sonic-blue-royal) 0%, var(--sonic-blue-electric) 100%);
    color: #FFFFFF;
    border: 2px solid rgba(255, 255, 255, 0.35);
    padding: 14px 22px;
    border-radius: 16px;
    font-size: 1.25rem;
    font-weight: 900;
    font-family: 'Changa', sans-serif;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    box-shadow: 0 5px 0 #0033AA, 0 8px 25px rgba(0, 81, 255, 0.5);
    transition: all 0.22s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

.sonic-login-btn:hover, .roblox-login-btn:hover {
    transform: translateY(-3px);
    background: linear-gradient(135deg, var(--sonic-gold) 0%, var(--tails-orange) 100%);
    color: #060A18;
    box-shadow: 0 7px 0 #B87A00, 0 10px 30px rgba(255, 230, 0, 0.6);
    border-color: #FFFFFF;
}

.sonic-login-btn:active, .roblox-login-btn:active {
    transform: translateY(3px);
    box-shadow: 0 1px 0 #0033AA;
}

.error-msg {
    color: #FF4757;
    font-size: 0.95rem;
    font-weight: 800;
    margin-top: 12px;
    min-height: 1.4em;
    font-family: 'Cairo', sans-serif;
    text-shadow: 0 0 10px rgba(255, 71, 87, 0.4);
}

.sonic-login-footer, .roblox-login-footer {
    margin-top: 14px;
    padding-top: 12px;
    border-top: 1px solid rgba(255, 255, 255, 0.08);
    color: var(--text-dim);
    font-size: 0.82rem;
    font-weight: 700;
    font-family: 'Changa', sans-serif;
}

/* Expired Subscription Box */
.expired-alert-box {
    background: #121A33;
    border: 2px solid var(--sonic-gold);
    border-radius: 18px;
    padding: 1.5rem;
    text-align: center;
}

.expired-icon {
    font-size: 3rem;
    margin-bottom: 0.5rem;
}

.expired-alert-box h3 {
    color: var(--sonic-gold);
    font-family: 'Changa', sans-serif;
    font-size: 1.4rem;
    margin-bottom: 0.5rem;
}

.expired-alert-box p {
    color: var(--text-muted);
    font-size: 0.95rem;
    margin-bottom: 1.2rem;
}

.contact-us-btn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    background: linear-gradient(135deg, var(--sonic-blue-royal), var(--sonic-blue-electric));
    color: #FFF;
    text-decoration: none;
    padding: 0.75rem 1.8rem;
    border-radius: 14px;
    font-weight: 800;
    font-family: 'Changa', sans-serif;
    transition: 0.2s;
    box-shadow: 0 4px 0 #0033AA;
}

.contact-us-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 0 #0033AA, 0 0 20px rgba(0, 200, 255, 0.6);
}

/* =========================================
   Portal Header (Student Profile)
   ========================================= */
.sonic-portal-header, .roblox-portal-header {
    padding: 2.2rem 1rem 0.8rem;
    display: flex;
    justify-content: center;
    align-items: center;
    position: relative;
    z-index: 2;
}

.portal-profile-wrap {
    display: flex;
    align-items: center;
    gap: 1.2rem;
    background: rgba(18, 26, 51, 0.92);
    border: 2px solid rgba(0, 200, 255, 0.35);
    border-radius: 24px;
    padding: 0.9rem 2rem 0.9rem 1.4rem;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.65), 0 0 25px rgba(0, 81, 255, 0.3);
    backdrop-filter: blur(10px);
}

.portal-avatar-box {
    width: 68px;
    height: 68px;
    border-radius: 50%;
    position: relative;
    background: #080D1F;
    border: 3px solid var(--sonic-gold);
    box-shadow: 0 0 20px rgba(255, 230, 0, 0.5);
    display: flex;
    align-items: center;
    justify-content: center;
}

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

.portal-profile-text {
    display: flex;
    flex-direction: column;
    text-align: right;
}

.portal-student-name {
    font-size: 1.65rem;
    font-weight: 900;
    color: #FFFFFF;
    font-family: 'Changa', sans-serif;
    margin: 0;
    line-height: 1.2;
    text-shadow: 0 0 15px rgba(0, 200, 255, 0.6);
}

.portal-grade-badge {
    font-size: 0.9rem;
    font-weight: 800;
    color: var(--sonic-gold);
    font-family: 'Changa', sans-serif;
    text-shadow: 0 0 10px rgba(255, 230, 0, 0.4);
}

/* =========================================
   Portal Main Content & Educational Platforms Grid
   ========================================= */
.portal-main-wrap {
    max-width: 1200px;
    width: 94%;
    margin: 1.5rem auto 3rem auto;
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    position: relative;
    z-index: 1;
}

.roblox-cards-grid {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 1.8rem;
    width: 100%;
    margin: 1.5rem 0;
}

.roblox-subject-card {
    background: linear-gradient(160deg, #121A33 0%, #090F24 100%);
    border: 2px solid rgba(0, 200, 255, 0.25);
    border-radius: 24px;
    padding: 2.2rem 1.6rem;
    text-decoration: none;
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    box-shadow: 0 8px 0 #050814, 0 12px 30px rgba(0, 0, 0, 0.5);
    transition: all 0.28s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    position: relative;
    overflow: hidden;
    min-height: 380px;
    max-width: 380px;
    width: 100%;
}

.roblox-subject-card:hover {
    transform: translateY(-8px);
    background: linear-gradient(160deg, #182345 0%, #0F1836 100%);
    border-color: var(--sonic-gold);
    box-shadow: 0 14px 0 #050814, 0 0 35px rgba(255, 230, 0, 0.4);
}

.roblox-subject-card:active {
    transform: translateY(2px);
    box-shadow: 0 2px 0 #050814;
}

/* Specific Card Themes */
.card-reading-theme { border-top: 5px solid var(--sonic-gold); }
.card-english-theme { border-top: 5px solid var(--sonic-blue-electric); }
.card-math-theme { border-top: 5px solid var(--chaos-green); }
.card-game-theme { border-top: 5px solid #FF9900; }

.card-header-pill {
    margin-bottom: 1rem;
}

.lesson-status-pill {
    font-size: 0.8rem;
    font-weight: 800;
    padding: 4px 14px;
    border-radius: 12px;
    font-family: 'Changa', sans-serif;
    background: rgba(255, 255, 255, 0.08);
    color: #FFF;
    border: 1px solid rgba(0, 200, 255, 0.3);
}

.special-game-pill {
    background: rgba(255, 153, 0, 0.2) !important;
    color: #FFB74D !important;
    border-color: rgba(255, 153, 0, 0.5) !important;
}

.card-stage-bubble {
    width: 88px;
    height: 88px;
    border-radius: 24px;
    background: #080D1F;
    border: 2px solid rgba(0, 200, 255, 0.3);
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 1.2rem;
    box-shadow: inset 0 2px 8px rgba(0,0,0,0.6), 0 0 20px rgba(0, 81, 255, 0.2);
    transition: transform 0.3s ease;
}

.card-stage-bubble i {
    width: 44px;
    height: 44px;
    stroke-width: 2.2;
}

.card-reading-theme .card-stage-bubble { color: var(--sonic-gold); }
.card-english-theme .card-stage-bubble { color: var(--sonic-blue-electric); }
.card-math-theme .card-stage-bubble { color: var(--chaos-green); }
.card-game-theme .card-stage-bubble { color: #FF9900; }

.roblox-subject-card:hover .card-stage-bubble {
    transform: scale(1.1) rotate(6deg);
}

.card-title {
    font-size: 1.4rem;
    font-weight: 800;
    color: #FFFFFF;
    font-family: 'Changa', sans-serif;
    margin-bottom: 0.6rem;
}

.card-desc {
    font-size: 0.92rem;
    color: var(--text-muted);
    line-height: 1.5;
    margin-bottom: 1.5rem;
    flex-grow: 1;
}

.roblox-card-btn {
    width: 100%;
    padding: 0.75rem 1rem;
    background: #0A1024;
    border: 1.5px solid rgba(0, 200, 255, 0.3);
    color: #FFFFFF;
    border-radius: 14px;
    font-weight: 800;
    font-family: 'Changa', sans-serif;
    font-size: 1rem;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    box-shadow: 0 4px 0 #040714;
    transition: all 0.2s ease;
}

.roblox-subject-card:hover .roblox-card-btn {
    background: linear-gradient(135deg, var(--sonic-gold) 0%, var(--tails-orange) 100%);
    color: #060A18;
    box-shadow: 0 4px 0 #B87A00, 0 0 20px rgba(255, 230, 0, 0.5);
    border-color: #FFFFFF;
}

/* =========================================
   Footer
   ========================================= */
.app-footer.roblox-footer {
    text-align: center;
    padding: 2.5rem 1rem 2rem 1rem;
    margin-top: auto;
    width: 100%;
    position: relative;
    z-index: 2;
}

.footer-link {
    color: var(--text-muted);
    text-decoration: none;
    font-family: 'Cairo', 'Changa', sans-serif;
    font-size: 1.05rem;
    font-weight: 700;
    padding: 8px 24px;
    border-radius: 20px;
    background: rgba(255, 255, 255, 0.04);
    border: 1px solid rgba(0, 200, 255, 0.25);
    transition: all 0.25s ease;
    display: inline-block;
}

.footer-link:hover {
    color: var(--sonic-gold);
    background: rgba(255, 230, 0, 0.1);
    border-color: var(--sonic-gold);
    transform: translateY(-2px);
    box-shadow: 0 4px 18px rgba(255, 230, 0, 0.35);
}

/* =========================================
   Responsive Adjustments
   ========================================= */
@media (max-width: 992px) {
    .roblox-cards-grid {
        grid-template-columns: 1fr;
        max-width: 420px;
        gap: 1.5rem;
    }
    .portal-profile-wrap {
        padding: 0.8rem 1.4rem;
        gap: 0.9rem;
    }
    .portal-student-name {
        font-size: 1.4rem;
    }
}
