/**
 * Kian AI - Estilos Estáticos Base
 * Maquetación, tipografía y estilos estructurales con efecto sin bordes.
 */

/* Reset y Base */
*,
*::before,
*::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
    border: none;
    /* Eliminar bordes por defecto */

    /* SCROLLBAR OCULTA GLOBALMENTE */
    scrollbar-width: none !important;
    /* Firefox */
    -ms-overflow-style: none !important;
    /* IE/Edge */
}

/* Ocultar scrollbar para Chrome/Safari/Opera en TODOS los elementos */
*::-webkit-scrollbar {
    display: none !important;
    width: 0 !important;
    height: 0 !important;
    background: transparent !important;
    -webkit-appearance: none !important;
}

/* Bloquear el rebote de toda la página (Pull-to-refresh nativo que rompe la app) */
html,
body {
    height: 100%;
    /* Fallback */
    height: 100dvh;
    /* Dynamic Viewport Height: Clave para móviles */
    width: 100%;
    overflow: hidden;
    /* Evita scroll en el body, solo permitido en contenedores internos */
    overscroll-behavior: none;
    /* Desactiva el rebote elástico global */
}

html {
    font-size: 16px;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

body {
    font-family: var(--font-family-base);
    font-size: var(--font-size-base);
    font-weight: var(--font-weight-normal);
    line-height: 1.6;
    color: var(--text-primary);
    background: var(--bg-primary);
}

/* Tipografía */
h1,
h2,
h3,
h4,
h5,
h6 {
    font-weight: var(--font-weight-bold);
    line-height: 1.3;
    margin-bottom: var(--spacing-md);
}

p {
    margin-bottom: var(--spacing-md);
}

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

/* Code & Preformatted Text */
code,
pre {
    font-family: var(--font-family-mono);
    font-size: var(--font-size-sm);
}

/* Inline Code */
code:not(pre code) {
    background: rgba(255, 255, 255, 0.1);
    padding: 2px 5px;
    border-radius: 4px;
    color: #e6e6e6;
    word-break: break-word;
    /* Prevents overflow in inline code */
}

/* Code Blocks Container */
pre {
    background: #1e1e1e !important;
    /* Atom One Dark bg match */
    margin-bottom: var(--spacing-md);
    border-radius: var(--border-radius-md);
    overflow-x: auto;
    /* Allow horizontal scroll for code */
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.2);
    position: relative;
    border: 1px solid rgba(255, 255, 255, 0.05);
    max-width: 100%;
}

/* Code Block Header (Language + Copy) */
.code-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 8px 12px;
    background: rgba(255, 255, 255, 0.05);
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
    font-family: var(--font-family-base);
    font-size: 0.75rem;
    color: var(--text-secondary);
}

