:root {
    /* Colores principales - Rojo característico */
    --primary-color: #F61C1C;
    --primary-dark: #D40E0E;
    --primary-light: #FEE;
    --primary-soft: #FF6B6B;
    --primary-gradient: linear-gradient(135deg, #F61C1C, #D40E0E);

    /* Colores de fondo */
    --bg-color: #FFFFFF;
    --sidebar-bg: #FAFAFA;
    --card-bg: #FFFFFF;

    /* Colores de texto */
    --text-color: #1A1A1A;
    --text-secondary: #666;
    --text-muted: #999;

    /* Colores de bordes */
    --border-color: #E5E5E5;
    --border-light: #F0F0F0;

    /* Colores de mensajes */
    --user-msg-bg: #F8F9FA;
    --assistant-msg-bg: #FFFFFF;

    /* Estados */
    --success-color: #10B981;
    --warning-color: #F59E0B;
    --error-color: #EF4444;
    --info-color: #3B82F6;

    /* Efectos */
    --shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
    --shadow-md: 0 4px 6px rgba(0, 0, 0, 0.05);
    --shadow-lg: 0 10px 15px rgba(0, 0, 0, 0.1);
    --radius: 12px;
    --radius-sm: 8px;

    /* Safe Areas para iPhone con notch y Dynamic Island */
    --safe-area-top: env(safe-area-inset-top);
    --safe-area-right: env(safe-area-inset-right);
    --safe-area-bottom: env(safe-area-inset-bottom);
    --safe-area-left: env(safe-area-inset-left);
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
}

body {
    background-color: var(--bg-color);
    color: var(--text-color);
    height: 100vh;
    overflow: hidden;
    /* Soporte para safe areas en iOS */
    padding-top: var(--safe-area-top);
    padding-right: var(--safe-area-right);
    padding-bottom: var(--safe-area-bottom);
    padding-left: var(--safe-area-left);
}

.app-container {
    height: 100vh;
    /* En mobile, ajustar altura considerando safe areas */
}

.hidden {
    display: none !important;
}

/* Modal Styles */
.modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
}

.modal-content {
    background: white;
    border-radius: var(--radius);
    padding: 1rem 1.25rem;
    width: 95%;
    max-width: 850px;
    max-height: 95vh;
    box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.1);
    position: relative;
    overflow-y: auto;
}

/* Modal más compacto SOLO cuando el login está activo */
.modal-content:has(#loginForm.active) {
    max-width: 480px;
    padding: 1.75rem 2rem;
}

/* Botón X para cerrar modal - SOLO el de la cabecera */
.modal-header .modal-close,
.modal-header .close-modal {
    position: absolute;
    top: 8px;
    right: 8px;
    background: white;
    border: 1px solid #ddd;
    font-size: 20px;
    color: #666;
    cursor: pointer;
    width: 28px;
    height: 28px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 4px;
    transition: all 0.2s;
    z-index: 10;
    line-height: 1;
}

.modal-header .modal-close:hover,
.modal-header .close-modal:hover {
    background: var(--primary-color);
    color: white;
    border-color: var(--primary-color);
}

.modal-header {
    text-align: center;
    margin-bottom: 1.25rem;
    padding-right: 0;
    padding-bottom: 0.75rem;
    border-bottom: 1px solid #f0f0f0;
}

.modal-header h2,
.modal-header h3 {
    color: var(--primary-color);
    margin-bottom: 0.35rem;
    font-size: 1.5rem;
    font-weight: 600;
}

.modal-header p {
    color: var(--text-secondary);
    font-size: 0.875rem;
    margin: 0;
}

/* Auth Forms */
.auth-forms {
    position: relative;
    min-height: 280px;
}

.auth-form {
    transition: opacity 0.3s ease;
}

.auth-form:not(.active) {
    display: none;
}

/* Login form más compacto */
#loginForm {
    max-width: 100%;
    margin: 0 auto;
}

