/* Mission to Mars - Styles */

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

:root {
    --primary-color: #ff6b35;
    --secondary-color: #4ecdc4;
    --bg-dark: #0a0a1a;
    --bg-panel: rgba(10, 20, 40, 0.9);
    --text-primary: #ffffff;
    --text-secondary: #a0a0c0;
    --danger: #ff4757;
    --success: #2ed573;
    --warning: #ffa502;
}

body {
    font-family: 'Segoe UI', 'Roboto', sans-serif;
    background: var(--bg-dark);
    color: var(--text-primary);
    overflow: hidden;
    height: 100vh;
}

#game-container {
    width: 100vw;
    height: 100vh;
    position: relative;
}

/* Écrans */
.screen {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    display: none;
    justify-content: center;
    align-items: center;
    flex-direction: column;
}

.screen.active {
    display: flex;
}

/* Fond étoilé */
.stars-bg {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background:
        radial-gradient(ellipse at center, #1a1a3a 0%, #0a0a1a 100%),
        url('data:image/svg+xml,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 100 100"><circle cx="10" cy="10" r="0.5" fill="white"/><circle cx="30" cy="25" r="0.3" fill="white"/><circle cx="50" cy="15" r="0.4" fill="white"/><circle cx="70" cy="35" r="0.3" fill="white"/><circle cx="90" cy="20" r="0.5" fill="white"/><circle cx="20" cy="50" r="0.4" fill="white"/><circle cx="40" cy="60" r="0.3" fill="white"/><circle cx="60" cy="45" r="0.5" fill="white"/><circle cx="80" cy="70" r="0.4" fill="white"/><circle cx="15" cy="80" r="0.3" fill="white"/><circle cx="45" cy="90" r="0.5" fill="white"/><circle cx="75" cy="85" r="0.4" fill="white"/><circle cx="95" cy="55" r="0.3" fill="white"/></svg>');
    z-index: -1;
}

/* Écran titre */
#title-screen h1 {
    font-size: 4rem;
    font-weight: 800;
    letter-spacing: 0.3em;
    text-shadow: 0 0 30px var(--primary-color), 0 0 60px var(--primary-color);
    margin-bottom: 0.5rem;
    animation: glow 2s ease-in-out infinite alternate;
}

@keyframes glow {
    from { text-shadow: 0 0 30px var(--primary-color), 0 0 60px var(--primary-color); }
    to { text-shadow: 0 0 40px var(--primary-color), 0 0 80px var(--primary-color), 0 0 120px var(--primary-color); }
}

.subtitle {
    font-size: 1.5rem;
    color: var(--text-secondary);
    margin-bottom: 3rem;
    letter-spacing: 0.2em;
}

.menu {
    display: flex;
    flex-direction: column;
    gap: 1rem;
    align-items: center;
}

.menu input {
    padding: 1rem 2rem;
    font-size: 1.2rem;
    border: 2px solid var(--secondary-color);
    background: rgba(0, 0, 0, 0.5);
    color: var(--text-primary);
    border-radius: 8px;
    text-align: center;
    width: 300px;
}

.menu input::placeholder {
    color: var(--text-secondary);
}

.btn-primary, .btn-secondary, .btn-action {
    padding: 1rem 3rem;
    font-size: 1.2rem;
    font-weight: 600;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.3s ease;
    text-transform: uppercase;
    letter-spacing: 0.1em;
}

.btn-primary {
    background: linear-gradient(135deg, var(--primary-color), #ff8c5a);
    color: white;
    box-shadow: 0 4px 20px rgba(255, 107, 53, 0.4);
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 30px rgba(255, 107, 53, 0.6);
}

.btn-secondary {
    background: transparent;
    color: var(--secondary-color);
    border: 2px solid var(--secondary-color);
}

.btn-secondary:hover {
    background: var(--secondary-color);
    color: var(--bg-dark);
}

.btn-action {
    background: rgba(78, 205, 196, 0.2);
    color: var(--secondary-color);
    border: 1px solid var(--secondary-color);
    padding: 0.8rem 1.5rem;
    font-size: 0.9rem;
    width: 100%;
    margin-top: 0.5rem;
}

.btn-action:hover {
    background: rgba(78, 205, 196, 0.4);
}

.credits {
    position: absolute;
    bottom: 2rem;
    color: var(--text-secondary);
    font-size: 0.9rem;
}

/* Tutoriel */
.tutorial-content {
    background: var(--bg-panel);
    padding: 3rem;
    border-radius: 20px;
    max-width: 800px;
    border: 1px solid rgba(78, 205, 196, 0.3);
}

.tutorial-content h2 {
    text-align: center;
    margin-bottom: 2rem;
    color: var(--secondary-color);
}

.tutorial-sections {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 2rem;
    margin-bottom: 2rem;
}

.tutorial-item {
    text-align: center;
    padding: 1.5rem;
    background: rgba(255, 255, 255, 0.05);
    border-radius: 12px;
}

.tutorial-item .icon {
    font-size: 3rem;
    display: block;
    margin-bottom: 1rem;
}

.tutorial-item h3 {
    color: var(--primary-color);
    margin-bottom: 0.5rem;
}

.tutorial-item p {
    color: var(--text-secondary);
    font-size: 0.95rem;
}

/* Écran de jeu */
#game-screen {
    display: none;
}