.code-lang {
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

/* Actual Code Area */
pre code.hljs {
    padding: 12px !important;
    overflow-x: auto;
    /* Horizontal scroll */
    white-space: pre;
    /* Maintain formatting */
    display: block;
    background: transparent !important;
    /* Let pre handle bg */
    max-width: 100%;
}

/* Copy Code Button */
.btn-copy-code {
    background: transparent;
    border: none;
    color: var(--text-secondary);
    cursor: pointer;
    font-size: 0.75rem;
    display: flex;
    align-items: center;
    gap: 4px;
    padding: 4px 8px;
    border-radius: 4px;
    transition: all 0.2s;
}

.btn-copy-code:hover {
    background: rgba(255, 255, 255, 0.1);
    color: var(--text-primary);
}

/* Mermaid Diagrams */
.mermaid {
    background: rgba(255, 255, 255, 0.05);
    padding: 15px;
    border-radius: var(--border-radius-md);
    margin-bottom: var(--spacing-md);
    display: flex;
    justify-content: center;
    overflow-x: auto;
    /* Permite scroll si el diagrama es muy ancho */
}

/* Tables */
table {
    border-collapse: collapse;
    width: 100%;
    margin-bottom: var(--spacing-md);
    font-size: 0.9em;
    border-radius: 8px;
    overflow: hidden;
}

th,
td {
    padding: 10px 14px;
    text-align: left;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

th {
    background: rgba(255, 255, 255, 0.05);
    font-weight: 600;
}

tr:last-child td {
    border-bottom: none;
}


/* Layout Principal anclado */
#app {
    width: 100%;
    height: 100%;
    /* Hereda el 100dvh */
    display: flex;
    flex-direction: column;
    position: relative;
    background: var(--bg-primary);
}

/* Header respetando el Notch (Safe Area) */
.app-header {
    padding-top: env(safe-area-inset-top);
    /* Baja el header si hay notch */
    height: calc(var(--header-height) + env(safe-area-inset-top));
    background: var(--glass-bg);
    backdrop-filter: blur(20px);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding-left: var(--spacing-lg);
    padding-right: var(--spacing-lg);
    flex-shrink: 0;
    /* Nunca se encoge */
    z-index: var(--z-sticky);
    box-shadow: var(--shadow-lg);
}

.header-title {
    display: flex;
    align-items: center;
    gap: var(--spacing-md);
    font-size: var(--font-size-xl);
    font-weight: var(--font-weight-bold);
    background: var(--primary-gradient);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.header-actions {
    display: flex;
    align-items: center;
    gap: var(--spacing-sm);
}

/* Contenedor de mensajes sólido */
.messages-container {
    flex: 1 1 auto;
    display: flex;
    flex-direction: column;
    min-height: 0;
    height: 100%;
    overflow-y: auto;
    overflow-x: hidden;
    padding: 5px;
    /* Compactado de var(--spacing-lg) a 5px */
    gap: 10px;
    /* Compactado de var(--spacing-lg) a 10px */
    scroll-behavior: smooth;
    -webkit-overflow-scrolling: touch;
    overscroll-behavior: contain;
    transition: opacity 0.3s ease;
}

/* Asegurar que el último mensaje no quede pegado al borde o tapado */
.messages-container::after {
    content: '';
    display: block;
    height: 10px;
    /* Reducido acorde al nuevo gap */
    flex-shrink: 0;
}

/* Ocultar scrollbar pero permitir scroll */
.messages-container::-webkit-scrollbar {
    display: none;
}

.messages-container {
    -ms-overflow-style: none;
    scrollbar-width: none;
}

/* ... (resto de estilos de messages-container se mantienen igual si no se tocan) ... */

/* Botones dentro de la cápsula (override para quitar espacios) */
.input-wrapper .btn-icon {
    width: 36px;
    height: 36px;
    padding: 0;
    margin: 0;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    background: transparent;
    color: var(--text-secondary);
    cursor: pointer;
    flex-shrink: 0;
    transition: all var(--transition-fast);
}

.input-wrapper .btn-icon:hover {
    background: var(--bg-tertiary);
    color: var(--text-primary);
}

/* El textarea se expande pero con límite estricto de 3 líneas */
.input-wrapper.expanded .input-field {
    min-height: 24px;
    max-height: 72px;
    margin-bottom: 0;
}

/* Textarea integrado */
.input-field {
    flex: 1;
    background: transparent;
    padding: 8px 4px;
    color: var(--text-primary);
    font-family: var(--font-family-base);
    font-size: var(--font-size-base);
    resize: none;
    min-height: 24px;
    max-height: 72px;
    line-height: 24px;
    outline: none;
    overflow-y: auto;
    scrollbar-width: none;
    transition: height 0.2s ease;
}

/* Contenedor de mensaje (Avatar eliminado) */
.message {
    display: flex;
    margin-bottom: 5px;
    /* Compactado de var(--spacing-md) a 5px */
    animation: slideIn 0.3s ease-out;
    max-width: 98%;
}

.message.user {
    margin-left: auto;
    flex-direction: row-reverse;
}

/* Burbuja de mensaje */
.message-bubble {
    padding: 10px 8px 5px;
    /* Ajustado: 10px Top, 8px H, 5px Bottom */
    border-radius: 18px;
    font-size: var(--font-size-base);
    line-height: 1.5;
    position: relative;
    word-wrap: break-word;
    box-shadow: var(--shadow-md);
    transition: all var(--transition-fast);
    overflow-x: auto;
    max-width: 100%;
    min-width: 100px;
    /* Ancho mínimo para evitar burbujas demasiado pequeñas */
}

.message.user .message-bubble {
    background: var(--msg-user-bg);
    color: var(--msg-user-text);
    border-bottom-right-radius: 4px;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.2);
    border: none;
}

.message.assistant .message-bubble {
    background: var(--msg-bot-bg);
    color: var(--msg-bot-text);
    border-bottom-left-radius: 4px;
}

.copy-btn {
    display: none !important;
    /* OCULTAR botón flotante antiguo */
}

/* --- Message Footer Actions (Nueva fila de controles) --- */
.message-actions {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    /* Alineado a la derecha */
    gap: 8px;
    margin-top: 6px;
    padding-top: 6px;
    border-top: 1px solid rgba(255, 255, 255, 0.05);
    /* Separador sutil */
    opacity: 0.9;
}

/* El botón de acción dentro del footer */
.action-btn {
    background: transparent;
    border: none;
    color: var(--text-tertiary);
    /* Discreto por defecto */
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 4px;
    font-size: 0.75rem;
    padding: 2px 6px;
    border-radius: 4px;
    transition: all 0.2s;
}

.action-btn:hover {
    background: rgba(255, 255, 255, 0.1);
    color: var(--text-primary);
}

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

/* Ajustes específicos para mensajes de usuario (acciones sutiles) */
.message.user .message-actions {
    justify-content: flex-end;
    border-top-color: rgba(255, 255, 255, 0.15);
    /* Contraste en burbuja de color */
}

.message.user .action-btn {
    color: rgba(255, 255, 255, 0.7);
}

.message.user .action-btn:hover {
    background: rgba(255, 255, 255, 0.2);
    color: white;
}

.copy-btn svg {
    width: 16px;
    height: 16px;
    pointer-events: none;
}

.message-bubble:hover .copy-btn {
    opacity: 1;
}

.copy-btn:hover {
    background: var(--bg-tertiary);
    color: var(--cyan);
    transform: scale(1.1);
}

/* Attachments en mensajes */
.message-attachments {
    margin-top: var(--spacing-sm);
    display: flex;
    flex-direction: column;
    gap: 8px;
}

/* --- GRID DE IMÁGENES (El Collage) --- */
.media-grid {
    display: grid;
    gap: 2px;
    border-radius: 12px;
    overflow: hidden;
    width: 100%;
    max-width: 320px;
    min-height: 160px;
}

/* ESTILOS BASE DE IMAGEN */
.media-grid img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
    cursor: zoom-in;
    transition: filter 0.2s;
    background: var(--bg-tertiary);
}