#loginForm h3 {
    font-size: 1.35rem;
    margin-bottom: 1.25rem;
    text-align: center;
    color: var(--text-color);
}

#loginForm .form-group {
    margin-bottom: 1rem;
}

#loginForm .form-group label {
    font-size: 0.9rem;
    margin-bottom: 0.4rem;
}

#loginForm .form-group input {
    padding: 0.65rem 0.75rem;
    font-size: 0.95rem;
}

#loginForm .btn-primary {
    margin-top: 0.5rem;
    padding: 0.75rem;
    font-size: 0.95rem;
}

#loginForm .auth-switch {
    margin-top: 1rem;
    font-size: 0.875rem;
}

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

.form-group label {
    display: block;
    margin-bottom: 0.35rem;
    font-weight: 500;
    color: var(--text-color);
    font-size: 0.875rem;
}

.form-group input,
.form-group select,
.form-group textarea {
    width: 100%;
    padding: 0.5rem 0.65rem;
    border: 1px solid var(--border-color);
    border-radius: var(--radius);
    font-size: 0.875rem;
    transition: border-color 0.2s;
}

.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus {
    outline: none;
    border-color: var(--primary-soft);
    box-shadow: 0 0 0 3px rgba(255, 107, 107, 0.1);
}

.form-group textarea {
    min-height: 60px;
    resize: vertical;
}

/* Form row para 2 columnas */
.form-row {
    display: flex;
    gap: 1rem;
    margin-bottom: 0.75rem;
}

.form-row .form-group {
    flex: 1;
    margin-bottom: 0;
}

.btn-primary {
    width: 100%;
    padding: 0.65rem;
    background: var(--primary-color);
    color: white;
    border: none;
    border-radius: var(--radius);
    font-size: 0.875rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s;
}

.btn-primary:hover {
    background: var(--primary-dark);
}

.btn-secondary {
    width: 100%;
    padding: 0.65rem;
    background: white;
    color: #666;
    border: 1px solid #ddd;
    border-radius: var(--radius);
    font-size: 0.875rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s;
}

.btn-secondary:hover {
    background: #f5f5f5;
    border-color: #999;
    color: #333;
}

.form-actions {
    display: flex;
    gap: 0.75rem;
    margin-top: 1rem;
}

.form-actions .btn-primary,
.form-actions .btn-secondary {
    flex: 1;
}

.btn-primary:disabled {
    background: var(--text-secondary);
    cursor: not-allowed;
}

.auth-switch {
    text-align: center;
    margin-top: 1rem;
    color: var(--text-secondary);
}

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

.auth-switch a:hover {
    text-decoration: underline;
}

/* Main App Styles */
#mainApp {
    display: flex;
    height: 100vh;
}

/* Sidebar Styles */
.sidebar {
    width: 220px;
    background-color: var(--sidebar-bg);
    border-right: 1px solid var(--border-color);
    display: flex;
    flex-direction: column;
    padding: 10px;
    transition: transform 0.3s ease;
}

.sidebar-header {
    padding: 10px 0;
    border-bottom: 1px solid var(--border-color);
    margin-bottom: 10px;
}

.user-info {
    display: flex;
    align-items: center;
    gap: 8px;
}