#game-screen.active {
    display: block;
}

#space-canvas {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: radial-gradient(ellipse at center, #0a0a2a 0%, #000010 100%);
}

/* HUD */
#hud {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
}

#hud > * {
    pointer-events: auto;
}

/* Panneau supérieur */
#top-panel {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    display: flex;
    justify-content: center;
    gap: 2rem;
    padding: 1rem 2rem;
    background: linear-gradient(to bottom, var(--bg-panel), transparent);
}

.stat-box {
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 0.5rem 1.5rem;
    background: rgba(0, 0, 0, 0.3);
    border-radius: 8px;
    border: 1px solid rgba(255, 255, 255, 0.1);
}

.stat-box .label {
    font-size: 0.7rem;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.1em;
}

.stat-box .value {
    font-size: 1.4rem;
    font-weight: 700;
    color: var(--secondary-color);
}

.time-buttons {
    display: flex;
    gap: 0.3rem;
    margin-top: 0.3rem;
}

.time-btn {
    padding: 0.3rem 0.8rem;
    background: rgba(255, 255, 255, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.2);
    color: var(--text-secondary);
    border-radius: 4px;
    cursor: pointer;
    font-size: 0.8rem;
    transition: all 0.2s;
}

.time-btn:hover, .time-btn.active {
    background: var(--secondary-color);
    color: var(--bg-dark);
    border-color: var(--secondary-color);
}

/* Panneaux latéraux */
#left-panel, #right-panel {
    position: absolute;
    top: 80px;
    width: 280px;
    background: var(--bg-panel);
    border-radius: 12px;
    padding: 1rem;
    border: 1px solid rgba(255, 255, 255, 0.1);
}

#left-panel {
    left: 1rem;
}

#right-panel {
    right: 1rem;
}

.panel-section {
    margin-bottom: 1.5rem;
}

.panel-section:last-child {
    margin-bottom: 0;
}

.panel-section h3 {
    font-size: 0.8rem;
    color: var(--primary-color);
    text-transform: uppercase;
    letter-spacing: 0.1em;
    margin-bottom: 0.8rem;
    padding-bottom: 0.5rem;
    border-bottom: 1px solid rgba(255, 107, 53, 0.3);
}

/* Jauges */
.gauge {
    margin-bottom: 0.8rem;
}

.gauge-label {
    display: block;
    font-size: 0.75rem;
    color: var(--text-secondary);
    margin-bottom: 0.3rem;
}

.gauge-bar {
    height: 8px;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 4px;
    overflow: hidden;
}

.gauge-fill {
    height: 100%;
    background: linear-gradient(90deg, var(--secondary-color), #7be0d8);
    border-radius: 4px;
    transition: width 0.3s ease;
    width: 100%;
}

.gauge-fill.integrity {
    background: linear-gradient(90deg, var(--success), #5ddb8d);
}

.gauge-fill.low {
    background: linear-gradient(90deg, var(--danger), #ff6b6b);
}

.gauge-fill.medium {
    background: linear-gradient(90deg, var(--warning), #ffbe5c);
}

.gauge-value {
    display: block;
    font-size: 0.8rem;
    color: var(--text-primary);
    margin-top: 0.2rem;
    font-weight: 600;
}

/* Navigation info */
.nav-item {
    display: flex;
    justify-content: space-between;
    padding: 0.4rem 0;
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
}

.nav-label {
    color: var(--text-secondary);
    font-size: 0.85rem;
}

.nav-value {
    color: var(--text-primary);
    font-weight: 600;
    font-size: 0.85rem;
}

/* Fenêtre de lancement */
#launch-window {
    text-align: center;
    padding: 0.8rem;
    background: rgba(0, 0, 0, 0.3);
    border-radius: 8px;
}

#window-indicator {
    font-size: 1.1rem;
    font-weight: 700;
    padding: 0.5rem 1rem;
    border-radius: 4px;
    margin-bottom: 0.5rem;
}

.window-good {
    background: rgba(46, 213, 115, 0.2);
    color: var(--success);
    border: 1px solid var(--success);
}

.window-medium {
    background: rgba(255, 165, 2, 0.2);
    color: var(--warning);
    border: 1px solid var(--warning);
}

.window-bad {
    background: rgba(255, 71, 87, 0.2);
    color: var(--danger);
    border: 1px solid var(--danger);
}

#window-efficiency {
    font-size: 0.8rem;
    color: var(--text-secondary);
}

/* Contrôles de poussée */
#thrust-control {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.3rem;
    margin-bottom: 1rem;
}

