/* ================================================================
   ASISTENTE PERSONAL UNIVERSAL — DISEÑO FUTURISTA
   ================================================================ */

/* ---- RESET Y BASE ---- */
*, *::before, *::after {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

:root {
    /* Paleta de colores principal */
    --bg-primary: #0A0E1A;
    --bg-secondary: #0D1B2A;
    --bg-tertiary: #1B2838;
    --accent-cyan: #00D4FF;
    --accent-blue: #0088FF;
    --accent-purple: #7B2FFF;
    --accent-green: #00E676;
    --accent-red: #FF1744;
    --text-primary: #FFFFFF;
    --text-secondary: #88CCFF;
    --text-dim: #4A6B8A;
    --glow-cyan: rgba(0, 212, 255, 0.4);
    --glow-blue: rgba(0, 136, 255, 0.3);
    --glow-green: rgba(0, 230, 118, 0.4);
    --glow-red: rgba(255, 23, 68, 0.4);

    /* Tipografía */
    --font-display: 'Orbitron', sans-serif;
    --font-body: 'Rajdhani', sans-serif;

    /* Espaciado */
    --safe-top: env(safe-area-inset-top, 20px);
    --safe-bottom: env(safe-area-inset-bottom, 20px);
}

html, body {
    width: 100%;
    height: 100%;
    overflow: hidden;
    background: var(--bg-primary);
    color: var(--text-primary);
    font-family: var(--font-body);
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    -webkit-tap-highlight-color: transparent;
    user-select: none;
    -webkit-user-select: none;
}

/* ================================================================
   SPLASH SCREEN
   ================================================================ */
.splash-screen {
    position: fixed;
    inset: 0;
    background: var(--bg-primary);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    z-index: 9999;
    transition: opacity 0.8s ease, transform 0.8s ease;
}

.splash-screen.fade-out {
    opacity: 0;
    transform: scale(1.1);
    pointer-events: none;
}

.splash-ring {
    width: 120px;
    height: 120px;
    border: 3px solid transparent;
    border-top-color: var(--accent-cyan);
    border-right-color: var(--accent-blue);
    border-radius: 50%;
    animation: spin 1.5s linear infinite;
    position: absolute;
}

.splash-ring-2 {
    width: 90px;
    height: 90px;
    border-top-color: var(--accent-purple);
    border-right-color: var(--accent-cyan);
    animation-direction: reverse;
    animation-duration: 1s;
}

.splash-text {
    font-family: var(--font-display);
    font-size: 14px;
    letter-spacing: 4px;
    color: var(--accent-cyan);
    margin-top: 100px;
    animation: pulse-text 1.5s ease-in-out infinite;
}

.splash-progress {
    width: 200px;
    height: 2px;
    background: rgba(0, 212, 255, 0.1);
    border-radius: 1px;
    margin-top: 20px;
    overflow: hidden;
}

.splash-progress-bar {
    height: 100%;
    width: 0%;
    background: linear-gradient(90deg, var(--accent-cyan), var(--accent-blue));
    border-radius: 1px;
    transition: width 0.3s ease;
}

/* ================================================================
   PANTALLA PRINCIPAL
   ================================================================ */
.main-screen {
    position: fixed;
    inset: 0;
    background: linear-gradient(160deg,
        var(--bg-primary) 0%,
        var(--bg-secondary) 40%,
        #0F2234 70%,
        var(--bg-tertiary) 100%);
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
}

/* Fondo de partículas */
.particles-bg {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    z-index: 0;
    opacity: 0.6;
}

/* Contenedor del contenido */
.content-wrapper {
    position: relative;
    z-index: 1;
    width: 100%;
    max-width: 420px;
    height: 100%;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: space-between;
    padding: calc(var(--safe-top) + 15px) 20px calc(var(--safe-bottom) + 10px);
}

/* ================================================================
   ENCABEZADO
   ================================================================ */
.header {
    text-align: center;
    width: 100%;
}

.header-line {
    width: 60%;
    height: 1px;
    margin: 8px auto;
    background: linear-gradient(90deg,
        transparent 0%,
        var(--accent-cyan) 50%,
        transparent 100%);
    opacity: 0.5;
}

.title {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 2px;
    cursor: default;
}

.title-line {
    font-family: var(--font-display);
    font-size: clamp(22px, 7vw, 32px);
    font-weight: 900;
    letter-spacing: 4px;
    line-height: 1.1;
    color: var(--text-primary);
    text-shadow: 0 0 15px rgba(0, 212, 255, 0.3);
}

.title-line.accent {
    background: linear-gradient(90deg, var(--accent-cyan), var(--accent-blue), var(--accent-purple));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    filter: drop-shadow(0 0 20px var(--glow-cyan));
}

/* ================================================================
   ESFERA NEURAL
   ================================================================ */
.sphere-section {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    width: 100%;
    position: relative;
}

.sphere-container {
    position: relative;
    width: 260px;
    height: 260px;
    display: flex;
    align-items: center;
    justify-content: center;
}

#neural-sphere {
    position: relative;
    z-index: 2;
    filter: drop-shadow(0 0 30px var(--glow-cyan));
}

