/* app/static/css/style.css */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    min-height: 100vh;
}

.navbar {
    background: white;
    box-shadow: 0 2px 10px rgba(0,0,0,0.1);
    padding: 15px 0;
}

.navbar .container {
    max-width: 1200px;
    margin: 0 auto;
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0 20px;
}

.logo {
    font-size: 1.5em;
    font-weight: bold;
    color: #667eea;
}

.company {
    color: #999;
}

.container {
    max-width: 900px;
    margin: 30px auto;
    padding: 0 20px;
}

.main-container {
    background: white;
    border-radius: 20px;
    padding: 40px;
    box-shadow: 0 20px 60px rgba(0,0,0,0.3);
}

.header-section {
    text-align: center;
    margin-bottom: 30px;
}

.header-section h1 {
    color: #333;
    margin-bottom: 10px;
}

.subtitle {
    color: #666;
    font-size: 1.1em;
}

.status-box {
    padding: 15px;
    border-radius: 10px;
    margin-bottom: 30px;
    text-align: center;
    font-weight: 500;
}

.status-box.ready {
    background: #d4edda;
    color: #155724;
}

.status-box.warning {
    background: #fff3cd;
    color: #856404;
}

.consulta-box textarea {
    width: 100%;
    padding: 15px;
    border: 2px solid #e0e0e0;
    border-radius: 10px;
    font-size: 1em;
    font-family: inherit;
    resize: vertical;
    margin-bottom: 15px;
}

.consulta-box textarea:focus {
    outline: none;
    border-color: #667eea;
}

.btn-primary {
    width: 100%;
    padding: 15px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border: none;
    border-radius: 10px;
    font-size: 1.1em;
    font-weight: bold;
    cursor: pointer;
    transition: transform 0.2s;
}

.btn-primary:hover:not(:disabled) {
    transform: translateY(-2px);
}

.btn-primary:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

.loading-box {
    text-align: center;
    padding: 30px;
}

.spinner {
    border: 4px solid #f3f3f3;
    border-top: 4px solid #667eea;
    border-radius: 50%;
    width: 40px;
    height: 40px;
    animation: spin 1s linear infinite;
    margin: 0 auto 15px;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

.resultado-box {
    margin-top: 30px;
}

.respuesta-text {
    background: #f8f9fa;
    padding: 20px;
    border-radius: 10px;
    line-height: 1.6;
    white-space: pre-wrap;
    margin-bottom: 15px;
}

.confianza-badge {
    text-align: right;
    color: #666;
    font-size: 0.9em;
    margin-bottom: 20px;
}

.fuentes-lista {
    margin-top: 15px;
}

.fuente-item {
    background: white;
    border: 1px solid #e0e0e0;
    padding: 15px;
    border-radius: 8px;
    margin-bottom: 10px;
}

.fuente-item .badge {
    display: inline-block;
    background: #667eea;
    color: white;
    padding: 3px 8px;
    border-radius: 5px;
    font-size: 0.8em;
    margin-left: 10px;
}

.fuente-item p {
    color: #666;
    font-size: 0.9em;
    margin-top: 8px;
}

.disclaimer-box {
    background: #fff3cd;
    border-left: 4px solid #ffc107;
    padding: 15px;
    margin-top: 20px;
    border-radius: 5px;
    font-size: 0.9em;
    white-space: pre-wrap;
}

footer {
    text-align: center;
    color: white;
    padding: 20px;
    margin-top: 30px;
}

@media (max-width: 768px) {
    .main-container {
        padding: 20px;
    }
    
    .navbar .container {
        flex-direction: column;
        gap: 10px;
    }
}

/* ESTILOS PARA CHAT CONVERSACIONAL */

.chat-container {
    background: #f8f9fa;
    border-radius: 10px;
    padding: 20px;
    margin-bottom: 20px;
    max-height: 500px;
    overflow-y: auto;
}

.mensajes-area {
    display: flex;
    flex-direction: column;
    gap: 15px;
}

.mensaje {
    padding: 15px;
    border-radius: 10px;
    max-width: 85%;
    animation: fadeIn 0.3s ease-in;
}

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(10px); }
    to { opacity: 1; transform: translateY(0); }
}

.mensaje-usuario {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    align-self: flex-end;
    margin-left: auto;
}

.mensaje-asistente {
    background: white;
    border: 1px solid #e0e0e0;
    align-self: flex-start;
}

.mensaje-error {
    background: #f8d7da;
    border: 1px solid #f5c6cb;
    color: #721c24;
    align-self: center;
}

.mensaje-bienvenida {
    background: #d1ecf1;
    border: 1px solid #bee5eb;
    color: #0c5460;
    padding: 15px;
    border-radius: 10px;
    text-align: center;
}

.mensaje-header {
    margin-bottom: 8px;
    font-size: 0.9em;
}

.mensaje-contenido {
    line-height: 1.6;
    white-space: pre-wrap;
}

