/* STYLE.CSS - Estilos de monitor retro CRT en pantalla completa y panel lateral glassmorphic */

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

@font-face {
    font-family: 'C64ProMono';
    src: url('C64_Pro_Mono-STYLE.ttf') format('truetype');
    font-weight: normal;
    font-style: normal;
    font-display: swap;
}

:root {
    --c64-black: #000000;
    --c64-white: #FFFFFF;
    --c64-red: #880000;
    --c64-cyan: #AABBEE;
    --c64-purple: #CC44CC;
    --c64-green: #00CC55;
    --c64-blue: #0000AA;
    --c64-yellow: #EEEE77;
    --c64-orange: #DD8855;
    --c64-brown: #664400;
    --c64-light-red: #FF7777;
    --c64-dark-grey: #333333;
    --c64-grey: #777777;
    --c64-light-green: #AAFF66;
    --c64-light-blue: #0088FF;
    --c64-light-grey: #BBBBBB;

    --font-pixel: 'C64ProMono', 'Press Start 2P', 'Courier New', monospace;
    --font-retro: 'VT323', Consolas, monospace;
    
    --card-bg: rgba(10, 10, 20, 0.72);
    --border-color: rgba(255, 255, 255, 0.08);
    --transition-speed: 0.4s;
    --transition-curve: cubic-bezier(0.16, 1, 0.3, 1);
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
    user-select: none;
    -webkit-user-drag: none;
}

body, html {
    width: 100%;
    height: 100%;
    overflow: hidden;
    background-color: var(--c64-black);
    font-family: 'Outfit', sans-serif;
    color: var(--c64-light-grey);
    display: flex;
    flex-direction: row;
    align-items: stretch;
    margin: 0;
    padding: 0;
}

/* Contenedor CRT Pantalla Completa */
.crt-monitor-fullscreen {
    position: relative;
    flex: 1;
    height: 100vh;
    overflow: hidden;
    z-index: 1;
    border: 16px solid var(--c64-blue); /* Ajustado dinámicamente por JS */
    box-sizing: border-box;
    transition: border-color 0.3s ease, box-shadow 0.3s ease;
    background-color: var(--c64-black);
}

#simulation-canvas {
    width: 100%;
    height: 100%;
    display: block;
    image-rendering: pixelated;
    image-rendering: crisp-edges;
    cursor: crosshair;
}

/* Filtros CRT */
.scanlines {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: linear-gradient(
        rgba(18, 16, 16, 0) 50%, 
        rgba(0, 0, 0, 0.25) 50%
    );
    background-size: 100% 4px;
    pointer-events: none;
    z-index: 2;
}

.crt-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: radial-gradient(
        circle, 
        rgba(255, 255, 255, 0.04) 0%, 
        rgba(0, 0, 0, 0.35) 100%
    );
    pointer-events: none;
    z-index: 3;
}

/* Telemetría Flotante Superior (HUD) */
.c64-hud-overlay {
    position: absolute;
    top: 2rem;
    left: 2rem;
    right: 2rem;
    z-index: 5;
    background-color: rgba(0, 0, 0, 0.65);
    backdrop-filter: blur(5px);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    padding: 0.6rem 1.2rem;
    display: flex;
    flex-direction: column;
    gap: 0.4rem;
    transition: opacity var(--transition-speed) var(--transition-curve);
    pointer-events: auto;
}

.hud-top-row {
    display: flex;
    align-items: center;
    gap: 1.5rem;
    width: 100%;
}

.hud-news-row {
    width: 100%;
    border-top: 1px dashed rgba(255, 255, 255, 0.12);
    padding-top: 0.4rem;
    display: flex;
    align-items: center;
}

.news-ticker {
    color: var(--c64-yellow);
    font-family: var(--font-pixel);
    font-size: 0.75rem;
    -webkit-font-smoothing: none;
    -moz-osx-font-smoothing: none;
    font-smoothing: none;
    text-rendering: optimizeSpeed;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    text-shadow: 0 0 4px rgba(238, 238, 119, 0.3);
}

.news-ticker.default-status {
    color: var(--c64-light-blue);
    text-shadow: 0 0 4px rgba(0, 136, 255, 0.3);
}

.btn-back {
    font-family: var(--font-pixel);
    font-size: 0.65rem;
    -webkit-font-smoothing: none;
    -moz-osx-font-smoothing: none;
    font-smoothing: none;
    text-rendering: optimizeSpeed;
    color: var(--c64-white);
    background-color: var(--c64-red);
    border: 2px solid var(--c64-light-red);
    border-radius: 4px;
    padding: 0.25rem 0.65rem;
    text-decoration: none;
    transition: all 0.2s ease;
    flex-shrink: 0;
    pointer-events: auto;
}