.user-avatar {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: linear-gradient(135deg, #667eea, #764ba2);
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-weight: bold;
    font-size: 12px;
}

.user-details {
    flex: 1;
}

.user-details span {
    display: block;
    font-weight: 500;
    margin-bottom: 2px;
    font-size: 13px;
}

.logout-btn {
    background: none;
    border: none;
    color: var(--text-secondary);
    font-size: 12px;
    cursor: pointer;
    text-decoration: underline;
}

.logout-btn:hover {
    color: var(--error-color);
}

.new-chat-btn {
    background-color: var(--primary-color);
    color: white;
    border: none;
    border-radius: var(--radius);
    padding: 8px 12px;
    margin-bottom: 12px;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 6px;
    font-weight: 500;
    font-size: 13px;
    transition: background-color 0.2s;
}

.new-chat-btn:hover {
    background-color: var(--primary-dark);
}

.btn-icon {
    font-size: 18px;
}

.chat-history {
    flex: 1;
    overflow-y: auto;
    margin-bottom: 16px;
}

.history-item {
    padding: 8px;
    border-radius: var(--radius);
    margin-bottom: 6px;
    cursor: pointer;
    font-size: 12px;
    transition: background-color 0.2s;
    border: 1px solid transparent;
}

.history-item:hover {
    background-color: rgba(0, 0, 0, 0.05);
    border-color: var(--border-color);
}

.history-title {
    font-weight: 500;
    margin-bottom: 4px;
}

.history-date {
    font-size: 12px;
    color: var(--text-secondary);
}

.sidebar-footer {
    margin-top: auto;
    padding-top: 16px;
    border-top: 1px solid var(--border-color);
}

.disclaimer {
    font-size: 12px;
    color: var(--text-secondary);
    line-height: 1.4;
    text-align: center;
}

/* Main Content Styles */
.main-content {
    flex: 1;
    display: flex;
    flex-direction: column;
    position: relative;
}

.chat-container {
    flex: 1;
    overflow-y: auto;
    padding: 16px;
    display: flex;
    flex-direction: column;
    gap: 16px;
}

/* Welcome Screen Styles */
.welcome-screen {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    height: 100%;
    text-align: center;
    padding: 20px 16px;
}

.welcome-header {
    margin-bottom: 24px;
}

.avatar-large {
    width: 48px;
    height: 48px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--primary-color), var(--primary-dark));
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto 12px;
    font-size: 20px;
    font-weight: bold;
    color: white;
}

.welcome-title {
    font-size: 22px;
    margin-bottom: 8px;
    color: var(--text-color);
}

.welcome-subtitle {
    font-size: 14px;
    color: var(--text-secondary);
    max-width: 500px;
    line-height: 1.4;
}

.examples-section {
    margin-bottom: 24px;
    max-width: 900px;
}

.examples-section h3 {
    margin-bottom: 16px;
    color: var(--text-color);
    font-size: 16px;
}

.examples-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 12px;
    width: 100%;
}

.example-card {
    background-color: var(--sidebar-bg);
    border: 1px solid var(--border-color);
    border-radius: var(--radius);
    padding: 12px;
    cursor: pointer;
    transition: all 0.2s;
    text-align: left;
}

.example-card:hover {
    background-color: var(--primary-light);
    border-color: var(--primary-color);
    transform: translateY(-2px);
}

.example-icon {
    font-size: 18px;
    margin-bottom: 8px;
}

.example-card p {
    font-size: 12px;
    line-height: 1.4;
    color: var(--text-color);
}

.safety-notice {
    background-color: #fff3cd;
    border: 1px solid #ffeaa7;
    border-radius: var(--radius);
    padding: 10px;
    max-width: 700px;
    display: flex;
    align-items: flex-start;
    gap: 8px;
}

.notice-icon {
    font-size: 14px;
    flex-shrink: 0;
}

.safety-notice p {
    font-size: 11px;
    line-height: 1.4;
    color: #856404;
    text-align: left;
}

/* Input Area Styles - Limpio y profesional */
.input-container {
    padding: 12px;
    border-top: 1px solid #f0f0f0;
    display: flex;
    justify-content: center;
    background-color: var(--bg-color);
}

.input-wrapper {
    width: 100%;
    max-width: 800px;
    position: relative;
    background: white;
    border: 2px solid #e0e0e0;
    border-radius: 24px;
    transition: all 0.2s ease;
    z-index: 1;
}

/* Floating notification in input area */
.voice-error-notification {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background: rgba(239, 68, 68, 0.95);
    color: white;
    padding: 12px 20px;
    border-radius: 12px;
    font-size: 14px;
    font-weight: 500;
    box-shadow: 0 4px 12px rgba(239, 68, 68, 0.3);
    z-index: 100;
    pointer-events: none;
    white-space: nowrap;
    animation: fadeInOut 3s ease-in-out forwards;
}

