@import url('https://fonts.googleapis.com/css2?family=Outfit:wght@300;400;600;800&family=Tajawal:wght@400;500;700&display=swap');

:root {
    /* Space Commander UI */
    --cosmic-black: #050505;
    --electric-blue: #007BFF;
    --electric-blue-glow: rgba(0, 123, 255, 0.5);
    --safety-orange: #FF6600;
    --chrome-silver: #C0C0C0;
    --chrome-dark: #808080;
    --pure-white: #FFFFFF;
    --cockpit-bg: rgba(5, 5, 5, 0.85);
    
    --bg-color: var(--cosmic-black);
    --card-bg: rgba(0, 30, 60, 0.7);
    --text-main: var(--pure-white);
    --text-muted: var(--chrome-silver);
    
    --glass-blur: blur(20px);
    --shadow-sm: 0 0 10px var(--electric-blue-glow);
    --shadow-md: 0 0 20px var(--electric-blue-glow);
    --shadow-lg: 0 0 30px var(--electric-blue-glow);
}

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

body {
    font-family: 'Outfit', 'Tajawal', sans-serif;
    background-color: var(--cosmic-black);
    background-image: 
        radial-gradient(rgba(255, 255, 255, 0.8) 1px, transparent 1px), 
        radial-gradient(rgba(255, 255, 255, 0.4) 1px, transparent 1px);
    background-size: 100px 100px, 40px 40px;
    background-position: 0 0, 20px 20px;
    color: var(--text-main);
    min-height: 100vh;
    overflow-x: hidden;
    /* Starfield animation */
    animation: star-movement 100s linear infinite;
}

@keyframes star-movement {
    from { background-position: 0 0, 20px 20px; }
    to { background-position: -1000px 1000px, -500px 500px; }
}

.app-container {
    display: flex;
    flex-direction: column;
    min-height: 100vh;
    position: relative;
}

/* Boot Sequence Overlay */
#boot-sequence {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: var(--cosmic-black);
    z-index: 9999;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    color: var(--electric-blue);
    font-family: 'Outfit', monospace;
    transition: opacity 1s ease-out;
}

.boot-text {
    font-size: 2.5rem;
    margin-bottom: 2rem;
    text-shadow: 0 0 10px var(--electric-blue);
    letter-spacing: 2px;
}

.countdown {
    font-size: 8rem;
    font-weight: 900;
    text-shadow: 0 0 20px var(--safety-orange);
    color: var(--safety-orange);
}

/* --- Header Styles (Cockpit Top Panel) --- */
.main-header {
    background: var(--cockpit-bg);
    backdrop-filter: var(--glass-blur);
    border-bottom: 3px solid var(--chrome-silver);
    border-image: linear-gradient(to right, transparent, var(--electric-blue), var(--chrome-silver), var(--electric-blue), transparent) 1;
    padding: 1rem 2.5rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
    position: sticky;
    top: 0;
    z-index: 100;
    box-shadow: 0 5px 15px rgba(0, 123, 255, 0.2);
}

.logo-text {
    font-size: 1.8rem;
    font-weight: 800;
    color: var(--pure-white);
    text-shadow: 0 0 8px var(--electric-blue);
    letter-spacing: 1px;
}

.subject-tag {
    font-size: 0.8rem;
    font-weight: 600;
    color: var(--cosmic-black);
    background: var(--safety-orange);
    padding: 0.2rem 0.6rem;
    border-radius: 4px;
    display: inline-block;
    margin-left: 10px;
    vertical-align: middle;
    text-transform: uppercase;
    box-shadow: 0 0 5px var(--safety-orange);
}

.main-nav {
    display: flex;
    gap: 1rem;
}

.nav-btn {
    padding: 0.6rem 1.2rem;
    border: 2px solid var(--chrome-silver);
    background: rgba(192, 192, 192, 0.1);
    border-radius: 4px;
    font-weight: 800;
    font-size: 1rem;
    color: var(--chrome-silver);
    cursor: pointer;
    transition: all 0.2s ease;
    text-transform: uppercase;
    font-family: 'Outfit', sans-serif;
    letter-spacing: 1px;
}

.nav-btn:hover {
    background: rgba(0, 123, 255, 0.2);
    border-color: var(--electric-blue);
    color: var(--electric-blue);
    box-shadow: inset 0 0 10px var(--electric-blue-glow);
}

.nav-btn.active {
    background: rgba(0, 123, 255, 0.3);
    color: var(--pure-white);
    border-color: var(--electric-blue);
    box-shadow: 0 0 15px var(--electric-blue-glow), inset 0 0 10px var(--electric-blue-glow);
}

