/* 
   Zentrale CSS-Konfiguration
   Definiert das visuelle "Terminal/CRT"-Design der Anwendung.
   Nutzt CSS-Variablen, die dynamisch via JavaScript (GameState.js) 
   an das Farbschema des jeweiligen Agenten angepasst werden.
*/
:root {
    --main-color: #00ff00;       /* Hauptfarbe für Text und Rahmen (wird überschrieben) */
    --bg-color: #050505;        /* Dunkler Hintergrund für den Terminal-Look */
    --terminal-glow: 0 0 10px rgba(0, 255, 0, 0.4); /* Leuchteffekt für Container */
    --agent-color: #00ff00;      /* Backup-Farbe für Agenten-Effekte */
}

/* Globales CRT & Terminal Design: Grundlegendes Layout und Übergänge */
body { 
    background-color: var(--bg-color); 
    color: var(--main-color); 
    font-family: 'Courier New', Courier, monospace; 
    margin: 0; 
    padding: 20px;
    box-sizing: border-box;
    overflow-x: hidden; 
    position: relative;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    /* Sanfter Farbübergang beim Agenten-Wechsel */
    transition: color 1s ease, border-color 1s ease, box-shadow 1s ease;
}

/* Statischer CRT-Grit-Effekt: Erzeugt die feinen horizontalen Linien und Farbrauschen */
body::before {
    content: " ";
    display: block;
    position: fixed;
    top: 0;
    left: 0;
    bottom: 0;
    right: 0;
    background: linear-gradient(rgba(18, 16, 16, 0) 50%, rgba(0, 0, 0, 0.25) 50%), 
                linear-gradient(90deg, rgba(255, 0, 0, 0.06), rgba(0, 255, 0, 0.02), rgba(0, 0, 255, 0.06));
    z-index: 9998;
    background-size: 100% 2px, 3px 100%;
    pointer-events: none;
}

/* Animierte Scanline: Simuliert den wandernden Lichtstrahl alter Röhrenmonitore */
body::after {
    content: "";
    position: fixed;
    top: 0; left: 0; width: 100%; height: 2px;
    background: rgba(0, 255, 0, 0.1);
    opacity: 0.1;
    z-index: 9999;
    pointer-events: none;
    animation: scanline 8s linear infinite;
}

@keyframes scanline {
    0% { transform: translateY(-100%); }
    100% { transform: translateY(100%); }
}

/* Basis Terminal Boxen: Standard-Container für alle Inhalte */
#terminal-box, .document-box, .container { 
    border: 2px solid var(--main-color); 
    padding: 20px; 
    box-shadow: var(--terminal-glow); 
    max-width: 600px; 
    width: 100%; 
    text-align: center; 
    background-color: #000; 
    box-sizing: border-box;
    position: relative;
    z-index: 1;
}

.document-box {
    max-width: 800px;
}

/* Standard Überschriften */
h1 { 
    font-size: clamp(1rem, 5vw, 1.5rem); 
    text-transform: uppercase; 
    letter-spacing: 2px; 
    margin-bottom: 20px; 
    border-bottom: 1px solid var(--main-color); 
    padding-bottom: 10px; 
    text-shadow: var(--terminal-glow);
}

/* Interaktive Elemente */
button, .action-link, .back-link, .back-btn { 
    background-color: #000; 
    color: var(--main-color); 
    border: 1px solid var(--main-color); 
    padding: 12px 24px; 
    font-family: 'Courier New', Courier, monospace; 
    font-size: 1rem; 
    cursor: pointer; 
    text-decoration: none; 
    display: inline-block; 
    margin-top: 15px; 
    transition: all 0.3s ease; 
}

button:hover, .action-link:hover, .back-link:hover, .back-btn:hover { 
    background-color: var(--main-color); 
    color: #000; 
}

input[type="text"], input[type="password"], input[type="number"], select, textarea { 
    background-color: #000; 
    color: var(--main-color);
    border: 1px solid var(--main-color); 
    padding: 12px; 
    font-family: 'Courier New', Courier, monospace; 
    font-size: 1rem; 
    text-align: center; 
    width: 100%; 
    max-width: 300px;
    outline: none; 
    box-sizing: border-box;
    display: block;
    margin: 0 auto;
}

input[type="text"], input[type="password"] {
    text-transform: uppercase;
}

textarea {
    resize: vertical;
    text-transform: none;
    text-align: left;
}

