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

:root {
    --primary: #2B3952;
    --primary-rgb: 43, 57, 82;
    --accent: #EEC693;
    --accent-hover: #E2B77D;
    --accent-light: rgba(238, 198, 147, 0.15);
    --bg: #F8FAFC;
    --panel: #FFFFFF;
    --text: #1A2332;
    --text-muted: #64748B;
    --border: rgba(43, 57, 82, 0.06);
    --border-active: rgba(238, 198, 147, 0.4);
    --shadow: 0 10px 30px rgba(43, 57, 82, 0.03);
    --shadow-heavy: 0 20px 50px rgba(43, 57, 82, 0.08);
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    scrollbar-width: thin;
    scrollbar-color: rgba(43, 57, 82, 0.15) transparent;
}

/* ===== PERSONALIZACIÓN DE BARRA DE DESPLAZAMIENTO (SCROLLBAR) ===== */
::-webkit-scrollbar {
    width: 6px;
    height: 6px;
}

::-webkit-scrollbar-track {
    background: transparent;
}

::-webkit-scrollbar-thumb {
    background: rgba(43, 57, 82, 0.15);
    border-radius: 10px;
    transition: background 0.2s;
}

::-webkit-scrollbar-thumb:hover {
    background: rgba(43, 57, 82, 0.3);
}

a {
    text-decoration: none;
}

body {
    font-family: 'Outfit', 'Inter', sans-serif;
    background-color: var(--bg);
    color: var(--text);
    overflow: hidden;
    height: 100vh;
    height: 100dvh;
    display: flex;
}

/* ===== LAYOUT ESTRUCTURAL ===== */
.app-layout {
    display: flex;
    width: 100vw;
    height: 100vh;
    height: 100dvh;
    position: relative;
}

/* ===== BARRA LATERAL (SIDEBAR) ===== */
.sidebar {
    width: 280px;
    background-color: #F7F9FC;
    border-right: 1px solid var(--border);
    display: flex;
    flex-direction: column;
    flex-shrink: 0;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    z-index: 100;
    position: relative; /* Habilita el z-index de forma efectiva */
    overflow: visible; /* Evita que el botón flotante se recorte lateralmente */
}