.btn-back:hover {
    background-color: var(--c64-light-red);
    color: var(--c64-black);
    box-shadow: 0 0 10px var(--c64-light-red);
}

.telemetry-ticker {
    color: var(--c64-light-green);
    font-family: var(--font-pixel);
    font-size: 0.9rem;
    -webkit-font-smoothing: none;
    -moz-osx-font-smoothing: none;
    font-smoothing: none;
    text-rendering: optimizeSpeed;
    letter-spacing: 0.5px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    text-shadow: 0 0 4px rgba(170, 255, 102, 0.3);
}

/* Botón flotante para mostrar/ocultar los ajustes */
.toggle-ui-btn {
    display: none !important;
}

/* Panel Lateral Glassmorphic */
.settings-panel {
    position: relative;
    width: 320px;
    height: 100vh;
    z-index: 10;
    background: var(--card-bg);
    backdrop-filter: blur(20px) saturate(185%);
    -webkit-backdrop-filter: blur(20px) saturate(185%);
    border-left: 1px solid var(--border-color);
    display: flex;
    flex-direction: column;
    overflow: hidden;
    box-shadow: -10px 0 30px rgba(0, 0, 0, 0.4);
    flex-shrink: 0;
}

.settings-header {
    padding: 0.8rem 1rem;
    border-bottom: 1px solid var(--border-color);
    display: flex;
    align-items: center;
    justify-content: space-between;
    background-color: rgba(0, 0, 0, 0.2);
}

.settings-title {
    font-family: var(--font-pixel);
    font-size: 0.65rem;
    letter-spacing: 0.5px;
    color: var(--c64-cyan);
    text-shadow: 0 0 8px rgba(170, 187, 238, 0.5);
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.pin-btn {
    display: none !important;
}

.settings-content {
    flex: 1;
    overflow-y: auto;
    padding: 1rem;
    display: flex;
    flex-direction: column;
    gap: 1.25rem;
}

/* Scrollbar styling */
.settings-content::-webkit-scrollbar {
    width: 6px;
}
.settings-content::-webkit-scrollbar-track {
    background: transparent;
}
.settings-content::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.1);
    border-radius: 10px;
}
.settings-content::-webkit-scrollbar-thumb:hover {
    background: rgba(255, 255, 255, 0.25);
}

.setting-group {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.setting-label {
    font-family: var(--font-pixel);
    font-size: 0.55rem;
    letter-spacing: 0.5px;
    color: var(--c64-grey);
    text-transform: uppercase;
}

.btn-row-glass {
    display: flex;
    flex-wrap: wrap;
    gap: 0.4rem;
}

.vertical-btn-row {
    flex-direction: column;
}

.btn-retro-glass {
    background-color: rgba(255, 255, 255, 0.04);
    color: var(--c64-white);
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 6px;
    font-family: var(--font-retro);
    font-size: 1.0rem;
    padding: 0.35rem 0.45rem;
    cursor: pointer;
    transition: all 0.2s ease;
    text-align: center;
    flex: 1;
    min-width: 60px;
    white-space: nowrap;
}

#btn-reset-era {
    background-color: rgba(0, 136, 255, 0.15);
    border-color: rgba(0, 136, 255, 0.3);
    color: var(--c64-cyan);
    margin-top: 0.25rem;
}

#btn-reset-era:hover {
    background-color: rgba(0, 136, 255, 0.25);
    border-color: var(--c64-light-blue);
    box-shadow: 0 0 10px rgba(0, 136, 255, 0.4);
}

.btn-retro-glass:hover {
    background-color: rgba(255, 255, 255, 0.08);
    border-color: rgba(255, 255, 255, 0.2);
}

.btn-retro-glass:active {
    transform: translateY(1px);
}

.btn-retro-glass.active {
    background-color: rgba(0, 136, 255, 0.2);
    border-color: var(--c64-light-blue);
    color: var(--c64-white);
    box-shadow: 0 0 10px rgba(0, 136, 255, 0.3);
}

#btn-pause.active {
    background-color: rgba(136, 0, 0, 0.3);
    border-color: var(--c64-light-red);
    box-shadow: 0 0 10px rgba(136, 0, 0, 0.3);
}

.settings-divider {
    height: 1px;
    background: rgba(255, 255, 255, 0.08);
    margin: 0.25rem 0;
}

/* Panel de Información / Microscopio */
.retro-panel-glass {
    background-color: rgba(0, 0, 0, 0.3);
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 8px;
    padding: 0.8rem;
}

.info-panel-glass {
    border-color: rgba(221, 136, 85, 0.2);
}