/* Status Texte */
.status-text { 
    font-size: 0.85rem; 
    margin-top: 15px; 
    opacity: 0.8; 
    line-height: 1.4; 
    text-align: center;
}

/* Animationen */
@keyframes shake {
    0%, 100% { transform: translateX(0); }
    25% { transform: translateX(-5px); }
    75% { transform: translateX(5px); }
}
.shake { animation: shake 0.2s ease-in-out 0s 2; }

.blink { animation: blinker 1s linear infinite; }
@keyframes blinker { 50% { opacity: 0; } }

/* Typewriter Cursor */
.cursor {
    display: inline-block;
    width: 10px;
    height: 1.2em;
    background-color: var(--main-color);
    margin-left: 2px;
    animation: blinker 1s infinite;
    vertical-align: middle;
}

/* Zentrale Spezifisch */
.timer-display { 
    font-size: clamp(1.2rem, 6vw, 2.2rem); 
    font-weight: bold; 
    letter-spacing: 2px; 
    text-shadow: 0 0 5px var(--main-color); 
    margin: 10px 0;
}
.phase-box { margin-bottom: 30px; padding: 15px; border: 1px dashed var(--main-color); }
#auth-container { margin-top: 20px; }
.input-group { margin: 20px 0; }
#error-msg, #msg-output { color: #ff0000; min-height: 20px; margin-top: 10px; font-size: 0.8rem; }

/* Dokument / Phase 2 Spezifisch */
.urgent-banner {
    background-color: #ff0000;
    color: #000;
    padding: 10px;
    font-weight: bold;
    text-align: center;
    font-size: clamp(0.9rem, 4vw, 1.4rem);
    letter-spacing: 2px;
    margin-bottom: 30px;
    box-shadow: 0 0 15px #ff0000;
    text-transform: uppercase;
}
.typewriter {
    white-space: pre-wrap; 
    line-height: 1.6;
    font-size: clamp(0.9rem, 3.5vw, 1.1rem);
    min-height: 100px;
}

/* Puzzles / Video Spezifisch */
.video-container {
    position: relative;
    padding-bottom: 56.25%; /* 16:9 Format */
    height: 0;
    overflow: hidden;
    margin-bottom: 30px;
    border: 1px solid var(--main-color);
}
.video-container iframe, .video-container video {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
}
.hint-text {
    white-space: pre-wrap;
    line-height: 1.5;
    margin-bottom: 30px;
}

/* --- AGENT PROFILE STYLES --- */
#agent-container, #admin-container {
    border: 2px solid var(--main-color);
    background-color: #000;
    padding: 30px;
    color: var(--main-color);
    box-shadow: 0 0 30px rgba(0, 255, 0, 0.2); /* Fallback */
    box-shadow: 0 0 30px rgba(var(--main-color-rgb), 0.3);
    max-width: 800px;
    width: 95%;
    margin: 20px auto;
    text-align: center;
}

#admin-container {
    --main-color: #ff0000;
    --main-color-rgb: 255, 0, 0;
    border-color: #ff0000;
    background-color: #110000;
    color: #ff0000;
    box-shadow: 0 0 30px rgba(255, 0, 0, 0.5);
}

.role-tag { 
    font-weight: bold; 
    background: var(--main-color); 
    color: #000; 
    padding: 5px 15px; 
    display: inline-block; 
    margin: 10px 0; 
    border-radius: 3px; 
}

.info-box { 
    border: 1px dashed var(--main-color); 
    padding: 20px; 
    margin: 25px 0; 
    font-size: 1.1rem; 
    text-align: center;
    background: rgba(0,0,0,0.5); 
}

#admin-container .info-box {
    border-color: #ff0000;
}

.status-online { 
    color: #00ff00; 
    font-weight: bold; 
    animation: blink 2s infinite; 
}

.admin-code { 
    font-weight: bold; 
    color: #fff; 
    background: #330000; 
    padding: 5px 10px; 
    border: 1px solid #ff0000; 
    display: inline-block; 
    margin: 5px; 
}

.reset-btn {
    background-color: #ff0000;
    color: white;
    border: 2px solid white;
    margin-top: 30px;
    padding: 15px;
    width: 100%;
    font-weight: bold;
    cursor: pointer;
    transition: all 0.3s ease;
}

.reset-btn:hover { 
    background-color: #aa0000; 
    transform: scale(1.02); 
}