.thrust-horizontal {
    display: flex;
    gap: 0.3rem;
}

.thrust-btn {
    width: 50px;
    height: 50px;
    border: 2px solid var(--secondary-color);
    background: rgba(78, 205, 196, 0.1);
    color: var(--secondary-color);
    border-radius: 8px;
    font-size: 1.5rem;
    cursor: pointer;
    transition: all 0.2s;
}

.thrust-btn:hover {
    background: rgba(78, 205, 196, 0.3);
}

.thrust-btn:active, .thrust-btn.active {
    background: var(--secondary-color);
    color: var(--bg-dark);
}

.thrust-btn.main {
    width: 60px;
    height: 60px;
    border-color: var(--primary-color);
    background: rgba(255, 107, 53, 0.2);
    color: var(--primary-color);
}

.thrust-btn.main:hover {
    background: rgba(255, 107, 53, 0.4);
}

.thrust-btn.main:active, .thrust-btn.main.active {
    background: var(--primary-color);
    color: white;
}

.thrust-info {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.85rem;
    color: var(--text-secondary);
}

.thrust-info input[type="range"] {
    width: 100px;
    accent-color: var(--primary-color);
}

/* Panneau inférieur */
#bottom-panel {
    position: absolute;
    bottom: 0;
    left: 50%;
    transform: translateX(-50%);
    width: 60%;
    max-width: 800px;
    background: var(--bg-panel);
    border-radius: 12px 12px 0 0;
    padding: 0.8rem 1.5rem;
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-bottom: none;
}

#event-log {
    max-height: 80px;
    overflow-y: auto;
}

.event-item {
    padding: 0.3rem 0;
    font-size: 0.9rem;
    color: var(--text-secondary);
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
}

.event-item:last-child {
    border-bottom: none;
}

.event-item.warning {
    color: var(--warning);
}

.event-item.danger {
    color: var(--danger);
}

.event-item.success {
    color: var(--success);
}

/* Indicateur trajectoire */
#trajectory-info {
    position: absolute;
    top: 80px;
    left: 50%;
    transform: translateX(-50%);
    background: rgba(0, 0, 0, 0.5);
    padding: 0.5rem 1.5rem;
    border-radius: 20px;
    border: 1px solid rgba(78, 205, 196, 0.3);
}

#trajectory-status {
    color: var(--secondary-color);
    font-weight: 600;
}

/* Mini-carte */
#minimap {
    position: absolute;
    bottom: 100px;
    right: 1rem;
    width: 200px;
    height: 200px;
    background: rgba(0, 0, 0, 0.7);
    border-radius: 50%;
    border: 2px solid rgba(78, 205, 196, 0.3);
    overflow: hidden;
}

#minimap-canvas {
    width: 100%;
    height: 100%;
}

/* Écran de fin */
.end-content {
    background: var(--bg-panel);
    padding: 3rem 4rem;
    border-radius: 20px;
    text-align: center;
    border: 1px solid rgba(78, 205, 196, 0.3);
}

#end-title {
    font-size: 2.5rem;
    margin-bottom: 2rem;
    color: var(--success);
}

#end-title.failed {
    color: var(--danger);
}

#end-stats {
    display: flex;
    gap: 2rem;
    margin-bottom: 2rem;
}

.end-stat {
    display: flex;
    flex-direction: column;
    padding: 1rem 2rem;
    background: rgba(0, 0, 0, 0.3);
    border-radius: 12px;
}

.end-label {
    font-size: 0.8rem;
    color: var(--text-secondary);
    margin-bottom: 0.5rem;
}

.end-value {
    font-size: 1.8rem;
    font-weight: 700;
    color: var(--secondary-color);
}

/* Animations */
@keyframes pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.5; }
}

.pulsing {
    animation: pulse 1s ease-in-out infinite;
}

/* Scrollbar */
::-webkit-scrollbar {
    width: 6px;
}

