/* ============================================================
   Mini-Helena — Devoteam Demo
   Tema oscuro corporativo (rojo Devoteam + grafito)
   ============================================================ */

:root {
    --bg:        #14161a;
    --bg-panel:  #1c1f25;
    --bg-input:  #22262e;
    --bg-user:   #d62828;
    --bg-bot:    #262a33;
    --text:      #e8e8ea;
    --text-dim:  #9aa0aa;
    --text-faint:#6b7280;
    --accent:    #d62828;
    --accent-dim:#8b1c1c;
    --border:    #2d323b;
    --radius:    14px;
    --shadow:    0 4px 20px rgba(0,0,0,0.3);
}

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

html, body {
    height: 100%;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
    background: var(--bg);
    color: var(--text);
}

/* ===== LAYOUT ===== */
.app {
    display: flex;
    height: 100vh;
    overflow: hidden;
}

/* ===== SIDEBAR ===== */
.sidebar {
    width: 280px;
    background: var(--bg-panel);
    border-right: 1px solid var(--border);
    display: flex;
    flex-direction: column;
    padding: 24px 20px;
    gap: 24px;
    flex-shrink: 0;
}

.logo {
    display: flex;
    align-items: center;
    gap: 12px;
}

.logo-mark {
    width: 42px;
    height: 42px;
    background: var(--accent);
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 800;
    font-size: 22px;
    color: white;
}

.logo-name {
    font-weight: 700;
    font-size: 18px;
}

.logo-sub {
    font-size: 12px;
    color: var(--text-dim);
    letter-spacing: 1px;
}

/* Estado de conexión */
.status {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 13px;
    color: var(--text-dim);
    padding: 10px 12px;
    background: var(--bg-input);
    border-radius: 10px;
}

.status-dot {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    background: #f0b400;
    flex-shrink: 0;
}

.status-dot.ready    { background: #2ecc71; }
.status-dot.error    { background: var(--accent); }

/* Tarjeta informativa */
.info-card {
    background: var(--bg-input);
    border-radius: 12px;
    padding: 14px;
    border: 1px solid var(--border);
}

.info-title {
    font-size: 14px;
    font-weight: 600;
    margin-bottom: 8px;
}

.info-text {
    font-size: 12px;
    color: var(--text-dim);
    line-height: 1.6;
    margin-bottom: 8px;
}

.info-text strong { color: var(--accent); }

/* Pilares en el footer */
.sidebar-footer {
    margin-top: auto;
}

.footer-label {
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 1px;
    color: var(--text-faint);
    margin-bottom: 10px;
}

.pillars {
    list-style: none;
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.pillars li {
    font-size: 13px;
    color: var(--text-dim);
    padding: 6px 10px;
    background: var(--bg-input);
    border-radius: 8px;
}

/* ===== CHAT ===== */
.chat {
    flex: 1;
    display: flex;
    flex-direction: column;
    min-width: 0;
}

.chat-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 18px 28px;
    border-bottom: 1px solid var(--border);
    background: var(--bg-panel);
}

.chat-header h1 {
    font-size: 16px;
    font-weight: 600;
}

.reset-btn {
    background: transparent;
    border: 1px solid var(--border);
    color: var(--text-dim);
    padding: 6px 14px;
    border-radius: 8px;
    cursor: pointer;
    font-size: 13px;
    transition: all 0.15s;
}

.reset-btn:hover {
    border-color: var(--accent);
    color: var(--text);
}

/* Contenedor de mensajes */
.messages {
    flex: 1;
    overflow-y: auto;
    padding: 28px;
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.messages::-webkit-scrollbar { width: 8px; }
.messages::-webkit-scrollbar-track { background: var(--bg); }
.messages::-webkit-scrollbar-thumb { background: var(--border); border-radius: 4px; }

/* Burbujas */
.msg {
    max-width: 75%;
    padding: 12px 16px;
    border-radius: var(--radius);
    line-height: 1.55;
    font-size: 15px;
    animation: fadeIn 0.2s ease;
}

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(6px); }
    to   { opacity: 1; transform: translateY(0); }
}

.msg.user {
    align-self: flex-end;
    background: var(--bg-user);
    color: white;
    border-bottom-right-radius: 4px;
}

.msg.bot {
    align-self: flex-start;
    background: var(--bg-bot);
    color: var(--text);
    border: 1px solid var(--border);
    border-bottom-left-radius: 4px;
}

.msg.bot strong { color: var(--accent); }

/* Indicador de "escribiendo" */
.typing {
    align-self: flex-start;
    background: var(--bg-bot);
    border: 1px solid var(--border);
    padding: 14px 18px;
    border-radius: var(--radius);
    border-bottom-left-radius: 4px;
    display: flex;
    gap: 5px;
}

.typing span {
    width: 8px;
    height: 8px;
    background: var(--text-dim);
    border-radius: 50%;
    animation: bounce 1.2s infinite;
}

.typing span:nth-child(2) { animation-delay: 0.2s; }
.typing span:nth-child(3) { animation-delay: 0.4s; }

@keyframes bounce {
    0%, 60%, 100% { transform: translateY(0); opacity: 0.4; }
    30% { transform: translateY(-6px); opacity: 1; }
}