@keyframes fadeInOut {
    0% {
        opacity: 0;
        transform: translate(-50%, -50%) scale(0.9);
    }
    10% {
        opacity: 1;
        transform: translate(-50%, -50%) scale(1);
    }
    85% {
        opacity: 1;
        transform: translate(-50%, -50%) scale(1);
    }
    100% {
        opacity: 0;
        transform: translate(-50%, -50%) scale(0.95);
    }
}

.input-wrapper:focus-within {
    border-color: var(--primary-soft);
}

.message-input {
    width: 100%;
    padding: 12px 96px 12px 18px;
    border: none;
    border-radius: 24px;
    resize: none;
    font-size: 14px;
    line-height: 1.5;
    max-height: 150px;
    outline: none !important;
    background-color: transparent;
    transition: all 0.2s;
    box-shadow: none !important;
}

.message-input:focus {
    outline: none !important;
    border: none !important;
    box-shadow: none !important;
}

.message-input.recording {
    opacity: 0;
    pointer-events: none;
}

.message-input::placeholder {
    color: #999;
}

.send-button {
    background: var(--primary-color);
    border: none;
    border-radius: 50%;
    cursor: pointer;
    color: white;
    width: 36px;
    height: 36px;
    min-width: 36px;
    min-height: 36px;
    max-width: 36px;
    max-height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: 0 2px 8px rgba(246, 28, 28, 0.25);
    opacity: 1;
    transform: scale(1);
    position: relative; /* Para el badge */
    flex-shrink: 0;
    padding: 0;
    aspect-ratio: 1 / 1;
}

.send-button.hidden {
    opacity: 0;
    transform: scale(0.8);
    pointer-events: none;
    width: 0;
    margin: 0;
    padding: 0;
}

.send-button:hover:not(:disabled) {
    background-color: var(--primary-dark);
    box-shadow: 0 4px 12px rgba(246, 28, 28, 0.35);
    transform: scale(1.05);
}

/* Trial Badge en botón de enviar */

.trial-badge {
    position: absolute;
    top: -4px;
    right: -4px;
    background: #fbbf24;
    color: white;
    font-size: 8px;
    font-weight: 700;
    min-width: 14px;
    height: 14px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.25);
    transition: all 0.2s ease;
}

.trial-badge.warning {
    background: #f59e0b;
    animation: pulse-badge 2s ease-in-out infinite;
}

.trial-badge.hidden {
    display: none;
}

@keyframes pulse-badge {
    0%, 100% {
        transform: scale(1);
    }
    50% {
        transform: scale(1.1);
    }
}

.send-button:active:not(:disabled) {
    transform: scale(0.95);
}

.send-button:disabled {
    background-color: #e0e0e0;
    cursor: not-allowed;
    opacity: 0.6;
    box-shadow: none;
}

.send-button svg {
    width: 18px;
    height: 18px;
}

/* Error and Loading States */
.error-message {
    background: #fed7d7;
    color: var(--error-color);
    padding: 12px;
    border-radius: var(--radius);
    margin: 10px 0;
    border: 1px solid #feb2b2;
}

.success-message {
    background: #c6f6d5;
    color: var(--success-color);
    padding: 12px;
    border-radius: var(--radius);
    margin: 10px 0;
    border: 1px solid #9ae6b4;
}

.loading {
    opacity: 0.6;
    pointer-events: none;
}

/* Chat message styles */
.message {
    display: flex;
    align-items: flex-start;
    gap: 12px;
    animation: fadeIn 0.3s ease;
}

.user-message .message-content {
    background-color: var(--user-msg-bg);
    border: 1px solid var(--border-color);
    align-self: flex-end;
}

.assistant-message .message-content {
    background-color: var(--assistant-msg-bg);
    border-left: 4px solid var(--primary-color);
    box-shadow: var(--shadow-md);
}