/* Fuel Tank */
.fuel-tank-container {
    display: flex;
    align-items: center;
    gap: 10px;
    background: rgba(0, 0, 0, 0.5);
    border: 2px solid var(--chrome-silver);
    padding: 5px 15px;
    border-radius: 20px;
    margin-right: 15px;
}

.fuel-icon {
    font-size: 1.5rem;
}

.fuel-bar-outer {
    width: 100px;
    height: 12px;
    background: #333;
    border-radius: 10px;
    overflow: hidden;
    border: 1px solid #555;
}

.fuel-bar-inner {
    height: 100%;
    background: linear-gradient(90deg, #10b981, var(--safety-orange));
    width: 0%;
    transition: width 1s ease-out;
    box-shadow: 0 0 10px var(--safety-orange);
}

/* --- Content Area --- */
#content-area {
    flex: 1;
    padding: 2.5rem;
    max-width: 1100px;
    margin: 0 auto;
    width: 100%;
}

/* Mission Control Dashboard */
.mission-dashboard {
    display: flex;
    flex-direction: column;
    align-items: center;
    animation: fadeIn 0.8s ease;
}

.commander-avatar {
    font-size: 6rem;
    filter: drop-shadow(0 0 20px rgba(255, 255, 255, 0.5));
    animation: float-in-space 4s ease-in-out infinite;
    z-index: 10;
}

@keyframes float-in-space {
    0%, 100% { transform: translateY(0) rotate(-2deg); }
    50% { transform: translateY(-15px) rotate(2deg); }
}

.commander-msg-box {
    background: rgba(0, 123, 255, 0.1);
    border: 2px solid var(--electric-blue);
    padding: 1rem 2rem;
    border-radius: 8px;
    margin-bottom: 2rem;
    box-shadow: inset 0 0 20px rgba(0, 123, 255, 0.2), 0 0 15px rgba(0, 123, 255, 0.3);
    position: relative;
    backdrop-filter: blur(5px);
}

.commander-msg-box::before {
    content: '';
    position: absolute;
    top: -10px;
    left: 20px;
    border-width: 0 10px 10px 10px;
    border-style: solid;
    border-color: transparent transparent var(--electric-blue) transparent;
}

/* Mission Panels */
.mission-panels-container {
    display: flex;
    justify-content: center;
    gap: 3rem;
    flex-wrap: wrap;
    margin-top: 2rem;
}

.mission-panel {
    width: 280px;
    background: rgba(10, 15, 30, 0.8);
    border: 2px solid var(--chrome-silver);
    border-radius: 12px;
    padding: 2rem;
    text-align: center;
    cursor: pointer;
    transition: all 0.3s ease;
    position: relative;
    overflow: hidden;
}

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

.mission-panel:hover::before {
    left: 150%;
}

.mission-panel:hover {
    border-color: var(--electric-blue);
    box-shadow: 0 0 25px rgba(0, 123, 255, 0.4);
    transform: translateY(-5px);
}

.panel-icon {
    font-size: 4rem;
    margin-bottom: 1rem;
    filter: drop-shadow(0 0 10px var(--pure-white));
}

.panel-title {
    font-size: 1.8rem;
    color: var(--electric-blue);
    margin-bottom: 0.5rem;
    font-weight: 800;
    text-shadow: 0 0 5px rgba(0, 123, 255, 0.5);
}

.panel-desc {
    color: var(--chrome-silver);
    font-size: 1rem;
    margin-bottom: 1.5rem;
}

.panel-action {
    background: var(--safety-orange);
    color: var(--cosmic-black);
    padding: 0.5rem 1.5rem;
    border-radius: 4px;
    font-weight: bold;
    display: inline-block;
    text-transform: uppercase;
    transition: all 0.2s;
    border: 1px solid #ff8c00;
}

.mission-panel:hover .panel-action {
    box-shadow: 0 0 15px var(--safety-orange);
    transform: scale(1.05);
}

/* --- Task Screens --- */

/* Radar */
.radar-container {
    width: 300px;
    height: 300px;
    border-radius: 50%;
    background: rgba(0, 20, 0, 0.8);
    border: 4px solid #0f0;
    position: relative;
    overflow: hidden;
    margin: 0 auto 2rem auto;
    box-shadow: 0 0 20px #0f0, inset 0 0 20px #0f0;
}

.radar-sweep {
    position: absolute;
    top: 50%;
    left: 50%;
    width: 50%;
    height: 50%;
    background: linear-gradient(45deg, rgba(0, 255, 0, 0.5) 0%, transparent 50%);
    transform-origin: 0 0;
    animation: sweep 2s linear infinite;
}

@keyframes sweep {
    to { transform: rotate(360deg); }
}

.radar-target {
    position: absolute;
    width: 20px;
    height: 20px;
    background: red;
    border-radius: 50%;
    box-shadow: 0 0 10px red;
    animation: blink 1s infinite;
}