.media-grid img:hover {
    filter: brightness(0.9);
}

/* --- LÓGICA DEL COLLAGE SEGÚN CANTIDAD --- */

/* 1 Imagen: Mostrar completa con un ratio máximo */
.media-grid[data-count="1"] {
    grid-template-columns: 1fr;
    min-height: 180px;
}

.media-grid[data-count="1"] img {
    max-height: 300px;
    object-fit: contain;
    background: rgba(0, 0, 0, 0.1);
}

/* 2 Imágenes: Dos columnas exactas */
.media-grid[data-count="2"] {
    grid-template-columns: 1fr 1fr;
    min-height: 160px;
}

.media-grid[data-count="2"] img {
    aspect-ratio: 1 / 1;
}

/* 3 Imágenes: Una grande arriba, dos abajo */
.media-grid[data-count="3"] {
    grid-template-columns: 1fr 1fr;
    grid-template-rows: 1.5fr 1fr;
    min-height: 240px;
}

.media-grid[data-count="3"] img:first-child {
    grid-column: span 2;
    aspect-ratio: 16 / 9;
}

.media-grid[data-count="3"] img:nth-child(2),
.media-grid[data-count="3"] img:nth-child(3) {
    aspect-ratio: 1 / 1;
}

/* 4 o más Imágenes: Cuadrícula 2x2 */
.media-grid[data-count="4"],
.media-grid[data-count="more"] {
    grid-template-columns: 1fr 1fr;
    grid-template-rows: 1fr 1fr;
    min-height: 320px;
}

.media-grid[data-count="4"] img,
.media-grid[data-count="more"] img {
    aspect-ratio: 1 / 1;
}