/* Archiv Spezifisch */
.file-list {
    list-style: none;
    padding: 0;
    margin: 0;
}
.file-item {
    border: 1px solid var(--main-color);
    margin-bottom: 15px;
    background: rgba(0,0,0,0.8);
    transition: all 0.3s;
    position: relative;
    overflow: hidden;
}
.file-item::after {
    content: "";
    position: absolute;
    top: 0; left: 0; right: 0; height: 1px;
    background: var(--main-color);
    opacity: 0.1;
    pointer-events: none;
    animation: archive-scan 4s linear infinite;
}
@keyframes archive-scan {
    0% { transform: translateY(-10px); }
    100% { transform: translateY(100px); }
}
.file-link {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 15px;
    text-decoration: none;
    color: var(--main-color);
    font-weight: bold;
    cursor: pointer;
}
.status-icon { font-size: 1.2rem; }
.locked { border-color: #555 !important; }
.locked .file-link { color: #555 !important; cursor: default; }
.locked .file-link:hover { background: none !important; }

.code-section {
    margin-top: 40px;
    border-top: 1px dashed var(--main-color);
    padding-top: 20px;
    text-align: center;
}

/* Archiv Admin Panel */
#admin-panel {
    display: none; /* Standardmäßig unsichtbar */
    margin-top: 50px;
    border: 2px solid red;
    background-color: #110000;
    padding: 15px;
    color: red;
    width: 100%;
    box-sizing: border-box;
    box-shadow: 0 0 20px rgba(255, 0, 0, 0.3);
}
#admin-panel h3 { margin-top: 0; border-bottom: 1px solid red; font-size: 1rem;}

/* --- LOGIN ANIMATION (TAROT CARD FLIP) --- */
#login-overlay {
    position: fixed;
    top: 0; left: 0; width: 100%; height: 100%;
    background: rgba(0,0,0,0.95);
    z-index: 10000;
    display: none;
    justify-content: center;
    align-items: center;
    perspective: 1500px;
    flex-direction: column;
    transition: opacity 1s ease;
    opacity: 1;
}

#login-overlay.fade-out {
    opacity: 0;
}

.card-container {
    width: 300px;
    height: 520px;
    position: relative;
    transform-style: preserve-3d;
    transition: transform 1.8s cubic-bezier(0.4, 0, 0.2, 1);
    cursor: default;
}

.card-container.flipped {
    transform: rotateY(180deg);
}

.card-face {
    position: absolute;
    width: 100%;
    height: 100%;
    backface-visibility: hidden;
    border: 3px solid var(--main-color);
    border-radius: 15px;
    box-shadow: 0 0 30px var(--main-color);
    overflow: hidden;
    display: flex;
    justify-content: center;
    align-items: center;
}

.card-back {
    background: #111;
    background-image: 
        radial-gradient(circle at 50% 50%, var(--main-color) 1px, transparent 1px),
        linear-gradient(45deg, transparent 48%, var(--main-color) 50%, transparent 52%);
    background-size: 30px 30px, 60px 60px;
}

.card-front {
    transform: rotateY(180deg);
    background: #000;
}

.card-front img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.scanline-effect {
    position: absolute;
    top: 0; left: 0; width: 100%; height: 5px;
    background: var(--main-color);
    opacity: 0.5;
    box-shadow: 0 0 15px var(--main-color);
    animation: scan 3s linear infinite;
    pointer-events: none;
}

@keyframes scan {
    0% { top: 0%; }
    100% { top: 100%; }
}

#login-msg {
    margin-top: 30px;
    font-size: 1.2rem;
    text-transform: uppercase;
    letter-spacing: 3px;
    color: var(--main-color);
    text-shadow: 0 0 10px var(--main-color);
    opacity: 0;
    transition: opacity 0.5s ease;
}

#login-msg.visible {
    opacity: 1;
}

/* Animations-Klasse zum "Öffnen" - Zoom-In oder Fade-Out */
.card-container.opening {
    transform: rotateY(180deg) scale(5);
    opacity: 0;
    transition: transform 1s ease-in, opacity 0.8s ease-in;
}

/* Einladung Spezifisch */
.header-info {
    display: flex;
    flex-direction: column;
    gap: 5px;
    border-bottom: 1px solid var(--main-color);
    padding-bottom: 10px;
    margin-bottom: 30px;
    font-size: 0.8rem;
    opacity: 0.8;
}
@media (min-width: 480px) {
    .header-info { flex-direction: row; justify-content: space-between; }
}
.signature {
    margin-top: 50px;
    text-align: right;
    font-style: italic;
    opacity: 0;
    transition: opacity 2s ease;
}
.signature.visible { opacity: 0.7; }

