/* =========================================================================
   ESTILOS DE ATLAS VOICE AI - COLUMNA IZQUIERDA ALARGADA (ia.css)
   ========================================================================= */

/* Desactivar botón secundario de dictado en Inbox para evitar duplicidad */
#inboxDictateBtn {
    display: none !important;
}

#ai-container {
    position: fixed !important;
    left: 14px !important;
    bottom: 150px !important;
    right: auto !important;
    z-index: 2147483645 !important;
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
}

/* Botón lanzador a la izquierda, justo encima del botón de loterías/ruleta */
#ai-launcher-btn {
    background: #0d0d14;
    color: #ffffff;
    border: 1.5px solid var(--accent, #00e5ff);
    border-radius: 25px;
    padding: 9px 15px;
    font-family: 'Orbitron', sans-serif;
    font-size: 11.5px;
    font-weight: bold;
    cursor: pointer;
    box-shadow: 0 4px 18px rgba(0, 0, 0, 0.9), 0 0 12px rgba(0, 229, 255, 0.35);
    display: flex;
    align-items: center;
    gap: 7px;
    transition: transform 0.2s ease, border-color 0.2s ease;
}

#ai-launcher-btn:hover {
    transform: scale(1.04);
}

#ai-launcher-btn.listening-active {
    border-color: #00ff66 !important;
    color: #00ff66 !important;
    box-shadow: 0 0 18px rgba(0, 255, 102, 0.6) !important;
}

/* Panel vertical alargado a la izquierda: desde arriba hasta encima de los botones de juegos */
#ai-panel {
    position: fixed !important;
    top: 12px;
    bottom: 185px; /* Subido para que no pise la lotería */
    left: 12px;
    right: auto;
    width: 235px; /* Más estrecho */
    min-width: 200px; /* Tamaño mínimo para que no se rompa */
    max-width: calc(100vw - 24px);
    background: #0d0d14 !important;
    color: #ffffff !important;
    border: 1.5px solid var(--accent, #00e5ff) !important;
    border-radius: 14px !important;
    box-shadow: 0 12px 40px rgba(0, 0, 0, 0.92), 0 0 18px rgba(0, 229, 255, 0.22) !important;
    display: none;
    flex-direction: column !important;
    overflow: hidden !important; /* Mantenemos hidden, la caja de comandos y el chat tendrán scroll */
    z-index: 2147483646 !important;
    box-sizing: border-box !important;
    resize: both !important; /* ESTA LÍNEA PERMITE REDIMENSIONAR LA VENTANA */
}

/* Adaptación a MODO DÍA (Fondo blanco, letras negras) */
body.light-mode #ai-panel,
html.light-mode #ai-panel {
    background: #ffffff !important;
    color: #111111 !important;
    border: 1.5px solid #222222 !important;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.25) !important;
}

body.light-mode #ai-launcher-btn,
html.light-mode #ai-launcher-btn {
    background: #ffffff !important;
    color: #111111 !important;
    border-color: #222222 !important;
}

/* Cabecera en 2 filas */
#ai-panel .ai-header {
    background: #151522 !important;
    padding: 8px 10px !important;
    border-bottom: 1px solid rgba(255, 255, 255, 0.12) !important;
    display: flex !important;
    flex-direction: column !important;
    gap: 6px !important;
    cursor: move !important;
    user-select: none !important;
    flex-shrink: 0;
}

body.light-mode #ai-panel .ai-header,
html.light-mode #ai-panel .ai-header {
    background: #f0f2f5 !important;
    border-bottom: 1px solid #cccccc !important;
    color: #111111 !important;
}

.ai-header-top {
    display: flex;
    align-items: center;
    justify-content: space-between;
    width: 100%;
}

#ai-panel .ai-title {
    font-family: 'Orbitron', sans-serif;
    font-size: 12px;
    font-weight: bold;
    color: var(--accent, #00e5ff);
}

body.light-mode #ai-panel .ai-title {
    color: #111111 !important;
}

#ai-panel .ai-close-btn {
    background: transparent !important;
    border: none !important;
    color: #ff4444 !important;
    font-size: 20px !important;
    line-height: 1 !important;
    padding: 0 4px !important;
    cursor: pointer !important;
}

.ai-header-controls {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 4px;
    width: 100%;
}

.ai-header-controls button {
    flex: 1;
    background: rgba(255, 255, 255, 0.08);
    color: #ffffff;
    border: 1px solid #444;
    border-radius: 6px;
    padding: 4px 4px;
    font-family: 'Orbitron', sans-serif;
    font-size: 9px;
    font-weight: bold;
    cursor: pointer;
    transition: 0.2s;
    text-align: center;
    white-space: nowrap;
}

body.light-mode .ai-header-controls button {
    background: #ffffff;
    color: #111111;
    border: 1px solid #aaa;
}

#ai-mic-toggle-btn.mic-on {
    background: rgba(0, 255, 102, 0.2) !important;
    border-color: #00ff66 !important;
    color: #00ff66 !important;
}

body.light-mode #ai-mic-toggle-btn.mic-on {
    background: #00aa44 !important;
    color: #ffffff !important;
}

#ai-guide-toggle-btn.guide-on {
    border-color: #ffcc00 !important;
    color: #ffcc00 !important;
}

