﻿* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

:root {
    --primary-color: #4F46E5;
    --primary-color-dark: #4338CA;
    --secondary-color: #10B981;
    --background-color: #F3F4F6;
    --surface-color: #FFFFFF;
    --text-color: #1F2937;
    --muted-text-color: #6B7280;
    --border-color: #E5E7EB;
    --error-color: #EF4444;
    --success-color: #22C55E;

    --font-family: 'Poppins', sans-serif;
    --border-radius: 0.75rem;
    --shadow: 0 4px 6px -1px rgb(0 0 0 / 0.1), 0 2px 4px -2px rgb(0 0 0 / 0.1);
    --transition: all 0.3s ease-in-out;
}

body {
    font-family: var(--font-family);
    background-color: var(--background-color);
    color: var(--text-color);
    line-height: 1.6;
}

/* ==================== SIDEBAR STYLES - Controlados desde navbar_sidebar.css ==================== */
/* Los estilos principales de sidebar y navbar están en navbar_sidebar.css */
/* Aquí solo ajustes específicos del container */

/* Ajustar el container para que no quede debajo de la sidebar */
#appContent > .container,
#appContent > main.container { 
    margin-left: var(--sidebar-width, 260px);
    padding-top: calc(var(--navbar-height, 64px) + 1.5rem);
    transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
}

/* Evitar salto: reservar espacio por el header cuando se hace scrollIntoView */
#appContent > .container > section,
#resultsSection {
    scroll-margin-top: calc(var(--navbar-height, 64px) + 12px);
}

@media (max-width: 900px) {
    #appContent > .container,
    #appContent > main.container { 
        margin-left: var(--sidebar-collapsed-width, 72px); 
    }
}

@media (max-width: 640px) {
    #appContent > .container,
    #appContent > main.container { 
        margin-left: 0; 
    }
}

/* ==================== LOGIN STYLES ==================== */
.login-section {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, #f5f7fa 0%, #e4e8eb 100%);
    padding: 1rem;
}

.login-container {
    width: 100%;
    max-width: 420px;
}

.login-card {
    background: white;
    border-radius: 1rem;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.1);
    padding: 2.5rem;
    border: 1px solid #e5e7eb;
}

.login-header {
    text-align: center;
    margin-bottom: 2rem;
}

.login-logo {
    height: 60px;
    width: auto;
    margin-bottom: 1rem;
    border: 2px solid #2563eb;
    padding: 0.25rem;
    border-radius: 4px;
}

.login-title {
    font-family: 'Cormorant Garamond', 'Georgia', serif;
    font-weight: 400;
    font-size: 1.5rem;
    color: #1a3a5c;
    margin-bottom: 0.5rem;
    letter-spacing: 0.5px;
}

.login-subtitle {
    font-family: 'Cormorant Garamond', 'Georgia', serif;
    font-size: 0.9rem;
    font-style: italic;
    color: #6B7280;
}

.login-form {
    display: flex;
    flex-direction: column;
    gap: 1.25rem;
}

.login-form .form-group {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.login-form label {
    font-size: 0.875rem;
    font-weight: 500;
    color: #374151;
}

.login-form input {
    padding: 0.875rem 1rem;
    border: 1px solid #d1d5db;
    border-radius: 0.5rem;
    font-size: 1rem;
    font-family: var(--font-family);
    transition: border-color 0.2s, box-shadow 0.2s;
}

.login-form input:focus {
    outline: none;
    border-color: #2563eb;
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.1);
}

.login-form input::placeholder {
    color: #9ca3af;
}

.login-error {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.75rem 1rem;
    background: #fef2f2;
    border: 1px solid #fecaca;
    border-radius: 0.5rem;
    color: #dc2626;
    font-size: 0.875rem;
}

.login-error svg {
    flex-shrink: 0;
}

.login-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    padding: 1rem;
    background: linear-gradient(135deg, #2563eb 0%, #1d4ed8 100%);
    color: white;
    border: none;
    border-radius: 0.5rem;
    font-size: 1rem;
    font-weight: 600;
    font-family: var(--font-family);
    cursor: pointer;
    transition: transform 0.2s, box-shadow 0.2s;
    margin-top: 0.5rem;
}

.login-btn:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(37, 99, 235, 0.4);
}

.login-btn:active {
    transform: translateY(0);
}

.login-btn:disabled {
    opacity: 0.7;
    cursor: not-allowed;
    transform: none;
}

.login-loader {
    display: flex;
    align-items: center;
}

.login-loader .spinner {
    width: 20px;
    height: 20px;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    from {
        transform: rotate(0deg);
    }

    to {
        transform: rotate(360deg);
    }
}

/* Logout button */
.logout-btn {
    display: flex;
    align-items: center;
    gap: 0.35rem;
    padding: 0.4rem 0.75rem;
    background: transparent;
    color: #6B7280;
    border: 1px solid #d1d5db;
    border-radius: 0.375rem;
    font-size: 0.8rem;
    font-family: var(--font-family);
    cursor: pointer;
    transition: all 0.2s;
    margin-left: 1rem;
}

.logout-btn:hover {
    background: #f3f4f6;
    color: #dc2626;
    border-color: #dc2626;
}

.logout-btn svg {
    flex-shrink: 0;
}

/* User Menu Dropdown */
.user-menu {
    position: relative;
    margin-left: auto;
}

.user-menu-btn {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.4rem 0.75rem;
    background: transparent;
    border: 1px solid var(--border-color);
    border-radius: 0.5rem;
    cursor: pointer;
    transition: all 0.2s;
    font-family: var(--font-family);
}

.user-menu-btn:hover {
    background: var(--background-color);
    border-color: var(--primary-color);
}

.user-avatar {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--primary-color), var(--secondary-color));
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
}

.user-name {
    font-size: 0.875rem;
    font-weight: 500;
    color: var(--text-color);
    max-width: 120px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.dropdown-arrow {
    color: var(--text-light);
    transition: transform 0.2s;
}

.user-menu.open .dropdown-arrow {
    transform: rotate(180deg);
}

.user-dropdown {
    position: absolute;
    top: calc(100% + 8px);
    right: 0;
    min-width: 220px;
    background: white;
    border: 1px solid var(--border-color);
    border-radius: 0.5rem;
    box-shadow: 0 10px 40px rgba(0,0,0,0.12);
    opacity: 0;
    visibility: hidden;
    transform: translateY(-10px);
    transition: all 0.2s ease;
    z-index: 1000;
}

.user-menu.open .user-dropdown {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}

.dropdown-header {
    padding: 0.75rem 1rem;
}

.dropdown-email {
    font-size: 0.8rem;
    color: var(--text-light);
}

.dropdown-divider {
    height: 1px;
    background: var(--border-color);
    margin: 0;
}

.dropdown-item {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    width: 100%;
    padding: 0.75rem 1rem;
    background: transparent;
    border: none;
    font-size: 0.875rem;
    font-family: var(--font-family);
    color: var(--text-color);
    cursor: pointer;
    transition: all 0.15s;
    text-align: left;
}

.dropdown-item:hover {
    background: #fef2f2;
    color: #dc2626;
}

.dropdown-item svg {
    flex-shrink: 0;
}

@media (max-width: 600px) {
    .user-name {
        display: none;
    }
    .user-menu-btn {
        padding: 0.35rem;
    }
}

/* ==================== END LOGIN STYLES ==================== */

/* Modo exportación PDF: eliminar sombras y animaciones que se pierden en html2canvas */
body.pdf-export {
    font-size: 13px;
    line-height: 1.5;
}

body.pdf-export .analysis-section {
    animation: none !important;
    opacity: 1 !important;
    transform: none !important;
    box-shadow: none;
    border-color: #222;
    page-break-inside: avoid;
    padding: 1.2rem;
}

body.pdf-export .analysis-section .section-title {
    border-color: #ccc;
    font-size: 1.2rem;
    padding-bottom: 0.6rem;
    margin-bottom: 0.8rem;
}

body.pdf-export .badge {
    filter: none;
}

body.pdf-export .table-wrapper {
    box-shadow: none;
    page-break-inside: avoid;
}

body.pdf-export table {
    page-break-inside: avoid;
    font-size: 0.85rem;
}

body.pdf-export table th,
body.pdf-export table td {
    padding: 0.65rem 0.9rem;
}

body.pdf-export .section-content {
    page-break-inside: avoid;
}

body.pdf-export .section-content-body p,
body.pdf-export .section-content-body ul,
body.pdf-export .section-content-body li {
    font-size: 0.9rem;
    line-height: 1.5;
}

body.pdf-export .section-content-body p {
    margin-bottom: 0.75rem;
}

body.pdf-export .section-content-body ul {
    margin-bottom: 0.75rem;
}

body.pdf-export .section-content-body li {
    margin-bottom: 0.4rem;
}

/* Mantener background en PDF pero más sutil */
body.pdf-export #resultsSection {
    background:
        linear-gradient(to bottom, rgba(255, 255, 255, 0.96), rgba(255, 255, 255, 0.98)),
        url('/mini-logo-mp.png');
    background-size:
        cover,
        350px 350px;
    padding: 0 2.5rem 2rem 2.5rem;
    box-shadow: none;
}

