/* ===== OPÉRATION VÉRITÉ III — STYLES ===== */
* { margin: 0; padding: 0; box-sizing: border-box; }

body {
    font-family: 'Courier New', 'Consolas', monospace;
    background: #050a05;
    color: #00ff41;
    height: 100vh;
    overflow: hidden;
}

#matrix-bg {
    position: fixed; top: 0; left: 0; width: 100%; height: 100%;
    background: radial-gradient(ellipse at center, #001a00 0%, #000800 40%, #000000 100%);
    z-index: -1;
}

#game-container {
    display: flex; flex-direction: column; height: 100vh; padding: 12px; gap: 10px;
}

/* ===== HEADER ===== */
#game-header {
    display: flex; justify-content: space-between; align-items: center;
    padding: 10px 20px;
    background: rgba(0, 15, 0, 0.95);
    border: 1px solid #00aa00;
    border-radius: 6px;
    box-shadow: 0 0 15px rgba(0,255,65,0.15);
    flex-shrink: 0;
}

.header-left h1 {
    color: #00ff41; font-size: 1.6em;
    text-shadow: 0 0 12px rgba(0,255,65,0.8);
}

.subtitle { color: #77ff77; font-size: 0.85em; opacity: 0.85; }

.header-right { display: flex; gap: 15px; align-items: center; }

#connection-status {
    display: flex; align-items: center; gap: 8px;
    padding: 6px 12px; background: rgba(0,30,0,0.8);
    border-radius: 4px; border: 1px solid #00aa00; font-size: 0.85em;
}

.status-dot {
    width: 8px; height: 8px; background: #00ff41;
    border-radius: 50%; animation: pulse 2s infinite;
}

@keyframes pulse { 0%,100% { opacity:1; box-shadow: 0 0 4px #00ff41; } 50% { opacity:0.4; box-shadow: none; } }

#encryption-level {
    padding: 6px 12px; background: rgba(0,0,30,0.8);
    border-radius: 4px; border: 1px solid #0066cc; font-size: 0.85em; color: #66aaff;
}

/* ===== MAIN CONTENT ===== */
#main-content {
    display: flex; flex: 1; gap: 12px; min-height: 0;
}

#terminal-section { flex: 3; display: flex; flex-direction: column; min-height: 0; }

#terminal {
    flex: 1; display: flex; flex-direction: column;
    background: rgba(2, 8, 2, 0.98);
    border: 1px solid #00cc33;
    border-radius: 8px; overflow: hidden;
    box-shadow: 0 0 25px rgba(0,255,65,0.2), inset 0 0 30px rgba(0,20,0,0.5);
}

#terminal-header-bar {
    display: flex; align-items: center; padding: 8px 15px;
    background: rgba(0, 20, 0, 0.95);
    border-bottom: 1px solid #007722;
    flex-shrink: 0;
}