body.light-mode #ai-guide-toggle-btn.guide-on {
    background: #ffcc00 !important;
    color: #000000 !important;
}

/* =========================================================================
   LISTA DE COMANDOS EN UNA SOLA COLUMNA VERTICAL SIN SCROLL ENGORROSO
   ========================================================================= */
#ai-context-box {
    background: rgba(0, 229, 255, 0.04);
    border-bottom: 1px solid rgba(255, 255, 255, 0.12);
    padding: 6px 8px;
    flex: 1 1 auto;
    overflow-y: auto;
}

body.light-mode #ai-context-box,
html.light-mode #ai-context-box {
    background: #f7f9fc !important;
    border-bottom: 1px solid #dddddd !important;
}

.ai-context-header {
    font-family: 'Orbitron', sans-serif;
    font-size: 9.5px;
    font-weight: bold;
    color: #00ffcc;
    margin-bottom: 5px;
}

body.light-mode .ai-context-header {
    color: #007766 !important;
}

/* 1 sola fila por comando (1 columna) */
#ai-context-list {
    display: flex;
    flex-direction: column;
    gap: 3px;
}

.ai-cmd-pill {
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.12);
    border-radius: 5px;
    padding: 3px 7px;
    font-size: 10.5px;
    color: #dddddd;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 6px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    transition: background 0.15s, border-color 0.15s;
}

.ai-cmd-pill:hover {
    border-color: var(--accent, #00e5ff);
    background: rgba(0, 229, 255, 0.14);
}

.ai-cmd-pill strong {
    color: #ffcc00;
    font-family: 'Orbitron', sans-serif;
    font-size: 9.5px;
}

.ai-cmd-pill small {
    color: #999999;
    font-size: 9px;
    overflow: hidden;
    text-overflow: ellipsis;
}

body.light-mode .ai-cmd-pill {
    background: #ffffff;
    border: 1px solid #cccccc;
    color: #111111;
}

body.light-mode .ai-cmd-pill strong {
    color: #b35900;
}

body.light-mode .ai-cmd-pill small {
    color: #555555;
}

/* =========================================================================
   CAJA DE CONVERSACIÓN E INPUT INFERIOR
   ========================================================================= */
#ai-panel #ai-history-box {
    height: 115px;
    min-height: 90px;
    max-height: 140px;
    padding: 8px 10px !important;
    overflow-y: auto !important;
    display: flex !important;
    flex-direction: column !important;
    gap: 6px !important;
    background: rgba(0, 0, 0, 0.25) !important;
    flex-shrink: 0;
}

body.light-mode #ai-panel #ai-history-box {
    background: #eaedf2 !important;
}

.ai-msg-bubble {
    padding: 6px 9px;
    border-radius: 8px;
    font-size: 11.5px;
    line-height: 1.35;
    word-break: break-word;
}

.ai-msg-bot {
    background: rgba(255, 255, 255, 0.07);
    border: 1px solid rgba(255, 255, 255, 0.12);
    color: #ffffff;
    align-self: flex-start;
    max-width: 94%;
}

.ai-msg-user {
    background: rgba(0, 229, 255, 0.18);
    border: 1px solid var(--accent, #00e5ff);
    color: #ffffff;
    align-self: flex-end;
    max-width: 90%;
}

body.light-mode .ai-msg-bot {
    background: #ffffff;
    border: 1px solid #cccccc;
    color: #111111;
}

body.light-mode .ai-msg-user {
    background: #d9f2ff;
    border: 1px solid #0088cc;
    color: #111111;
}

#ai-panel .ai-input-area {
    display: flex !important;
    gap: 5px !important;
    padding: 7px 8px !important;
    background: #14141f !important;
    border-top: 1px solid rgba(255, 255, 255, 0.1) !important;
    flex-shrink: 0;
}

body.light-mode #ai-panel .ai-input-area,
html.light-mode #ai-panel .ai-input-area {
    background: #f0f2f5 !important;
    border-top: 1px solid #cccccc !important;
}

#ai-panel #ai-user-input {
    flex: 1 !important;
    min-width: 0 !important;
    background: #08080c !important;
    color: #ffffff !important;
    border: 1px solid #3a3a4a !important;
    border-radius: 6px !important;
    padding: 6px 8px !important;
    font-size: 11.5px !important;
    outline: none !important;
}

body.light-mode #ai-panel #ai-user-input,
html.light-mode #ai-panel #ai-user-input {
    background: #ffffff !important;
    color: #111111 !important;
    border: 1px solid #bbbbbb !important;
}

#ai-panel .ai-input-area button {
    background: var(--accent, #00e5ff) !important;
    color: #000000 !important;
    border: none !important;
    border-radius: 6px !important;
    padding: 6px 10px !important;
    font-family: 'Orbitron', sans-serif !important;
    font-size: 10px !important;
    font-weight: bold !important;
    cursor: pointer !important;
}

.atlas-num-badge {
    background: #00ffcc;
    color: #000000;
    font-family: 'Orbitron', sans-serif;
    font-size: 10px;
    font-weight: bold;
    padding: 2px 6px;
    border-radius: 5px;
    box-shadow: 0 2px 6px rgba(0,0,0,0.85);
    display: inline-block;
    pointer-events: none;
    z-index: 30;
}