/* =================================
   SISTEMA RAG - DISEÑO PROFESIONAL
   Paleta: #008BCA #000000 #FFFFFF #495D6B
   ================================= */

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

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background: #F5F5F5;
    color: #000000;
    line-height: 1.6;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

/* BARRA DE ESTADO DEL ALMACÉN */
.barra-estado-almacen {
    background: #008BCA;
    color: #FFFFFF;
    padding: 12px 40px;
    text-align: right;
    font-size: 0.9em;
    font-weight: 600;
    letter-spacing: 0.5px;
    cursor: pointer;
    transition: background 0.2s ease;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    z-index: 1000;
}

.barra-estado-almacen:hover {
    background: #006A9E;
}

.barra-estado-almacen.sin-almacen {
    background: #D32F2F;
}

.barra-estado-almacen.sin-almacen:hover {
    background: #B71C1C;
}

.barra-estado-almacen span {
    text-transform: uppercase;
}

.barra-estado-almacen span::before {
    content: '➤➤➤ ';
    display: inline-block;
    margin-right: 8px;
    animation: flechaPulso 1.5s ease-in-out infinite;
}

@keyframes flechaPulso {
    0%, 100% {
        transform: translateX(0);
        opacity: 0.7;
    }
    50% {
        transform: translateX(8px);
        opacity: 1;
    }
}

.contenedor {
    flex: 1;
    max-width: 1400px;
    margin: 0 auto;
    padding: 0 20px;
    width: 100%;
    margin-top: 46px;
}

/* HEADER */
header {
    background: #FFFFFF;
    border-bottom: 3px solid #008BCA;
    padding: 20px 40px;
    margin-bottom: 30px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 20px;
}

header .logo-container {
    display: flex;
    align-items: center;
    gap: 20px;
}

header .logo-container img {
    height: 50px;
    width: auto;
}

header .titulo-principal {
    flex: 1;
    text-align: right;
    padding-right: 50px;
}

header h1 {
    font-size: 2.2em;
    color: #000000;
    font-weight: 700;
    letter-spacing: 2px;
    margin: 0;
}

.info-sesion-demo {
    text-align: right;
    padding: 10px;
    background: #F5F5F5;
    border: 1px solid #E0E0E0;
}

.info-sesion-demo strong {
    color: #008BCA;
    font-family: monospace;
    font-size: 1.1em;
}

/* NAVEGACIÓN */
.navegacion-pestanas {
    background: #495D6B;
    border: none;
    padding: 0;
    margin-bottom: 30px;
    display: flex;
    gap: 0;
}

.boton-pestana {
    flex: 1;
    padding: 15px 20px;
    border: none;
    background: #495D6B;
    color: #FFFFFF;
    font-size: 0.95em;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
    text-transform: uppercase;
    letter-spacing: 1px;
    border-right: 1px solid #5A6D7B;
}

.boton-pestana:last-child {
    border-right: none;
}

.boton-pestana:hover {
    background: #3A4A57;
}

.boton-pestana.activo {
    background: #008BCA;
    color: #FFFFFF;
}

/* CONTENIDO */
.contenido-pestana {
    display: none;
}

.contenido-pestana.activo {
    display: block;
}

/* TARJETAS */
.tarjeta {
    background: #FFFFFF;
    border: 1px solid #E0E0E0;
    padding: 30px;
    margin-bottom: 25px;
}

.tarjeta h2 {
    color: #008BCA;
    margin-bottom: 25px;
    font-size: 1.5em;
    font-weight: 700;
    padding-bottom: 15px;
    border-bottom: 2px solid #008BCA;
}

.tarjeta h3 {
    color: #000000;
    margin: 25px 0 15px 0;
    font-size: 1.2em;
    font-weight: 600;
}

/* LAYOUT CHAT */
.contenido-principal {
    display: grid;
    grid-template-columns: 350px 1fr;
    gap: 25px;
}

@media (max-width: 1200px) {
    .contenido-principal {
        grid-template-columns: 1fr;
    }
}

.panel-lateral {
    display: flex;
    flex-direction: column;
    max-height: 850px;
}