/* Asegurar que el logo se vea en el PDF */
body.pdf-export .results-logo {
    margin-bottom: 2rem;
    padding-top: 1rem;
    page-break-inside: avoid;
}

body.pdf-export .report-logo {
    max-width: 300px;
    opacity: 0.95;
    filter: drop-shadow(0 2px 4px rgba(0, 0, 0, 0.1));
}

body.pdf-export .results-header {
    border-bottom: 2px solid #e5e7eb;
    padding-bottom: 1rem;
    margin-bottom: 1.5rem;
}

body.pdf-export .results-header h2 {
    font-size: 1.4rem;
}

/* Ocultar texto introductorio de Gemini en el PDF */
body.pdf-export .hide-in-pdf {
    display: none !important;
}

body.pdf-export .analysis-section.pdf-continuation {
    margin-top: 0.75rem;
    padding-top: 0.85rem;
    padding-bottom: 1.25rem;
    border-left-color: #9ca3af;
}

body.pdf-export .analysis-section.pdf-continuation .section-title {
    margin-bottom: 0.5rem;
    padding-bottom: 0.5rem;
    justify-content: space-between;
}

body.pdf-export .analysis-section.pdf-continuation .section-icon {
    display: none;
}

body.pdf-export .analysis-section.pdf-continuation .continuation-badge {
    margin-left: auto;
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    font-size: 0.72rem;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    background: linear-gradient(135deg, var(--primary-color), #6366f1);
    color: #ffffff;
    padding: 0.2rem 0.65rem;
    border-radius: 999px;
    box-shadow: 0 6px 16px rgba(79, 70, 229, 0.25);
}

.pdf-loading-modal {
    position: fixed;
    inset: 0;
    background: rgba(15, 23, 42, 0.35);
    backdrop-filter: blur(8px);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 9999;
}

.pdf-loading-content {
    background: linear-gradient(155deg, #ffffff, #f8fafc);
    padding: 2.75rem 3.25rem;
    border-radius: 1.5rem;
    box-shadow: 0 25px 60px rgba(15, 23, 42, 0.25);
    text-align: center;
    display: flex;
    flex-direction: column;
    gap: 1.75rem;
    min-width: 260px;
}

.pdf-loading-text {
    font-size: 1.05rem;
    color: #0f172a;
    font-weight: 600;
    letter-spacing: 0.02em;
}

.pdf-logo-spinner {
    width: 96px;
    height: 96px;
    margin: 0 auto 1.5rem;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

.pdf-logo-spinner-image {
    width: 100%;
    height: 100%;
    object-fit: contain;
    animation: pdf-logo-spin 2.25s linear infinite;
    transform-origin: center;
    filter: drop-shadow(0 12px 24px rgba(15, 23, 42, 0.25));
}

@keyframes pdf-logo-spin {
    from {
        transform: rotate(0deg);
    }

    to {
        transform: rotate(360deg);
    }
}

/* Modal PDF Completado */
.pdf-complete-modal {
    position: fixed;
    inset: 0;
    background: rgba(15, 23, 42, 0.4);
    backdrop-filter: blur(8px);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 10000;
    animation: fadeIn 0.3s ease;
}

.pdf-complete-content {
    background: white;
    padding: 3rem 3.5rem;
    border-radius: 1.5rem;
    box-shadow: 0 25px 60px rgba(15, 23, 42, 0.3);
    text-align: center;
    max-width: 400px;
    animation: slideUp 0.4s ease;
}

@keyframes slideUp {
    from {
        opacity: 0;
        transform: translateY(20px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.pdf-complete-icon {
    width: 80px;
    height: 80px;
    margin: 0 auto 1.5rem;
    background: linear-gradient(135deg, #10B981, #059669);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    animation: scaleIn 0.5s ease 0.2s both;
}

@keyframes scaleIn {
    from {
        transform: scale(0);
    }

    to {
        transform: scale(1);
    }
}

.pdf-complete-icon svg {
    fill: white;
    filter: drop-shadow(0 2px 4px rgba(0, 0, 0, 0.1));
}

.pdf-complete-title {
    font-size: 1.5rem;
    font-weight: 600;
    color: #1a3a5c;
    margin-bottom: 0.75rem;
}

.pdf-complete-message {
    font-size: 1rem;
    color: #6B7280;
    margin-bottom: 2rem;
}

.pdf-complete-btn {
    background: #4F46E5;
    color: white;
    border: none;
    padding: 0.875rem 2.5rem;
    border-radius: 0.75rem;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    font-family: var(--font-family);
}

.pdf-complete-btn:hover {
    background: #4338CA;
    transform: translateY(-2px);
    box-shadow: 0 8px 20px rgba(79, 70, 229, 0.3);
}

.container {
    max-width: 1600px;
    margin: 0 auto;
    padding: 2rem 1.5rem;
}

/* Header antiguo (DESACTIVADO - Ahora usamos .app-navbar en navbar_sidebar.css)
.app-header {
    background: white;
    color: #1a3a5c;
    padding: 0.25rem 0;
    text-align: center;
    margin-bottom: 0.5rem;
    transition: var(--transition);
    border-bottom: 1px solid #e5e7eb;
}

.app-header.compact {
    padding: 1.25rem 0;
    margin-bottom: 1.5rem;
}
*/

/* Footer */
.app-footer {
    text-align: center;
    padding: 2rem 0;
    color: var(--muted-text-color);
    font-size: 0.9rem;
    margin-top: 2rem;
}

/* Mode Selection Cards */
.mode-selection {
    margin-bottom: 3rem;
}

.mode-cards-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 1.5rem;
    max-width: 1200px;
    margin: 0 auto;
    padding: 1.5rem 0;
}

/* Centrar los últimos 2 cards en la segunda fila */
.mode-cards-grid .mode-card:nth-child(4) {
    grid-column: 1 / 2;
    margin-left: auto;
    margin-right: 0;
    width: 100%;
    max-width: 100%;
}

.mode-cards-grid .mode-card:nth-child(5) {
    grid-column: 2 / 3;
    margin-left: 0;
    margin-right: auto;
    width: 100%;
    max-width: 100%;
}

/* Para 5 cards: centrar las últimas 2 usando un wrapper approach */
@media (min-width: 1024px) {
    .mode-cards-grid {
        display: flex;
        flex-wrap: wrap;
        justify-content: center;
        gap: 1.5rem;
        max-width: 1300px;
    }

    .mode-cards-grid .mode-card {
        flex: 0 0 calc(33.333% - 1rem);
        max-width: calc(33.333% - 1rem);
    }

    .mode-cards-grid .mode-card:nth-child(4),
    .mode-cards-grid .mode-card:nth-child(5) {
        flex: 0 0 calc(33.333% - 1rem);
        max-width: calc(33.333% - 1rem);
        margin-left: 0;
        margin-right: 0;
    }
}

.mode-card {
    background: #ffffff;
    border-radius: 1rem;
    padding: 1.75rem 1.5rem;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.06);
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    cursor: pointer;
    position: relative;
    overflow: hidden;
    border: 1px solid #e2e8f0;
    display: flex;
    flex-direction: column;
    min-height: 320px;
}

.mode-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 4px;
    height: 100%;
    background: linear-gradient(180deg, #0f172a, #1e293b);
    transition: all 0.3s ease;
}

.mode-card:hover {
    transform: translateY(-6px);
    box-shadow: 0 20px 40px rgba(15, 23, 42, 0.12);
    border-color: #0f172a;
}

.mode-card.active {
    border-color: #0f172a;
    box-shadow: 0 20px 40px rgba(15, 23, 42, 0.15);
    transform: translateY(-6px);
}

.mode-card.active::before {
    width: 5px;
    background: linear-gradient(180deg, #d4a853, #e8c87a);
}
.mode-card:hover::before {
    width: 5px;
    background: linear-gradient(180deg, #d4a853, #e8c87a);
}

.mode-card>* {
    position: relative;
    z-index: 1;
}


.mode-card-heading {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    margin-bottom: 1rem;
}

.mode-card-icon {
    width: 48px;
    height: 48px;
    background: linear-gradient(135deg, #0f172a 0%, #1e293b 100%);
    border-radius: 0.625rem;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    transition: all 0.3s ease;
    box-shadow: 0 4px 12px rgba(15, 23, 42, 0.2);
}

.mode-card:hover .mode-card-icon {
    transform: translateY(-2px) scale(1.05);
    box-shadow: 0 8px 20px rgba(15, 23, 42, 0.3);
}

.mode-card-icon.comparison {
    background: linear-gradient(135deg, #f59e0b 0%, #d97706 100%);
    box-shadow: 0 4px 12px rgba(245, 158, 11, 0.3);
}

.mode-card:hover .mode-card-icon.comparison {
    box-shadow: 0 8px 20px rgba(245, 158, 11, 0.4);
}

.mode-card-icon.meeting {
    background: linear-gradient(135deg, #10b981 0%, #059669 100%);
    box-shadow: 0 4px 12px rgba(16, 185, 129, 0.3);
}

.mode-card:hover .mode-card-icon.meeting {
    box-shadow: 0 8px 20px rgba(16, 185, 129, 0.4);
}

.mode-card-icon.chat {
    background: linear-gradient(135deg, #8B5CF6 0%, #7C3AED 100%);
    box-shadow: 0 4px 12px rgba(139, 92, 246, 0.3);
}

.mode-card:hover .mode-card-icon.chat {
    box-shadow: 0 8px 20px rgba(139, 92, 246, 0.4);
}

.mode-card-icon.email {
    background: linear-gradient(135deg, #3b82f6 0%, #2563eb 100%);
    box-shadow: 0 4px 12px rgba(59, 130, 246, 0.3);
}

.mode-card:hover .mode-card-icon.email {
    box-shadow: 0 8px 20px rgba(59, 130, 246, 0.4);
}

.mode-card-icon svg {
    width: 24px;
    height: 24px;
    fill: white;
}

.mode-card-title {
    font-family: 'Cormorant Garamond', 'Georgia', serif;
    font-size: 1.4rem;
    font-weight: 600;
    color: #0f172a;
    margin: 0;
    letter-spacing: 0.3px;
    line-height: 1.2;
}

.mode-card-description {
    font-size: 0.9rem;
    color: #64748b;
    line-height: 1.65;
    margin-bottom: 1rem;
    font-weight: 400;
    flex-grow: 1;
}

.mode-card-features {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    margin-bottom: 1.25rem;
}

.feature-badge {
    background: #f8fafc;
    border: 1px solid #e2e8f0;
    padding: 0.4rem 0.75rem;
    border-radius: 6px;
    font-size: 0.75rem;
    color: #475569;
    font-weight: 500;
    transition: all 0.3s ease;
}

.mode-card:hover .feature-badge {
    border-color: #d4a853;
    color: #0f172a;
    background: rgba(212, 168, 83, 0.08);
}

.mode-card-btn {
    width: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    padding: 0.875rem 1.25rem;
    background: linear-gradient(135deg, #0f172a 0%, #1e293b 100%);
    color: white;
    border: none;
    border-radius: 0.625rem;
    font-size: 0.9rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.3s ease;
    font-family: var(--font-family);
    letter-spacing: 0.3px;
    margin-top: auto;
    box-shadow: 0 4px 12px rgba(15, 23, 42, 0.2);
}

.mode-card-btn:hover {
    background: linear-gradient(135deg, #1e293b 0%, #334155 100%);
    transform: translateY(-2px);
    box-shadow: 0 8px 20px rgba(15, 23, 42, 0.3);
}

.mode-card-btn svg {
    width: 18px;
    height: 18px;
    transition: transform 0.3s ease;
}

.mode-card-btn:hover svg {
    transform: translateX(4px);
}

/* Responsive para las cards */
@media (max-width: 1023px) {
    .mode-cards-grid {
        display: grid;
        grid-template-columns: repeat(2, 1fr);
        gap: 1.25rem;
    }

    .mode-cards-grid .mode-card {
        flex: none;
        max-width: none;
    }

    .mode-cards-grid .mode-card:nth-child(5) {
        grid-column: 1 / -1;
        max-width: 400px;
        margin: 0 auto;
    }
}

@media (max-width: 640px) {
    .mode-cards-grid {
        grid-template-columns: 1fr;
        gap: 1rem;
    }

    .mode-cards-grid .mode-card:nth-child(5) {
        max-width: none;
    }

    .mode-card {
        min-height: auto;
        padding: 1.25rem;
    }

    .mode-card-title {
        font-size: 1.25rem;
    }

    .mode-card-description {
        font-size: 0.85rem;
    }
}

/* Botón Volver */
.back-btn {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.625rem 1rem;
    background: white;
    border: 2px solid #e5e7eb;
    border-radius: 0.5rem;
    color: var(--text-color);
    font-size: 0.95rem;
    font-weight: 500;
    cursor: pointer;
    transition: var(--transition);
    margin-bottom: 1.5rem;
    font-family: var(--font-family);
}

.back-btn:hover {
    border-color: var(--primary-color);
    color: var(--primary-color);
    background: #f9fafb;
    transform: translateX(-4px);
}

.back-btn svg {
    transition: transform 0.3s ease;
}

.back-btn:hover svg {
    transform: translateX(-4px);
}

/* Compare Section */
.compare-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 2.5rem;
    margin-bottom: 1.5rem;
    max-width: 1200px;
    margin-left: auto;
    margin-right: auto;
}

.compare-column {
    display: flex;
    flex-direction: column;
}

.compare-title {
    font-size: 1.25rem;
    font-weight: 600;
    margin-bottom: 1.25rem;
    color: var(--text-color);
    text-align: center;
}

.compare-upload {
    height: 320px;
}

.compare-upload .upload-content h4 {
    font-size: 1rem;
    font-weight: 600;
    margin-bottom: 0.5rem;
}

.compare-upload .upload-content p {
    font-size: 0.9rem;
}

.file-name-compare {
    font-size: 0.9rem;
}

/* Meeting Summary Section */
.meeting-container {
    background-color: var(--surface-color);
    padding: 2rem;
    border-radius: var(--border-radius);
    box-shadow: var(--shadow);
}

.meeting-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
    gap: 2rem;
    margin-bottom: 1.5rem;
}

.meeting-panel {
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius);
    padding: 1.5rem;
    background: #f9fafb;
    height: 100%;
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.meeting-panel-header h3 {
    font-size: 1.2rem;
    color: var(--text-color);
    margin-bottom: 0.35rem;
}

.meeting-panel-header p {
    color: var(--muted-text-color);
    font-size: 0.9rem;
}

.meeting-textarea {
    width: 100%;
    min-height: 240px;
    border-radius: var(--border-radius);
    border: 1px solid var(--border-color);
    padding: 1rem;
    font-family: var(--font-family);
    font-size: 0.95rem;
    resize: vertical;
    background: white;
    transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.meeting-textarea:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(79, 70, 229, 0.1);
}

.meeting-meta {
    display: flex;
    flex-direction: column;
    gap: 0.4rem;
    color: var(--muted-text-color);
    font-size: 0.85rem;
}

.meeting-hint {
    color: #059669;
    font-weight: 500;
}

.audio-upload {
    min-height: 220px;
    background: white;
}

.meeting-tips {
    margin-top: auto;
    padding-left: 1.2rem;
    color: var(--muted-text-color);
    font-size: 0.9rem;
    display: flex;
    flex-direction: column;
    gap: 0.3rem;
}

.meeting-tips li {
    list-style: disc;
}

/* Loading Overlay */
.loading-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(255, 255, 255, 0.98);
    backdrop-filter: blur(10px);
    z-index: 9999;
    display: flex;
    align-items: center;
    justify-content: center;
    animation: fadeIn 0.3s ease;
}

.loading-content {
    text-align: center;
    color: #1F2937;
    max-width: 500px;
    padding: 3rem 2rem;
    background: white;
    border-radius: 1rem;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.1);
}

.loading-logo-container {
    position: relative;
    width: 100%;
    max-width: 300px;
    height: auto;
    margin: 0 auto 2rem;
    display: flex;
    align-items: center;
    justify-content: center;
}

.loading-logo {
    width: 100%;
    max-width: 220px;
    height: auto;
    animation: logoPulse 2s ease-in-out infinite;
    filter: drop-shadow(0 4px 12px rgba(79, 70, 229, 0.2));
}

@keyframes logoPulse {
    0% {
        transform: scale(1);
        filter: drop-shadow(0 4px 12px rgba(79, 70, 229, 0.2));
    }

    50% {
        transform: scale(1.12);
        filter: drop-shadow(0 20px 30px rgba(79, 70, 229, 0.4));
    }

    100% {
        transform: scale(1);
        filter: drop-shadow(0 4px 12px rgba(79, 70, 229, 0.2));
    }
}

@keyframes rotate {
    0% {
        transform: rotate(0deg) scale(1);
    }

    50% {
        transform: rotate(180deg) scale(1.1);
    }

    100% {
        transform: rotate(360deg) scale(1);
    }
}

@keyframes fadeIn {
    from {
        opacity: 0;
    }

    to {
        opacity: 1;
    }
}

.loading-title {
    font-size: 1.5rem;
    font-weight: 600;
    margin-bottom: 1rem;
    color: #1a3a5c;
    animation: pulse 2s ease-in-out infinite;
}

.loading-message {
    font-size: 1.1rem;
    opacity: 0.8;
    margin-bottom: 1.5rem;
    color: #4B5563;
    font-weight: 400;
    animation: textFade 3s ease-in-out infinite;
}

@keyframes textFade {

    0%,
    100% {
        opacity: 0.6;
    }

    50% {
        opacity: 1;
    }
}

.loading-progress {
    width: 100%;
    height: 4px;
    background: rgba(255, 255, 255, 0.2);
    border-radius: 2px;
    overflow: hidden;
}

.progress-bar {
    height: 100%;
    background: white;
    border-radius: 2px;
    animation: progress 2s ease-in-out infinite;
}

@keyframes progress {
    0% {
        width: 10%;
        transform: translateX(0);
    }

    50% {
        width: 60%;
        transform: translateX(50%);
    }

    100% {
        width: 10%;
        transform: translateX(500%);
    }
}

/* Estilos para el Timer de Carga */
.loading-timer {
    font-family: 'Monaco', 'Consolas', 'Courier New', monospace;
    font-size: 3rem;
    font-weight: 700;
    color: #1a3a5c;
    margin-top: 1.5rem;
    background: linear-gradient(145deg, #ffffff, #f3f4f6);
    padding: 0.75rem 2.5rem;
    border-radius: 1rem;
    box-shadow:
        5px 5px 10px #d1d5db,
        -5px -5px 10px #ffffff;
    letter-spacing: 3px;
    display: inline-block;
    min-width: 220px;
    text-shadow: 1px 1px 0px rgba(255, 255, 255, 0.5);
    border: 1px solid rgba(255, 255, 255, 0.8);
}

/* Badge de duración en resultados */
.duration-badge {
    display: inline-block;
    font-size: 0.85rem;
    color: #6B7280;
    background-color: #F3F4F6;
    padding: 0.25rem 0.75rem;
    border-radius: 9999px;
    margin-top: 0.25rem;
    font-weight: 500;
}

/* Badge del modelo usado */
.model-badge {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    font-size: 0.8rem;
    color: #4F46E5;
    background: linear-gradient(135deg, #EEF2FF 0%, #E0E7FF 100%);
    padding: 0.25rem 0.75rem;
    border-radius: 9999px;
    margin-left: 0.5rem;
    font-weight: 500;
    border: 1px solid #C7D2FE;
}

.model-badge svg {
    color: #22C55E;
}

.model-badge.fallback {
    color: #D97706;
    background: linear-gradient(135deg, #FFFBEB 0%, #FEF3C7 100%);
    border-color: #FCD34D;
}

.model-badge.fallback svg {
    color: #F59E0B;
}

/* Texto de duración en error */
.error-duration-text {
    font-size: 0.9rem;
    color: #9CA3AF;
    margin-top: 0.5rem;
    margin-bottom: 1rem;
}

/* Botones */
.btn {
    padding: 0.75rem 1.5rem;
    border: none;
    border-radius: var(--border-radius);
    font-family: var(--font-family);
    font-weight: 500;
    font-size: 1rem;
    cursor: pointer;
    transition: var(--transition);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
}

.btn-primary {
    background-color: var(--primary-color);
    color: white;
}

.btn-primary:hover:not(:disabled) {
    background-color: var(--primary-color-dark);
    transform: translateY(-2px);
    box-shadow: var(--shadow);
}

.btn-primary:disabled {
    background-color: #A5B4FC;
    cursor: not-allowed;
}

/* Model Selector */
.model-selector {
    margin: 1.5rem 0;
    display: flex;
    align-items: center;
    gap: 1rem;
    padding: 1rem;
    background: #f9fafb;
    border-radius: var(--border-radius);
    border: 1px solid var(--border-color);
}

.model-selector label {
    font-weight: 500;
    color: var(--text-color);
    font-size: 0.95rem;
    white-space: nowrap;
}

.model-select {
    flex: 1;
    padding: 0.625rem 1rem;
    border: 1px solid var(--border-color);
    border-radius: 0.375rem;
    background-color: white;
    color: var(--text-color);
    font-size: 0.95rem;
    font-family: var(--font-family);
    cursor: pointer;
    transition: var(--transition);
}

.model-select:hover {
    border-color: var(--primary-color);
}

.model-select:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(79, 70, 229, 0.1);
}

.btn-secondary {
    background-color: #4F46E5;
    color: white;
    border: 2px solid #4338CA;
    font-weight: 600;
    transition: all 0.3s ease;
}

.btn-secondary:hover {
    background-color: #4338CA;
    border-color: #3730A3;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(79, 70, 229, 0.3);
}

.btn-icon {
    background: white;
    border: 2px solid #e5e7eb;
    color: #4B5563;
    padding: 0.75rem 1.25rem;
    font-weight: 500;
    transition: all 0.3s ease;
}

.btn-icon:hover {
    background-color: #F3F4F6;
    color: #1F2937;
    border-color: #D1D5DB;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
}

.btn-icon svg {
    width: 1.25rem;
    height: 1.25rem;
}

.btn-text {
    background: none;
    border: none;
    color: var(--primary-color);
    font-weight: 500;
    cursor: pointer;
}

.btn-text:hover {
    text-decoration: underline;
}

/* Upload Container */
.upload-container {
    background-color: var(--surface-color);
    padding: 2rem;
    border-radius: var(--border-radius);
    box-shadow: var(--shadow);
    text-align: center;
}

.upload-box {
    border: 2px dashed var(--border-color);
    border-radius: var(--border-radius);
    padding: 2.5rem;
    cursor: pointer;
    transition: var(--transition);
    margin-bottom: 1.5rem;
}

.upload-box:hover,
.upload-box.drag-over {
    border-color: var(--primary-color);
    background-color: #EEF2FF;
}

.upload-content h3 {
    font-size: 1.2rem;
    margin: 1rem 0 0.5rem;
}

.upload-content p {
    color: var(--muted-text-color);
    margin-bottom: 1rem;
}

.upload-icon {
    width: 4rem;
    height: 4rem;
    color: var(--primary-color);
}

.file-selected-view {
    display: flex;
    align-items: center;
    justify-content: center;
    flex-direction: column;
    gap: 1rem;
}

.file-icon {
    width: 3rem;
    height: 3rem;
    color: var(--secondary-color);
}

#fileName {
    font-weight: 500;
    font-size: 1.1rem;
}

#analyzeBtn {
    width: 100%;
    min-height: 50px;
}

/* Loader mejorado */
.loader {
    position: relative;
    width: 24px;
    height: 24px;
    display: inline-block;
}

.loader::before,
.loader::after {
    content: '';
    position: absolute;
    border-radius: 50%;
    animation: pulse 1.5s ease-in-out infinite;
}

.loader::before {
    width: 24px;
    height: 24px;
    border: 3px solid rgba(255, 255, 255, 0.8);
    animation: ripple 1.5s ease-out infinite;
}

.loader::after {
    width: 16px;
    height: 16px;
    background: white;
    top: 4px;
    left: 4px;
    animation: pulse 1s ease-in-out infinite;
}

@keyframes ripple {
    0% {
        transform: scale(0.8);
        opacity: 1;
    }

    50% {
        transform: scale(1.2);
        opacity: 0.5;
    }

    100% {
        transform: scale(0.8);
        opacity: 1;
    }
}

@keyframes pulse {

    0%,
    100% {
        transform: scale(0.8);
        opacity: 0.8;
    }

    50% {
        transform: scale(1);
        opacity: 1;
    }
}

/* Results Section */
#resultsSection {
    margin-top: 2rem;
    margin-left: auto;
    margin-right: auto;
    max-width: 1600px;
    width: 100%;
    position: relative;
    padding: 2.5rem 3rem;
    border-radius: var(--border-radius);
    background:
        linear-gradient(to bottom, rgba(255, 255, 255, 0.96), rgba(255, 255, 255, 0.98)),
        url('/mini-logo-mp.png');
    background-size:
        cover,
        400px 400px;
    background-position:
        center,
        center;
    background-repeat:
        no-repeat,
        repeat;
    background-attachment: scroll, scroll;
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1);
}

/* PDF Header Logo */
.pdf-header-logo {
    text-align: center;
    padding: 0;
    margin-bottom: 0.25rem;
    border-bottom: 1px solid #e5e7eb;
}

.report-logo-pdf {
    max-width: 400px;
    height: auto;
    display: block;
    margin: 0 auto;
    padding: 0;
}

/* Ocultar logo en pantalla, mostrar solo en PDF */
body:not(.pdf-export) .pdf-header-logo {
    display: none;
}

body.pdf-export .pdf-header-logo {
    display: block;
    padding: 0;
    margin: 0;
    margin-bottom: 0.5rem;
}

.results-logo {
    text-align: center;
    margin-bottom: -5rem;
    padding-top: 0rem;
}

.report-logo {
    max-width: 300px;
    height: auto;
    opacity: 0.95;
    filter: drop-shadow(0 2px 4px rgba(0, 0, 0, 0.1));
}

.results-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 2rem;
    padding-bottom: 1rem;
    border-bottom: 2px solid #e5e7eb;
    flex-wrap: wrap;
    gap: 1rem;
    position: relative;
    z-index: 10;
    background: rgba(255, 255, 255, 0.95);
    padding: 1rem;
    border-radius: 0.5rem;
}

.results-header h2 {
    font-size: 1.8rem;
    font-weight: 600;
    color: #1a3a5c;
    margin: 0;
}

.results-actions {
    display: flex;
    gap: 0.75rem;
    flex-wrap: wrap;
    align-items: center;
}

.results-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 1.5rem;
}

body.pdf-export .results-grid {
    margin-top: 0.75rem;
}

.analysis-section {
    background-color: var(--surface-color);
    border-radius: var(--border-radius);
    padding: 1.5rem;
    box-shadow: var(--shadow);
    border-left: 5px solid;
    opacity: 0;
    transform: translateY(20px);
}

@keyframes slideIn {
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.section-title {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    font-size: 1.4rem;
    font-weight: 600;
    margin-bottom: 1rem;
    padding-bottom: 0.75rem;
    border-bottom: 1px solid var(--border-color);
}

.section-icon {
    font-size: 1.5rem;
}

.section-content-body p,
.section-content-body ul {
    margin-bottom: 1rem;
}

.section-content-body ul {
    padding-left: 1.5rem;
}

.section-content-body li {
    margin-bottom: 0.5rem;
}

/* Section Colors */
.summary {
    border-color: var(--primary-color);
}

.income {
    border-color: var(--success-color);
}

.expenses {
    border-color: var(--error-color);
}

.balance {
    border-color: #F59E0B;
}

.recommendations {
    border-color: #8B5CF6;
}

/* Content Formatting */
.highlight-number {
    font-weight: 600;
    color: var(--primary-color);
    background-color: #EEF2FF;
    padding: 0.1rem 0.4rem;
    border-radius: 0.25rem;
}

.badge {
    padding: 0.25rem 0.6rem;
    border-radius: 999px;
    font-weight: 500;
    font-size: 0.8rem;
    text-transform: uppercase;
}

.badge.positive {
    background-color: #D1FAE5;
    color: #065F46;
}

.badge.negative {
    background-color: #FEE2E2;
    color: #991B1B;
}

hr.divider {
    border: none;
    border-top: 1px solid var(--border-color);
    margin: 1.5rem 0;
}

/* Error Section */
.error-container {
    background-color: #FFFBEB;
    border: 1px solid #FBBF24;
    border-radius: var(--border-radius);
    padding: 2rem;
    text-align: center;
    color: #92400E;
}

.error-icon {
    width: 3rem;
    height: 3rem;
    color: #D97706;
    margin-bottom: 1rem;
}

.error-container h3 {
    font-size: 1.5rem;
    margin-bottom: 0.5rem;
}

.error-actions {
    margin-top: 1.5rem;
    display: flex;
    justify-content: center;
    gap: 1rem;
}

/* Contenedor responsivo para tablas */
.table-wrapper {
    width: 100%;
    overflow-x: auto;
    background: var(--surface-color);
    border-radius: var(--border-radius);
}

/* Estilos para tablas */
table {
    width: 100%;
    border-collapse: collapse;
    margin: 1.5rem 0;
    font-size: 0.95rem;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.05);
    border-radius: var(--border-radius);
    overflow: hidden;
}

table thead {
    background-color: var(--background-color);
}

table th,
table td {
    padding: 0.9rem 1.2rem;
    text-align: left;
    border-bottom: 1px solid var(--border-color);
}

table th {
    font-weight: 600;
    color: var(--text-color);
}

table th:nth-child(2),
table th:nth-child(3),
table th:nth-child(4),
table th:nth-child(5) {
    text-align: right;
}

table tbody tr:last-child td {
    border-bottom: none;
}

table tbody tr:hover {
    background-color: #F9FAFB;
}

table td:nth-child(2),
table td:nth-child(3),
table td:nth-child(4),
table td:nth-child(5) {
    text-align: right;
    font-family: monospace;
    font-size: 1rem;
}

table tr.table-summary td {
    font-weight: 600;
    color: var(--primary-color);
    border-top: 2px solid var(--border-color);
}


/* Responsive */
@media (max-width: 768px) {
    .container {
        padding: 1.5rem 1rem;
    }

    .header-content {
        gap: 1rem;
    }

    .header-line {
        flex: 0.5;
    }

    .header-center {
        flex-direction: column;
        gap: 0.5rem;
    }

    .header-logo {
        height: 38px;
    }

    .app-header h1 {
        font-size: 1.35rem;
        text-align: center;
    }

    .app-header .subtitle {
        font-size: 0.85rem;
        padding: 0 1rem;
    }

    .mode-selector {
        flex-direction: column;
        gap: 0.75rem;
    }

    .mode-btn {
        justify-content: center;
        padding: 0.75rem 1rem;
        font-size: 0.95rem;
    }

    .compare-grid {
        grid-template-columns: 1fr;
        gap: 1rem;
    }

    .compare-upload {
        height: 200px;
    }

    .results-logo {
        margin-bottom: 1.5rem;
        padding-top: 0.5rem;
    }

    .report-logo {
        max-width: 220px;
    }

    .results-header {
        flex-direction: column;
        align-items: flex-start;
        margin-bottom: 1.5rem;
        gap: 1rem;
    }

    .results-header h2 {
        font-size: 1.5rem;
    }

    .results-actions {
        width: 100%;
        flex-direction: column;
        gap: 0.75rem;
    }

    .results-actions .btn,
    .results-actions .btn-icon,
    .results-actions .btn-secondary {
        width: 100%;
        justify-content: center;
    }

    #resultsSection {
        width: 95%;
        max-width: 95%;
        padding: 1.5rem;
        background-size:
            cover,
            250px 250px;
    }

    .meeting-grid {
        grid-template-columns: 1fr;
    }

    .meeting-panel {
        padding: 1.25rem;
    }
}

/* ===== MODO EDICIÓN ===== */
.btn-edit {
    background: linear-gradient(135deg, #8B5CF6 0%, #7C3AED 100%);
    color: white;
}

.btn-edit:hover {
    background: linear-gradient(135deg, #7C3AED 0%, #6D28D9 100%);
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(139, 92, 246, 0.4);
}

.btn-edit.active {
    background: linear-gradient(135deg, #F59E0B 0%, #D97706 100%);
    animation: editPulse 2s ease-in-out infinite;
}

.btn-edit.active span::after {
    content: ' ✓';
}

@keyframes editPulse {

    0%,
    100% {
        box-shadow: 0 0 0 0 rgba(245, 158, 11, 0.4);
    }

    50% {
        box-shadow: 0 0 0 8px rgba(245, 158, 11, 0);
    }
}

.edit-mode-notice {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    background: linear-gradient(135deg, #FEF3C7 0%, #FDE68A 100%);
    border: 2px solid #F59E0B;
    border-radius: var(--border-radius);
    padding: 0.875rem 1.25rem;
    margin-bottom: 1rem;
    color: #92400E;
    font-size: 0.9rem;
    animation: slideDown 0.3s ease-out;
}

.edit-mode-notice svg {
    flex-shrink: 0;
    color: #D97706;
}

.edit-mode-notice span {
    flex: 1;
}

.edit-mode-notice .btn-sm {
    padding: 0.4rem 0.75rem;
    font-size: 0.8rem;
    white-space: nowrap;
}

@keyframes slideDown {
    from {
        opacity: 0;
        transform: translateY(-10px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Contenido editable */
.section-content-body.editable {
    cursor: text;
    border: 2px dashed #8B5CF6;
    border-radius: 0.5rem;
    padding: 0.75rem;
    margin: -0.75rem;
    transition: all 0.2s ease;
    background: rgba(139, 92, 246, 0.03);
}

.section-content-body.editable:hover {
    border-color: #7C3AED;
    background: rgba(139, 92, 246, 0.06);
}

.section-content-body.editable:focus {
    outline: none;
    border-color: #F59E0B;
    background: rgba(245, 158, 11, 0.05);
    box-shadow: 0 0 0 3px rgba(245, 158, 11, 0.2);
}

.section-content-body.editable::before {
    content: '✏️';
    position: absolute;
    top: -0.75rem;
    right: 0.5rem;
    font-size: 0.9rem;
    opacity: 0;
    transition: opacity 0.2s;
}

.section-content-body.editable:hover::before {
    opacity: 1;
}

.section-content {
    position: relative;
}

/* Responsive para el aviso de edición */
@media (max-width: 768px) {
    .edit-mode-notice {
        flex-direction: column;
        text-align: center;
        gap: 0.5rem;
    }

    .edit-mode-notice .btn-sm {
        width: 100%;
    }
}

/* ===== CHATBOT STYLES ===== */

/* Card del chat en selección de modo */
.mode-card-icon.chat {
    background: linear-gradient(135deg, #8B5CF6 0%, #6D28D9 100%);
}

/* Contenedor principal del chat */
.chat-container {
    background-color: var(--surface-color);
    border-radius: var(--border-radius);
    box-shadow: var(--shadow);
    padding: 0;
    max-width: 1400px;
    width: 95%;
    margin: 0 auto;
    display: flex;
    flex-direction: column;
    height: calc(100vh - 200px);
    min-height: 500px;
    max-height: 700px;
    overflow: hidden;
    font-size: 0.9rem;
}

/* Header del chat */
.chat-header {
    display: flex;
    align-items: center;
    gap: 1rem;
    padding: 1rem 1.5rem;
    background: linear-gradient(135deg, #4F46E5 0%, #7C3AED 100%);
    color: white;
    border-radius: var(--border-radius) var(--border-radius) 0 0;
}

/* Botón volver en el chat */
.chat-back-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.4rem;
    padding: 0.5rem 1rem;
    background: rgba(255, 255, 255, 0.2);
    border: none;
    border-radius: 2rem;
    color: white;
    cursor: pointer;
    transition: all 0.2s ease;
    flex-shrink: 0;
    font-family: var(--font-family);
    font-size: 0.85rem;
    font-weight: 500;
}

.chat-back-btn:hover {
    background: rgba(255, 255, 255, 0.3);
    transform: translateX(-2px);
}

.chat-back-btn svg {
    width: 18px;
    height: 18px;
}

.chat-avatar {
    width: 48px;
    height: 48px;
    border-radius: 50%;
    background: white;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 6px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
}

.chat-avatar img {
    width: 100%;
    height: 100%;
    object-fit: contain;
}

.chat-header-info h3 {
    margin: 0;
    font-size: 1rem;
    font-weight: 600;
}

.chat-status {
    display: flex;
    align-items: center;
    gap: 0.4rem;
    font-size: 0.75rem;
    opacity: 0.9;
}

.status-dot {
    width: 8px;
    height: 8px;
    background-color: #22C55E;
    border-radius: 50%;
    animation: pulse 2s infinite;
}

@keyframes pulse {

    0%,
    100% {
        opacity: 1;
    }

    50% {
        opacity: 0.5;
    }
}

/* Área de mensajes */
.chat-messages {
    flex: 1;
    overflow-y: auto;
    padding: 1rem;
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
    background: linear-gradient(180deg, #F9FAFB 0%, #F3F4F6 100%);
}

/* Mensajes individuales */
.chat-message {
    display: flex;
    gap: 0.75rem;
    max-width: 85%;
    animation: messageSlide 0.3s ease-out;
}

@keyframes messageSlide {
    from {
        opacity: 0;
        transform: translateY(10px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.chat-message.user {
    align-self: flex-end;
    flex-direction: row-reverse;
}

.chat-message.assistant {
    align-self: flex-start;
}

.message-avatar {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: white;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
    padding: 3px;
}

.message-avatar img {
    width: 100%;
    height: 100%;
    object-fit: contain;
}

.chat-message.user .message-avatar {
    background: linear-gradient(135deg, #4F46E5 0%, #7C3AED 100%);
    color: white;
    font-weight: 600;
    font-size: 0.75rem;
}

.message-content {
    background: white;
    padding: 0.75rem 1rem;
    border-radius: 1rem;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.05);
    line-height: 1.5;
    font-size: 0.875rem;
    position: relative;
}

.chat-message.user .message-content {
    background: linear-gradient(135deg, #4F46E5 0%, #7C3AED 100%);
    color: white;
    border-bottom-right-radius: 0.25rem;
}

.chat-message.assistant .message-content {
    border-bottom-left-radius: 0.25rem;
}

/* Botón de copiar mensaje */
.copy-message-btn {
    position: absolute;
    top: 0.5rem;
    right: 0.5rem;
    background: #f3f4f6;
    border: none;
    border-radius: 0.375rem;
    padding: 0.35rem;
    cursor: pointer;
    opacity: 0;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #6B7280;
}

.chat-message.assistant .message-content:hover .copy-message-btn {
    opacity: 1;
}

.copy-message-btn:hover {
    background: #e5e7eb;
    color: #374151;
}

.copy-message-btn.copied {
    background: #dcfce7;
    color: #16a34a;
}

.message-content p {
    margin: 0;
}

.message-content p+p {
    margin-top: 0.5rem;
}

/* Indicador de escritura */
.typing-indicator {
    display: flex;
    gap: 0.3rem;
    padding: 0.5rem 0;
}

.typing-indicator span {
    width: 8px;
    height: 8px;
    background-color: #9CA3AF;
    border-radius: 50%;
    animation: typing 1.4s infinite ease-in-out;
}

.typing-indicator span:nth-child(2) {
    animation-delay: 0.2s;
}

.typing-indicator span:nth-child(3) {
    animation-delay: 0.4s;
}

@keyframes typing {

    0%,
    60%,
    100% {
        transform: translateY(0);
    }

    30% {
        transform: translateY(-8px);
    }
}

/* Área de entrada */
.chat-input-container {
    padding: 1rem 1.5rem;
    background: white;
    border-top: 1px solid var(--border-color);
}

.chat-input-wrapper {
    display: flex;
    align-items: flex-end;
    gap: 0.75rem;
    background: #F3F4F6;
    border-radius: 1.5rem;
    padding: 0.5rem 0.5rem 0.5rem 1.25rem;
    transition: all 0.2s ease;
    border: 2px solid transparent;
}

.chat-input-wrapper:focus-within {
    background: white;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(79, 70, 229, 0.1);
}

.chat-input {
    flex: 1;
    border: none;
    background: transparent;
    resize: none;
    font-family: var(--font-family);
    font-size: 0.95rem;
    line-height: 1.5;
    max-height: 120px;
    outline: none;
    padding: 0.5rem 0;
}

.chat-input::placeholder {
    color: #9CA3AF;
}

.chat-send-btn {
    width: 44px;
    height: 44px;
    border-radius: 50%;
    border: none;
    background: linear-gradient(135deg, #4F46E5 0%, #7C3AED 100%);
    color: white;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
    flex-shrink: 0;
}

.chat-send-btn:disabled {
    background: #D1D5DB;
    cursor: not-allowed;
}

.chat-send-btn:not(:disabled):hover {
    transform: scale(1.05);
    box-shadow: 0 4px 12px rgba(79, 70, 229, 0.4);
}

.chat-send-btn svg {
    width: 20px;
    height: 20px;
}

.chat-disclaimer {
    text-align: center;
    font-size: 0.75rem;
    color: #9CA3AF;
    margin-top: 0.5rem;
    margin-bottom: 0;
}

/* Error en mensaje */
.message-error {
    color: var(--error-color);
    font-size: 0.85rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.message-error svg {
    width: 16px;
    height: 16px;
}

/* Responsive chat */
@media (max-width: 768px) {

    /* Ocultar header y footer en la vista del chat en móvil */
    body.chat-mode .app-header,
    body.chat-mode .app-footer {
        display: none !important;
    }

    body.chat-mode .container {
        padding: 0;
        max-width: 100%;
    }

    body.chat-mode #chatSection {
        padding: 0;
        margin: 0;
    }

    .chat-container {
        height: 100vh;
        max-height: none;
        border-radius: 0;
        margin: 0;
        width: 100%;
    }

    .chat-message {
        max-width: 90%;
    }

    .chat-header {
        border-radius: 0;
    }
}

/* ==================== EMAIL ASSISTANT STYLES ==================== */

/* Card icon email */
.mode-card-icon.email {
    background: linear-gradient(135deg, #10B981 0%, #059669 100%);
}

/* Main section */
.email-assistant-section {
    max-width: 1400px;
    width: 95%;
    margin: 0 auto;
    padding: 1.5rem;
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
}

/* Navbar */
.email-navbar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1rem 1.5rem;
    background: white;
    border-radius: var(--border-radius);
    box-shadow: var(--shadow);
}

.email-navbar-left {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.email-back-btn {
    display: flex;
    align-items: center;
    gap: 0.4rem;
    padding: 0.5rem 1rem;
    background: #f3f4f6;
    border: none;
    border-radius: 0.5rem;
    color: #374151;
    cursor: pointer;
    transition: all 0.2s;
    font-family: var(--font-family);
    font-size: 0.875rem;
}

.email-back-btn:hover {
    background: #e5e7eb;
}

.email-logo {
    width: 40px;
    height: 40px;
    background: linear-gradient(135deg, #10B981 0%, #059669 100%);
    border-radius: 0.75rem;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
}

.email-logo svg {
    width: 22px;
    height: 22px;
}

.email-title-wrapper {
    display: flex;
    flex-direction: column;
    flex: 1;
}

.email-title {
    font-size: 1.5rem;
    font-weight: 700;
    color: #111827;
    margin: 0;
    line-height: 1.2;
}

.email-title .gradient-text {
    background: linear-gradient(135deg, #14B8A6 0%, #0D9488 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.email-subtitle {
    font-size: 0.85rem;
    color: #6B7280;
    margin-top: 0.25rem;
}

.email-navbar-right {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.email-env-toggle {
    display: flex;
    background: #f3f4f6;
    border-radius: 2rem;
    padding: 0.25rem;
}

.env-btn {
    padding: 0.5rem 1rem;
    border: none;
    background: transparent;
    border-radius: 2rem;
    font-size: 0.8rem;
    font-family: var(--font-family);
    cursor: pointer;
    transition: all 0.2s;
    color: #6B7280;
}

.env-btn.active {
    background: white;
    color: #111827;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
}

.email-env-badge {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.5rem 1rem;
    border-radius: 2rem;
    font-size: 0.75rem;
    font-weight: 500;
}

.email-env-badge.test {
    background: #fef3c7;
    color: #92400e;
}

.email-env-badge.prod {
    background: #dcfce7;
    color: #166534;
}

.env-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    animation: pulse 2s infinite;
}

.email-env-badge.test .env-dot {
    background: #f59e0b;
}

.email-env-badge.prod .env-dot {
    background: #22c55e;
}

/* Panels */
.email-panels {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1.5rem;
    padding-top: 1rem;
}

.email-panel {
    background: white;
    border-radius: var(--border-radius);
    box-shadow: var(--shadow);
    display: flex;
    flex-direction: column;
    min-height: 400px;
}

.email-panel-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1rem 1.25rem;
    border-bottom: 1px solid #e5e7eb;
}

.panel-header-left {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.875rem;
    font-weight: 500;
    color: #374151;
}

.panel-header-left svg {
    color: #6B7280;
}

.panel-action-btn {
    padding: 0.5rem;
    background: #f3f4f6;
    border: none;
    border-radius: 0.375rem;
    cursor: pointer;
    color: #6B7280;
    transition: all 0.2s;
}

.panel-action-btn:hover {
    background: #e5e7eb;
    color: #374151;
}

.email-textarea {
    flex: 1;
    padding: 1.25rem;
    border: none;
    resize: none;
    font-family: var(--font-family);
    font-size: 0.9rem;
    line-height: 1.6;
    color: #374151;
}

.email-textarea:focus {
    outline: none;
}

.email-textarea::placeholder {
    color: #9ca3af;
}

.email-panel-footer {
    padding: 1rem 1.25rem;
    border-top: 1px solid #e5e7eb;
}

.email-generate-btn {
    width: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    padding: 0.875rem 1.5rem;
    background: linear-gradient(135deg, #10B981 0%, #059669 100%);
    color: white;
    border: none;
    border-radius: 0.5rem;
    font-size: 0.95rem;
    font-weight: 600;
    font-family: var(--font-family);
    cursor: pointer;
    transition: all 0.2s;
}

.email-generate-btn:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(16, 185, 129, 0.4);
}

.email-generate-btn:disabled {
    opacity: 0.7;
    cursor: not-allowed;
    transform: none;
}

.email-generate-btn .spinner-icon {
    animation: spin 1s linear infinite;
}

.email-output {
    flex: 1;
    padding: 1.25rem;
    overflow-y: auto;
    font-size: 0.9rem;
    line-height: 1.7;
    color: #374151;
}

.email-output-empty {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    height: 100%;
    color: #9ca3af;
    text-align: center;
}

.email-output-empty svg {
    opacity: 0.3;
    margin-bottom: 1rem;
}

.email-output-empty p {
    margin: 0;
}

/* Output content styling */
.email-output-content {
    white-space: pre-wrap;
}

.email-output-content p {
    margin: 0 0 1rem 0;
}

.email-output-content ul,
.email-output-content ol {
    margin: 0 0 1rem 1.5rem;
}

.email-output-content strong {
    font-weight: 600;
}

/* Footer */
.email-footer {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1rem 0;
}

.email-secondary-btn {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.75rem 1.25rem;
    background: white;
    border: 1px solid #e5e7eb;
    border-radius: 0.5rem;
    color: #374151;
    font-size: 0.875rem;
    font-family: var(--font-family);
    cursor: pointer;
    transition: all 0.2s;
}

.email-secondary-btn:hover {
    background: #f9fafb;
    border-color: #d1d5db;
}

.email-footer-text {
    font-size: 0.8rem;
    color: #9ca3af;
}

/* Loading Modal */
.email-loading-modal {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.5);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    backdrop-filter: blur(4px);
}

.email-loading-content {
    background: white;
    padding: 2.5rem;
    border-radius: 1.5rem;
    text-align: center;
    max-width: 400px;
    width: 90%;
}

.email-loading-scene {
    display: flex;
    justify-content: center;
    gap: 1rem;
    margin-bottom: 1.5rem;
    font-size: 2rem;
}

.scene-mountain {
    animation: float 3s ease-in-out infinite;
}

.scene-tree {
    animation: float 3s ease-in-out infinite 0.5s;
}

.scene-bird {
    animation: fly 2s ease-in-out infinite;
}

@keyframes float {

    0%,
    100% {
        transform: translateY(0);
    }

    50% {
        transform: translateY(-10px);
    }
}

@keyframes fly {

    0%,
    100% {
        transform: translate(0, 0);
    }

    25% {
        transform: translate(10px, -5px);
    }

    50% {
        transform: translate(0, -10px);
    }

    75% {
        transform: translate(-10px, -5px);
    }
}

.email-loading-spinner {
    width: 60px;
    height: 60px;
    margin: 0 auto 1.5rem;
    border: 3px solid #e5e7eb;
    border-top-color: #10B981;
    border-radius: 50%;
    animation: spin 1s linear infinite;
    display: flex;
    align-items: center;
    justify-content: center;
    background: white;
}

.email-loading-spinner svg {
    color: #10B981;
    animation: none;
}

.email-loading-text {
    font-size: 1rem;
    color: #374151;
    margin: 0 0 1.5rem 0;
}

.email-loading-dots {
    display: flex;
    justify-content: center;
    gap: 0.5rem;
}

.email-loading-dots .dot {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    animation: bounce 1.4s infinite ease-in-out;
}

.dot-1 {
    background: #10B981;
    animation-delay: 0s;
}

.dot-2 {
    background: #14b8a6;
    animation-delay: 0.2s;
}

.dot-3 {
    background: #06b6d4;
    animation-delay: 0.4s;
}

@keyframes bounce {

    0%,
    80%,
    100% {
        transform: scale(0);
    }

    40% {
        transform: scale(1);
    }
}

/* Toast */
.email-toast-container {
    position: fixed;
    bottom: 2rem;
    right: 2rem;
    z-index: 1001;
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.email-toast {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 1rem 1.5rem;
    background: white;
    border-radius: 0.75rem;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.15);
    animation: slideIn 0.3s ease-out;
    max-width: 350px;
}

@keyframes slideIn {
    from {
        transform: translateX(100%);
        opacity: 0;
    }

    to {
        transform: translateX(0);
        opacity: 1;
    }
}

.email-toast.success {
    border-left: 4px solid #10B981;
}

.email-toast.error {
    border-left: 4px solid #ef4444;
}

.email-toast.warning {
    border-left: 4px solid #f59e0b;
}

.email-toast.info {
    border-left: 4px solid #3b82f6;
}

.email-toast svg {
    flex-shrink: 0;
}

.email-toast.success svg {
    color: #10B981;
}

.email-toast.error svg {
    color: #ef4444;
}

.email-toast.warning svg {
    color: #f59e0b;
}

.email-toast.info svg {
    color: #3b82f6;
}

.email-toast p {
    margin: 0;
    font-size: 0.875rem;
    color: #374151;
}

/* Responsive */
@media (max-width: 1024px) {
    .email-panels {
        grid-template-columns: 1fr;
    }

    .email-panel {
        min-height: 300px;
    }
}

@media (max-width: 768px) {
    .email-navbar {
        flex-direction: column;
        gap: 1rem;
        align-items: flex-start;
    }

    .email-navbar-right {
        width: 100%;
        justify-content: space-between;
    }

    .email-title {
        font-size: 1.25rem;
    }

    .email-subtitle {
        font-size: 0.75rem;
    }

    .email-footer {
        flex-direction: column;
        gap: 1rem;
        text-align: center;
    }
}

/* ==================== PRINT STYLES ==================== */
@media print {
    /* Ocultar todo excepto los resultados */
    body * {
        visibility: hidden;
    }

    #resultsSection,
    #resultsSection * {
        visibility: visible;
    }

    #resultsSection {
        position: absolute;
        left: 0;
        top: 0;
        width: 100%;
        padding: 0;
        margin: 0;
    }

    /* Ocultar botones y controles en impresión */
    .results-header,
    .edit-mode-notice,
    #newAnalysis,
    .results-actions {
        display: none !important;
    }

    /* Mostrar logo en impresión */
    .pdf-header-logo {
        display: block !important;
        margin-bottom: 1rem;
    }

    /* Estilos del contenido para impresión */
    #resultsContentWrapper {
        box-shadow: none !important;
        border: none !important;
        padding: 0 !important;
    }

    .results-grid {
        gap: 0.75rem !important;
    }

    .section-card {
        break-inside: avoid;
        box-shadow: none !important;
        border: 1px solid #e5e7eb !important;
        page-break-inside: avoid;
    }

    /* Asegurar que las tablas no se corten */
    table {
        page-break-inside: avoid;
    }

    /* Ocultar sidebar, header, navbar */
    .app-header,
    .sidebar,
    .navbar,
    footer,
    .app-footer {
        display: none !important;
    }
}
/* ==================== END PRINT STYLES ==================== */

/* ==================== END EMAIL ASSISTANT STYLES ====================