::-webkit-scrollbar-track {
    background: rgba(0, 0, 0, 0.3);
}

::-webkit-scrollbar-thumb {
    background: var(--secondary-color);
    border-radius: 3px;
}

/* Responsive */
@media (max-width: 1200px) {
    #left-panel, #right-panel {
        width: 240px;
    }
}

@media (max-width: 900px) {
    #title-screen h1 {
        font-size: 2.5rem;
    }

    #left-panel, #right-panel {
        width: 200px;
        font-size: 0.85rem;
    }

    #bottom-panel {
        width: 80%;
    }
}

/* ============================================================
   NOUVEAUX STYLES - MISSION RÉALISTE STARSHIP
   ============================================================ */

/* Sélection trajectoire menu */
.trajectory-select {
    margin: 1rem 0;
    text-align: left;
}

.trajectory-select label {
    display: block;
    font-size: 0.9rem;
    color: var(--text-secondary);
    margin-bottom: 0.5rem;
}

.trajectory-select select {
    width: 300px;
    padding: 0.8rem 1rem;
    font-size: 1rem;
    border: 2px solid var(--secondary-color);
    background: rgba(0, 0, 0, 0.5);
    color: var(--text-primary);
    border-radius: 8px;
    cursor: pointer;
}

.trajectory-select select:focus {
    outline: none;
    border-color: var(--primary-color);
}

/* Tutoriel élargi */
.tutorial-content.wide {
    max-width: 1000px;
    padding: 2rem 3rem;
}

.tutorial-content.wide .tutorial-sections {
    grid-template-columns: repeat(3, 1fr);
    gap: 1.5rem;
}

.tutorial-content.wide .tutorial-item {
    padding: 1rem;
}

.tutorial-content.wide .tutorial-item p {
    font-size: 0.85rem;
    line-height: 1.5;
}

/* Breakdown Delta-V */
.mission-stats {
    margin-top: 1.5rem;
    padding: 1rem;
    background: rgba(0, 0, 0, 0.3);
    border-radius: 12px;
}

.mission-stats h3 {
    color: var(--primary-color);
    margin-bottom: 1rem;
    font-size: 1rem;
}

.deltav-breakdown {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 0.5rem;
}

.deltav-item {
    display: flex;
    justify-content: space-between;
    padding: 0.5rem 1rem;
    background: rgba(255, 255, 255, 0.05);
    border-radius: 4px;
    font-size: 0.9rem;
}

.deltav-item.total {
    grid-column: span 3;
    background: var(--primary-color);
    color: white;
    font-weight: 700;
}

/* Panneau équipage */
#crew-panel {
    position: absolute;
    top: 80px;
    left: 300px;
    width: 240px;
    background: var(--bg-panel);
    border-radius: 12px;
    padding: 1rem;
    border: 1px solid rgba(255, 255, 255, 0.1);
}