.panel-lateral .lista-archivos {
    flex: 1;
    overflow-y: auto;
    max-height: 700px;
}

.panel-chat {
    display: flex;
    flex-direction: column;
    height: 850px;
}

/* MENSAJES CHAT - ESTILO MINIMALISTA */
.mensajes-chat {
    flex: 1;
    overflow-y: auto;
    padding: 15px;
    background: #FAFAFA;
    margin-bottom: 15px;
    border: 1px solid #E0E0E0;
    font-family: 'Courier New', 'Consolas', monospace;
}

.mensaje {
    margin-bottom: 12px;
}

.mensaje.usuario {
    text-align: right;
}

.contenido-mensaje {
    display: inline-block;
    max-width: 75%;
    padding: 10px 14px;
    word-wrap: break-word;
    font-size: 0.85em;
    line-height: 1.5;
    font-family: 'Courier New', 'Consolas', monospace;
}

.mensaje.usuario .contenido-mensaje {
    background: #FFFFFF;
    color: #2C3E50;
    text-align: left;
    border: 1px solid #BDC3C7;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.05);
}

.mensaje.usuario .contenido-mensaje::before {
    content: '→ ';
    color: #008BCA;
    font-weight: bold;
    margin-right: 4px;
}

.mensaje.asistente .contenido-mensaje {
    background: #F8F9FA;
    color: #34495E;
    border: 1px solid #D1D5DB;
    text-align: left;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.05);
}

.mensaje.asistente .contenido-mensaje::before {
    content: '← ';
    color: #495D6B;
    font-weight: bold;
    margin-right: 4px;
}

.mensaje.cargando .contenido-mensaje {
    background: #FFF9E6;
    border: 1px solid #FFC107;
    color: #856404;
}

.mensaje.cargando .contenido-mensaje::before {
    content: '◆ ';
    color: #FFC107;
}

.indicador-escritura {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 8px 0;
}

.indicador-escritura span {
    height: 8px;
    width: 8px;
    background: #495D6B;
    display: inline-block;
    animation: escritura 1.4s infinite;
}

.indicador-escritura span:nth-child(2) {
    animation-delay: 0.2s;
}

.indicador-escritura span:nth-child(3) {
    animation-delay: 0.4s;
}

@keyframes escritura {
    0%, 60%, 100% {
        transform: translateY(0);
        opacity: 0.7;
    }
    30% {
        transform: translateY(-8px);
        opacity: 1;
    }
}

/* ENTRADA CHAT */
.entrada-chat {
    display: flex;
    gap: 10px;
}

/* ZONA ARRASTRE */
.zona-arrastre {
    border: 2px dashed #495D6B;
    padding: 60px 20px;
    text-align: center;
    cursor: pointer;
    transition: all 0.3s ease;
    background: #F9F9F9;
    margin-bottom: 25px;
}

.zona-arrastre:hover,
.zona-arrastre.arrastrando {
    border-color: #008BCA;
    background: #E6F4FA;
}

.zona-arrastre p {
    font-size: 1.1em;
    color: #000000;
    margin-bottom: 8px;
    font-weight: 500;
}

.zona-arrastre .texto-pequeno {
    font-size: 0.85em;
    color: #495D6B;
}

/* LISTAS */
.lista-archivos {
    max-height: 550px;
    overflow-y: auto;
}

.elemento-archivo {
    padding: 15px;
    background: #E6F4FA;
    margin-bottom: 12px;
    border: 1px solid #B3D9EF;
    transition: all 0.2s ease;
}

.elemento-archivo:hover {
    background: #D1EBFA;
    border-color: #008BCA;
    box-shadow: 0 2px 4px rgba(0, 139, 202, 0.15);
}

.nombre-archivo {
    font-weight: 600;
    color: #000000;
    font-size: 0.9em;
    margin-bottom: 5px;
}

.info-archivo {
    font-size: 0.8em;
    color: #495D6B;
}

/* TARJETAS STORE */
.tarjeta-store {
    background: #F9F9F9;
    padding: 20px;
    margin-bottom: 15px;
    border: 1px solid #E0E0E0;
    transition: all 0.3s ease;
}

