/* ========================================
   SEÑAS CONNECT - Diseño Futurista Monocromático
   ======================================== */

:root {
    /* Paleta de colores */
    --bg-dark: #0a0a0f;
    --bg-card: #12121a;
    --border: #2a2a3a;
    --text-primary: #ffffff;
    --text-secondary: #8888aa;
    --accent: #00d4ff;
    --success: #00ff88;
    --danger: #ff4466;
    --warning: #ffaa00;
    --glass: rgba(255, 255, 255, 0.03);
    --glass-border: rgba(255, 255, 255, 0.08);
}

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

html, body {
    height: 100%;
    overflow: hidden;
}

body {
    font-family: 'Segoe UI', -apple-system, sans-serif;
    background: var(--bg-dark);
    color: var(--text-primary);
    display: flex;
    flex-direction: column;
}

.hidden { display: none !important; }

/* ========================================
   CONTENEDOR PRINCIPAL DE LA APP
   ======================================== */
.app-container {
    display: flex;
    flex-direction: column;
    height: 100vh;
    padding: 10px;
    gap: 10px;
}

.app-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 10px 16px;
    background: var(--glass);
    border: 1px solid var(--glass-border);
    border-radius: 12px;
    flex-shrink: 0;
}

.app-header h1 {
    font-size: 1rem;
    color: var(--accent);
}

/* ========================================
   CONTENIDO PRINCIPAL Y PANELES COLAPSABLES
   ======================================== */
.main-content {
    flex: 1;
    display: grid;
    grid-template-columns: 1fr auto 1fr;
    gap: 10px;
    min-height: 0;
    transition: grid-template-columns 0.3s ease-in-out;
}

/* Estados de los paneles */
.main-content.left-minimized {
    grid-template-columns: 60px auto 1fr;
}

.main-content.right-minimized {
    grid-template-columns: 1fr auto 60px;
}

.panel {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 16px;
    padding: 14px;
    display: flex;
    flex-direction: column;
    gap: 12px;
    overflow-y: auto;
    transition: padding 0.3s ease;
}

.panel.minimized {
    overflow: hidden;
    padding: 10px 0;
    cursor: pointer;
}

.panel.minimized > *:not(.panel-header) {
    display: none;
}

.panel.minimized .panel-header {
    height: 100%;
}

.panel.minimized .panel-header h2 {
    writing-mode: vertical-rl;
    transform: rotate(180deg);
    margin: auto;
    font-size: 1.1rem;
}

.panel.minimized .panel-header .panel-subtitle {
    display: none;
}

.panel.minimized .btn-toggle-panel {
    display: none; /* Ocultar el botón cuando ya está minimizado */
}

.panel-separator {
    display: flex;
    align-items: center;
    justify-content: center;
}

.panel-header {
    text-align: center;
    position: relative;
}

.panel-header h2 {
    color: var(--accent);
}

/* Botón para minimizar/maximizar */
.btn-toggle-panel {
    position: absolute;
    top: -4px;
    right: -4px;
    background: var(--border);
    color: var(--text-secondary);
    border: none;
    width: 28px;
    height: 28px;
    border-radius: 8px;
    cursor: pointer;
    font-size: 20px;
    line-height: 28px;
    padding: 0;
    z-index: 10;
    transition: background-color 0.2s, color 0.2s;
}

.btn-toggle-panel:hover {
    background-color: var(--accent);
    color: var(--bg-dark);
}

/* ========================================
   COMPONENTES (CÁMARA, BOTONES, ETC.)
   ======================================== */
.camera-container {
    position: relative;
    background: #000;
    border-radius: 12px;
    overflow: hidden;
    width: 100%;
    flex: 1; /* Permitir que crezca y ocupe el espacio */
    display: flex; /* Centrar el video dentro */
    align-items: center;
    justify-content: center;
}

.camera-video, .camera-canvas {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    object-fit: contain; /* <-- CAMBIO CLAVE: Mantiene la proporción, sin estirar */
}

.camera-video { transform: scaleX(-1); }
.camera-canvas { transform: scaleX(-1); }

.output-text {
    background: var(--bg-dark);
    border-radius: 8px;
    padding: 12px;
    text-align: center;
    font-size: 1.2rem;
    min-height: 50px;
}

.voice-text-container {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 1rem;
    font-size: 1.5rem;
    text-align: center;
}

.btn {
    padding: 12px 18px;
    border-radius: 8px;
    border: none;
    cursor: pointer;
    font-weight: 600;
}

.btn-primary {
    background-color: var(--accent);
    color: var(--bg-dark);
}

.btn-secondary {
    background-color: var(--border);
    color: var(--text-primary);
}

.btn-danger {
    background-color: var(--danger);
    color: white;
}

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

.controls-group {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
}

.controls-group .btn {
    flex: 1 1 auto;
}

.modal {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.8);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    padding: 16px;
}

.modal-content {
    background: var(--bg-card);
    padding: 24px;
    border-radius: 16px;
    max-width: 500px;
    width: 100%;
}

/* ========================================
   DISEÑO RESPONSIVE PARA MÓVILES
   ======================================== */
@media (max-width: 768px) {
    html, body {
        height: auto;
        overflow: auto;
    }

    .app-container {
        height: auto;
        padding: 8px;
    }

    .main-content,
    .main-content.left-minimized,
    .main-content.right-minimized {
        grid-template-columns: 1fr;
        grid-template-rows: auto auto auto;
        height: auto;
    }
    
    .panel.minimized {
        display: none; /* En móvil, simplemente ocultamos el panel minimizado */
    }

    .panel-separator {
        transform: rotate(90deg);
        margin: 10px 0;
    }

    .panel {
        overflow-y: visible;
        min-height: auto;
        border: none;
    }

    .camera-container {
        aspect-ratio: 16 / 9; /* Mantener en móvil para consistencia */
    }

    .voice-text-container {
        font-size: 1.2rem;
        min-height: 100px;
    }

    .app-header h1 {
        font-size: 0.9rem;
    }

    .btn {
        padding: 14px 16px;
    }

    .btn-toggle-panel {
        display: none; /* No necesitamos los botones en móvil */
    }
}