@keyframes blink {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.3; }
}

/* Tracing HUD (Flight Path) */
#tracing-canvas, #dotCanvas {
    background-color: #000;
    background-image: 
        linear-gradient(rgba(0, 123, 255, 0.2) 1px, transparent 1px),
        linear-gradient(90deg, rgba(0, 123, 255, 0.2) 1px, transparent 1px);
    background-size: 40px 40px;
    border: 2px solid var(--electric-blue) !important;
    border-radius: 8px;
    box-shadow: inset 0 0 20px rgba(0, 123, 255, 0.2), 0 0 15px rgba(0, 123, 255, 0.3);
    cursor: crosshair;
}

/* Encrypted Planets */
.planet-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    gap: 2rem;
    padding: 2rem;
}

.planet-btn {
    background: radial-gradient(circle at 30% 30%, #555, #111);
    border: 2px solid var(--chrome-silver);
    border-radius: 50%;
    width: 120px;
    height: 120px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 3rem;
    cursor: pointer;
    box-shadow: 0 0 15px rgba(255, 255, 255, 0.1);
    transition: all 0.3s;
}

.planet-btn:hover {
    transform: scale(1.1);
    box-shadow: 0 0 25px var(--electric-blue);
    border-color: var(--electric-blue);
}

.planet-btn.scanned {
    background: radial-gradient(circle at 30% 30%, var(--electric-blue), #002244);
    box-shadow: 0 0 30px var(--electric-blue);
}

/* General Buttons */
.btn-back {
    background: rgba(0, 0, 0, 0.5) !important;
    color: var(--chrome-silver) !important;
    border: 1px solid var(--chrome-silver) !important;
    border-radius: 4px !important;
    padding: 0.5rem 1rem !important;
    font-size: 1rem !important;
    transition: all 0.2s ease !important;
    text-transform: uppercase;
}

.btn-back:hover {
    background: rgba(0, 123, 255, 0.2) !important;
    color: var(--pure-white) !important;
    border-color: var(--electric-blue) !important;
}

/* Speaker Icon */
.speaker-icon {
    cursor: pointer;
    font-size: 1.1em;
    margin-left: 5px;
    display: inline-block;
    transition: transform 0.2s;
    filter: grayscale(0.5);
}

.speaker-icon:hover {
    transform: scale(1.3);
    filter: grayscale(0);
}

/* UI Elements */
.student-card, .activity-card {
    background: var(--card-bg);
    border: 1px solid var(--chrome-dark);
    box-shadow: var(--shadow-sm);
    color: var(--text-main);
    padding: 1rem;
    border-radius: 8px;
    margin-bottom: 1rem;
}

.student-card h3, .activity-card h3 {
    color: var(--electric-blue);
}

.lesson-box {
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid var(--chrome-dark);
    padding: 1rem;
    border-radius: 8px;
    cursor: pointer;
    text-align: center;
}
.lesson-box:hover {
    border-color: var(--electric-blue);
    box-shadow: inset 0 0 10px rgba(0,123,255,0.2);
}

/* Misc Utilities */
@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

/* Responsive Design */
@media (max-width: 900px) {
    .main-header {
        flex-direction: column;
        gap: 1.5rem;
        padding: 1rem;
    }
    
    .main-nav {
        flex-wrap: wrap;
        justify-content: center;
        width: 100%;
    }
    
    .fuel-tank-container {
        margin: 0;
        margin-bottom: 10px;
    }
    
    .nav-btn {
        font-size: 0.9rem;
        padding: 0.5rem 1rem;
    }
}

@media (max-width: 600px) {
    .nav-btn {
        flex: 1 1 45%;
        text-align: center;
    }
    
    .fuel-bar-outer {
        width: 80px;
    }
}

/* Override inline white backgrounds from previous light theme to match space theme */
div[style*="background: white"],
div[style*="background: #f8f9fa"],
div[style*="background: #F8FAFC"],
div[style*="background: #f1f2f6"],
div[style*="background: #e0f2fe"],
div[style*="background: #F1F5F9"] {
    background: var(--card-bg) !important;
}

div[style*="color: #1e293b"],
div[style*="color: #2d3436"],
div[style*="color: #2F3542"],
h2[style*="color: #1e293b"],
h3[style*="color: #1e293b"],
div[style*="color: #1e293b"] {
    color: var(--pure-white) !important;
}

div[style*="color: #64748b"],
div[style*="color: #636e72"],
span[style*="color:#64748b"] {
    color: var(--chrome-silver) !important;
}

div[style*="color: #0369a1"] {
    color: var(--safety-orange) !important;
}

/* Fix borders to match space theme */
div[style*="border: 1px solid #e2e8f0"],
div[style*="border: 4px solid #e2e8f0"] {
    border-color: var(--electric-blue) !important;
}