.tarjeta-store:hover {
    background: #F0F0F0;
}

.tarjeta-store.activo {
    background: #E6F4FA;
    border: 2px solid #008BCA;
}

.tarjeta-store h3 {
    margin: 0 0 15px 0;
    color: #000000;
    font-size: 1.1em;
}

.info-store {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 12px;
    margin-bottom: 15px;
    font-size: 0.9em;
}

.info-store strong {
    color: #495D6B;
}

.acciones-store {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
}

/* BOTONES */
.boton-primario,
.boton-secundario,
.boton-peligro {
    padding: 12px 24px;
    border: none;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
    font-size: 0.95em;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.boton-primario {
    background: #008BCA;
    color: #FFFFFF;
}

.boton-primario:hover:not(:disabled) {
    background: #006A9E;
}

.boton-secundario {
    background: #495D6B;
    color: #FFFFFF;
}

.boton-secundario:hover:not(:disabled) {
    background: #3A4A57;
}

.boton-peligro {
    background: #D32F2F;
    color: #FFFFFF;
}

.boton-peligro:hover:not(:disabled) {
    background: #B71C1C;
}

.boton-pequeno {
    padding: 8px 16px;
    font-size: 0.85em;
}

button:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

/* FORMULARIOS */
.grupo-formulario {
    margin-bottom: 20px;
}

.grupo-formulario label {
    display: block;
    margin-bottom: 8px;
    font-weight: 600;
    color: #000000;
    font-size: 0.95em;
}

.entrada-texto,
.entrada-select {
    width: 100%;
    padding: 12px;
    border: 1px solid #495D6B;
    font-size: 1em;
    transition: all 0.2s ease;
    background: #FFFFFF;
}

.entrada-texto:focus,
.entrada-select:focus {
    outline: none;
    border-color: #008BCA;
    border-width: 2px;
}

.entrada-archivo {
    display: none;
}

/* METADATA */
.seccion-metadata {
    margin-top: 25px;
    padding: 20px;
    background: #F9F9F9;
    border: 1px solid #E0E0E0;
}

.campo-metadata {
    display: flex;
    gap: 10px;
    margin-bottom: 12px;
    align-items: center;
}

.campo-metadata input {
    flex: 1;
}

.campo-metadata button {
    flex-shrink: 0;
}

/* ESTADOS VACIOS */
.estado-vacio {
    text-align: center;
    padding: 40px 20px;
    color: #495D6B;
    font-size: 0.95em;
    font-style: italic;
}

/* ESTADO VACIO EN CHAT - ESTILO MINIMALISTA */
.mensajes-chat .estado-vacio {
    color: #7F8C8D;
    font-family: 'Courier New', 'Consolas', monospace;
    font-style: normal;
}

/* NOTIFICACIONES - MODAL CENTRAL */
#contenedorNotificaciones {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    z-index: 9999;
    max-width: 500px;
    width: 90%;
}

.notificacion {
    background: #FFFFFF;
    padding: 25px 35px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.3);
    border: 2px solid #000000;
    animation: aparecerModal 0.3s ease;
    text-align: center;
    font-size: 1.1em;
    font-weight: 500;
}

@keyframes aparecerModal {
    from {
        transform: scale(0.8);
        opacity: 0;
    }
    to {
        transform: scale(1);
        opacity: 1;
    }
}

/* FOOTER */
footer {
    background: #000000;
    color: #FFFFFF;
    padding: 30px 40px;
    margin-top: 50px;
    border-top: 3px solid #008BCA;
}