.terminal-button { width: 11px; height: 11px; border-radius: 50%; margin-right: 6px; }
.terminal-button.red   { background: #ff5f56; }
.terminal-button.yellow { background: #ffbd2e; }
.terminal-button.green  { background: #27ca3f; }

.terminal-title {
    margin-left: 12px; color: #00cc33;
    font-weight: bold; font-size: 0.82em; letter-spacing: 0.5px;
}

#output {
    flex: 1; padding: 15px 18px;
    overflow-y: auto; background: transparent;
    font-size: 13px; line-height: 1.65;
}

#output > div {
    margin-bottom: 2px;
    white-space: pre-wrap; word-wrap: break-word;
}

/* Output classes */
.command-output  { color: #00ff41; }
.system-message  { color: #ffff44; font-weight: bold; }
.error-message   { color: #ff4444; }
.success-message { color: #44ff88; font-weight: bold; }
.file-content    { color: #aaccff; background: rgba(10,15,35,0.7); padding: 2px 8px; border-left: 2px solid #3355aa; margin: 2px 0; }
.file-header     { color: #888888; font-size: 0.9em; }
.file-list       { color: #aaffcc; }
.dir-list        { color: #66ccff; font-weight: bold; }
.story-content   { color: #ffdd99; line-height: 1.8; margin: 3px 0; }
.story-reveal    { color: #ff9944; font-style: italic; }
.chapter-header  { color: #00ff41; font-weight: bold; text-shadow: 0 0 8px rgba(0,255,65,0.5); }
.separator-line  { color: #447744; }
.skill-earned    { color: #ffdd00; font-weight: bold; }
.side-story-header { color: #ffaa44; }
.side-story-content { color: #ffcc99; line-height: 1.75; }
.hint-message    { color: #88ff88; font-style: italic; font-size: 0.92em; }
.diff-remove     { color: #ff6666; background: rgba(80,0,0,0.4); padding: 1px 6px; }
.diff-add        { color: #66ff66; background: rgba(0,60,0,0.4); padding: 1px 6px; }
.news-headline   { color: #ffff88; font-weight: bold; font-style: italic; }

#input-line {
    display: flex; align-items: center; padding: 10px 18px;
    background: rgba(0,15,0,0.95); border-top: 1px solid #005500;
    flex-shrink: 0;
}

#prompt {
    color: #00ff41; font-weight: bold;
    margin-right: 6px; user-select: none; white-space: nowrap;
    font-size: 13px;
}

#command-input {
    flex: 1; background: transparent; border: none;
    color: #00ff41; font-family: 'Courier New', monospace;
    font-size: 13px; outline: none; caret-color: transparent;
}

#cursor {
    color: #00ff41; animation: blink 1s infinite; margin-left: 1px;
}

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

/* ===== SIDEBAR ===== */
#sidebar {
    flex: 1; display: flex; flex-direction: column;
    gap: 8px; min-width: 260px; max-width: 310px;
    overflow-y: auto;
}

.panel {
    background: rgba(5, 12, 20, 0.95);
    border: 1px solid #005599;
    border-radius: 6px; padding: 12px;
    box-shadow: 0 0 10px rgba(0,100,200,0.1);
    flex-shrink: 0;
}

.panel h3 {
    color: #3399ff; border-bottom: 1px solid #003366;
    padding-bottom: 7px; margin-bottom: 10px;
    font-size: 0.9em; letter-spacing: 1px;
}

#current-mission {
    color: #ddcc88; font-size: 0.85em; min-height: 30px; margin-bottom: 10px;
}

#mission-progress-bar {
    height: 6px; background: rgba(0,30,60,0.8);
    border-radius: 3px; overflow: hidden; margin-bottom: 4px;
}

#mission-fill {
    height: 100%;
    background: linear-gradient(90deg, #0066cc, #00ff41);
    width: 0%; transition: width 0.6s ease;
}

#mission-percent {
    font-size: 0.85em; color: #00ff41; font-weight: bold;
}

#chapters-list { display: flex; flex-direction: column; gap: 4px; max-height: 280px; overflow-y: auto; }

.chapter-item {
    padding: 6px 8px; background: rgba(0,20,40,0.6);
    border-radius: 3px; border-left: 2px solid #003366;
    font-size: 0.8em;
}

.chapter-item.completed { border-left-color: #00aa44; background: rgba(0,25,10,0.6); }
.chapter-item.current   { border-left-color: #ff8800; background: rgba(40,20,0,0.7); font-weight: bold; }

.chapter-title { color: #99bbff; }
.chapter-status { color: #667799; font-size: 0.85em; margin-top: 2px; }
.chapter-item.completed .chapter-status { color: #44aa66; }
.chapter-item.current .chapter-title { color: #ffcc66; }

#side-stories-list { display: flex; flex-direction: column; gap: 4px; max-height: 180px; overflow-y: auto; }

.side-story-item {
    padding: 6px 8px; background: rgba(30,15,0,0.6);
    border-radius: 3px; border-left: 2px solid #553300;
    font-size: 0.8em; cursor: default;
}

.side-story-item.unlocked   { border-left-color: #cc7700; background: rgba(40,20,0,0.7); }
.side-story-item.completed  { border-left-color: #00aa44; background: rgba(0,25,10,0.6); }

.side-story-title { color: #ffbb77; }
.side-story-desc  { color: #998866; font-size: 0.85em; margin-top: 2px; }

#skills-list { display: flex; flex-wrap: wrap; gap: 5px; }

.skill-badge {
    padding: 3px 8px; background: rgba(0,30,0,0.6);
    border: 1px solid #004400; border-radius: 12px;
    font-size: 0.75em; color: #447744;
    transition: all 0.3s;
}

.skill-badge.learned {
    background: rgba(0,60,0,0.9); border-color: #00ff41;
    color: #00ff41; box-shadow: 0 0 6px rgba(0,255,65,0.3);
}

#current-hint {
    color: #aaddaa; font-size: 0.85em; line-height: 1.6; min-height: 40px;
}

/* ===== FOOTER ===== */
#game-footer {
    display: flex; justify-content: space-between; align-items: center;
    padding: 8px 20px;
    background: rgba(0,15,0,0.9); border: 1px solid #004400;
    border-radius: 5px; flex-shrink: 0; font-size: 0.82em;
}

.footer-left, .footer-center, .footer-right { display: flex; gap: 15px; }
#chapter-indicator { color: #00ff41; font-weight: bold; }
#discovered-files, #commands-used { color: #66aa66; }
#current-time { color: #8899bb; font-family: monospace; }

/* ===== ACHIEVEMENT POPUP ===== */
#achievement-popup {
    position: fixed; top: 40px; right: 40px;
    background: linear-gradient(135deg, #0a0a1a, #0a1a0a);
    border: 2px solid #ffcc00; border-radius: 8px;
    padding: 15px 20px;
    box-shadow: 0 0 25px rgba(255,204,0,0.4);
    z-index: 1000;
    animation: slideIn 0.4s ease, slideOut 0.5s ease 4.5s forwards;
}

@keyframes slideIn { from { transform: translateX(120%); opacity: 0; } to { transform: translateX(0); opacity: 1; } }
@keyframes slideOut { from { transform: translateX(0); opacity: 1; } to { transform: translateX(120%); opacity: 0; } }

.achievement-content { display: flex; align-items: center; gap: 12px; }
.achievement-icon { font-size: 1.8em; }
.achievement-text h4 { color: #ffcc00; font-size: 0.9em; margin-bottom: 3px; }
.achievement-text p  { color: #ffffff; font-size: 0.85em; max-width: 220px; }

/* ===== MODAL ===== */
.modal {
    position: fixed; top: 0; left: 0; width: 100%; height: 100%;
    background: rgba(0,0,0,0.92);
    display: flex; justify-content: center; align-items: center; z-index: 2000;
}

.modal-content {
    background: linear-gradient(135deg, #050a05, #050510);
    border: 2px solid #00ff41; border-radius: 10px;
    padding: 25px; width: 80%; max-width: 750px;
    max-height: 80vh; overflow-y: auto; position: relative;
}

.close-modal {
    position: absolute; top: 12px; right: 16px;
    color: #ff4444; font-size: 24px; cursor: pointer;
}
.close-modal:hover { color: #ff0000; }

#story-content { color: #ffdd99; line-height: 1.8; font-size: 1em; margin-bottom: 15px; white-space: pre-wrap; }

#continue-story {
    background: linear-gradient(135deg, #003366, #006600);
    color: #00ff41; border: 1px solid #00ff41;
    padding: 10px 25px; border-radius: 4px;
    font-weight: bold; cursor: pointer; font-size: 0.9em;
    display: block; margin: 0 auto;
}
#continue-story:hover { box-shadow: 0 0 15px rgba(0,255,65,0.4); }

/* ===== SCROLLBARS ===== */
::-webkit-scrollbar { width: 6px; }
::-webkit-scrollbar-track { background: rgba(0,10,0,0.5); }
::-webkit-scrollbar-thumb { background: #004400; border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: #006600; }

/* ===== ANIMATIONS ===== */
.fade-in { animation: fadeIn 0.2s ease-out; }
@keyframes fadeIn { from { opacity: 0; transform: translateY(3px); } to { opacity: 1; transform: translateY(0); } }

.hidden { display: none !important; }

/* ===== RESPONSIVE ===== */
@media (max-width: 1100px) {
    #main-content { flex-direction: column; }
    #sidebar { max-width: 100%; min-width: 100%; flex-direction: row; flex-wrap: wrap; overflow-y: visible; }
    .panel { flex: 1; min-width: 200px; }
    #chapters-list, #side-stories-list { max-height: 120px; }
}

@media (max-width: 768px) {
    #game-header { flex-direction: column; gap: 8px; text-align: center; }
    .header-left h1 { font-size: 1.2em; }
    #output { font-size: 12px; padding: 10px; }
    #game-footer { flex-direction: column; gap: 5px; }
}