.message-content {
    padding: 14px 18px;
    border-radius: var(--radius);
    max-width: 80%;
    line-height: 1.6;
    font-size: 15px;
    white-space: pre-wrap;
}

.avatar {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: var(--primary-color);
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: bold;
}

/* Subtítulos y secciones */
.section-title {
    font-weight: 600;
    font-size: 16px;
    color: var(--primary-dark);
    margin-top: 12px;
    margin-bottom: 6px;
}

/* Listas dentro de respuestas */
.assistant-list {
    margin-top: 8px;
    margin-bottom: 8px;
    padding-left: 20px;
}

.assistant-list li {
    margin-bottom: 6px;
}

/* Animaciones */
@keyframes fadeIn {
    from { opacity: 0; transform: translateY(10px); }
    to { opacity: 1; transform: translateY(0); }
}

/* ========== RESPONSIVE DESIGN ========== */

/* Botón hamburguesa para móvil */
.hamburger-btn {
    display: none;
    position: fixed;
    top: calc(16px + var(--safe-area-top));
    left: calc(16px + var(--safe-area-left));
    z-index: 1001;
    background: var(--primary-color);
    border: none;
    border-radius: 8px;
    width: 44px;
    height: 44px;
    cursor: pointer;
    box-shadow: 0 4px 12px rgba(246, 28, 28, 0.3);
    transition: all 0.3s ease;
    -webkit-tap-highlight-color: transparent;
}

.hamburger-btn:active {
    transform: scale(0.95);
}

.hamburger-icon {
    display: flex;
    flex-direction: column;
    gap: 4px;
    align-items: center;
    justify-content: center;
}

.hamburger-icon span {
    display: block;
    width: 20px;
    height: 2px;
    background: white;
    border-radius: 2px;
    transition: all 0.3s ease;
}

.hamburger-btn.active .hamburger-icon span:nth-child(1) {
    transform: rotate(45deg) translateY(6px);
}

.hamburger-btn.active .hamburger-icon span:nth-child(2) {
    opacity: 0;
}

.hamburger-btn.active .hamburger-icon span:nth-child(3) {
    transform: rotate(-45deg) translateY(-6px);
}

/* Overlay para cerrar el menú en móvil */
.sidebar-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.5);
    z-index: 999;
}

/* Tablets y dispositivos medianos */
@media (max-width: 1024px) {
    .sidebar {
        width: 240px;
        padding: 10px;
    }

    .welcome-title {
        font-size: 24px;
    }

    .welcome-subtitle {
        font-size: 15px;
    }

    .examples-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 12px;
    }

    .example-card {
        padding: 16px;
    }
}

/* Tablet: 746px - 900px - Ajustes específicos */
@media (max-width: 900px) and (min-width: 746px) {
    .message-input {
        padding: 12px 110px 12px 18px;
    }

    .input-actions {
        gap: 4px;
    }

    .send-button {
        width: 36px;
        height: 36px;
    }

    .voice-button,
    .voice-cancel-button,
    .voice-confirm-button {
        width: 36px;
        height: 36px;
    }
}