.sidebar-header {
    padding: 1.5rem 1.25rem;
    border-bottom: 1px solid var(--border);
    display: flex;
    align-items: center;
    justify-content: space-between;
    transition: padding 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.sidebar-brand-container {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.brand-monogram {
    flex-shrink: 0;
    object-fit: contain;
}

.brand-monogram-large {
    object-fit: contain;
    flex-shrink: 0;
}

.sidebar-title-container h1 {
    font-size: 1.15rem;
    font-weight: 800;
    color: var(--primary);
    line-height: 1.1;
    letter-spacing: -0.3px;
}

.sidebar-title-container p {
    font-size: 0.72rem;
    color: var(--text-muted);
    font-weight: 600;
    margin-top: 1px;
}

.sidebar-action-container {
    padding: 1.25rem 1.25rem 0.5rem;
    transition: padding 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.btn-new-chat {
    width: 100%;
    background-color: transparent;
    color: var(--primary);
    border: 1px solid rgba(43, 57, 82, 0.15);
    border-radius: 30px;
    padding: 0.65rem 1.2rem;
    font-family: inherit;
    font-weight: 700;
    font-size: 0.9rem;
    display: flex;
    align-items: center;
    justify-content: flex-start;
    gap: 0.75rem;
    cursor: pointer;
    transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: none;
}

.btn-new-chat:hover {
    background-color: rgba(43, 57, 82, 0.03);
    border-color: rgba(43, 57, 82, 0.25);
    color: var(--primary);
}

.btn-new-chat:active {
    background-color: rgba(43, 57, 82, 0.06);
    border-color: var(--primary);
    transform: scale(0.97);
}

.btn-new-chat i,
.btn-new-chat svg {
    width: 15px;
    height: 15px;
    font-size: 0.9rem;
    color: var(--text-muted);
    transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
}

.btn-new-chat:hover i,
.btn-new-chat:hover svg,
.btn-new-chat:active i,
.btn-new-chat:active svg {
    color: var(--primary);
}

.sidebar-scroll {
    flex: 1;
    overflow-y: auto;
    padding: 0 0 1rem;
}

.sidebar-section-title {
    font-size: 0.78rem;
    font-weight: 700;
    color: var(--primary);
    margin: 1.5rem 1.25rem 0.75rem;
}

.chat-list-container {
    display: flex;
    flex-direction: column;
}

.chat-list-item {
    background: transparent;
    border: 1px solid transparent;
    border-right: 3px solid transparent;
    border-radius: 0;
    padding: 0.8rem 1.5rem;
    cursor: pointer;
    transition: all 0.2s ease;
    text-align: left;
    display: flex;
    align-items: center;
}

.chat-list-item:hover {
    background-color: rgba(43, 57, 82, 0.02);
}

.chat-list-item.active {
    background-color: rgba(43, 57, 82, 0.05); /* Soft gray blue background */
    border-right: 3px solid var(--primary); /* Indigo boundary border on the right */
    border-left: none;
}

.chat-list-item-title {
    font-weight: 500;
    font-size: 0.88rem;
    color: #475569;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    width: 100%;
}

.chat-list-item.active .chat-list-item-title {
    color: var(--primary);
    font-weight: 700;
}

.sidebar-footer {
    padding: 1.25rem;
    border-top: 1px solid var(--border);
    background-color: transparent;
    transition: padding 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

/* ===== FOOTER PREMIUM CARDS ===== */
.auth-sidebar-premium-card,
.user-sidebar-profile-card {
    background-color: var(--panel);
    border: 1px solid rgba(43, 57, 82, 0.08);
    border-radius: 16px;
    padding: 1.25rem;
    display: flex;
    flex-direction: column;
    gap: 0.85rem;
    box-shadow: var(--shadow);
    text-align: left;
}

.auth-sidebar-card-top,
.user-sidebar-profile-top {
    display: flex;
    gap: 0.75rem;
    align-items: flex-start;
}

.auth-sidebar-card-icon,
.user-sidebar-avatar-circle {
    width: 38px;
    height: 38px;
    background-color: var(--accent-light);
    color: var(--primary);
    border-radius: 50%; /* Contorno perfectamente circular */
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    border: 1px solid rgba(238, 198, 147, 0.2);
}

.auth-sidebar-card-icon i,
.auth-sidebar-card-icon svg,
.user-sidebar-avatar-circle i,
.user-sidebar-avatar-circle svg {
    width: 18px;
    height: 18px;
}

.auth-sidebar-card-text {
    font-size: 0.75rem;
    color: var(--text-muted);
    line-height: 1.45;
    margin: 0;
}

.btn-auth-card-link,
.btn-logout-link {
    background: transparent;
    border: none;
    color: var(--primary);
    font-family: inherit;
    font-weight: 700;
    font-size: 0.82rem;
    cursor: pointer;
    text-align: left;
    text-decoration: none;
    width: fit-content;
    padding: 0;
    transition: color 0.2s;
}

.btn-auth-card-link:hover,
.btn-logout-link:hover {
    color: rgba(43, 57, 82, 0.85);
}

.user-sidebar-profile-details {
    overflow: hidden;
}

.user-sidebar-profile-name {
    font-weight: 700;
    font-size: 0.85rem;
    color: var(--primary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.user-sidebar-profile-email {
    font-size: 0.68rem;
    color: var(--text-muted);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* ===== CHATGPT-STYLE PROFILE CARD (SIDEBAR FOOTER) ===== */
.chatgpt-profile-card {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.5rem 0.65rem;
    background-color: transparent;
    border-radius: 12px;
    transition: background-color 0.2s ease;
    width: 100%;
    box-sizing: border-box;
}

.chatgpt-profile-card:hover {
    background-color: rgba(43, 57, 82, 0.04); /* Sutil hover en toda la capsula */
}

.chatgpt-avatar {
    width: 34px;
    height: 34px;
    background-color: var(--primary);
    color: white;
    font-family: 'Outfit', sans-serif;
    font-weight: 700;
    font-size: 0.82rem;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    letter-spacing: 0.2px;
    box-shadow: 0 2px 5px rgba(43, 57, 82, 0.1);
}

.chatgpt-details {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 0.15rem;
    overflow: hidden;
    text-align: left;
}

.chatgpt-name {
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--primary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    line-height: 1.2;
}

.chatgpt-role {
    font-size: 0.72rem;
    color: var(--text-muted);
    font-weight: 500;
    line-height: 1.1;
}

.btn-chatgpt-logout {
    background: transparent;
    border: 1px solid transparent;
    color: var(--text-muted);
    cursor: pointer;
    width: 32px;
    height: 32px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
    flex-shrink: 0;
}

.btn-chatgpt-logout:hover {
    background-color: rgba(220, 38, 38, 0.08);
    color: #DC2626;
    border-color: rgba(220, 38, 38, 0.15);
}

.btn-chatgpt-logout i,
.btn-chatgpt-logout svg {
    width: 14px;
    height: 14px;
}

/* ===== CONTENEDOR PRINCIPAL ===== */
.main-area {
    flex: 1;
    display: flex;
    flex-direction: column;
    height: 100vh;
    height: 100dvh;
    background-color: var(--bg);
    position: relative;
    z-index: 1; /* Permite que el sidebar (z-index: 100) y su botón flotante queden por encima */
}

/* Topbar móvil */
.mobile-topbar {
    height: 60px;
    background-color: var(--panel);
    border-bottom: 1px solid var(--border);
    display: none;
    align-items: center;
    justify-content: space-between;
    padding: 0 1.25rem;
    flex-shrink: 0;
    z-index: 90;
}

.btn-sidebar-toggle {
    background: transparent;
    border: none;
    color: var(--primary);
    cursor: pointer;
    width: 40px;
    height: 40px;
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.2s;
}

.btn-sidebar-toggle:hover {
    background-color: rgba(43, 57, 82, 0.05);
}

.mobile-logo-title {
    font-weight: 800;
    color: var(--primary);
    font-size: 0.95rem;
}

/* ===== PANTALLA INICIAL (BIENVENIDA) ===== */
.welcome-screen {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: flex-end; /* Alinea los elementos hacia la parte inferior estilo Figma */
    padding: 2rem 2rem 1.25rem; /* Margen inferior ajustado */
    text-align: center;
    overflow-y: auto;
}

.welcome-logo-section {
    margin-bottom: 1.5rem;
}

.welcome-logo-section img {
    max-width: 260px;
    height: auto;
}

.welcome-headline {
    font-size: 2.2rem;
    font-weight: 800;
    color: var(--primary);
    margin-bottom: 0.5rem;
    letter-spacing: -0.5px;
}

.welcome-subline {
    color: var(--text-muted);
    font-size: 1rem;
    margin-bottom: 2.5rem;
    max-width: 760px; /* Más ancho para que quepa en exactamente 2 líneas fluidas como en Figma */
    line-height: 1.6;
}

.suggestions-grid {
    display: flex;
    flex-wrap: wrap; /* Por defecto se envuelve en móviles y tablets */
    gap: 0.75rem;
    max-width: 100%;
    width: 100%;
    margin-bottom: 1.5rem; /* Reducido para acoplarse mejor con la barra inferior */
    justify-content: center;
}

@media (min-width: 1200px) {
    .suggestions-grid {
        flex-wrap: nowrap; /* En pantallas de escritorio se alinea en una sola fila limpia estilo Figma */
        max-width: 980px; /* Un poco más angosto para que el chat de abajo sobresalga */
    }
}

.suggestion-pill {
    background-color: var(--panel);
    border: 1px solid var(--border);
    border-radius: 20px;
    padding: 0.55rem 1.25rem;
    font-family: inherit;
    font-size: 0.8rem;
    font-weight: 600;
    color: #475569;
    cursor: pointer;
    transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: 0 2px 8px rgba(43, 57, 82, 0.02);
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

.suggestion-pill:hover {
    border-color: rgba(43, 57, 82, 0.25);
    background-color: rgba(43, 57, 82, 0.04);
    color: var(--primary);
    transform: translateY(-2px);
    box-shadow: 0 6px 15px rgba(43, 57, 82, 0.08);
}

/* ===== PANTALLA ACTIVA (VENTANA DE CHAT) ===== */
.chat-window {
    flex: 1;
    display: flex;
    flex-direction: column;
    height: 100%;
    overflow: hidden;
}

.chat-header {
    height: 70px;
    background-color: var(--panel);
    border-bottom: 1px solid var(--border);
    padding: 0 2rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-shrink: 0;
}

.chat-header-info {
    display: flex;
    align-items: center;
    gap: 0.85rem;
}

.chat-header-avatar {
    width: 38px;
    height: 38px;
    background-color: var(--primary);
    color: white;
    border-radius: 50%; /* Contorno circular perfecto */
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.1rem;
}

.chat-header-details h2 {
    font-size: 0.95rem;
    font-weight: 700;
    color: var(--primary);
}

.chat-header-details p {
    font-size: 0.72rem;
    color: var(--text-muted);
    display: flex;
    align-items: center;
    gap: 0.25rem;
    font-weight: 600;
}

.chat-header-details p::before {
    content: '';
    width: 6px;
    height: 6px;
    background-color: #10B981;
    border-radius: 50%;
    display: inline-block;
}

.chat-header-actions {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.btn-header-action {
    background: var(--panel);
    border: 1px solid rgba(43, 57, 82, 0.12);
    color: #64748B;
    cursor: pointer;
    width: 36px;
    height: 36px;
    border-radius: 50%; /* Contorno circular perfecto */
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
}

.btn-header-action:hover {
    background-color: rgba(43, 57, 82, 0.05);
    color: var(--primary);
    border-color: rgba(43, 57, 82, 0.25);
}

.btn-header-action i,
.btn-header-action svg {
    width: 15px; /* Icono más delicado y reducido */
    height: 15px;
}

.chat-scroll {
    flex: 1;
    overflow-y: auto;
    padding: 2rem calc(max(2rem, (100% - 1100px) / 2)); /* Centra la columna de mensajes para alinearse con el input de 1100px */
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
    background-color: #FAFBFD;
}

/* Burbujas de Mensaje */
.message-row {
    display: flex;
    gap: 0.75rem;
    max-width: 75%;
    align-items: flex-end;
}

.message-row.bot {
    align-self: flex-start;
    flex-direction: row;
}

.message-row.user {
    align-self: flex-end;
    flex-direction: row-reverse;
}

.message-avatar {
    width: 38px;
    height: 38px;
    border-radius: 50%; /* Contorno circular perfecto */
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    font-size: 0.85rem;
    margin-bottom: 1.25rem;
}

.message-avatar i,
.message-avatar svg {
    width: 18px; /* Iconos más visibles y amplificados de forma proporcional */
    height: 18px;
}

.message-row.bot .message-avatar {
    background-color: var(--primary);
    color: white;
}

.message-row.user .message-avatar {
    background-color: var(--accent-light);
    color: var(--primary);
    border: 1px solid var(--border-active);
    font-weight: 700;
}

.message-body {
    display: flex;
    flex-direction: column;
}

.message-bubble {
    padding: 0.85rem 1.15rem;
    font-size: 0.88rem;
    line-height: 1.55;
    box-shadow: var(--shadow);
}

.message-row.bot .message-bubble {
    background-color: var(--primary);
    color: white;
    border-radius: 16px;
    border-bottom-left-radius: 4px;
}

.message-row.user .message-bubble {
    background-color: var(--panel);
    color: var(--primary);
    border: 1px solid var(--border);
    border-radius: 16px;
    border-bottom-right-radius: 4px;
}

.message-time {
    font-size: 0.65rem;
    color: var(--text-muted);
    margin-top: 0.35rem;
    font-weight: 500;
}

.message-row.user .message-time {
    align-self: flex-end;
}

.message-row.bot .message-time {
    align-self: flex-start;
}

/* Tarjetas de opciones interactivas en el chat */
.chat-options-container {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    margin-top: 0.75rem;
}

.chat-opt-btn {
    background-color: var(--panel);
    border: 1px solid var(--border);
    color: var(--primary);
    font-family: inherit;
    font-weight: 600;
    font-size: 0.8rem;
    padding: 0.55rem 0.9rem;
    border-radius: 20px;
    cursor: pointer;
    transition: all 0.2s ease;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.02);
}

.chat-opt-btn:hover {
    border-color: rgba(43, 57, 82, 0.25);
    background-color: rgba(43, 57, 82, 0.04);
    color: var(--primary);
    transform: translateY(-1px);
    box-shadow: 0 4px 10px rgba(43, 57, 82, 0.08);
}

/* ===== ENTRADA DE MENSAJES (AI INPUT CARD) ===== */
.input-area {
    padding: 1rem 2rem 2.5rem;
    background-color: transparent;
    flex-shrink: 0;
    display: flex;
    justify-content: center;
    width: 100%;
}

.input-container-card {
    background-color: var(--panel);
    border: 1px solid rgba(43, 57, 82, 0.08);
    border-radius: 24px;
    padding: 1.25rem 1.5rem;
    display: flex;
    flex-direction: column;
    gap: 0.85rem;
    width: 100%;
    max-width: 1100px;
    margin: 0 auto;
    box-shadow: 0 10px 40px rgba(43, 57, 82, 0.03);
    min-height: 130px;
    transition: border-color 0.25s, box-shadow 0.25s;
}

.input-container-card:focus-within {
    border-color: rgba(43, 57, 82, 0.25);
    box-shadow: 0 10px 40px rgba(43, 57, 82, 0.06);
}

.input-top-row {
    display: flex;
    align-items: flex-start;
    gap: 0.75rem;
    flex: 1;
}

.input-clip-icon {
    color: #94A3B8;
    cursor: pointer;
    font-size: 1.15rem;
    padding-top: 0.25rem;
    transition: color 0.2s;
    flex-shrink: 0;
}

.input-clip-icon:hover {
    color: var(--primary);
}

.chat-input {
    flex: 1;
    border: none;
    background: transparent;
    outline: none;
    font-family: inherit;
    font-size: 0.9rem;
    color: var(--text);
    padding: 0.2rem 0;
    min-height: 52px;
    max-height: 180px;
    resize: none;
    line-height: 1.5;
}

.chat-input::placeholder {
    color: #94A3B8;
}

.input-bottom-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-top: 1px solid rgba(43, 57, 82, 0.02);
    padding-top: 0.5rem;
}

.input-controls-right {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    margin-left: auto;
}

/* Vista previa de adjunto en la tarjeta */
.attachment-preview {
    display: flex;
    align-items: center;
    justify-content: space-between;
    background-color: rgba(43, 57, 82, 0.05);
    border: 1px solid rgba(43, 57, 82, 0.08);
    border-radius: 12px;
    padding: 0.5rem 0.85rem;
    margin-bottom: 0.5rem;
    font-size: 0.78rem;
    color: var(--primary);
    font-weight: 600;
}

.btn-remove-attachment {
    background: transparent;
    border: none;
    color: var(--text-muted);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 2px;
    border-radius: 50%;
    transition: all 0.2s;
}

.btn-remove-attachment:hover {
    background-color: rgba(220, 38, 38, 0.1);
    color: #DC2626;
}

.btn-input-attach {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background-color: var(--panel);
    border: 1px solid rgba(43, 57, 82, 0.12); /* Contorno circular visible */
    color: #64748B;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.2s;
}

.btn-input-attach:hover {
    background-color: rgba(43, 57, 82, 0.05);
    color: var(--primary);
    border-color: rgba(43, 57, 82, 0.25);
}

.btn-input-attach i,
.btn-input-attach svg {
    width: 15px; /* Icono más delicado y reducido */
    height: 15px;
}

.btn-send {
    background-color: var(--primary);
    color: white;
    border: none;
    border-radius: 20px;
    padding: 0.55rem 1.4rem;
    font-family: inherit;
    font-weight: 700;
    font-size: 0.85rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    cursor: pointer;
    transition: all 0.2s ease;
    box-shadow: 0 4px 10px rgba(43, 57, 82, 0.1);
}

.btn-send:hover {
    background-color: rgba(43, 57, 82, 0.9);
    color: white;
    transform: translateY(-1px);
    box-shadow: 0 6px 15px rgba(43, 57, 82, 0.15);
}

.btn-send i {
    font-size: 0.95rem;
}

/* ===== MODALES E INTEGRACIÓN DE AUTH (OVERLAYS) ===== */
.overlay-confirm {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: rgba(43, 57, 82, 0.4);
    backdrop-filter: blur(4px);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 2000;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s ease;
    padding: 1.5rem;
}

.overlay-confirm.active {
    opacity: 1;
    pointer-events: all;
}

.confirm-card {
    background-color: var(--panel);
    width: 100%;
    max-width: 420px;
    border-radius: 24px;
    padding: 2rem;
    border: 1px solid var(--border);
    box-shadow: var(--shadow-heavy);
    text-align: center;
    display: flex;
    flex-direction: column;
    gap: 1.25rem;
    transform: scale(0.92);
    transition: transform 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
}

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

.confirm-card .alert-icon-container {
    width: 50px;
    height: 50px;
    background-color: var(--accent-light);
    color: #C69A5D; /* Elegante tono arena sofisticado */
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto;
}

.confirm-card .alert-icon-container i,
.confirm-card .alert-icon-container svg {
    width: 22px;
    height: 22px;
}

.confirm-card h3 {
    font-size: 1.15rem;
    font-weight: 800;
    color: var(--primary);
}

.confirm-card p {
    font-size: 0.85rem;
    color: var(--text-muted);
    line-height: 1.45;
}

.confirm-btns {
    display: flex;
    gap: 0.75rem;
}

.btn-confirm-cancel {
    flex: 1;
    background-color: rgba(43, 57, 82, 0.05);
    color: var(--primary);
    border: none;
    border-radius: 10px;
    padding: 0.75rem;
    font-family: inherit;
    font-weight: 700;
    font-size: 0.85rem;
    cursor: pointer;
    transition: background 0.2s;
}

.btn-confirm-cancel:hover {
    background-color: rgba(43, 57, 82, 0.08);
}

.btn-confirm-action {
    flex: 1;
    background-color: var(--primary);
    color: white;
    border: none;
    border-radius: 10px;
    padding: 0.75rem;
    font-family: inherit;
    font-weight: 700;
    font-size: 0.85rem;
    cursor: pointer;
    transition: background 0.2s;
}

.btn-confirm-action:hover {
    background-color: #1E273A;
}

/* Modales de Login / Registro */
.auth-form-card {
    background-color: var(--panel);
    width: 100%;
    max-width: 380px; /* Ancho más compacto y elegante */
    border-radius: 24px;
    padding: 2.25rem 1.75rem; /* Padding proporcional */
    border: 1px solid var(--border);
    box-shadow: var(--shadow-heavy);
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
    transform: scale(0.92);
    transition: transform 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
    position: relative;
}

.overlay-confirm.active .auth-form-card {
    transform: scale(1);
}

.auth-close-btn {
    position: absolute;
    top: 1.25rem;
    right: 1.25rem;
    background: transparent;
    border: none;
    color: var(--text-muted);
    cursor: pointer;
    width: 32px;
    height: 32px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.2s;
}

.auth-close-btn:hover {
    background-color: rgba(43, 57, 82, 0.05);
    color: var(--primary);
}

.auth-header {
    text-align: center;
}

.auth-header h3 {
    font-size: 1.25rem;
    font-weight: 800;
    color: var(--primary);
    margin-bottom: 0.35rem;
}

.auth-header p {
    font-size: 0.8rem;
    color: var(--text-muted);
}

.auth-form {
    display: flex;
    flex-direction: column;
    gap: 1.25rem; /* Más espacio entre inputs para que respiren */
}

.form-group {
    display: flex;
    flex-direction: column;
    gap: 0.4rem;
    text-align: left;
}

.form-group label {
    font-size: 0.82rem;
    font-weight: 600;
    color: var(--primary);
    letter-spacing: 0.3px;
}

.form-input {
    width: 100%;
    border: 1px solid var(--border);
    padding: 0.7rem 0.9rem;
    border-radius: 10px;
    font-family: inherit;
    font-size: 0.85rem;
    color: var(--text);
    outline: none;
    transition: all 0.2s;
    background-color: #FAFBFD;
    box-shadow: none; /* Sin sombra por defecto */
}

.form-input:focus {
    border-color: rgba(43, 57, 82, 0.35);
    background-color: white;
    box-shadow: none; /* Sin sombra al enfocar */
}

.btn-auth-submit {
    background-color: var(--primary);
    color: white;
    border: none;
    border-radius: 10px;
    padding: 0.75rem;
    font-family: inherit;
    font-weight: 700;
    font-size: 0.88rem;
    cursor: pointer;
    transition: all 0.2s;
    margin-top: 0.5rem;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
}

.btn-auth-submit:hover {
    background-color: rgba(43, 57, 82, 0.95);
    box-shadow: 0 4px 10px rgba(43, 57, 82, 0.15);
}

.auth-switch-prompt {
    font-size: 0.8rem;
    color: var(--text-muted);
    text-align: center;
}

.auth-switch-link {
    color: var(--primary);
    font-weight: 700;
    cursor: pointer;
    text-decoration: none;
    transition: color 0.2s;
}

.auth-switch-link:hover {
    color: rgba(43, 57, 82, 0.85);
}

.error-banner {
    background-color: rgba(220, 38, 38, 0.05);
    border: 1px solid rgba(220, 38, 38, 0.2);
    border-radius: 8px;
    padding: 0.65rem 0.85rem;
    color: #DC2626;
    font-size: 0.78rem;
    font-weight: 600;
    text-align: left;
    display: none;
}

/* ===== ADAPTACIONES RESPONSIVAS (MÓVIL / TABLET) ===== */
@media (max-width: 992px) {
    .suggestions-grid {
        max-width: 600px;
        gap: 1rem;
    }
}

@media (max-width: 768px) {
    .sidebar {
        position: absolute;
        left: -280px;
        top: 0;
        bottom: 0;
        box-shadow: 10px 0 30px rgba(0, 0, 0, 0.05);
    }
    
    .sidebar.mobile-open {
        left: 0;
    }
    
    .mobile-topbar {
        display: flex;
    }
    
    .welcome-headline {
        font-size: 1.75rem;
    }
    
    .welcome-subline {
        font-size: 0.88rem;
        margin-bottom: 2rem;
    }
    
    .suggestions-grid {
        grid-template-columns: 1fr;
        gap: 0.75rem;
        max-width: 100%;
    }
    
    .suggestion-card {
        padding: 1rem;
    }
    
    .chat-header {
        padding: 0 1.25rem;
    }
    
    .chat-scroll {
        padding: 1.25rem;
    }
    
    .message-row {
        max-width: 88%;
    }
    
    .input-area {
        padding: 1rem;
    }
    
    .input-container {
        padding-left: 1rem;
    }
}

.sidebar-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: rgba(43, 57, 82, 0.15);
    backdrop-filter: blur(2px);
    z-index: 95;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s ease;
}

.sidebar-overlay.active {
    opacity: 1;
    pointer-events: all;
}

/* ===== ESTILOS DEL BOTÓN DE COLAPSO Y ESTADO COLAPSADO DESKTOP ===== */
.btn-sidebar-collapse {
    background: transparent;
    border: none;
    color: var(--text-muted);
    cursor: pointer;
    width: 32px;
    height: 32px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
    flex-shrink: 0;
}

.btn-sidebar-collapse:hover {
    background-color: rgba(43, 57, 82, 0.05);
    color: var(--primary);
}

.btn-sidebar-collapse i,
.btn-sidebar-collapse svg {
    width: 16px;
    height: 16px;
    transition: transform 0.3s ease;
}

/* Transiciones suaves y prevención de saltos de línea para colapsado */
.sidebar-title-container,
.btn-new-chat span,
.chat-list-item-title,
.sidebar-section-title,
.user-sidebar-profile-details {
    transition: opacity 0.2s cubic-bezier(0.4, 0, 0.2, 1), 
                max-width 0.2s cubic-bezier(0.4, 0, 0.2, 1),
                margin 0.2s cubic-bezier(0.4, 0, 0.2, 1),
                padding 0.2s cubic-bezier(0.4, 0, 0.2, 1),
                visibility 0.2s ease;
    opacity: 1;
    max-width: 220px;
    visibility: visible;
    overflow: hidden;
    white-space: nowrap; /* Evita que el texto salte de línea verticalmente al colapsar */
    display: inline-block;
}

.sidebar-title-container {
    display: flex;
    flex-direction: column;
}

/* Iconos de la lista de chats con transición suave */
.chat-list-item-icon {
    display: block !important;
    max-width: 0;
    opacity: 0;
    overflow: hidden;
    transition: opacity 0.2s cubic-bezier(0.4, 0, 0.2, 1), max-width 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    flex-shrink: 0;
}

.sidebar.collapsed {
    width: 0px;
    border-right: none;
    overflow: hidden;
}

/* Ocultar elementos de forma fluida al colapsar */
.sidebar.collapsed .sidebar-title-container,
.sidebar.collapsed .btn-new-chat span,
.sidebar.collapsed .chat-list-item-title,
.sidebar.collapsed .sidebar-section-title,
.sidebar.collapsed .auth-sidebar-card-text,
.sidebar.collapsed .btn-auth-card-link,
.sidebar.collapsed .user-sidebar-profile-details,
.sidebar.collapsed .btn-logout-link {
    opacity: 0 !important;
    max-width: 0 !important;
    margin: 0 !important;
    padding: 0 !important;
    visibility: hidden !important;
    pointer-events: none;
}

/* Botón Nuevo Chat colapsado */
.sidebar.collapsed .sidebar-action-container {
    padding: 1.25rem 0.5rem;
}

.sidebar.collapsed .btn-new-chat {
    justify-content: center;
    padding: 0;
    width: 44px;
    height: 44px;
    margin: 0 auto;
    border-radius: 50%;
    gap: 0;
    box-shadow: none;
}

.sidebar.collapsed .btn-new-chat i,
.sidebar.collapsed .btn-new-chat svg {
    margin: 0;
    width: 15px;
    height: 15px;
}

/* Chats colapsados (Centrado Absoluto) */
.sidebar.collapsed .chat-list-item {
    padding: 0.9rem 0;
    justify-content: center;
    border-right-width: 3px;
}

.sidebar.collapsed .chat-list-item-icon {
    max-width: 16px !important;
    width: 16px !important;
    height: 16px !important;
    opacity: 1 !important;
    margin: 0 !important; /* Elimina auto-margin para permitir que flexbox centre de forma matemática */
}

.sidebar.collapsed .chat-list-item.active .chat-list-item-icon {
    color: var(--primary);
}

/* Footer colapsado */
.sidebar.collapsed .sidebar-footer {
    padding: 1rem 0.5rem;
}

.sidebar.collapsed .auth-sidebar-premium-card,
.sidebar.collapsed .user-sidebar-profile-card {
    padding: 0.75rem 0.5rem;
    align-items: center;
    justify-content: center;
    border: none;
    background: transparent;
    box-shadow: none;
    gap: 0;
    width: 100%;
    display: flex !important;
}

.sidebar.collapsed .auth-sidebar-card-icon,
.sidebar.collapsed .user-sidebar-avatar-circle {
    margin: 0 !important;
    width: 38px;
    height: 38px;
    border-radius: 50%;
}

/* Ajustes de diseño de la página cuando la barra está colapsada en desktop */
@media (min-width: 769px) {
    .sidebar.collapsed ~ .main-area {
        margin-left: 0;
    }
}

/* ===== CÁPSULA FLOTANTE COLAPSADA (TIPO DEEPSEEK) ===== */
.collapsed-sidebar-trigger-container {
    position: absolute;
    top: 19px; /* Centrado vertical perfecto con el chat-header de 70px */
    left: 24px;
    z-index: 101;
    display: none; /* Se activa en desktop por JS/CSS */
    align-items: center;
    gap: 0.75rem;
    pointer-events: auto;
}

/* Mostrar la cápsula cuando el sidebar está colapsado en pantallas grandes */
@media (min-width: 769px) {
    .sidebar-collapsed .collapsed-sidebar-trigger-container {
        display: flex;
        animation: fadeInColl 0.25s cubic-bezier(0.4, 0, 0.2, 1);
    }
    
    /* Desplaza los detalles del header del chat para que no se superpongan */
    .sidebar-collapsed .chat-header-info {
        margin-left: 130px;
    }
    
    .chat-header-info {
        transition: margin-left 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    }
}

.brand-monogram-collapsed {
    object-fit: contain;
    flex-shrink: 0;
}

.collapsed-pill-capsule {
    background-color: var(--panel);
    border: 1px solid rgba(43, 57, 82, 0.08);
    box-shadow: 0 4px 14px rgba(43, 57, 82, 0.04);
    border-radius: 30px;
    padding: 3px 8px;
    display: flex;
    align-items: center;
    gap: 4px;
}

.collapsed-pill-capsule button {
    background: transparent;
    border: none;
    color: var(--text-muted);
    cursor: pointer;
    width: 28px;
    height: 28px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
}

.collapsed-pill-capsule button:hover {
    background-color: rgba(43, 57, 82, 0.05);
    color: var(--primary);
}

.collapsed-pill-capsule button i,
.collapsed-pill-capsule button svg {
    width: 15px;
    height: 15px;
}

.collapsed-pill-divider {
    width: 1px;
    height: 14px;
    background-color: rgba(43, 57, 82, 0.08);
}

@keyframes fadeInColl {
    from {
        opacity: 0;
        transform: translateY(-2px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

