/* ================================================
   Sistema de Diseño - NexIA Chat
   Continental Assist - Chat API
   ================================================ */

@import url('https://fonts.googleapis.com/css2?family=Manrope:wght@400;500;600;700&display=swap');

:root {
    --color-primary-dark: #00184C;
    --color-primary-cyan: #43D3FF;
    --color-cta-yellow: #F9D35A;
    --color-success: #22C55E;
    --color-warning: #F59E0B;
    --color-error: #EF4444;
    --color-info: #3B82F6;
    --color-background: #F8FAFC;
    --color-surface: #FFFFFF;
    --color-chat-user: #00184C;
    --color-chat-nexia: #F1F5F9;
    --color-text-primary: #00184C;
    --color-text-secondary: #64748B;
    --color-text-white: #FFFFFF;
    --color-text-muted: #94A3B8;
    --color-border: #E2E8F0;
    --font-family: 'Manrope', -apple-system, BlinkMacSystemFont, sans-serif;
    --shadow-card: 0 4px 20px rgba(0, 24, 76, 0.08);
    --shadow-lg: 0 10px 40px rgba(0, 24, 76, 0.15);
    --shadow-modal: 0 25px 80px rgba(0, 24, 76, 0.3);
    --shadow-focus: 0 0 0 3px rgba(67, 211, 255, 0.3);
    --radius-xl: 24px;
    --radius-lg: 16px;
    --radius-md: 12px;
    --radius-full: 9999px;
    --transition-normal: 250ms ease;
}

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

html {
    font-size: 16px;
    -webkit-font-smoothing: antialiased;
    height: -webkit-fill-available;
}

body {
    font-family: var(--font-family);
    font-size: 1rem;
    line-height: 1.6;
    color: var(--color-text-primary);
    background-color: var(--color-background);
    min-height: 100vh;
    min-height: 100dvh;
    min-height: -webkit-fill-available;
    overflow: hidden;
}

/* Layout del chat: mantiene header/footer fijos y scroll en mensajes */
body.chat-page {
    height: 100vh;
    height: 100dvh;
    height: -webkit-fill-available;
    display: flex;
    flex-direction: column;
}

a {
    color: var(--color-primary-cyan);
    text-decoration: none;
    transition: color var(--transition-normal);
}

a:hover {
    color: var(--color-primary-dark);
}

/* === LOGIN PAGE === */
.login-page {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
    padding: 3rem 1.5rem;
    background-image: url('../assets/imagenes/fondo.jpg');
    background-size: cover;
    background-position: center;
    background-repeat: no-repeat;
}

.login-page::before {
    content: '';
    position: absolute;
    inset: 0;
    background: rgba(0, 24, 76, 0.5);
    z-index: 1;
}

.login-illustration-overlay {
    position: absolute;
    left: 13%;
    top: 50%;
    transform: translateY(-50%);
    width: 400px;
    height: auto;
    z-index: 2;
    animation: float 6s ease-in-out infinite;
}

@media (max-width: 1023px) {
    .login-illustration-overlay {
        display: none;
    }
}

@keyframes float {
    0%, 100% { transform: translateY(-50%) translateY(0); }
    50% { transform: translateY(-50%) translateY(-15px); }
}

.login-card {
    position: relative;
    z-index: 5;
    width: 100%;
    max-width: 420px;
    padding: 2rem;
    margin-left: auto;
    margin-right: auto;
    background-color: #FFFFFF;
    border-radius: var(--radius-xl);
    box-shadow: 0 25px 80px rgba(0, 24, 76, 0.4);
    animation: slideUp 0.6s ease-out;
}

@media (min-width: 1024px) {
    .login-card {
        margin-right: 10%;
    }
}

@media (max-width: 1023px) {
    .login-card {
        margin-left: auto;
        margin-right: auto;
    }
}

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

.login-card-header {
    text-align: center;
    margin-bottom: 2rem;
}

.login-logo {
    height: 48px;
    width: auto;
    margin: 0 auto 1.25rem;
    display: block;
}

.login-card-header h1 {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--color-text-primary);
    margin-bottom: 0.5rem;
}

.login-card-header p {
    font-size: 0.875rem;
    color: var(--color-text-secondary);
    line-height: 1.5;
}

.form-group {
    margin-bottom: 1.25rem;
}