/* --- ARCHIVOS DE DOCUMENTOS (Lista separada) --- */
.documents-list {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.file-attachment {
    display: flex;
    align-items: center;
    gap: 10px;
    background: var(--bg-tertiary);
    padding: 10px 14px;
    border-radius: 8px;
    font-size: var(--font-size-sm);
    color: var(--text-primary);
    text-decoration: none;
    transition: background 0.2s;
    border: 1px solid rgba(255, 255, 255, 0.05);
}

.file-attachment:hover {
    background: rgba(255, 255, 255, 0.1);
}

.file-icon {
    flex-shrink: 0;
    width: 24px;
    height: 24px;
    color: var(--cyan);
}

/* Input Area anclado y seguro */
/* Input Area anclado y seguro */
.input-area {
    flex-shrink: 0;
    width: 100%;
    background: var(--bg-primary);

    /* Padding Modificado: CERO abajo explícito para permitir pegado total */
    padding-top: 5px;
    padding-bottom: env(safe-area-inset-bottom);
    /* Solo safe area, sin extra padding */
    padding-left: 0;
    padding-right: 0;

    z-index: var(--z-sticky);
}

/* ... (omitted .input-container styles) ... */

/* Estado Focus/Expanded: Pegado al borde inferior */
.input-wrapper.expanded {
    /* Ancho completo */
    width: 100%;
    max-width: 100%;

    /* Margin negativo para compensar cualquier padding residual y safe-area si es necesario */
    margin: 0 0 calc(-1 * env(safe-area-inset-bottom)) 0;

    /* Esquinas inferiores cuadradas, superiores redondeadas */
    border-radius: 20px 20px 0 0;
    border-bottom: none;

    /* Fondo más visible */
    background: rgba(255, 255, 255, 0.1);
    box-shadow: 0 -4px 20px rgba(0, 0, 0, 0.25);

    /* Layout con botones abajo */
    align-items: flex-end;
    /* Aumentamos padding inferior para compensar el safe area visualmente dentro del contenedor */
    padding: 10px 12px calc(8px + env(safe-area-inset-bottom)) 12px;
}

.input-container {
    max-width: 1200px;
    margin: 0 auto;
    display: flex;
    flex-direction: column;
    gap: var(--spacing-md);
}

.input-attachments {
    display: flex;
    flex-wrap: wrap;
    gap: var(--spacing-sm);
}

.attachment-preview {
    position: relative;
    background: var(--bg-tertiary);
    border-radius: var(--border-radius-md);
    padding: var(--spacing-sm);
    display: flex;
    align-items: center;
    gap: var(--spacing-sm);
    font-size: var(--font-size-sm);
}

.attachment-preview img {
    max-width: 50px;
    /* Tamaño máximo para la vista previa */
    max-height: 50px;
    object-fit: contain;
    border-radius: var(--border-radius-sm);
}

.attachment-remove {
    position: absolute;
    top: -4px;
    right: -4px;
    width: 15px;
    height: 15px;
    border-radius: 50%;
    background: var(--error);
    color: var(--text-secondary);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    font-size: 9px;
}

/* Wrapper del input (La Cápsula Principal) */
.input-wrapper {
    display: flex;
    align-items: flex-end;
    /* Alineado abajo para crecimiento natural */
    gap: 8px;
    /* Espacio entre elementos */

    /* Glassmorphism Input */
    background: rgba(255, 255, 255, 0.08);
    /* Un poco más visible */
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border: 1px solid rgba(255, 255, 255, 0.1);

    border-radius: 24px;
    /* Capsula suave */
    padding: 6px 10px;
    /* Padding interno balanceado */

    transition: all 0.3s cubic-bezier(0.2, 0.8, 0.2, 1);
    width: 90%;
    /* Un poco más ancho por defecto */
    max-width: 800px;
    margin: 0 auto;
    min-height: 48px;
    /* Altura base más cómoda */
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.2);
    position: relative;
    z-index: 2;
}



/* Grupo de botones de acción - Fila por defecto */
.input-actions-group {
    display: flex;
    flex-direction: row;
    gap: 2px;
    align-items: center;
    flex-shrink: 0;
}

/* Botones en COLUMNA cuando está expandido (mic arriba de send) */
.input-wrapper.expanded .input-actions-group {
    flex-direction: column;
    gap: 4px;
    margin-left: 8px;
}

/* Textarea: Ocupa el espacio central */
.input-field {
    flex: 1;
    background: transparent;
    border: none !important;
    padding: 8px 4px;
    /* Padding para texto centrado verticalmente aprox */
    color: var(--text-primary);
    font-family: var(--font-family-base);
    font-size: var(--font-size-base);
    resize: none;
    height: auto;
    min-height: 24px;
    max-height: 120px;
    /* Más espacio vertical (aprox 5 líneas) */
    line-height: 24px;
    outline: none;
    overflow-y: auto;
    scrollbar-width: none;
    transition: height 0.1s ease;
    display: block;
    margin-bottom: 2px;
    /* Ajuste fino de alineación */
}