.panel-title-glass {
    font-family: var(--font-pixel);
    font-size: 0.55rem;
    color: var(--c64-cyan);
    margin-bottom: 0.6rem;
    border-bottom: 1px solid rgba(255, 255, 255, 0.08);
    padding-bottom: 0.4rem;
}

.info-panel-glass .panel-title-glass {
    color: var(--c64-orange);
}

.stats-grid-glass {
    display: flex;
    flex-direction: column;
    gap: 0.3rem;
}

.stat-row-glass {
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 1.15rem;
    font-family: var(--font-retro);
}

.stat-label-glass {
    color: var(--c64-grey);
}

.stat-value-glass {
    color: var(--c64-white);
}

.settings-footer {
    padding: 0.6rem 1rem;
    border-top: 1px solid var(--border-color);
    font-size: 0.72rem;
    color: var(--c64-grey);
    text-align: center;
    line-height: 1.4;
    background: rgba(0, 0, 0, 0.15);
}

/* Alerta de Extinción */
.extinction-alert {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background-color: rgba(136, 0, 0, 0.85);
    backdrop-filter: blur(10px);
    border: 3px solid var(--c64-white);
    border-radius: 12px;
    padding: 1.5rem;
    text-align: center;
    color: var(--c64-white);
    font-family: var(--font-pixel);
    font-size: 0.75rem;
    z-index: 5;
    box-shadow: 0 20px 50px rgba(0,0,0,0.8);
    max-width: 90%;
    width: 400px;
}

.extinction-alert p {
    margin-top: 1rem;
    font-family: var(--font-retro);
    font-size: 1.25rem;
}

.extinction-alert p.small {
    font-size: 1rem;
    color: var(--c64-yellow);
    margin-top: 0.5rem;
}

.blink-text {
    animation: blinker 0.8s linear infinite;
    color: var(--c64-yellow);
    font-size: 0.8rem;
    font-weight: bold;
}

@keyframes blinker {
    50% { opacity: 0; }
}

/* Clases de Utilidad de Colores */
.text-green { color: var(--c64-green); }
.text-purple { color: var(--c64-purple); }
.text-yellow { color: var(--c64-yellow); }
.text-cyan { color: var(--c64-cyan); }
.text-orange { color: var(--c64-orange); }
.text-grey { color: var(--c64-grey); }
.text-white { color: var(--c64-white); }

/* SVG inline */
.icon-svg {
    width: 16px;
    height: 16px;
    fill: currentColor;
    vertical-align: middle;
}

/* Ocultado Automático de UI */
body.hide-ui {
    cursor: none;
}

/* Chat de Nitas */
.chat-row-glass {
    margin-top: 0.6rem;
    border-top: 1px dashed rgba(255, 255, 255, 0.1);
    padding-top: 0.6rem;
    display: flex;
    align-items: center;
    gap: 0.4rem;
}
.chat-input-glass {
    flex: 1;
    background: rgba(0, 0, 0, 0.5);
    border: 1px solid rgba(255, 255, 255, 0.15);
    border-radius: 4px;
    color: var(--c64-cyan);
    font-family: var(--font-retro);
    font-size: 0.85rem;
    padding: 0.2rem 0.4rem;
    outline: none;
}
.chat-input-glass:focus {
    border-color: var(--c64-cyan);
    box-shadow: 0 0 5px rgba(0, 136, 255, 0.3);
}

/* Botones de Terminal de Extinción */
.extinction-btn {
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.2);
    color: var(--c64-white);
    font-family: var(--font-retro);
    font-size: 0.9rem;
    padding: 0.4rem 0.6rem;
    text-align: left;
    cursor: pointer;
    border-radius: 4px;
    transition: all 0.15s ease;
    outline: none;
}
.extinction-btn:hover {
    background: rgba(0, 136, 255, 0.2);
    border-color: var(--c64-cyan);
    color: var(--c64-cyan);
    box-shadow: 0 0 8px rgba(0, 136, 255, 0.3);
}

/* Checkbox Glassmorphic */
.checkbox-container-glass {
    display: flex;
    align-items: center;
    cursor: pointer;
    font-family: var(--font-retro);
    font-size: 0.95rem;
    color: var(--c64-white);
    user-select: none;
    margin-top: 0.25rem;
    gap: 0.5rem;
}
.checkbox-container-glass input {
    cursor: pointer;
    accent-color: var(--c64-cyan);
    width: 16px;
    height: 16px;
}
.checkbox-text-glass {
    line-height: 1;
}