/* Mobile: < 745px - Diseño profesional con safe areas */
@media (max-width: 745px) {
    body {
        overflow-x: hidden;
        /* Ajustar para safe areas */
        padding: 0;
        /* Asegurar altura completa en iOS */
        min-height: 100vh;
        min-height: -webkit-fill-available;
    }

    html {
        height: -webkit-fill-available;
    }

    /* Mostrar botón hamburguesa */
    .hamburger-btn {
        display: flex;
        align-items: center;
        justify-content: center;
    }

    /* Sidebar oculto por defecto en móvil con safe areas */
    .sidebar {
        position: fixed;
        top: 0;
        left: 0;
        height: 100vh;
        width: 280px;
        z-index: 1000;
        transform: translateX(-100%);
        box-shadow: 2px 0 10px rgba(0, 0, 0, 0.1);
        padding-top: calc(50px + var(--safe-area-top));
        padding-left: var(--safe-area-left);
        padding-bottom: var(--safe-area-bottom);
    }

    .sidebar.active {
        transform: translateX(0);
    }

    .sidebar-overlay.active {
        display: block;
    }

    /* Main content ocupa todo el ancho */
    #mainApp {
        flex-direction: column;
        height: 100vh;
        height: -webkit-fill-available;
        overflow: hidden;
    }

    .main-content {
        width: 100%;
        padding-top: calc(60px + env(safe-area-inset-top));
        /* Espacio para input fijo: 86px altura total */
        padding-bottom: 86px;
        height: 100%;
        display: flex;
        flex-direction: column;
        overflow: hidden;
    }

    /* Chat container - profesional con espacio para input fijo */
    .chat-container {
        padding: 12px;
        padding-left: max(12px, env(safe-area-inset-left));
        padding-right: max(12px, env(safe-area-inset-right));
        padding-bottom: 0;
        gap: 12px;
        overflow-y: auto;
        overflow-x: hidden;
        flex: 1;
        display: flex;
        flex-direction: column;
        -webkit-overflow-scrolling: touch;
        overscroll-behavior: contain;
    }

    /* Chat messages - legible y profesional */
    .message {
        gap: 10px;
        width: 100%;
    }

    .message-content {
        max-width: 85%;
        font-size: 15px;
        padding: 12px 16px;
        line-height: 1.5;
    }

    .assistant-message {
        width: 100%;
    }

    .assistant-message .message-content {
        width: auto;
        max-width: 85%;
    }

    .user-message .message-content {
        max-width: 80%;
    }

    .avatar {
        width: 32px;
        height: 32px;
        font-size: 13px;
        flex-shrink: 0;
    }

    /* Welcome screen - compacto para mostrar todo sin scroll */
    .welcome-screen {
        padding: 12px 10px;
        padding-left: max(10px, env(safe-area-inset-left));
        padding-right: max(10px, env(safe-area-inset-right));
        padding-bottom: 0;
        justify-content: flex-start;
        gap: 10px;
        overflow-y: auto;
        overflow-x: hidden;
        -webkit-overflow-scrolling: touch;
        overscroll-behavior: contain;
    }

    .welcome-header {
        margin-bottom: 8px;
    }

    .avatar-large {
        width: 48px;
        height: 48px;
        font-size: 20px;
        margin-bottom: 8px;
    }

    .welcome-title {
        font-size: 20px;
        margin-bottom: 6px;
    }

    .welcome-subtitle {
        font-size: 13px;
        padding: 0 8px;
        line-height: 1.3;
    }

    /* Feature grid - 3 columnas compactas pero legibles */
    .welcome-features {
        margin: 8px 0;
        width: 100%;
    }

    .feature-grid {
        display: flex;
        gap: 6px;
        justify-content: space-between;
    }

    .feature-card {
        flex: 1;
        padding: 8px 4px;
        border: 1px solid var(--border-color);
        text-align: center;
        display: flex;
        flex-direction: column;
        align-items: center;
        min-width: 0;
    }

    .feature-icon {
        font-size: 24px;
        margin-bottom: 4px;
    }

    .feature-card h4 {
        font-size: 10px;
        margin-bottom: 3px;
        font-weight: 600;
        line-height: 1.2;
    }

    .feature-card p {
        font-size: 8px;
        line-height: 1.2;
        color: var(--text-secondary);
        margin: 0;
    }

    /* Examples section - Grid 2x2 compacto pero legible */
    .examples-section {
        margin-bottom: 10px;
        max-width: 100%;
        width: 100%;
    }

    .examples-section h3 {
        font-size: 14px;
        margin-bottom: 8px;
    }

    .examples-grid {
        display: grid;
        grid-template-columns: repeat(2, 1fr);
        gap: 6px;
    }

    .example-card {
        padding: 8px;
        display: flex;
        flex-direction: column;
        align-items: center;
        text-align: center;
    }

    .example-icon {
        font-size: 20px;
        margin-bottom: 4px;
    }

    .example-card p {
        font-size: 10px;
        line-height: 1.3;
        margin: 0;
    }

    /* Safety notice - visible y compacto */
    .safety-notice {
        padding: 8px;
        max-width: 100%;
        gap: 6px;
    }

    .notice-icon {
        font-size: 14px;
    }

    .safety-notice p {
        font-size: 10px;
        line-height: 1.3;
    }

    /* Input area - SIEMPRE por encima de la barra de navegación */
    .input-container {
        position: fixed;
        bottom: env(safe-area-inset-bottom);
        left: 0;
        right: 0;
        padding: 12px;
        padding-left: max(12px, env(safe-area-inset-left));
        padding-right: max(12px, env(safe-area-inset-right));
        padding-bottom: 12px;
        background: white;
        border-top: 1px solid #f0f0f0;
        z-index: 9999;
        /* Importante para iOS */
        transform: translateZ(0);
        -webkit-transform: translateZ(0);
    }

    .input-wrapper {
        max-width: 100%;
        margin: 0 auto;
        position: relative;
        z-index: 10000;
    }

    .message-input {
        padding: 12px 100px 12px 14px;
        font-size: 16px !important;
        min-height: 44px;
        line-height: 1.5;
        -webkit-user-select: text;
        user-select: text;
        touch-action: manipulation;
        -webkit-tap-highlight-color: transparent;
        pointer-events: auto;
        outline: none !important;
        border: none !important;
        box-shadow: none !important;
    }

    .message-input:focus {
        outline: none !important;
        border: none !important;
        box-shadow: none !important;
    }

    /* Voice error notification - responsive para móvil */
    .voice-error-notification {
        font-size: 13px;
        padding: 10px 16px;
        max-width: 90%;
        white-space: normal;
        text-align: center;
    }

    .send-button {
        width: 36px;
        height: 36px;
        /* No posicionar absoluto, ya está en input-actions */
    }

    .send-button svg {
        width: 18px;
        height: 18px;
    }

    /* Modal - ajustado para safe areas */
    .modal-content {
        width: 90%;
        max-width: 480px;
        padding: 1.5rem;
        margin: var(--safe-area-top) var(--safe-area-right) var(--safe-area-bottom) var(--safe-area-left);
    }

    .modal-header h2 {
        font-size: 20px;
    }

    .form-group input,
    .form-group select {
        padding: 12px;
        font-size: 16px; /* 16px previene zoom en iOS */
        -webkit-appearance: none;
        border-radius: var(--radius);
    }

    .btn-primary,
    .btn-secondary {
        padding: 14px;
        font-size: 16px;
        min-height: 48px;
        -webkit-tap-highlight-color: transparent;
    }

    /* Mejorar scrollbars en mobile */
    .chat-container::-webkit-scrollbar,
    .welcome-screen::-webkit-scrollbar {
        width: 4px;
    }

    .chat-container::-webkit-scrollbar-thumb,
    .welcome-screen::-webkit-scrollbar-thumb {
        background: rgba(0, 0, 0, 0.2);
        border-radius: 4px;
    }
}

/* Mobile pequeño: < 480px */
@media (max-width: 480px) {
    .welcome-title {
        font-size: 20px;
    }

    .welcome-subtitle {
        font-size: 13px;
    }

    .avatar-large {
        width: 48px;
        height: 48px;
        font-size: 20px;
    }

    .feature-card {
        padding: 16px 12px;
    }

    .feature-icon {
        font-size: 32px;
    }

    .feature-card h4 {
        font-size: 15px;
    }

    .feature-card p {
        font-size: 12px;
    }

    .examples-section h3 {
        font-size: 16px;
    }

    .example-card {
        padding: 12px;
    }

    .example-card p {
        font-size: 12px;
    }

    .safety-notice {
        font-size: 11px;
        padding: 10px;
    }

    .modal-content {
        padding: 1.25rem;
    }

    .hamburger-btn {
        width: 40px;
        height: 40px;
    }
}