.fuentes-area {
    margin-top: 12px;
    padding-top: 12px;
    border-top: 1px solid #e0e0e0;
    font-size: 0.85em;
}

.fuente-mini {
    margin: 5px 0;
    color: #666;
}

.badge-mini {
    background: #667eea;
    color: white;
    padding: 2px 6px;
    border-radius: 3px;
    font-size: 0.85em;
}

.confianza-mini {
    margin-top: 8px;
    font-size: 0.85em;
    color: #666;
    text-align: right;
}

.disclaimer-mini {
    margin-top: 12px;
    padding: 10px;
    background: #fff3cd;
    border-left: 3px solid #ffc107;
    font-size: 0.8em;
    border-radius: 5px;
    white-space: pre-wrap;
}

.botones-area {
    display: flex;
    gap: 10px;
    margin-top: 10px;
}

.btn-secondary {
    flex: 1;
    padding: 15px;
    background: #6c757d;
    color: white;
    border: none;
    border-radius: 10px;
    font-size: 1em;
    font-weight: bold;
    cursor: pointer;
    transition: background 0.2s;
}

.btn-secondary:hover {
    background: #5a6268;
}

.btn-primary {
    flex: 2;
}

/* Scrollbar personalizado */
.chat-container::-webkit-scrollbar {
    width: 8px;
}

.chat-container::-webkit-scrollbar-track {
    background: #f1f1f1;
    border-radius: 10px;
}

.chat-container::-webkit-scrollbar-thumb {
    background: #888;
    border-radius: 10px;
}

.chat-container::-webkit-scrollbar-thumb:hover {
    background: #555;
}
/* ============================================================
   ESTILOS SISTEMA DE AUTENTICACIÓN
   ============================================================ */