/* Ocultar scrollbar en WebKit */
.input-field::-webkit-scrollbar {
    display: none;
}

.input-field::placeholder {
    color: var(--text-tertiary);
}

/* Estilos base para todos los botones de icono */
.btn-icon {
    width: 36px;
    height: 36px;
    padding: 6px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    background: transparent;
    color: var(--text-secondary);
    cursor: pointer;
    flex-shrink: 0;
    transition: all var(--transition-fast);
}

.btn-icon:hover {
    background: var(--bg-tertiary);
    color: var(--text-primary);
}

.btn-icon svg {
    width: 20px;
    height: 20px;
}

/* Botones dentro de la cápsula (override) */
.input-wrapper .btn-icon {
    width: 36px;
    height: 36px;
    padding: 0;
    /* Solicitud: CERO padding */
    margin: 0;
    /* Solicitud: CERO margin */
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    background: transparent;
    color: var(--text-secondary);
    cursor: pointer;
    flex-shrink: 0;
    transition: all var(--transition-fast);
}

.input-wrapper .btn-icon:hover {
    background: var(--bg-tertiary);
    color: var(--text-primary);
}

/* Botón de enviar específico */
#send-btn {
    background: linear-gradient(135deg, #11998e 0%, #38ef7d 100%);
    color: white;
    box-shadow: 0 4px 15px rgba(56, 239, 125, 0.4);
}

#send-btn:hover {
    background: var(--lime-green);
    transform: scale(1.05);
}

/* Botón activo (micrófono) */
.input-wrapper .btn-icon.active {
    color: var(--error);
    background: rgba(255, 69, 58, 0.1);
    animation: pulse 1.5s infinite;
}

.btn-primary {
    background: linear-gradient(135deg, var(--primary), var(--primary-dark));
    color: var(--text-primary);
    /* Ajustado de white a text-primary */
    box-shadow: var(--shadow-md);
}

.btn-secondary {
    background: var(--bg-secondary);
    color: var(--text-primary);
}

.btn-danger {
    background: linear-gradient(135deg, var(--error), hsl(0, 70%, 45%));
    color: white;
    box-shadow: var(--shadow-md);
}

.btn-danger:hover {
    background: linear-gradient(135deg, hsl(0, 70%, 55%), var(--error));
    transform: scale(1.02);
}

.btn:disabled,
.btn-icon:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

/* Iconos */
.icon {
    width: 15px;
    height: 15px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

.icon svg {
    width: 100%;
    height: 100%;
}

/* Modal */
.modal-backdrop {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: hsla(240, 30%, 5%, 0.7);
    backdrop-filter: blur(10px);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: var(--z-modal-backdrop);
    padding: var(--spacing-lg);
    -webkit-overflow-scrolling: touch;
    overscroll-behavior: contain;
}

.modal {
    background: var(--bg-secondary);
    border-radius: var(--border-radius-xl);
    max-width: 600px;
    width: 100%;
    max-height: 90%;
    /* Use % instead of vh to avoid keyboard issues */
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    /* Smooth scrolling on iOS */
    box-shadow: var(--shadow-xl);
    z-index: var(--z-modal);
    /* Ensure content is above backdrop */
    position: relative;
    /* Establish stacking context */
    /* Sombra pronunciada para el modal */
}

.modal-header,
.modal-footer {
    padding: var(--spacing-lg);
    display: flex;
    align-items: center;
    justify-content: space-between;
    position: relative;
}

.modal-header::after,
.modal-footer::before {
    content: '';
    position: absolute;
    left: var(--spacing-lg);
    right: var(--spacing-lg);
    height: 1px;
    background: hsla(180, 15%, 70%, 0.1);
    /* Línea divisoria sutil */
}

.modal-header::after {
    bottom: 0;
}

.modal-footer::before {
    top: 0;
}

.modal-body {
    padding: var(--spacing-lg);
}

.modal-footer {
    justify-content: flex-end;
    gap: var(--spacing-md);
}

/* Form elements */
.form-group {
    margin-bottom: var(--spacing-lg);
}

.form-label {
    display: block;
    margin-bottom: var(--spacing-xs);
    font-weight: var(--font-weight-medium);
    color: var(--text-secondary);
    font-size: var(--font-size-sm);
}

.form-input {
    width: 100%;
    padding: var(--spacing-sm) var(--spacing-md);
    background: var(--bg-primary);
    /* Más oscuro que el fondo del modal */
    border-radius: var(--border-radius-md);
    color: var(--text-primary);
    font-family: var(--font-family-base);
    font-size: var(--font-size-base);
    outline: none;
    transition: box-shadow var(--transition-fast);
}

.form-input:focus {
    box-shadow: none;
    /* Eliminado el efecto de resplandor */
}

.form-hint {
    margin-top: var(--spacing-xs);
    font-size: var(--font-size-sm);
    color: var(--text-tertiary);
}

/* =========================================
   Welcome Splash (Mascota)
   ========================================= */
#welcome-splash {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    width: 100%;
    min-height: 100%;
    /* Ocupa todo el alto cuando está solo */
    gap: 20px;
    transition: all 0.5s cubic-bezier(0.4, 0, 0.2, 1);
    padding: 2rem;
    opacity: 1;
}