/* Anillos orbitales */
.orbit-ring {
    position: absolute;
    border: 1px solid rgba(0, 212, 255, 0.15);
    border-radius: 50%;
    animation: orbit 8s linear infinite;
}

.orbit-1 {
    width: 280px;
    height: 280px;
    border-color: rgba(0, 212, 255, 0.12);
    animation-duration: 10s;
}

.orbit-1::after {
    content: '';
    position: absolute;
    width: 6px;
    height: 6px;
    background: var(--accent-cyan);
    border-radius: 50%;
    top: -3px;
    left: 50%;
    box-shadow: 0 0 10px var(--accent-cyan);
}

.orbit-2 {
    width: 310px;
    height: 310px;
    border-color: rgba(0, 136, 255, 0.08);
    animation-duration: 15s;
    animation-direction: reverse;
}

.orbit-2::after {
    content: '';
    position: absolute;
    width: 4px;
    height: 4px;
    background: var(--accent-blue);
    border-radius: 50%;
    bottom: 10px;
    right: 10px;
    box-shadow: 0 0 8px var(--accent-blue);
}

.orbit-3 {
    width: 340px;
    height: 340px;
    border-color: rgba(123, 47, 255, 0.06);
    animation-duration: 20s;
}

/* Pulso de energía */
.energy-pulse {
    position: absolute;
    width: 200px;
    height: 200px;
    border-radius: 50%;
    border: 2px solid var(--accent-cyan);
    opacity: 0;
    z-index: 1;
    pointer-events: none;
}

.energy-pulse.active {
    animation: energy-burst 2s ease-out infinite;
}

/* Visualizador de audio */
.audio-visualizer {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 4px;
    height: 40px;
    margin-top: 15px;
    opacity: 0;
    transition: opacity 0.5s ease;
}

.audio-visualizer.active {
    opacity: 1;
}

.audio-bar {
    width: 4px;
    height: 8px;
    background: var(--accent-cyan);
    border-radius: 2px;
    transition: height 0.1s ease;
    box-shadow: 0 0 6px var(--glow-cyan);
}

/* ================================================================
   BARRA DE ESTADO
   ================================================================ */
.status-section {
    display: flex;
    align-items: center;
    justify-content: space-between;
    width: 100%;
    padding: 0 10px;
    margin-bottom: 10px;
}

.status-bar {
    display: flex;
    align-items: center;
    gap: 8px;
}

.status-indicator {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--text-dim);
    transition: background 0.3s ease, box-shadow 0.3s ease;
}

.status-indicator.connected {
    background: var(--accent-green);
    box-shadow: 0 0 10px var(--glow-green);
    animation: pulse-dot 2s ease-in-out infinite;
}

.status-indicator.connecting {
    background: #FFB300;
    box-shadow: 0 0 10px rgba(255, 179, 0, 0.4);
    animation: pulse-dot 0.8s ease-in-out infinite;
}

.status-text {
    font-family: var(--font-body);
    font-size: 15px;
    font-weight: 500;
    color: var(--text-secondary);
    letter-spacing: 1px;
}

.timer {
    font-family: var(--font-display);
    font-size: 18px;
    font-weight: 700;
    color: var(--accent-cyan);
    letter-spacing: 2px;
    text-shadow: 0 0 10px var(--glow-cyan);
}

/* ================================================================
   CONTROLES
   ================================================================ */
.controls-section {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 28px;
    padding: 10px 0;
}

.ctrl-btn {
    position: relative;
    border: none;
    border-radius: 50%;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    background: transparent;
    -webkit-tap-highlight-color: transparent;
}

.ctrl-btn:active {
    transform: scale(0.92);
}

/* Botones laterales (VOZ y AGENTES) */
.ctrl-voz, .ctrl-agents {
    width: 64px;
    height: 64px;
    background: rgba(0, 212, 255, 0.06);
    border: 1.5px solid rgba(0, 212, 255, 0.25);
    color: var(--accent-cyan);
}

.ctrl-voz:hover, .ctrl-agents:hover {
    background: rgba(0, 212, 255, 0.12);
    border-color: rgba(0, 212, 255, 0.5);
    box-shadow: 0 0 20px rgba(0, 212, 255, 0.15);
}

.ctrl-btn-glow {
    position: absolute;
    inset: -2px;
    border-radius: 50%;
    background: radial-gradient(circle, var(--glow-cyan) 0%, transparent 70%);
    opacity: 0;
    transition: opacity 0.3s ease;
    z-index: 0;
}