/* Cursor de escritura del bot */
.cursor {
    display: inline-block;
    width: 8px;
    height: 16px;
    background: var(--accent);
    margin-left: 2px;
    animation: blink 0.8s infinite;
    vertical-align: middle;
}

@keyframes blink {
    0%, 50% { opacity: 1; }
    51%, 100% { opacity: 0; }
}

/* ===== INPUT BAR ===== */
.input-bar {
    display: flex;
    gap: 10px;
    padding: 18px 28px;
    border-top: 1px solid var(--border);
    background: var(--bg-panel);
}

#chat-input {
    flex: 1;
    background: var(--bg-input);
    border: 1px solid var(--border);
    color: var(--text);
    padding: 13px 18px;
    border-radius: 12px;
    font-size: 15px;
    outline: none;
    transition: border-color 0.15s;
}

#chat-input:focus { border-color: var(--accent); }
#chat-input::placeholder { color: var(--text-faint); }

.send-btn {
    background: var(--accent);
    color: white;
    border: none;
    padding: 0 22px;
    border-radius: 12px;
    font-size: 15px;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.15s;
}

.send-btn:hover { background: var(--accent-dim); }
.send-btn:disabled { background: var(--border); cursor: not-allowed; }

/* ============================================================
   ELEMENTOS DE CUMPLIMIENTO — Art. 50 IA Act (UE) 2024/1689
   ============================================================ */

/* ----- BANNER DE CONSENTIMIENTO (overlay inicial) ----- */
.consent-overlay {
    position: fixed;
    inset: 0;
    background: rgba(10, 12, 15, 0.85);
    backdrop-filter: blur(6px);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    padding: 20px;
    animation: fadeIn 0.3s ease;
}

.consent-overlay.hidden { display: none; }

.consent-card {
    background: var(--bg-panel);
    border: 1px solid var(--border);
    border-radius: 18px;
    padding: 32px;
    max-width: 480px;
    width: 100%;
    box-shadow: var(--shadow);
    text-align: center;
}

.consent-icon {
    font-size: 48px;
    margin-bottom: 16px;
}

.consent-card h2 {
    font-size: 20px;
    font-weight: 700;
    margin-bottom: 16px;
    color: var(--text);
}

.consent-body {
    font-size: 14px;
    color: var(--text-dim);
    line-height: 1.6;
    margin-bottom: 18px;
}

.consent-body a, .legal-footer a {
    color: var(--accent);
    text-decoration: none;
}
.consent-body a:hover, .legal-footer a:hover { text-decoration: underline; }

.consent-list {
    list-style: none;
    text-align: left;
    margin-bottom: 24px;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.consent-list li {
    font-size: 13px;
    color: var(--text-dim);
    padding: 8px 12px;
    background: var(--bg-input);
    border-radius: 8px;
    line-height: 1.4;
}

.consent-buttons {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.consent-btn {
    padding: 13px 20px;
    border-radius: 12px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    text-decoration: none;
    text-align: center;
    transition: all 0.15s;
    border: 1px solid transparent;
}

.consent-btn.primary {
    background: var(--accent);
    color: white;
    border: none;
}
.consent-btn.primary:hover { background: var(--accent-dim); }

.consent-btn.secondary {
    background: transparent;
    color: var(--text-dim);
    border: 1px solid var(--border);
}
.consent-btn.secondary:hover { color: var(--text); border-color: var(--text-dim); }

/* ----- BADGE "IA" EN EL HEADER ----- */
.header-left {
    display: flex;
    align-items: center;
    gap: 12px;
}

.header-right {
    display: flex;
    align-items: center;
    gap: 10px;
}

.ai-badge {
    background: var(--accent-dim);
    color: white;
    font-size: 11px;
    font-weight: 700;
    padding: 4px 10px;
    border-radius: 6px;
    letter-spacing: 0.5px;
}

/* ----- BOTÓN "HABLAR CON UN HUMANO" ----- */
.human-btn {
    background: transparent;
    border: 1px solid var(--border);
    color: var(--text-dim);
    padding: 6px 14px;
    border-radius: 8px;
    cursor: pointer;
    font-size: 13px;
    text-decoration: none;
    transition: all 0.15s;
    white-space: nowrap;
}
.human-btn:hover {
    border-color: var(--accent);
    color: var(--text);
}

/* ----- FOOTER LEGAL ----- */
.legal-footer {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 8px 28px;
    background: var(--bg-panel);
    border-top: 1px solid var(--border);
    font-size: 11px;
    color: var(--text-faint);
}

.legal-footer strong { color: var(--text-dim); }

/* ===== RESPONSIVE ===== */
@media (max-width: 768px) {
    .sidebar { display: none; }
    .msg { max-width: 90%; }
    .chat-header { padding: 12px 14px; flex-wrap: wrap; gap: 8px; }
    .messages { padding: 18px; }
    .input-bar { padding: 12px 18px; }
    .legal-footer { flex-direction: column; gap: 4px; padding: 8px 14px; text-align: center; }
    .header-left h1 { font-size: 14px; }
    .human-btn { font-size: 11px; padding: 5px 10px; }
}