/* Footer de Adaptaciones de Era Anterior */
.c64-adaptations-footer {
    position: absolute;
    bottom: 12px;
    left: 50%;
    transform: translateX(-50%);
    background-color: rgba(0, 0, 0, 0.7);
    border: 1px solid var(--c64-light-blue);
    padding: 0.35rem 0.75rem;
    font-family: var(--font-retro);
    font-size: 0.75rem;
    color: var(--c64-white);
    display: flex;
    gap: 0.6rem;
    align-items: center;
    border-radius: 4px;
    z-index: 100;
    pointer-events: none;
    text-transform: uppercase;
    box-shadow: 0 0 10px rgba(0, 0, 0, 0.5);
    transition: opacity 0.3s ease, visibility 0.3s ease;
}

body.hide-ui .c64-adaptations-footer {
    opacity: 1.0;
}

/* Chat flotante directamente sobre el terrario */
.canvas-chat-box {
    position: absolute;
    bottom: 50px;
    left: 50%;
    transform: translateX(-50%);
    background: rgba(10, 10, 30, 0.92);
    border: 2px solid var(--c64-light-blue);
    border-radius: 4px;
    padding: 6px 12px;
    display: flex;
    align-items: center;
    gap: 8px;
    z-index: 110;
    box-shadow: 0 0 15px rgba(0, 0, 0, 0.8), inset 0 0 4px var(--c64-light-blue);
    font-family: 'C64ProMono', 'Courier New', monospace;
    font-size: 0.85rem;
    color: var(--c64-white);
}

.chat-prefix {
    color: var(--c64-yellow);
    font-weight: bold;
}

.canvas-chat-box input[type="text"] {
    background: rgba(0, 0, 0, 0.6);
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 3px;
    color: var(--c64-white);
    font-family: inherit;
    font-size: 0.85rem;
    padding: 3px 6px;
    outline: none;
    width: 240px;
}

.canvas-chat-box input[type="text"]:focus {
    border-color: var(--c64-light-blue);
    box-shadow: 0 0 5px rgba(124, 112, 218, 0.5);
}

.btn-chat-send {
    background: var(--c64-blue);
    border: 1px solid var(--c64-light-blue);
    border-radius: 3px;
    color: var(--c64-white);
    font-family: inherit;
    font-size: 0.75rem;
    padding: 3px 8px;
    cursor: pointer;
    text-transform: uppercase;
}

.btn-chat-send:hover {
    background: var(--c64-light-blue);
    color: var(--c64-blue);
}

/* Envoltura y Lista de Sugerencias */
.chat-input-wrapper {
    position: relative;
    display: inline-block;
}

.chat-suggestions-list {
    position: absolute;
    bottom: 100%;
    left: 0;
    width: 100%;
    min-width: 200px;
    background: rgba(10, 10, 30, 0.95);
    border: 2px solid var(--c64-light-blue);
    border-radius: 4px;
    margin-bottom: 8px;
    box-shadow: 0 -5px 15px rgba(0, 0, 0, 0.8), inset 0 0 5px rgba(124, 112, 218, 0.3);
    display: flex;
    flex-direction: column;
    z-index: 120;
    max-height: 180px;
    overflow-y: auto;
}

/* Scrollbar retro para el dropup */
.chat-suggestions-list::-webkit-scrollbar {
    width: 6px;
}
.chat-suggestions-list::-webkit-scrollbar-track {
    background: rgba(0, 0, 0, 0.5);
}
.chat-suggestions-list::-webkit-scrollbar-thumb {
    background: var(--c64-light-blue);
    border-radius: 2px;
}

.suggestion-item {
    padding: 6px 10px;
    cursor: pointer;
    font-size: 0.72rem;
    color: var(--c64-white);
    text-transform: uppercase;
    text-align: left;
    transition: background 0.1s, color 0.1s;
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
}

.suggestion-item:hover {
    background: var(--c64-light-blue);
    color: var(--c64-blue);
}

.suggestion-item-info {
    padding: 6px 10px;
    font-size: 0.62rem;
    color: var(--c64-grey);
    text-align: center;
    background: rgba(0, 0, 0, 0.4);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    border-top: 1px dashed rgba(255, 255, 255, 0.1);
}

/* Bocadillos de diálogo renderizados en HTML (arriba de scanlines / sin CRT filter) */
.retro-speech-bubble {
    position: absolute;
    background-color: var(--c64-blue);
    border: 1px solid var(--c64-light-blue);
    color: var(--c64-white);
    font-family: 'C64ProMono', 'Courier New', monospace;
    font-size: 9px; /* Cuerpo ajustado a 8px de pantalla física */
    line-height: 1;
    padding: 1px 2px;
    border-radius: 0px;
    white-space: nowrap;
    pointer-events: none;
    transform: translate(-50%, -100%);
    box-shadow: 2px 2px 0px rgba(0, 0, 0, 0.6);
    z-index: 100;
}