.ctrl-voz:hover .ctrl-btn-glow,
.ctrl-agents:hover .ctrl-btn-glow {
    opacity: 0.3;
}

.ctrl-icon {
    width: 24px;
    height: 24px;
    position: relative;
    z-index: 1;
}

.ctrl-label {
    font-family: var(--font-display);
    font-size: 9px;
    letter-spacing: 2px;
    margin-top: 4px;
    position: relative;
    z-index: 1;
    opacity: 0.8;
}

/* Botón principal de LLAMAR */
.ctrl-call {
    width: 78px;
    height: 78px;
    background: linear-gradient(135deg, #00C853 0%, #00E676 50%, #69F0AE 100%);
    color: white;
    box-shadow:
        0 4px 15px var(--glow-green),
        0 0 40px rgba(0, 200, 83, 0.2),
        inset 0 1px 0 rgba(255, 255, 255, 0.2);
}

.ctrl-call:hover {
    transform: scale(1.08);
    box-shadow:
        0 6px 25px var(--glow-green),
        0 0 60px rgba(0, 200, 83, 0.3),
        inset 0 1px 0 rgba(255, 255, 255, 0.2);
}

.ctrl-icon-call {
    width: 32px;
    height: 32px;
    position: relative;
    z-index: 1;
    transition: transform 0.3s ease;
}

/* Anillos pulsantes del botón de llamar */
.ctrl-btn-ring {
    position: absolute;
    inset: -6px;
    border-radius: 50%;
    border: 2px solid rgba(0, 230, 118, 0.3);
    animation: ring-pulse 2s ease-out infinite;
    z-index: 0;
}

.ctrl-btn-ring-2 {
    inset: -14px;
    border-color: rgba(0, 230, 118, 0.15);
    animation-delay: 0.5s;
}

/* Estado ACTIVO del botón (Colgar) */
.ctrl-call.active {
    background: linear-gradient(135deg, #D50000 0%, #FF1744 50%, #FF5252 100%);
    box-shadow:
        0 4px 15px var(--glow-red),
        0 0 40px rgba(255, 23, 68, 0.2),
        inset 0 1px 0 rgba(255, 255, 255, 0.2);
}

.ctrl-call.active .ctrl-btn-ring {
    border-color: rgba(255, 23, 68, 0.3);
}

.ctrl-call.active .ctrl-btn-ring-2 {
    border-color: rgba(255, 23, 68, 0.15);
}

.ctrl-call.active .ctrl-icon-call {
    transform: rotate(135deg);
}

/* ================================================================
   BARRA INFERIOR
   ================================================================ */
.bottom-bar {
    display: flex;
    align-items: center;
    gap: 12px;
    width: 100%;
    opacity: 0.4;
}

.bottom-line {
    flex: 1;
    height: 1px;
    background: linear-gradient(90deg, transparent, var(--text-dim), transparent);
}

.version-text {
    font-family: var(--font-body);
    font-size: 11px;
    color: var(--text-dim);
    letter-spacing: 1px;
    white-space: nowrap;
}

/* ================================================================
   MODAL DE ADMIN
   ================================================================ */
.admin-modal {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.85);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 8000;
    padding: 20px;
    animation: fadeIn 0.3s ease;
}

.admin-card {
    background: linear-gradient(135deg, var(--bg-secondary), var(--bg-tertiary));
    border: 1px solid rgba(0, 212, 255, 0.2);
    border-radius: 16px;
    padding: 30px;
    width: 100%;
    max-width: 340px;
    text-align: center;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.5);
}

.admin-header {
    margin-bottom: 5px;
}

.admin-lock-icon {
    width: 40px;
    height: 40px;
    color: var(--accent-cyan);
    margin-bottom: 10px;
}

.admin-card h2 {
    font-family: var(--font-display);
    font-size: 14px;
    font-weight: 700;
    color: var(--text-primary);
    letter-spacing: 2px;
    margin-bottom: 20px;
}

.admin-input {
    width: 100%;
    padding: 12px 16px;
    background: rgba(0, 0, 0, 0.3);
    border: 1px solid rgba(0, 212, 255, 0.2);
    border-radius: 8px;
    color: var(--text-primary);
    font-family: var(--font-body);
    font-size: 16px;
    outline: none;
    transition: border-color 0.3s ease;
    text-align: center;
    letter-spacing: 4px;
}

.admin-input:focus {
    border-color: var(--accent-cyan);
    box-shadow: 0 0 15px rgba(0, 212, 255, 0.1);
}

.admin-buttons {
    display: flex;
    gap: 10px;
    margin-top: 20px;
}