.form-label {
    display: block;
    margin-bottom: 0.5rem;
    font-size: 0.875rem;
    font-weight: 600;
    color: var(--color-text-primary);
}

.form-label.required::after {
    content: ' *';
    color: var(--color-error);
}

.form-input {
    width: 100%;
    padding: 0.875rem 1rem;
    font-family: var(--font-family);
    font-size: 1rem;
    color: var(--color-text-primary);
    background-color: var(--color-background);
    border: 2px solid var(--color-border);
    border-radius: var(--radius-md);
    transition: all var(--transition-normal);
}

.form-input::placeholder {
    color: var(--color-text-muted);
}

.form-input:focus {
    outline: none;
    border-color: var(--color-primary-cyan);
    box-shadow: var(--shadow-focus);
}

.form-input.error {
    border-color: var(--color-error);
    background-color: #FEF2F2;
}

.form-error {
    margin-top: 0.5rem;
    font-size: 0.8125rem;
    font-weight: 500;
    color: var(--color-error);
    display: flex;
    align-items: center;
    gap: 0.375rem;
}

.form-error::before {
    content: '';
    width: 16px;
    height: 16px;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23EF4444' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Ccircle cx='12' cy='12' r='10'/%3E%3Cline x1='12' y1='8' x2='12' y2='12'/%3E%3Cline x1='12' y1='16' x2='12.01' y2='16'/%3E%3C/svg%3E");
    background-size: contain;
    flex-shrink: 0;
}

.btn-primary {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    width: 100%;
    padding: 1rem 1.5rem;
    font-family: var(--font-family);
    font-size: 1rem;
    font-weight: 600;
    color: var(--color-primary-dark);
    background-color: var(--color-cta-yellow);
    border: none;
    border-radius: var(--radius-md);
    cursor: pointer;
    transition: all var(--transition-normal);
}

.btn-primary:hover:not(:disabled) {
    transform: translateY(-2px);
    box-shadow: 0 8px 25px rgba(249, 211, 90, 0.4);
}

.btn-primary:disabled {
    opacity: 0.7;
    cursor: not-allowed;
    transform: none;
}

.login-security {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    margin-top: 1.5rem;
    padding-top: 1.5rem;
    border-top: 1px solid var(--color-border);
    font-size: 0.75rem;
    color: var(--color-text-secondary);
}

.login-security svg {
    width: 14px;
    height: 14px;
}

.login-success {
    display: none;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-align: center;
    padding: 2rem;
}

.login-success.show {
    display: flex;
}

.login-success-icon {
    width: 60px;
    height: 60px;
    background: linear-gradient(135deg, var(--color-success) 0%, #16A34A 100%);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 1rem;
    animation: scaleIn 0.4s ease-out;
}

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

.login-success-icon svg {
    width: 30px;
    height: 30px;
    color: white;
}

.login-success h2 {
    font-size: 1.25rem;
    font-weight: 700;
    color: var(--color-text-primary);
    margin-bottom: 0.5rem;
}

.login-success p {
    font-size: 0.875rem;
    color: var(--color-text-secondary);
}

.login-form.hidden {
    display: none;
}

/* === CHAT MODAL === */
.chat-modal {
    position: fixed;
    inset: 0;
    z-index: 1000;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.4s ease, visibility 0.4s ease;
}

.chat-modal.active {
    opacity: 1;
    visibility: visible;
}

.chat-modal-backdrop {
    position: absolute;
    inset: 0;
    background: rgba(0, 24, 76, 0.6);
}

.chat-modal-container {
    position: relative;
    width: 85%;
    height: 90%;
    max-width: 1200px;
    background-color: var(--color-background);
    border-radius: var(--radius-xl);
    box-shadow: var(--shadow-modal);
    display: flex;
    flex-direction: column;
    overflow: hidden;
    transform: scale(0.9);
    opacity: 0;
    transition: transform 0.4s cubic-bezier(0.4, 0, 0.2, 1), opacity 0.4s ease;
}

.chat-modal-container.active {
    transform: scale(1);
    opacity: 1;
}

.chat-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0.875rem 1.5rem;
    background-color: var(--color-primary-dark);
    color: var(--color-text-white);
    box-shadow: 0 4px 20px rgba(0, 24, 76, 0.15);
    z-index: 100;
    flex-shrink: 0;
}