footer .footer-content {
    max-width: 1400px;
    margin: 0 auto;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

footer .footer-info {
    flex: 1;
}

footer .footer-info p {
    margin: 5px 0;
    color: #FFFFFF;
    font-size: 0.9em;
}

footer .footer-info a {
    color: #008BCA;
    text-decoration: none;
}

footer .footer-info a:hover {
    text-decoration: underline;
}

footer .logo-footer img {
    height: 40px;
    width: auto;
}

/* SCROLLBAR */
::-webkit-scrollbar {
    width: 10px;
    height: 10px;
}

::-webkit-scrollbar-track {
    background: #F5F5F5;
}

::-webkit-scrollbar-thumb {
    background: #495D6B;
}

::-webkit-scrollbar-thumb:hover {
    background: #008BCA;
}

/* MARKDOWN EN MENSAJES - ESTILO MINIMALISTA */
.contenido-mensaje p {
    margin: 0 0 10px 0;
}

.contenido-mensaje p:last-child {
    margin-bottom: 0;
}

.contenido-mensaje ul,
.contenido-mensaje ol {
    margin: 8px 0 10px 20px;
}

.contenido-mensaje li {
    margin: 4px 0;
}

.contenido-mensaje li::marker {
    color: inherit;
}

.contenido-mensaje strong {
    font-weight: 700;
    color: #000000;
}

.contenido-mensaje code {
    background: #E8EAF6;
    padding: 2px 6px;
    font-family: 'Courier New', 'Consolas', monospace;
    font-size: 0.9em;
    border: 1px solid #C5CAE9;
    color: #3F51B5;
}

.contenido-mensaje pre {
    background: #F5F5F5;
    color: #2C3E50;
    padding: 12px;
    overflow-x: auto;
    margin: 10px 0;
    border: 1px solid #E0E0E0;
    border-left: 3px solid #008BCA;
}

.contenido-mensaje pre code {
    background: transparent;
    border: none;
    color: #2C3E50;
    padding: 0;
}

/* MODALES */
.modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.6);
    z-index: 10000;
    align-items: center;
    justify-content: center;
}

.modal.activo {
    display: flex;
}

.modal-contenido {
    background: #FFFFFF;
    width: 90%;
    max-width: 500px;
    border: 2px solid #000000;
    animation: aparecerModal 0.3s ease;
}

.modal-grande {
    max-width: 700px;
}

.modal-header {
    background: #495D6B;
    color: #FFFFFF;
    padding: 20px 30px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.modal-header h3 {
    margin: 0;
    font-size: 1.1em;
    font-weight: 700;
    letter-spacing: 1px;
    color: #008BCA;
}

/* Modal de sesión con estilo especial */
.modal-sesion .modal-header {
    background: #008BCA;
}

.modal-sesion .modal-header h3 {
    color: #FFFFFF;
}

.modal-cerrar {
    background: none;
    border: none;
    color: #FFFFFF;
    font-size: 2em;
    cursor: pointer;
    line-height: 1;
    padding: 0;
    width: 30px;
    height: 30px;
    transition: color 0.2s ease;
}

.modal-cerrar:hover {
    color: #008BCA;
}

.modal-body {
    padding: 30px;
}

.modal-footer {
    padding: 20px 30px;
    background: #F9F9F9;
    border-top: 1px solid #E0E0E0;
    display: flex;
    gap: 10px;
    justify-content: flex-end;
}

/* SELECT DE ACCIONES EN ARCHIVOS */
.select-acciones-archivo {
    width: 100%;
    padding: 8px;
    border: 1px solid #495D6B;
    background: #FFFFFF;
    font-size: 0.85em;
    cursor: pointer;
    transition: border-color 0.2s ease;
}

.select-acciones-archivo:focus {
    outline: none;
    border-color: #008BCA;
    border-width: 2px;
}

/* RESPONSIVE */
@media (max-width: 768px) {
    header {
        flex-direction: column;
        text-align: center;
        padding: 20px;
    }

    header .logo-container {
        flex-direction: column;
        margin-bottom: 15px;
    }

    header h1 {
        font-size: 1.5em;
    }

    .navegacion-pestanas {
        flex-direction: column;
    }

    .boton-pestana {
        border-right: none;
        border-bottom: 1px solid #333333;
    }

    .entrada-chat {
        flex-direction: column;
    }

    .contenido-mensaje {
        max-width: 90%;
    }

    footer .footer-content {
        flex-direction: column;
        gap: 20px;
        text-align: center;
    }
}
