:root {
    --bg-color: #1a202c;
    --panel-bg: rgba(26, 38, 52, 0.85);
    --panel-border: #3b4e68;
    --text-primary: #e2e8f0;
    --text-secondary: #94a3b8;
    --accent-color: #38bdf8;
    --button-bg: #e2e8f0;
    --button-text: #1e293b;
    --input-bg: #0f172a;
    --success: #4ade80;
    --danger: #f87171;
    --font-main: 'Inter', sans-serif;
    --font-heading: 'Teko', sans-serif;
}

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

body {
    background-color: var(--bg-color);
    color: var(--text-primary);
    font-family: var(--font-main);
    height: 100vh;
    display: flex;
    justify-content: center;
    align-items: center;
    overflow: hidden;
    position: relative;
}

/* Fondo decorativo */
.background-grid {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-image: 
        linear-gradient(rgba(59, 78, 104, 0.1) 1px, transparent 1px),
        linear-gradient(90deg, rgba(59, 78, 104, 0.1) 1px, transparent 1px);
    background-size: 40px 40px;
    z-index: -1;
}

/* Utilidades SPA */
.screen {
    display: none;
    width: 100%;
    height: 100%;
    justify-content: center;
    align-items: center;
    animation: fadeIn 0.4s ease-out forwards;
}
.screen.active {
    display: flex;
}
.hidden {
    display: none !important;
}

@keyframes fadeIn {
    from { opacity: 0; transform: scale(0.98); }
    to { opacity: 1; transform: scale(1); }
}

/* Paneles */
.panel {
    background: var(--panel-bg);
    border: 1px solid var(--panel-border);
    border-radius: 12px;
    padding: 30px;
    box-shadow: 0 10px 30px rgba(0,0,0,0.5);
    backdrop-filter: blur(10px);
}

.login-panel { width: 400px; }
.menu-panel { width: 500px; text-align: center; }
.chat-panel { width: 600px; height: 80vh; display: flex; flex-direction: column; }

/* Tipografía y Textos */
h1, h2, h3 { font-family: var(--font-heading); text-transform: uppercase; letter-spacing: 1px; }
.logo { font-size: 3rem; text-align: center; margin-bottom: 20px; text-shadow: 0 0 10px rgba(56, 189, 248, 0.5); }
.logo-small { font-family: var(--font-heading); font-size: 1.5rem; }
.panel-header { text-align: center; font-size: 1.8rem; margin-bottom: 5px; }
.panel-sub { text-align: center; color: var(--text-secondary); font-size: 0.9rem; margin-bottom: 20px; }
.subtitle { font-size: 1.2rem; font-weight: 600; margin-bottom: 10px; }
.small-text { font-size: 0.8rem; color: var(--text-secondary); }

/* Botones y Formularios */
.inner-box { background: rgba(0,0,0,0.2); padding: 20px; border-radius: 8px; border: 1px solid var(--panel-border); }
.form-group { margin-bottom: 15px; }
.form-group label { display: block; font-size: 0.8rem; font-weight: 600; margin-bottom: 5px; color: var(--text-secondary); text-transform: uppercase; }
input[type="text"], input[type="password"] {
    width: 100%;
    padding: 12px;
    background: var(--input-bg);
    border: 1px solid var(--panel-border);
    color: white;
    border-radius: 6px;
    outline: none;
    transition: border 0.3s;
}
input:focus { border-color: var(--accent-color); }
.password-wrapper { position: relative; }
.icon-btn { position: absolute; right: 10px; top: 50%; transform: translateY(-50%); background: none; border: none; cursor: pointer; font-size: 1.2rem; }

.form-options { display: flex; justify-content: space-between; font-size: 0.8rem; color: var(--text-secondary); margin-top: 10px; }
.form-options a { color: var(--text-secondary); text-decoration: none; }
.form-options a:hover { color: white; }

.primary-btn {
    width: 100%;
    padding: 12px;
    background: var(--button-bg);
    color: var(--button-text);
    border: none;
    border-radius: 6px;
    font-weight: bold;
    cursor: pointer;
    text-transform: uppercase;
    transition: all 0.3s;
}
.primary-btn:hover { background: white; transform: translateY(-2px); }
.mt-20 { margin-top: 20px; }