#welcome-splash img {
    width: 120px;
    height: 120px;
    filter: drop-shadow(0 0 20px rgba(0, 255, 136, 0.4));
    animation: float 3s ease-in-out infinite;
    transition: all 0.5s ease;
}

#welcome-splash h1 {
    font-family: var(--font-family-base);
    font-size: 2.5rem;
    font-weight: 700;
    margin: 0;
    background: linear-gradient(90deg, var(--cyan), var(--lime-green));
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
    text-shadow: 0 4px 20px rgba(0, 255, 136, 0.2);
    transition: all 0.5s ease;
}

/* Estado Minimizado (Header mode) */
#welcome-splash.minimized {
    min-height: auto;
    height: auto;
    padding: 15px 0;
    margin-bottom: 20px;
    flex-direction: row;
    justify-content: center;
    gap: 15px;
    border-bottom: 1px solid var(--border-color);
    background: linear-gradient(to bottom, var(--bg-primary), transparent);
}

#welcome-splash.minimized img {
    width: 40px;
    height: 40px;
    animation: none;
    /* Parar flotación para no distraer */
    filter: drop-shadow(0 2px 5px rgba(0, 255, 136, 0.3));
}

#welcome-splash.minimized h1 {
    font-size: 1.5rem;
    text-shadow: none;
}

/* Utilidades */
.hidden {
    display: none !important;
}

.sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border-width: 0;
}

/* =========================================
   Botones Generales y Modales (FALTANTES)
   ========================================= */
.btn {
    padding: 10px 20px;
    border-radius: 8px;
    border: none;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
    font-family: inherit;
    font-size: 0.95rem;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
}

/* Botón Primario (Acción principal) */
.btn-primary {
    background: var(--accent-primary);
    color: #000;
    font-weight: 600;
}

.btn-primary:hover {
    background: var(--accent-secondary);
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(0, 255, 136, 0.2);
}

/* Botón Secundario (Cancelar/Neutro) */
.btn-secondary {
    background: var(--bg-tertiary);
    color: var(--text-secondary);
    border: 1px solid transparent;
}

.btn-secondary:hover {
    background: var(--bg-secondary);
    color: var(--text-primary);
    border-color: var(--border-color);
}

/* Botón de Peligro (Borrar/Destructivo) */
.btn-danger {
    background: rgba(255, 69, 58, 0.15);
    /* Rojo transparente */
    color: #ff453a;
    border: 1px solid rgba(255, 69, 58, 0.2);
}

.btn-danger:hover {
    background: #ff453a;
    color: white;
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(255, 69, 58, 0.3);
}

.btn:active {
    transform: translateY(0);
}

/* --- Desktop Spacing Improvement: "Aire" a los lados --- */
/* Aplicar solo si es mayor a 1080px (pantallas de escritorio reales) */
@media (min-width: 1081px) {

    /* Centralizar contenido visualmente dejando márgenes laterales dinámicos */
    .app-header,
    .messages-container {
        /*
          Cálculo: (AnchoTotal - 1200px) / 2
          Usamos max() para asegurar un padding mínimo de 20px
        */
        padding-left: max(20px, calc((100% - 1200px) / 2)) !important;
        padding-right: max(20px, calc((100% - 1200px) / 2)) !important;
    }
}