/* Jauge propergol */
.gauge-fill.propellant {
    background: linear-gradient(90deg, #3498db, #5dade2);
}

/* Jauge santé */
.gauge-fill.health {
    background: linear-gradient(90deg, var(--success), #58d68d);
}

/* Jauge radiation */
.gauge-fill.radiation {
    background: linear-gradient(90deg, #f1c40f, #e74c3c);
}

/* Badge phase mission */
.phase-badge {
    display: inline-block;
    padding: 0.2rem 0.6rem;
    background: var(--primary-color);
    color: white;
    border-radius: 4px;
    font-size: 0.75rem;
    font-weight: 700;
}

/* Ressources grid */
.supplies-grid {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.supply-item {
    display: grid;
    grid-template-columns: 24px 40px 1fr 45px;
    align-items: center;
    gap: 0.5rem;
}

.supply-icon {
    font-size: 1rem;
}

.supply-label {
    font-size: 0.8rem;
    color: var(--text-secondary);
}

.supply-bar {
    height: 8px;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 4px;
    overflow: hidden;
}

.supply-fill {
    height: 100%;
    background: linear-gradient(90deg, var(--secondary-color), #7be0d8);
    border-radius: 4px;
    transition: width 0.3s ease;
    width: 100%;
}

.supply-value {
    font-size: 0.75rem;
    font-weight: 600;
    text-align: right;
}

/* Communications info */
.comm-info {
    display: flex;
    flex-direction: column;
    gap: 0.3rem;
}

.comm-item {
    display: flex;
    justify-content: space-between;
    font-size: 0.85rem;
}

.comm-label {
    color: var(--text-secondary);
}

.comm-value {
    font-weight: 600;
    color: var(--secondary-color);
}

/* Info moteur */
.engine-info {
    text-align: center;
    font-size: 0.75rem;
    color: var(--text-secondary);
    margin-bottom: 0.5rem;
}

/* Boutons de burn */
.burn-btn {
    background: rgba(255, 107, 53, 0.2) !important;
    border-color: var(--primary-color) !important;
    color: var(--primary-color) !important;
}

.burn-btn:hover {
    background: rgba(255, 107, 53, 0.4) !important;
}

.burn-btn:disabled {
    opacity: 0.4;
    cursor: not-allowed;
}

/* Toggles système */
.system-toggles {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.toggle-item {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.85rem;
    color: var(--text-secondary);
    cursor: pointer;
}

.toggle-item input[type="checkbox"] {
    accent-color: var(--secondary-color);
    width: 16px;
    height: 16px;
}

/* Fenêtre prochaine */
.window-next {
    display: block;
    font-size: 0.75rem;
    color: var(--text-secondary);
    margin-top: 0.3rem;
}

/* Classes de fenêtre étendues */
.window-optimal {
    background: rgba(46, 213, 115, 0.2);
    color: var(--success);
    border: 1px solid var(--success);
}

.window-marginal {
    background: rgba(255, 165, 2, 0.2);
    color: var(--warning);
    border: 1px solid var(--warning);
}

.window-closed {
    background: rgba(255, 71, 87, 0.2);
    color: var(--danger);
    border: 1px solid var(--danger);
}

/* Alerte radiation */
@keyframes radiation-pulse {
    0%, 100% { box-shadow: 0 0 5px #f1c40f; }
    50% { box-shadow: 0 0 20px #e74c3c; }
}

.radiation-warning {
    animation: radiation-pulse 1s ease-in-out infinite;
}

/* Indicateur phase sur trajectoire */
#trajectory-info {
    max-width: 500px;
}

.phase-indicator {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.phase-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--success);
    animation: pulse 1s ease-in-out infinite;
}

/* Responsive pour nouveaux panneaux */
@media (max-width: 1400px) {
    #crew-panel {
        left: 290px;
        width: 220px;
    }
}

@media (max-width: 1200px) {
    #crew-panel {
        display: none;
    }

    .tutorial-content.wide .tutorial-sections {
        grid-template-columns: repeat(2, 1fr);
    }
}

@media (max-width: 800px) {
    .deltav-breakdown {
        grid-template-columns: 1fr;
    }

    .deltav-item.total {
        grid-column: span 1;
    }
}

/* ============================================================
   STYLES SUPPLÉMENTAIRES - BOUTONS ET BARRES
   ============================================================ */

/* Boutons de manœuvre disponibles */
.btn-action.available {
    background: rgba(255, 107, 53, 0.3);
    border-color: var(--primary-color);
    color: var(--primary-color);
    animation: pulse-glow 2s ease-in-out infinite;
}

@keyframes pulse-glow {
    0%, 100% { box-shadow: 0 0 5px rgba(255, 107, 53, 0.3); }
    50% { box-shadow: 0 0 15px rgba(255, 107, 53, 0.6); }
}

.btn-action:disabled {
    opacity: 0.4;
    cursor: not-allowed;
    border-color: var(--text-secondary);
    color: var(--text-secondary);
    background: rgba(255, 255, 255, 0.05);
}

/* Barres de ressources colorées */
.supply-fill.low {
    background: linear-gradient(90deg, var(--danger), #ff6b6b);
}

.supply-fill.medium {
    background: linear-gradient(90deg, var(--warning), #ffbe5c);
}

/* Phase badges colorés */
.phase-badge.phase-LEO {
    background: var(--secondary-color);
}

.phase-badge.phase-transit {
    background: #9b59b6;
}

.phase-badge.phase-mars_orbit {
    background: #e74c3c;
}

.phase-badge.phase-surface {
    background: var(--success);
}

/* Radiation bar high level */
.gauge-fill.radiation.high {
    background: linear-gradient(90deg, #e74c3c, #c0392b);
    animation: radiation-pulse 1s ease-in-out infinite;
}

/* Health bar animations */
.gauge-fill.health.low {
    background: linear-gradient(90deg, var(--danger), #ff6b6b);
    animation: pulse 1s ease-in-out infinite;
}

.gauge-fill.health.medium {
    background: linear-gradient(90deg, var(--warning), #ffbe5c);
}

/* End screen success styling */
#end-title.success {
    color: var(--success);
    text-shadow: 0 0 30px var(--success);
}

/* End stats flex wrap for more items */
#end-stats {
    flex-wrap: wrap;
    justify-content: center;
}