.chat-header-left {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.chat-header-avatar {
    position: relative;
    width: 40px;
    height: 40px;
    flex-shrink: 0;
}

.chat-header-logo-img {
    width: 40px;
    height: 40px;
    object-fit: cover;
    border-radius: 50%;
    display: block;
}

.chat-header-status {
    position: absolute;
    bottom: 0;
    right: 0;
    width: 12px;
    height: 12px;
    background-color: #22C55E;
    border: 2px solid var(--color-primary-dark);
    border-radius: 50%;
    box-shadow: 0 0 0 2px rgba(34, 197, 94, 0.3);
}

.chat-header-info {
    display: flex;
    flex-direction: column;
    gap: 0.125rem;
}

.chat-header-info h2 {
    font-size: 1rem;
    font-weight: 600;
    line-height: 1.2;
}

.chat-header-status-text {
    font-size: 0.6875rem;
    font-weight: 500;
    color: #22C55E;
    letter-spacing: 0.025em;
    text-transform: uppercase;
}

.chat-header-right {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.chat-body {
    flex: 1;
    overflow-y: auto;
    min-height: 0;
    padding: 1.5rem 1rem;
    display: flex;
    flex-direction: column;
}

.chat-messages {
    max-width: 1200px;
    width: 100%;
    margin: 0 auto;
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.chat-message {
    display: flex;
    gap: 0.75rem;
    animation: slideUp 0.3s ease-out;
}

.chat-message.user {
    flex-direction: row-reverse;
    justify-content: flex-start;
    margin-left: auto;
    max-width: 95%;
}

.chat-message.nexia {
    justify-content: flex-start;
    margin-right: auto;
    max-width: 95%;
}

.chat-message-avatar {
    flex-shrink: 0;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.875rem;
}

.chat-message-avatar {
    flex-shrink: 0;
    width: 32px;
    height: 32px;
    border-radius: 50%;
    overflow: hidden;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.75rem;
}

.chat-message.nexia .chat-message-avatar {
    background: none;
    padding: 0;
}

.chat-message.nexia .chat-message-avatar img {
    width: 32px;
    height: 32px;
    object-fit: cover;
    border-radius: 50%;
}

.chat-message.user .chat-message-avatar {
    background-color: var(--color-primary-dark);
    color: var(--color-text-white);
    font-weight: 600;
    font-size: 0.6875rem;
}

.chat-message-content {
    max-width: 90%;
    display: flex;
    flex-direction: column;
}

.chat-message.user .chat-message-content {
    align-items: flex-end;
}

.chat-message-bubble {
    padding: 0.875rem 1rem;
    border-radius: 16px 16px 16px 4px;
    position: relative;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
    max-width: 100%;
}

.chat-message.nexia .chat-message-bubble {
    background-color: var(--color-chat-nexia);
    color: var(--color-text-primary);
    border-radius: 16px 16px 16px 4px;
}

.chat-message.user .chat-message-bubble {
    background-color: var(--color-primary-dark);
    color: var(--color-text-white);
    border-radius: 16px 16px 4px 16px;
    box-shadow: 0 2px 8px rgba(0, 24, 76, 0.15);
}

.chat-message-text {
    font-size: 0.9375rem;
    line-height: 1.6;
    white-space: pre-wrap;
    word-wrap: break-word;
}

.chat-message-text p {
    margin-bottom: 0.5rem;
}

.chat-message-text p:last-child {
    margin-bottom: 0;
}

.chat-message-text ul,
.chat-message-text ol {
    margin: 0.5rem 0;
    padding-left: 1.5rem;
}

.chat-message-text li {
    margin-bottom: 0.25rem;
}

.chat-message-text code,
.chat-badge {
    font-family: 'Fira Code', 'Consolas', 'Monaco', monospace;
    font-size: 0.75rem;
    background-color: #0a1628;
    color: #43D3FF;
    padding: 3px 8px;
    border-radius: 4px;
    display: inline;
    vertical-align: baseline;
    border: 1px solid rgba(67, 211, 255, 0.3);
    word-break: break-all;
}

.chat-message.user .chat-message-text code,
.chat-message.user .chat-badge {
    background-color: rgba(67, 211, 255, 0.2);
    color: #FFFFFF;
    border-color: rgba(67, 211, 255, 0.4);
}

.chat-message-text pre {
    background-color: #0a1628;
    color: #E2E8F0;
    padding: 1rem;
    border-radius: 12px;
    overflow-x: auto;
    margin: 0.75rem 0;
    font-size: 0.8125rem;
    border: 1px solid rgba(67, 211, 255, 0.2);
}

.chat-message-text pre code {
    background: none;
    padding: 0;
    color: inherit;
    border-radius: 0;
}

.chat-message-time {
    display: block;
    margin-top: 0.5rem;
    font-size: 0.6875rem;
    color: var(--color-text-muted);
}

.chat-message.user .chat-message-time {
    text-align: right;
}

.typing-indicator {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.5rem 0;
}

.typing-indicator::before {
    content: 'NexIA está escribiendo';
    font-size: 0.6875rem;
    color: var(--color-text-muted);
    white-space: nowrap;
}

.typing-bubble {
    min-width: 100px;
    display: flex;
    align-items: center;
    justify-content: center;
    background-color: var(--color-chat-nexia);
    border-radius: 16px 16px 16px 4px;
    padding: 0.75rem 1rem;
}

.chat-message.nexia.typing .chat-message-bubble {
    background-color: transparent;
}

.chat-message.user .avatar {
    flex-shrink: 0;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.875rem;
}

.chat-message.user .chat-message-avatar img {
    width: 40px;
    height: 40px;
    border-radius: 50%;
}

.typing-indicator span {
    width: 8px;
    height: 8px;
    background-color: var(--color-primary-cyan);
    border-radius: 50%;
    animation: typingDot 1.2s ease-in-out infinite;
}

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

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

.chat-footer {
    padding: 1rem 1.5rem;
    padding-bottom: calc(1rem + env(safe-area-inset-bottom, 0px));
    background-color: var(--color-surface);
    border-top: 1px solid var(--color-border);
    flex-shrink: 0;
}

.chat-footer-container {
    max-width: 1200px;
    margin: 0 auto;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
}

.chat-actions-bar {
    display: flex;
    justify-content: flex-start;
    margin-bottom: 0.5rem;
}

.chat-input-row {
    display: flex;
    align-items: flex-end;
    gap: 0.5rem;
}

.chat-input-container {
    flex: 1;
    position: relative;
}

.chat-input {
    width: 100%;
    min-height: 52px;
    max-height: 120px;
    padding: 1rem 4rem 1rem 1.25rem;
    font-family: var(--font-family);
    font-size: 0.9375rem;
    color: var(--color-text-primary);
    background-color: var(--color-surface);
    border: 2px solid var(--color-border);
    border-radius: var(--radius-lg);
    resize: none;
    transition: all var(--transition-normal);
}

.chat-input:focus {
    outline: none;
    border-color: var(--color-primary-cyan);
    box-shadow: 0 0 0 3px rgba(67, 211, 255, 0.15);
}

.chat-input::placeholder {
    color: var(--color-text-muted);
    font-style: italic;
}

.chat-send-btn {
    position: absolute;
    right: 0.875rem;
    top: 50%;
    bottom: auto;
    transform: translateY(-50%);
    width: 42px;
    height: 42px;
    background-color: var(--color-cta-yellow);
    border: none;
    border-radius: var(--radius-md);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
}

.chat-send-btn svg {
    width: 20px;
    height: 20px;
    color: var(--color-primary-dark);
    transition: transform 0.2s ease;
}

.chat-send-btn:hover {
    background-color: #F9D35A;
    box-shadow: 0 4px 16px rgba(249, 211, 90, 0.5);
    transform: translateY(calc(-50% - 2px));
}

.chat-send-btn:hover svg {
    transform: scale(1.1);
}

.chat-send-btn:active {
    transform: translateY(-50%) scale(0.95);
    box-shadow: 0 2px 8px rgba(249, 211, 90, 0.3);
}

.chat-send-btn.active {
    background-color: #F9D35A;
    box-shadow: 0 0 20px rgba(249, 211, 90, 0.6);
}

.chat-send-btn:disabled {
    background-color: var(--color-border);
    cursor: not-allowed;
    transform: translateY(-50%);
    box-shadow: none;
}

.chat-send-btn:disabled {
    background-color: var(--color-border);
    cursor: not-allowed;
    transform: translateY(-50%);
}

.chat-send-btn:disabled svg {
    color: var(--color-text-muted);
}

.btn-action {
    width: 42px;
    height: 42px;
    border: none;
    border-radius: var(--radius-md);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all var(--transition-normal);
    flex-shrink: 0;
    position: relative;
}

.btn-action svg {
    width: 18px;
    height: 18px;
}

.btn-finish-action {
    background-color: transparent;
    color: rgba(255, 255, 255, 0.7);
    border: 1.5px solid var(--color-primary-cyan);
}

.btn-finish-action svg {
    color: var(--color-primary-cyan);
}

.btn-finish-action:hover {
    background-color: rgba(67, 211, 255, 0.15);
    border-color: var(--color-primary-cyan);
    color: #FFFFFF;
    transform: scale(1.05);
}

.btn-finish-action:hover svg {
    color: #FFFFFF;
}

.btn-finish-action .btn-tooltip {
    position: absolute;
    bottom: calc(100% + 8px);
    left: 50%;
    transform: translateX(-50%) translateY(4px);
    background-color: var(--color-primary-dark);
    color: var(--color-text-white);
    padding: 0.375rem 0.75rem;
    border-radius: 6px;
    font-size: 0.75rem;
    font-family: var(--font-family);
    font-weight: 500;
    white-space: nowrap;
    opacity: 0;
    visibility: hidden;
    transition: all 0.2s ease;
    pointer-events: none;
    z-index: 10;
}

.btn-finish-action .btn-tooltip::after {
    content: '';
    position: absolute;
    top: 100%;
    left: 50%;
    transform: translateX(-50%);
    border: 5px solid transparent;
    border-top-color: var(--color-primary-dark);
}

.btn-finish-action:hover .btn-tooltip {
    opacity: 1;
    visibility: visible;
    transform: translateX(-50%) translateY(0);
}

.btn-clear-action {
    background-color: transparent;
    color: var(--color-text-secondary);
    border: 1.5px solid var(--color-border);
    position: relative;
}

.btn-clear-action svg {
    color: inherit;
}

.btn-clear-action:hover {
    background-color: #FEE2E2;
    color: var(--color-error);
    border-color: var(--color-error);
}

.btn-clear-action .btn-tooltip {
    position: absolute;
    bottom: calc(100% + 8px);
    left: 50%;
    transform: translateX(-50%) translateY(4px);
    background-color: var(--color-primary-dark);
    color: var(--color-text-white);
    padding: 0.375rem 0.75rem;
    border-radius: 6px;
    font-size: 0.75rem;
    font-family: var(--font-family);
    font-weight: 500;
    white-space: nowrap;
    opacity: 0;
    visibility: hidden;
    transition: all 0.2s ease;
    pointer-events: none;
    z-index: 10;
}

.btn-clear-action .btn-tooltip::after {
    content: '';
    position: absolute;
    top: 100%;
    left: 50%;
    transform: translateX(-50%);
    border: 5px solid transparent;
    border-top-color: var(--color-primary-dark);
}

.btn-clear-action:hover .btn-tooltip {
    opacity: 1;
    visibility: visible;
    transform: translateX(-50%) translateY(0);
}

/* === CONFIRM MODAL === */
.confirm-modal {
    position: fixed;
    inset: 0;
    z-index: 2000;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.25s ease, visibility 0.25s ease;
}

.confirm-modal.active {
    opacity: 1;
    visibility: visible;
}

.confirm-modal-backdrop {
    position: absolute;
    inset: 0;
    background: rgba(0, 24, 76, 0.5);
}

.confirm-modal-card {
    position: relative;
    width: 100%;
    max-width: 380px;
    padding: 2rem;
    background-color: var(--color-surface);
    border-radius: var(--radius-xl);
    box-shadow: var(--shadow-lg);
    text-align: center;
    transform: scale(0.95);
    transition: transform 0.25s ease;
}

.confirm-modal.active .confirm-modal-card {
    transform: scale(1);
}

.confirm-modal-icon {
    width: 56px;
    height: 56px;
    margin: 0 auto 1.25rem;
    background-color: #FEE2E2;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
}

.confirm-modal-icon svg {
    width: 28px;
    height: 28px;
    color: var(--color-error);
}

.confirm-modal-title {
    font-size: 1.125rem;
    font-weight: 700;
    color: var(--color-text-primary);
    margin-bottom: 0.5rem;
}

.confirm-modal-text {
    font-size: 0.875rem;
    color: var(--color-text-secondary);
    margin-bottom: 1.5rem;
    line-height: 1.5;
}

.confirm-modal-actions {
    display: flex;
    gap: 0.75rem;
    justify-content: center;
}

.confirm-btn {
    flex: 1;
    padding: 0.75rem 1rem;
    font-family: var(--font-family);
    font-size: 0.875rem;
    font-weight: 600;
    border-radius: var(--radius-md);
    cursor: pointer;
    transition: all var(--transition-normal);
    border: none;
}

.confirm-btn-danger {
    background-color: var(--color-error);
    color: white;
}

.confirm-btn-danger:hover {
    background-color: #DC2626;
}

.confirm-btn-cancel {
    background-color: transparent;
    color: var(--color-text-secondary);
    border: 1.5px solid var(--color-border);
}

.confirm-btn-cancel:hover {
    background-color: var(--color-chat-nexia);
    color: var(--color-text-primary);
}

/* === FINISHED PAGE === */
.finished-page {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: flex-end;
    position: relative;
    padding: 1.5rem;
    background-image: url('../assets/imagenes/fondo.jpg');
    background-size: cover;
    background-position: center;
    background-repeat: no-repeat;
}

.finished-page::before {
    content: '';
    position: absolute;
    inset: 0;
    background: rgba(0, 24, 76, 0.5);
    z-index: 1;
}

.finished-illustration {
    position: fixed;
    left: 13%;
    bottom: 2%;
    width: 400px;
    height: auto;
    z-index: 3;
    animation: floatSoft 4s ease-in-out infinite;
    filter: drop-shadow(0 20px 40px rgba(0, 0, 0, 0.3));
}

@keyframes floatSoft {
    0%, 100% { transform: translateY(0); }
    50% { transform: translateY(-15px); }
}

.finished-card {
    position: relative;
    z-index: 5;
    width: 100%;
    max-width: 420px;
    padding: 2rem;
    margin-left: auto;
    margin-right: auto;
    background-color: #FFFFFF;
    border-radius: var(--radius-xl);
    box-shadow: 0 25px 80px rgba(0, 24, 76, 0.4);
    text-align: center;
    animation: slideUp 0.6s ease-out;
}

.finished-card-header {
    text-align: center;
    margin-bottom: 1.5rem;
}

.finished-card-header .finished-logo {
    height: 48px;
    width: auto;
    margin: 0 auto 1.25rem;
    display: block;
}

.finished-card .finished-icon {
    width: 80px;
    height: 80px;
    margin: 0 auto 1rem;
    flex-shrink: 0;
    background: linear-gradient(135deg, #43D3FF 0%, #0099B8 100%);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
}

.finished-card .finished-icon svg {
    width: 40px;
    height: 40px;
    color: #00184C;
}

.finished-card h1.finished-title {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--color-text-primary);
    margin-bottom: 0.75rem;
}

.finished-card .finished-message {
    font-size: 0.9rem;
    line-height: 1.5;
    color: var(--color-text-secondary);
    margin-bottom: 1.5rem;
}

.finished-card .finished-actions {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.finished-card .finished-actions .btn-primary,
.finished-card .finished-actions .btn-secondary {
    width: 100%;
    justify-content: center;
}

.finished-card .btn-secondary {
    background-color: transparent;
    color: var(--color-primary-dark);
    border: 2px solid var(--color-primary-dark);
    border-radius: var(--radius-md);
    padding: 1rem 1.5rem;
    font-family: var(--font-family);
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    transition: all var(--transition-normal);
}

.finished-card .btn-secondary:hover {
    background-color: var(--color-primary-dark);
    color: var(--color-text-white);
}

@media (min-width: 1024px) {
    .finished-card {
        margin-right: 5%;
    }

    .finished-illustration {
        width: 400px;
    }
}

@media (max-width: 1023px) {
    .finished-page {
        justify-content: center;
    }

    .finished-card {
        margin-left: auto;
        margin-right: auto;
    }

    .finished-illustration {
        width: 200px;
        left: 50%;
        transform: translateX(-50%);
        bottom: 2%;
    }
}

@media (max-width: 480px) {
    .finished-card {
        padding: 1.5rem 1rem;
    }

    .finished-illustration {
        width: 160px;
    }
}

/* === SCROLLBAR === */
::-webkit-scrollbar { width: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background-color: var(--color-border); border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background-color: var(--color-text-muted); }

/* === RESPONSIVE === */
@media (max-width: 768px) {
    .chat-modal-container {
        width: 95%;
        height: 95%;
    }

    .chat-header { padding: 0.75rem 1rem; }
    .chat-header-info span { display: none; }
    .chat-body { padding: 0.875rem; }
    .chat-message-content { max-width: 88%; }
    .chat-message-bubble { padding: 0.75rem 0.875rem; }
    .chat-message-text { font-size: 0.875rem; }
    .chat-footer { padding: 0.75rem 1rem; padding-bottom: calc(0.75rem + env(safe-area-inset-bottom, 0px)); }
    .chat-input { min-height: 48px; padding: 0.875rem 3.5rem 0.875rem 1rem; }
    .btn-action { width: 40px; height: 40px; }
    .chat-send-btn { width: 38px; height: 38px; right: 0.625rem; bottom: 0.625rem; }
    .chat-send-btn svg { width: 18px; height: 18px; }
}

@media (max-width: 480px) {
    .login-card { padding: 1.5rem 1rem; }
    .login-logo { height: 36px; }
    .login-card-header h1 { font-size: 1.25rem; }

    .chat-modal-container {
        width: 100%;
        height: 100%;
        border-radius: 0;
    }

    .chat-header { padding: 0.625rem 0.875rem; }
    .chat-header-avatar { width: 36px; height: 36px; }
    .chat-header-logo-img { width: 36px; height: 36px; }
    .chat-header-status { width: 10px; height: 10px; }
    .chat-header-info h2 { font-size: 0.9375rem; }
    .btn-action { width: 36px; height: 36px; }
    .btn-action svg { width: 16px; height: 16px; }
    .chat-header-right { gap: 0.5rem; }

    .chat-body { padding: 0.75rem; }
    .chat-message-content { max-width: 92%; }
    .chat-message-bubble { padding: 0.625rem 0.75rem; border-radius: 12px 12px 12px 4px; }
    .chat-message.user .chat-message-bubble { border-radius: 12px 12px 4px 12px; }
    .chat-message-text { font-size: 0.875rem; line-height: 1.5; }
    .chat-message-avatar { width: 28px; height: 28px; }
    .chat-message.nexia .chat-message-avatar img { width: 28px; height: 28px; }

    .chat-footer { padding: 0.625rem 0.875rem; padding-bottom: calc(0.625rem + env(safe-area-inset-bottom, 0px)); }
    .chat-input { min-height: 44px; padding: 0.75rem 3rem 0.75rem 0.875rem; font-size: 0.875rem; }
    .chat-send-btn { width: 34px; height: 34px; right: 0.5rem; bottom: 0.5rem; }
    .chat-send-btn svg { width: 16px; height: 16px; }
}

/* iPhone landscape / pantallas bajas: compacta header + footer para mantener input visible */
@media (max-height: 480px) and (orientation: landscape) {
    .chat-header {
        padding: 0.5rem 0.875rem;
    }

    .chat-header-avatar,
    .chat-header-logo-img {
        width: 32px;
        height: 32px;
    }

    .chat-header-info h2 {
        font-size: 0.875rem;
    }

    .chat-header-status-text {
        display: none;
    }

    .chat-header-right {
        gap: 0.5rem;
    }

    .btn-action {
        width: 34px;
        height: 34px;
    }

    .chat-body {
        padding: 0.625rem 0.75rem;
    }

    .chat-footer {
        padding: 0.5rem 0.75rem;
        padding-bottom: calc(0.5rem + env(safe-area-inset-bottom, 0px));
    }

    .chat-input {
        min-height: 40px;
        padding: 0.625rem 2.75rem 0.625rem 0.75rem;
    }

    .chat-send-btn {
        width: 30px;
        height: 30px;
        right: 0.5rem;
    }
}

@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
}