/* Navbar mejorado con usuario */
.navbar .container {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.navbar .logo a {
    color: #667eea;
    text-decoration: none;
}

.nav-items {
    display: flex;
    align-items: center;
    gap: 15px;
}

.user-info {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px 15px;
    background: #f0f0f0;
    border-radius: 20px;
    font-size: 0.9em;
}

.badge-plan {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    padding: 3px 10px;
    border-radius: 12px;
    font-size: 0.85em;
    font-weight: bold;
    text-transform: uppercase;
}

.consultas-restantes {
    color: #666;
    font-size: 0.85em;
}

.btn-nav {
    padding: 8px 20px;
    border-radius: 5px;
    text-decoration: none;
    color: #667eea;
    border: 1px solid #667eea;
    transition: all 0.3s;
}

.btn-nav:hover {
    background: #667eea;
    color: white;
}

.btn-primary-nav {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border: none;
}

.btn-primary-nav:hover {
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(102, 126, 234, 0.3);
}

/* Mensajes Flash */
.flash-messages {
    position: fixed;
    top: 80px;
    right: 20px;
    z-index: 9999;
    max-width: 400px;
}

.alert {
    padding: 15px 20px;
    margin-bottom: 10px;
    border-radius: 8px;
    box-shadow: 0 4px 12px rgba(0,0,0,0.15);
    display: flex;
    align-items: center;
    gap: 10px;
    animation: slideInRight 0.3s ease-out;
}

@keyframes slideInRight {
    from {
        transform: translateX(100%);
        opacity: 0;
    }
    to {
        transform: translateX(0);
        opacity: 1;
    }
}

.alert-success {
    background: #d4edda;
    border-left: 4px solid #28a745;
    color: #155724;
}

.alert-danger {
    background: #f8d7da;
    border-left: 4px solid #dc3545;
    color: #721c24;
}

.alert-warning {
    background: #fff3cd;
    border-left: 4px solid #ffc107;
    color: #856404;
}

.alert-info {
    background: #d1ecf1;
    border-left: 4px solid #17a2b8;
    color: #0c5460;
}

.alert-icon {
    font-size: 1.3em;
}

.alert-close {
    margin-left: auto;
    background: none;
    border: none;
    font-size: 1.5em;
    cursor: pointer;
    color: inherit;
    opacity: 0.6;
    transition: opacity 0.2s;
}

.alert-close:hover {
    opacity: 1;
}

/* Contenedor de autenticación */
.auth-container {
    min-height: calc(100vh - 200px);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 40px 20px;
}

.auth-box {
    background: white;
    border-radius: 20px;
    box-shadow: 0 20px 60px rgba(0,0,0,0.3);
    max-width: 500px;
    width: 100%;
    padding: 40px;
}

.auth-header {
    text-align: center;
    margin-bottom: 30px;
}

.auth-header h1 {
    color: #333;
    margin-bottom: 10px;
    font-size: 2em;
}

.auth-header p {
    color: #666;
    font-size: 1em;
}

/* Formularios */
.auth-form {
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.form-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 15px;
}

.form-group {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.form-group label {
    font-weight: 600;
    color: #333;
    font-size: 0.9em;
}

.form-control {
    padding: 12px 15px;
    border: 2px solid #e0e0e0;
    border-radius: 8px;
    font-size: 1em;
    font-family: inherit;
    transition: border-color 0.3s;
}

.form-control:focus {
    outline: none;
    border-color: #667eea;
}

.form-help {
    color: #666;
    font-size: 0.85em;
    margin-top: -5px;
}

.form-error {
    color: #dc3545;
    font-size: 0.85em;
    margin-top: -5px;
}

.form-group-checkbox {
    display: flex;
    align-items: center;
    gap: 8px;
}

.form-checkbox {
    width: 18px;
    height: 18px;
    cursor: pointer;
}

.form-group-checkbox label {
    font-weight: normal;
    cursor: pointer;
    font-size: 0.9em;
}

.form-row-between {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.link-recovery {
    color: #667eea;
    text-decoration: none;
    font-size: 0.9em;
}

.link-recovery:hover {
    text-decoration: underline;
}

.btn-submit {
    padding: 15px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border: none;
    border-radius: 10px;
    font-size: 1.1em;
    font-weight: bold;
    cursor: pointer;
    transition: transform 0.2s, box-shadow 0.2s;
}

.btn-submit:hover {
    transform: translateY(-2px);
    box-shadow: 0 10px 20px rgba(102, 126, 234, 0.4);
}

.btn-submit:active {
    transform: translateY(0);
}

.auth-footer {
    text-align: center;
    margin-top: 25px;
    padding-top: 25px;
    border-top: 1px solid #e0e0e0;
}

.auth-footer p {
    color: #666;
    font-size: 0.9em;
}

.auth-footer a {
    color: #667eea;
    text-decoration: none;
    font-weight: 600;
}

.auth-footer a:hover {
    text-decoration: underline;
}

.recaptcha-info {
    text-align: center;
    margin-top: 20px;
    color: #999;
}

.recaptcha-info a {
    color: #999;
    text-decoration: underline;
}

/* Footer mejorado */
.footer-content {
    text-align: center;
}

.footer-links {
    margin-top: 10px;
}

.footer-links a {
    color: white;
    text-decoration: none;
    opacity: 0.8;
    transition: opacity 0.2s;
}

.footer-links a:hover {
    opacity: 1;
    text-decoration: underline;
}

/* Páginas legales */
.legal-container {
    max-width: 900px;
    margin: 40px auto;
    padding: 40px;
    background: white;
    border-radius: 20px;
    box-shadow: 0 10px 30px rgba(0,0,0,0.1);
}

.legal-header {
    text-align: center;
    margin-bottom: 40px;
    padding-bottom: 20px;
    border-bottom: 2px solid #e0e0e0;
}

.legal-header h1 {
    color: #333;
    margin-bottom: 10px;
}

.legal-header .last-updated {
    color: #666;
    font-size: 0.9em;
}

.legal-content h2 {
    color: #667eea;
    margin-top: 30px;
    margin-bottom: 15px;
}

.legal-content h3 {
    color: #333;
    margin-top: 20px;
    margin-bottom: 10px;
}

.legal-content p {
    line-height: 1.8;
    color: #333;
    margin-bottom: 15px;
}

.legal-content ul, .legal-content ol {
    margin: 15px 0;
    padding-left: 30px;
}

.legal-content li {
    margin-bottom: 10px;
    line-height: 1.6;
}

.legal-highlight {
    background: #fff3cd;
    border-left: 4px solid #ffc107;
    padding: 15px;
    margin: 20px 0;
    border-radius: 5px;
}

.legal-footer {
    margin-top: 40px;
    padding-top: 20px;
    border-top: 2px solid #e0e0e0;
    text-align: center;
    color: #666;
}

/* Responsive */
@media (max-width: 768px) {
    .form-row {
        grid-template-columns: 1fr;
    }
    
    .auth-box {
        padding: 25px;
    }
    
    .nav-items {
        flex-direction: column;
        gap: 10px;
    }
    
    .user-info {
        flex-direction: column;
        text-align: center;
    }
    
    .flash-messages {
        right: 10px;
        left: 10px;
        max-width: none;
    }
}
/* ============================================================
   ESTILOS ADICIONALES - LÍMITES DE CONSULTAS
   ============================================================ */

.consultas-info {
    display: flex;
    gap: 15px;
    margin-bottom: 20px;
    justify-content: center;
}

.info-card {
    background: white;
    border: 2px solid #e0e0e0;
    padding: 12px 20px;
    border-radius: 10px;
    display: flex;
    gap: 10px;
    align-items: center;
}

.info-label {
    color: #666;
    font-size: 0.9em;
}

.info-value {
    font-weight: bold;
    color: #667eea;
    font-size: 1.1em;
}

.info-value.text-warning {
    color: #ffc107;
    animation: pulse 1s infinite;
}

@keyframes pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.6; }
}

/* Responsive consultas-info */
@media (max-width: 768px) {
    .consultas-info {
        flex-direction: column;
    }
    
    .info-card {
        justify-content: center;
    }
}