@media (prefers-reduced-motion: reduce) {
    *, ::before, ::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
        scroll-behavior: auto !important;
    }
    body::after { display: none; } /* Scanline off */
    .shake, .blink, .scanline-effect { animation: none !important; }
}

.admin-section {
    margin-top: 30px;
    padding-top: 20px;
    border-top: 1px dashed var(--main-color);
    text-align: left;
}

.admin-section h2 {
    margin: 0 0 12px;
    font-size: 1rem;
    text-transform: uppercase;
    letter-spacing: 1px;
}

.admin-section-head {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 12px;
}

.admin-checkbox-row {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    margin: 10px 0 0;
}

.admin-table-wrap {
    width: 100%;
    overflow-x: auto;
}

.admin-table {
    width: 100%;
    border-collapse: collapse;
    margin-top: 10px;
    font-size: 0.85rem;
}

.admin-table th, .admin-table td {
    border: 1px solid var(--main-color);
    padding: 8px;
    text-align: left;
}

.admin-table th {
    text-transform: uppercase;
}

.admin-mini-btn {
    padding: 6px 10px;
    margin: 4px 6px 4px 0;
    font-size: 0.8rem;
}

.admin-actions {
    margin-top: 30px;
}

.profile-actions {
    display: flex;
    gap: 10px;
    justify-content: center;
    flex-wrap: wrap;
}

#archive-container {
    max-width: 920px;
    width: 95%;
    margin: 20px auto;
}

.archive-tree-wrap {
    text-align: left;
    margin-top: 20px;
}

.archive-tree {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.archive-node {
    border: 1px solid var(--main-color);
    background: rgba(0, 0, 0, 0.8);
}

.archive-node > summary {
    cursor: pointer;
    padding: 10px 12px;
    font-weight: bold;
    list-style: none;
}

.archive-node > summary::-webkit-details-marker {
    display: none;
}

.archive-node-content {
    padding: 0 12px 12px;
    border-top: 1px dashed var(--main-color);
}

.archive-node.locked > summary {
    color: #777;
}

.archive-section-description {
    margin: 10px 0;
    opacity: 0.9;
}

.archive-children {
    display: flex;
    flex-direction: column;
    gap: 8px;
    margin-top: 10px;
}

.archive-item-list {
    list-style: none;
    margin: 0;
    padding: 0;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.archive-item {
    border: 1px dashed var(--main-color);
    padding: 10px;
}

.archive-item.locked {
    border-color: #555;
    color: #777;
}

.archive-item-title {
    margin: 0 0 8px;
    font-size: 0.95rem;
}

.archive-item-body {
    margin: 0 0 8px;
    line-height: 1.45;
}

.archive-item-link {
    color: var(--main-color);
}

.archive-redacted {
    margin: 0;
    font-weight: bold;
    letter-spacing: 1px;
}

.admin-accordion {
    margin-top: 18px;
    border: 1px solid var(--main-color);
    text-align: left;
}

.admin-accordion > summary {
    cursor: pointer;
    padding: 12px;
    font-weight: bold;
    text-transform: uppercase;
    letter-spacing: 1px;
    list-style: none;
}

.admin-accordion > summary::-webkit-details-marker {
    display: none;
}

.admin-accordion-body {
    border-top: 1px dashed var(--main-color);
    padding: 15px 12px 12px;
}

.admin-dual-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 16px;
}

.admin-subsection {
    border: 1px dashed var(--main-color);
    padding: 12px;
}

.admin-subsection h2 {
    margin: 0 0 10px;
    font-size: 0.95rem;
}

.admin-inline-form {
    display: grid;
    grid-template-columns: 1fr;
    gap: 10px;
}

.admin-mini-btn.is-danger {
    border-color: #ff0000;
    color: #ff0000;
}

#admin-container select,
#admin-container textarea,
#admin-container input[type="number"],
#admin-container input[type="text"],
#admin-container input[type="password"] {
    max-width: 100%;
}

#new-item-link {
    text-transform: none;
}

@media (min-width: 900px) {
    .admin-dual-grid {
        grid-template-columns: 1fr 1fr;
    }

    .admin-inline-form {
        grid-template-columns: 2fr 1fr auto;
        align-items: center;
    }
}