/* Menú Principal */
.top-bar { display: flex; justify-content: space-between; align-items: center; border-bottom: 1px solid var(--panel-border); padding-bottom: 10px; margin-bottom: 20px; }
.status { font-size: 0.8rem; font-weight: bold; color: var(--text-secondary); }
.online { color: var(--success); }

.ai-orb {
    width: 120px;
    height: 120px;
    margin: 30px auto;
    position: relative;
    display: flex;
    justify-content: center;
    align-items: center;
}
.orb-core {
    width: 80px;
    height: 80px;
    background: radial-gradient(circle, rgba(56,189,248,0.8) 0%, rgba(15,23,42,1) 100%);
    border-radius: 50%;
    display: flex;
    justify-content: center;
    align-items: center;
    font-family: var(--font-heading);
    font-size: 2rem;
    color: white;
    box-shadow: 0 0 20px var(--accent-color);
    z-index: 2;
}
.orb-ring {
    position: absolute;
    width: 100%;
    height: 100%;
    border: 2px solid rgba(56, 189, 248, 0.3);
    border-radius: 50%;
    animation: pulse 2s infinite linear;
}
@keyframes pulse {
    0% { transform: scale(0.9); opacity: 1; }
    100% { transform: scale(1.3); opacity: 0; }
}

.go-chat-box {
    background: var(--button-bg);
    color: var(--button-text);
    padding: 15px;
    border-radius: 6px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    cursor: pointer;
    font-weight: 600;
    font-size: 0.9rem;
    transition: 0.3s;
}
.go-chat-box:hover { background: white; }

.options-grid {
    display: grid;
    grid-template-columns: 1fr 1fr 1fr;
    gap: 10px;
}
.option-card {
    background: var(--input-bg);
    border: 1px solid var(--panel-border);
    padding: 15px 5px;
    border-radius: 6px;
    cursor: pointer;
    transition: 0.3s;
}
.option-card:hover { border-color: var(--accent-color); background: rgba(56, 189, 248, 0.1); }
.option-card h3 { font-size: 1rem; margin: 0; }

/* Chat Interface */
.back-btn { background: none; border: none; color: var(--text-secondary); cursor: pointer; font-weight: bold; }
.back-btn:hover { color: white; }

.chat-container {
    flex: 1;
    overflow-y: auto;
    padding: 10px;
    margin-bottom: 20px;
    display: flex;
    flex-direction: column;
    gap: 15px;
}

.chat-container::-webkit-scrollbar { width: 6px; }
.chat-container::-webkit-scrollbar-thumb { background: var(--panel-border); border-radius: 3px; }

.message { display: flex; align-items: flex-start; gap: 10px; max-width: 85%; }
.message.user { align-self: flex-end; flex-direction: row-reverse; }
.message .avatar { width: 35px; height: 35px; border-radius: 50%; background: var(--panel-border); display: flex; justify-content: center; align-items: center; font-size: 0.8rem; font-weight: bold; flex-shrink: 0;}
.message.ai .avatar { background: var(--accent-color); color: #000; }
.message.user .avatar { background: var(--success); color: #000; }
.message .text { background: var(--input-bg); padding: 12px; border-radius: 8px; border: 1px solid var(--panel-border); font-size: 0.95rem; line-height: 1.4; word-wrap: break-word; }
.message.user .text { border-color: var(--success); }
.message.ai .text { border-color: var(--accent-color); }

.input-area { display: flex; gap: 10px; }
.send-btn { width: 50px; background: var(--accent-color); color: #000; border: none; border-radius: 6px; cursor: pointer; font-size: 1.2rem; font-weight: bold; transition: 0.3s; }
.send-btn:hover { filter: brightness(1.2); }

/* Modal de Memoria */
.modal { position: absolute; top:0; left:0; width: 100%; height: 100%; background: rgba(0,0,0,0.7); display: flex; justify-content: center; align-items: center; z-index: 100; }
.modal-content { width: 500px; max-height: 80vh; display: flex; flex-direction: column; }
.memory-viewer { flex:1; overflow-y: auto; background: var(--input-bg); padding: 15px; border-radius: 6px; border: 1px solid var(--panel-border); font-family: monospace; white-space: pre-wrap; font-size: 0.9rem; }