.admin-btn {
    flex: 1;
    padding: 10px;
    border: none;
    border-radius: 8px;
    font-family: var(--font-display);
    font-size: 12px;
    font-weight: 700;
    letter-spacing: 1px;
    cursor: pointer;
    transition: all 0.3s ease;
}

.admin-btn-cancel {
    background: rgba(255, 255, 255, 0.05);
    color: var(--text-dim);
    border: 1px solid rgba(255, 255, 255, 0.1);
}

.admin-btn-cancel:hover {
    background: rgba(255, 255, 255, 0.1);
    color: var(--text-secondary);
}

.admin-btn-enter {
    background: linear-gradient(135deg, var(--accent-cyan), var(--accent-blue));
    color: white;
}

.admin-btn-enter:hover {
    box-shadow: 0 4px 20px var(--glow-cyan);
    transform: translateY(-1px);
}

.admin-hint {
    margin-top: 12px;
    font-size: 13px;
    color: var(--accent-red);
    font-weight: 600;
    animation: shake 0.4s ease;
}

/* ================================================================
   VISTA DE ADMIN
   ================================================================ */
.admin-view {
    position: fixed;
    inset: 0;
    z-index: 7000;
    display: flex;
    flex-direction: column;
    background: var(--bg-primary);
}

.admin-toolbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 10px 16px;
    background: var(--bg-secondary);
    border-bottom: 1px solid rgba(0, 212, 255, 0.2);
    min-height: 44px;
}

.admin-toolbar-title {
    font-family: var(--font-display);
    font-size: 12px;
    color: var(--accent-cyan);
    letter-spacing: 1px;
}

.admin-toolbar-btn {
    padding: 6px 14px;
    background: rgba(255, 23, 68, 0.1);
    border: 1px solid rgba(255, 23, 68, 0.3);
    border-radius: 6px;
    color: var(--accent-red);
    font-family: var(--font-display);
    font-size: 11px;
    cursor: pointer;
    transition: all 0.3s ease;
}

.admin-toolbar-btn:hover {
    background: rgba(255, 23, 68, 0.2);
}

.gemini-frame {
    flex: 1;
    width: 100%;
    border: none;
}

.admin-content {
    flex: 1;
    width: 100%;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    background: #0D1B2A;
    padding: 30px;
}

.admin-open-btn {
    color: #FFFFFF;
    font-size: 18px;
    font-weight: bold;
    font-family: var(--font-display);
    text-decoration: none;
    padding: 20px 45px;
    background: linear-gradient(135deg, #00C853, #00E676);
    border-radius: 14px;
    display: inline-block;
    box-shadow: 0 4px 25px rgba(0, 200, 83, 0.4);
    transition: transform 0.2s ease, box-shadow 0.2s ease;
    letter-spacing: 1px;
}

.admin-open-btn:hover {
    transform: scale(1.05);
    box-shadow: 0 6px 35px rgba(0, 200, 83, 0.6);
}

.admin-open-btn:active {
    transform: scale(0.97);
}

.gemini-hidden {
    border: none;
}

/* ================================================================
   ANIMACIONES
   ================================================================ */
@keyframes spin {
    from { transform: rotate(0deg); }
    to { transform: rotate(360deg); }
}

@keyframes orbit {
    from { transform: rotate(0deg); }
    to { transform: rotate(360deg); }
}

@keyframes pulse-text {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.4; }
}

@keyframes pulse-dot {
    0%, 100% { transform: scale(1); opacity: 1; }
    50% { transform: scale(1.3); opacity: 0.7; }
}

@keyframes ring-pulse {
    0% { transform: scale(1); opacity: 0.6; }
    100% { transform: scale(1.5); opacity: 0; }
}

@keyframes energy-burst {
    0% { transform: scale(0.8); opacity: 0.6; }
    100% { transform: scale(2); opacity: 0; }
}

@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

@keyframes shake {
    0%, 100% { transform: translateX(0); }
    25% { transform: translateX(-8px); }
    50% { transform: translateX(8px); }
    75% { transform: translateX(-4px); }
}

/* ================================================================
   RESPONSIVE
   ================================================================ */
@media (max-height: 650px) {
    .sphere-container {
        width: 200px;
        height: 200px;
    }

    #neural-sphere {
        width: 200px !important;
        height: 200px !important;
    }

    .orbit-1 { width: 220px; height: 220px; }
    .orbit-2 { width: 240px; height: 240px; }
    .orbit-3 { width: 260px; height: 260px; }

    .title-line { font-size: 22px; }
}

@media (max-height: 550px) {
    .header-line { display: none; }
    .orbit-ring { display: none; }
    .bottom-bar { display: none; }
}

@media (min-width: 768px) {
    .content-wrapper {
        max-width: 480px;
    }
}
