/* ============================================
   SUMAQBOT — "Andean Dusk" Design System
   Chat Interface — Premium, Distinctive, Memorable
   ============================================ */

/* ============================================
   CSS Variables — Andean Dusk Palette
   ============================================ */
:root {
    /* Core Palette — Warm amber on deep slate */
    --amber-500: #F59E0B;
    --amber-400: #FBBF24;
    --amber-600: #D97706;
    --amber-700: #B45309;

    /* Surface hierarchy */
    --surface-0: #080E1A;
    --surface-1: #0C1222;
    --surface-2: #141C2E;
    --surface-3: #1B2540;
    --surface-4: #243052;

    /* Gradients */
    --gradient-amber: linear-gradient(135deg, #F59E0B 0%, #D97706 100%);
    --gradient-gold: linear-gradient(135deg, #FBBF24 0%, #F59E0B 100%);
    --gradient-surface: linear-gradient(160deg, #141C2E 0%, #0C1222 100%);
    --gradient-glass: linear-gradient(135deg, rgba(20, 28, 46, 0.65) 0%, rgba(12, 18, 34, 0.55) 100%);

    /* Glass */
    --glass-bg: rgba(20, 28, 46, 0.6);
    --glass-border: rgba(245, 158, 11, 0.08);
    --glass-blur: blur(16px);
    --glass-blur-heavy: blur(24px) saturate(180%);

    /* Text */
    --text-primary: #F1F5F9;
    --text-secondary: #94A3B8;
    --text-muted: #64748B;

    /* Semantic */
    --success: #34D399;
    --danger: #F87171;
    --warning: #FBBF24;
    --info: #60A5FA;

    /* Shadows & Glows */
    --shadow-sm: 0 2px 8px rgba(0, 0, 0, 0.25);
    --shadow-md: 0 4px 20px rgba(0, 0, 0, 0.35);
    --shadow-lg: 0 10px 40px rgba(0, 0, 0, 0.5);
    --shadow-premium: 0 8px 32px rgba(0, 0, 0, 0.4);
    --glow-amber: 0 0 20px rgba(245, 158, 11, 0.25);
    --glow-amber-strong: 0 4px 24px rgba(245, 158, 11, 0.35);

    /* Radii */
    --radius-xl: 20px;
    --radius-lg: 16px;
    --radius-md: 12px;
    --radius-sm: 8px;
    --radius-pill: 9999px;

    /* Layout & Fluid Sizing */
    --header-height: clamp(62px, 8vw, 75px);
    --chat-padding: clamp(12px, 4vw, 24px);
    --avatar-size: clamp(38px, 10vw, 50px);
    --btn-size: clamp(34px, 8vw, 40px);

    /* Motion */
    --ease-out: cubic-bezier(0.16, 1, 0.3, 1);
    --ease-out-quint: cubic-bezier(0.22, 1, 0.36, 1); /* Snappy (Entrances) */
    --ease-out-quart: cubic-bezier(0.25, 1, 0.5, 1); /* Smooth, refined (Transitions) */
    --transition-fast: 0.15s var(--ease-out-quart);
    --transition-normal: 0.25s var(--ease-out-quart);
    --transition-slow: 0.4s var(--ease-out-quart);

    /* Primary aliases */
    --primary-orange: #F59E0B;
    --primary-orange-light: #FBBF24;
    --primary-orange-dark: #D97706;
    --border-color: rgba(245, 158, 11, 0.08);
    --bg-dark: var(--surface-0);
    --bg-chat: var(--surface-1);
    --bg-message-bot: var(--glass-bg);
    --bg-message-user: var(--gradient-amber);
    --bg-input: rgba(20, 28, 46, 0.5);
    --bg-header: rgba(8, 14, 26, 0.85);
}

/* ============================================
   Light Theme
   ============================================ */
[data-theme="light"] {
    --surface-0: #F8F6F1;
    --surface-1: #FFFFFF;
    --surface-2: #F3F0E8;
    --surface-3: #E8E3D8;
    --surface-4: #DDD6C8;

    --glass-bg: rgba(255, 255, 255, 0.7);
    --glass-border: rgba(180, 83, 9, 0.1);

    --text-primary: #1C1917;
    --text-secondary: #57534E;
    --text-muted: #A8A29E;

    --shadow-sm: 0 2px 8px rgba(180, 83, 9, 0.06);
    --shadow-md: 0 4px 20px rgba(180, 83, 9, 0.08);
    --shadow-lg: 0 10px 40px rgba(180, 83, 9, 0.12);
    --shadow-premium: 0 8px 32px rgba(180, 83, 9, 0.1);
    --glow-amber: 0 0 20px rgba(245, 158, 11, 0.15);

    --border-color: rgba(180, 83, 9, 0.08);
    --bg-dark: var(--surface-0);
    --bg-chat: var(--surface-1);
    --bg-message-bot: rgba(243, 240, 232, 0.8);
    --bg-input: rgba(243, 240, 232, 0.6);
    --bg-header: rgba(255, 255, 255, 0.92);
}

/* ============================================
   Reset & Base
   ============================================ */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html {
    scroll-behavior: smooth;
    font-size: clamp(14px, 2vw + 10px, 16px);
}

body {
    font-family: 'Source Sans 3', 'DM Sans', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    background: var(--surface-0);
    color: var(--text-primary);
    min-height: 100vh;
    line-height: 1.6;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

/* ============================================
   App Container
   ============================================ */
.app-container {
    display: flex;
    flex-direction: column;
    height: 100vh;
    height: 100dvh;
    width: 100%;
    margin: 0 auto;
    background: var(--bg-chat);
    position: relative;
    overflow: hidden;
}

/* Ambient grain texture */
.app-container::before {
    content: '';
    position: absolute;
    inset: 0;
    background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 256 256' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)' opacity='0.03'/%3E%3C/svg%3E");
    pointer-events: none;
    z-index: 0;
    opacity: 0.5;
}

/* Subtle warm radial behind content */
.app-container::after {
    content: '';
    position: absolute;
    top: -30%;
    left: -20%;
    width: 140%;
    height: 140%;
    background: radial-gradient(ellipse at 30% 20%, rgba(245, 158, 11, 0.04) 0%, transparent 60%),
                radial-gradient(ellipse at 70% 80%, rgba(217, 119, 6, 0.03) 0%, transparent 50%);
    pointer-events: none;
    z-index: 0;
}

/* ============================================
   Header — Frosted Glass
   ============================================ */
.chat-header {
    height: var(--header-height);
    padding: 0 var(--chat-padding);
    background: var(--bg-header);
    backdrop-filter: var(--glass-blur-heavy);
    -webkit-backdrop-filter: var(--glass-blur-heavy);
    border-bottom: 1px solid var(--glass-border);
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-shrink: 0;
    z-index: 100;
    position: relative;
    box-shadow: 0 1px 0 var(--glass-border), var(--shadow-sm);
}

.header-content {
    display: flex;
    align-items: center;
    gap: 14px;
    flex: 1;
}

.bot-avatar {
    position: relative;
    width: var(--avatar-size);
    height: var(--avatar-size);
    min-width: var(--avatar-size);
    background: var(--gradient-amber);
    color: white;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: var(--glow-amber);
    transition: box-shadow var(--transition-normal);
}

.bot-avatar:hover {
    box-shadow: var(--glow-amber-strong);
}

.avatar-icon {
    font-size: 24px;
}

.status-dot {
    position: absolute;
    bottom: 2px;
    right: 2px;
    width: 10px;
    height: 10px;
    background: var(--success);
    border-radius: 50%;
    border: 2px solid var(--surface-1);
    box-shadow: 0 0 6px rgba(52, 211, 153, 0.4);
}

.status-dot.offline {
    background: var(--danger);
    box-shadow: 0 0 6px rgba(248, 113, 113, 0.4);
}

.header-info h1 {
    font-family: 'DM Sans', sans-serif;
    font-size: clamp(16px, 4vw, 21px);
    font-weight: 700;
    background: var(--gradient-gold);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.header-info p {
    font-size: 12px;
    color: var(--text-secondary);
    letter-spacing: 0.02em;
}

.header-actions {
    display: flex;
    gap: 8px;
}

.btn-icon {
    width: var(--btn-size);
    height: var(--btn-size);
    border: 1px solid var(--glass-border);
    background: var(--glass-bg);
    backdrop-filter: blur(8px);
    border-radius: var(--radius-md);
    color: var(--text-secondary);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all var(--transition-normal);
}

.btn-icon:hover {
    background: rgba(245, 158, 11, 0.12);
    border-color: rgba(245, 158, 11, 0.25);
    color: var(--amber-400);
    transform: translateY(-1px);
    box-shadow: var(--glow-amber);
}

.btn-icon:focus-visible,
#sendButton:focus-visible,
button:focus-visible {
    outline: none;
    box-shadow: 0 0 0 3px rgba(245, 158, 11, 0.4);
}

.btn-icon:active {
    transform: scale(0.95) translateY(0);
}

/* Theme Toggle */
[data-theme="light"] .theme-toggle .icon-moon { display: none; }
[data-theme="dark"] .theme-toggle .icon-sun,
:root:not([data-theme]) .theme-toggle .icon-sun { display: none; }

/* ============================================
   Chat Container
   ============================================ */
.chat-container {
    flex: 1;
    overflow-y: auto;
    padding: var(--chat-padding);
    display: flex;
    flex-direction: column;
    gap: clamp(12px, 3vw, 18px);
    position: relative;
    z-index: 1;
}

/* ============================================
   Premium Scrollbar — Andean Dusk
   ============================================ */
.chat-container::-webkit-scrollbar {
    width: 5px;
}

.chat-container::-webkit-scrollbar-track {
    background: transparent;
    border-radius: 4px;
}

.chat-container::-webkit-scrollbar-thumb {
    background: linear-gradient(180deg,
        rgba(245, 158, 11, 0.5) 0%,
        rgba(217, 119, 6, 0.3) 60%,
        rgba(245, 158, 11, 0.15) 100%);
    border-radius: 4px;
    transition: background 0.3s ease, box-shadow 0.3s ease;
    box-shadow: 0 0 6px rgba(245, 158, 11, 0.15) inset;
}

.chat-container::-webkit-scrollbar-thumb:hover {
    background: linear-gradient(180deg,
        rgba(251, 191, 36, 0.85) 0%,
        rgba(245, 158, 11, 0.65) 60%,
        rgba(217, 119, 6, 0.4) 100%);
    box-shadow: 0 0 8px rgba(245, 158, 11, 0.35);
}

/* Firefox */
.chat-container {
    scrollbar-width: thin;
    scrollbar-color: rgba(245, 158, 11, 0.35) transparent;
}

/* ============================================
   Messages
   ============================================ */
.message {
    display: flex;
    gap: clamp(8px, 2vw, 10px);
    max-width: 90%;
    /* Removido: animation: messageIn 0.35s var(--ease-out) both; (Se maneja por JS o subclase) */
}

@keyframes messageIn {
    from { opacity: 0; transform: translateY(12px) scale(0.98); } /* Ligerísima escala para mas organicidad */
    to   { opacity: 1; transform: translateY(0) scale(1); }
}

/* Bot messages */
.bot-message {
    align-self: flex-start;
}

.bot-message .message-avatar {
    width: calc(var(--avatar-size) - 10px);
    height: calc(var(--avatar-size) - 10px);
    min-width: calc(var(--avatar-size) - 10px);
    background: var(--gradient-amber);
    color: white;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 18px;
    flex-shrink: 0;
    box-shadow: 0 2px 8px rgba(245, 158, 11, 0.2);
}

.bot-message .message-bubble {
    background: var(--bg-message-bot);
    backdrop-filter: var(--glass-blur);
    border: 1px solid var(--glass-border);
    border-radius: var(--radius-xl);
    border-top-left-radius: 4px;
    padding: clamp(12px, 3vw, 16px) clamp(16px, 4vw, 22px);
    color: var(--text-primary);
    box-shadow: var(--shadow-sm);
    animation: slideInLeft 0.4s var(--ease-out) forwards; /* Aumentado a 0.4s con curva decisiva */
    transform-origin: top left;
}

@keyframes slideInLeft {
    from { opacity: 0; transform: translateX(-15px) scale(0.95); }
    to   { opacity: 1; transform: translateX(0) scale(1); }
}

/* User messages */
.user-message {
    align-self: flex-end;
    flex-direction: row-reverse;
}

.user-message .message-bubble {
    background: var(--gradient-amber);
    border-radius: var(--radius-xl);
    border-top-right-radius: 4px;
    padding: clamp(12px, 3vw, 16px) clamp(16px, 4vw, 22px);
    color: white;
    box-shadow: var(--glow-amber);
    animation: slideInRight 0.3s var(--ease-out) forwards;
    transform-origin: top right;
}

@keyframes slideInRight {
    from { opacity: 0; transform: translateX(15px) scale(0.95); }
    to   { opacity: 1; transform: translateX(0) scale(1); }
}

.message-content {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.message-bubble p {
    margin-bottom: 6px;
    word-wrap: break-word;
}

.message-bubble p:last-child {
    margin-bottom: 0;
}

.message-time {
    font-size: 10px;
    color: var(--text-muted);
    align-self: flex-end;
}

.user-message .message-time {
    align-self: flex-start;
}

/* Links in messages */
.chat-link {
    color: var(--amber-400);
    text-decoration: underline;
    text-underline-offset: 2px;
    word-break: break-all;
    transition: color var(--transition-fast);
}

.chat-link:hover {
    color: var(--amber-500);
}

.user-message .chat-link {
    color: rgba(255, 255, 255, 0.9);
}

.user-message .chat-link:hover {
    color: white;
}

/* Bullet Icons (replaced emojis) */
.emoji-bullet-container {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    margin-right: 8px;
    vertical-align: middle;
    color: var(--amber-400);
}

.emoji-bullet-svg {
    flex-shrink: 0;
}

.bot-message .message-bubble br + .emoji-bullet-container {
    margin-top: 4px;
}

/* ============================================
   Welcome Card — Entrance Choreography
   ============================================ */
.welcome-card {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-align: center;
    padding: 50px 30px;
    margin: auto;
    max-width: 500px;
    width: 100%;
}

.welcome-avatar {
    width: 80px;
    height: 80px;
    background: var(--gradient-amber);
    color: white;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 42px;
    margin-bottom: 20px;
    box-shadow: var(--glow-amber-strong);
    animation: avatarEntrance 0.4s var(--ease-out-quint) both;
}

@keyframes avatarEntrance {
    from {
        opacity: 0;
        transform: scale(0.85) translateY(15px);
    }
    to {
        opacity: 1;
        transform: scale(1) translateY(0);
    }
}

.welcome-greeting {
    font-family: 'DM Sans', sans-serif;
    font-size: 28px;
    font-weight: 700;
    margin-bottom: 12px;
    background: var(--gradient-gold);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    animation: fadeSlideUp 0.4s var(--ease-out-quint) 0.05s both;
}

@keyframes fadeSlideUp {
    from {
        opacity: 0;
        transform: translateY(12px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.welcome-intro {
    font-size: 15px;
    color: var(--text-secondary);
    line-height: 1.6;
    margin-bottom: 8px;
    animation: fadeSlideUp 0.4s var(--ease-out-quint) 0.1s both;
}

.welcome-intro strong {
    color: var(--text-primary);
}

.highlight-name {
    color: var(--amber-400);
    font-weight: 600;
}

.welcome-question {
    font-family: 'DM Sans', sans-serif;
    font-size: 16px;
    color: var(--text-primary);
    font-weight: 500;
    margin-bottom: 24px;
    margin-top: 8px;
    animation: fadeSlideUp 0.4s var(--ease-out-quint) 0.15s both;
}

.welcome-card .quick-replies {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    justify-content: center;
    margin-top: 0;
    animation: fadeSlideUp 0.4s var(--ease-out-quint) 0.2s both;
}

.quick-reply-btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: clamp(10px, 2.5vw, 12px) clamp(14px, 3.5vw, 20px);
    background: rgba(245, 158, 11, 0.06);
    border: 1px solid rgba(245, 158, 11, 0.18);
    border-radius: var(--radius-lg);
    color: var(--amber-400);
    font-size: clamp(13px, 3vw, 14px);
    font-weight: 500;
    cursor: pointer;
    transition: all 0.3s var(--ease-out);
    font-family: inherit;
    backdrop-filter: blur(8px);
    overflow: hidden;
    position: relative;
}

/* Emoji badge inside the button */
.quick-reply-btn .qr-emoji {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 16px;
    flex-shrink: 0;
    transition: transform 0.3s var(--ease-out);
}

.quick-reply-btn:hover {
    background: rgba(245, 158, 11, 0.12);
    border-color: rgba(245, 158, 11, 0.4);
    color: var(--amber-300, #FCD34D);
    transform: translateY(-2px) scale(1.03); /* Ligeramente más orgánico */
    box-shadow: var(--glow-amber-strong), 0 4px 16px rgba(245, 158, 11, 0.15);
}

.quick-reply-btn:hover .qr-emoji {
    transform: scale(1.2);
}

.quick-reply-btn:active {
    transform: translateY(0) scale(0.97);
}

/* Explore button */
.explore-btn {
    margin-top: 12px;
    background: rgba(96, 165, 250, 0.08);
    border-color: rgba(96, 165, 250, 0.25);
    color: var(--info);
}

.explore-btn:hover {
    background: linear-gradient(135deg, #60A5FA, #3B82F6);
    border-color: transparent;
    color: white;
    box-shadow: 0 4px 15px rgba(96, 165, 250, 0.3);
}

/* Quick Replies Wrapper */
.quick-replies-wrapper {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 16px;
    width: 100%;
}

.quick-replies-buttons {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    justify-content: center;
    width: 100%;
}

/* Refresh Button */
.refresh-btn {
    width: 36px;
    height: 36px;
    min-width: 36px;
    padding: 0;
    background: rgba(245, 158, 11, 0.08);
    border: 1px solid rgba(245, 158, 11, 0.2);
    border-radius: 50%;
    color: var(--amber-500);
    font-size: 16px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all var(--transition-normal);
    flex-shrink: 0;
}

.refresh-btn:hover {
    background: var(--gradient-amber);
    border-color: transparent;
    color: white;
    transform: rotate(180deg) scale(1.1);
    box-shadow: var(--glow-amber);
}

.refresh-btn:active {
    transform: rotate(180deg) scale(0.95);
}

.refresh-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.refresh-btn.rotating {
    animation: spin 0.8s linear infinite;
}

@keyframes spin {
    from { transform: rotate(0deg); }
    to   { transform: rotate(360deg); }
}

/* Quick Replies Loading */
.quick-replies-loading {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 12px 20px;
    color: var(--text-muted);
    font-size: 13px;
}

.quick-replies-loading .loading-dot {
    width: 6px;
    height: 6px;
    background: var(--amber-500);
    border-radius: 50%;
    animation: pulseGlow 1s ease-in-out infinite;
}

@keyframes pulseGlow {
    0%, 100% {
        opacity: 0.4;
        transform: scale(1);
        box-shadow: none;
    }
    50% {
        opacity: 1;
        transform: scale(1.3);
        box-shadow: 0 0 8px rgba(245, 158, 11, 0.4);
    }
}

/* ============================================
   Typing Indicator
   ============================================ */
.typing-bubble {
    padding: 16px 20px !important;
}

.typing-dots {
    display: flex;
    gap: 5px;
    align-items: center;
}

.typing-dots span {
    width: 8px;
    height: 8px;
    background: var(--amber-500);
    border-radius: 50%;
    opacity: 0.3;
}

.typing-dots span:nth-child(1) { animation: typingDot 1.4s infinite cubic-bezier(0.45, 0, 0.55, 1); }
.typing-dots span:nth-child(2) { animation: typingDot 1.4s infinite cubic-bezier(0.45, 0, 0.55, 1) 0.15s; }
.typing-dots span:nth-child(3) { animation: typingDot 1.4s infinite cubic-bezier(0.45, 0, 0.55, 1) 0.3s; }

@keyframes typingDot {
    0%, 80%, 100% { opacity: 0.3; transform: translateY(0) scale(1); }
    40%           { opacity: 1; transform: translateY(-4px) scale(1.1); box-shadow: var(--glow-amber); }
}

/* ============================================
   Input Area
   ============================================ */
.input-area {
    padding: clamp(12px, 3vw, 18px) var(--chat-padding);
    background: var(--bg-header);
    backdrop-filter: var(--glass-blur-heavy);
    -webkit-backdrop-filter: var(--glass-blur-heavy);
    border-top: 1px solid var(--glass-border);
    flex-shrink: 0;
    position: relative;
    z-index: 10;
}

.input-container {
    display: flex;
    gap: 12px;
    align-items: center;
}

#userInput {
    flex: 1;
    padding: clamp(12px, 3vw, 16px) clamp(16px, 4vw, 24px);
    font-size: clamp(13px, 3vw, 15px);
    background: var(--bg-input);
    border: 1px solid var(--border-color);
    border-radius: 28px;
    font-size: 14px;
    color: var(--text-primary);
    outline: none;
    transition: all var(--transition-normal);
    font-family: inherit;
    backdrop-filter: blur(8px);
}

#userInput::placeholder {
    color: var(--text-muted);
}

#userInput:focus {
    border-color: var(--amber-500);
    box-shadow: 0 0 0 3px rgba(245, 158, 11, 0.12), var(--glow-amber);
    background: rgba(20, 28, 46, 0.7);
}

#sendButton {
    width: clamp(42px, 10vw, 54px);
    height: clamp(42px, 10vw, 54px);
    min-width: clamp(42px, 10vw, 54px);
    background: var(--gradient-amber);
    border: none;
    border-radius: 50%;
    color: white;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all var(--transition-normal);
    box-shadow: var(--glow-amber);
}

#sendButton:hover {
    transform: scale(1.08);
    box-shadow: var(--glow-amber-strong);
}

#sendButton:active {
    transform: scale(0.93);
}

#sendButton:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    transform: scale(0.85); /* Se encoge un poco cuando está deshabilitado */
    box-shadow: none;
}

/* Animación para el botón de enviar (pop in) */
.send-btn-pop {
    animation: popIn 0.3s var(--ease-out-quint) forwards;
}

@keyframes popIn {
    0% { transform: scale(0.85); opacity: 0; }
    100% { transform: scale(1); opacity: 1; }
}


/* ============================================
   Responsive (Mobile-First)
   ============================================ */

/* Tablet Optimization */
@media (min-width: 768px) {
    .message { max-width: 80%; }
}

/* Floating App Style for Desktop */
@media (min-width: 850px) {
    body {
        display: flex;
        justify-content: center;
        align-items: center;
        padding: 24px;
        background: var(--surface-0);
        background-image:
            radial-gradient(ellipse at 20% 50%, rgba(245, 158, 11, 0.06) 0%, transparent 50%),
            radial-gradient(ellipse at 80% 20%, rgba(217, 119, 6, 0.04) 0%, transparent 50%);
    }

    [data-theme="light"] body {
        background-image:
            radial-gradient(ellipse at 20% 50%, rgba(245, 158, 11, 0.06) 0%, transparent 50%),
            radial-gradient(ellipse at 80% 80%, rgba(217, 119, 6, 0.04) 0%, transparent 50%);
    }

    .app-container {
        width: 100%;
        max-width: 800px;
        height: 90vh;
        max-height: 820px;
        border-radius: 24px;
        box-shadow: var(--shadow-lg);
        border: 1px solid var(--glass-border);
    }

    .app-container::before {
        border-radius: 24px;
    }
}

@media (min-width: 1024px) {
    .message { max-width: 75%; }
}

/* ============================================
   Feedback System
   ============================================ */
.message-footer {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-top: 8px;
}

.feedback-buttons {
    display: flex;
    gap: 6px;
}

.feedback-btn {
    width: 28px;
    height: 28px;
    border: 1px solid var(--glass-border);
    background: var(--bg-input);
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 14px;
    transition: all var(--transition-fast);
    opacity: 0.6;
}

.feedback-btn:hover {
    opacity: 1;
    transform: translateY(-4px) scale(1.05); /* Micro interacciones de Feedback */
}

.feedback-btn.feedback-positive:hover {
    background: rgba(52, 211, 153, 0.15);
    border-color: var(--success);
    box-shadow: 0 0 8px rgba(52, 211, 153, 0.2);
}

.feedback-btn.feedback-negative:hover {
    background: rgba(248, 113, 113, 0.15);
    border-color: var(--danger);
    box-shadow: 0 0 8px rgba(248, 113, 113, 0.2);
}

.feedback-btn.selected { opacity: 1; }

.feedback-btn.feedback-positive.selected {
    background: rgba(52, 211, 153, 0.2);
    border-color: var(--success);
}

.feedback-btn.feedback-negative.selected {
    background: rgba(248, 113, 113, 0.2);
    border-color: var(--danger);
}

.feedback-btn:disabled {
    cursor: default;
    opacity: 0.4;
}

.feedback-btn:disabled:hover {
    transform: none;
    box-shadow: none;
}

.feedback-thanks {
    font-size: 12px;
    color: var(--text-secondary);
}

/* Copy Button */
.copy-btn {
    width: 28px;
    height: 28px;
    border: 1px solid var(--glass-border);
    background: var(--bg-input);
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 14px;
    opacity: 0.6;
    transition: all var(--transition-fast);
    margin-left: 4px;
}

.copy-btn:hover {
    opacity: 1;
    background: rgba(245, 158, 11, 0.12);
    border-color: rgba(245, 158, 11, 0.25);
    transform: translateY(-2px) scale(1.05);
}

.copy-btn.copied {
    opacity: 1;
    background: rgba(52, 211, 153, 0.15);
    border-color: rgba(52, 211, 153, 0.3);
    animation: bounceGlow 0.3s var(--ease-out-quint) both;
}

@keyframes bounceGlow {
    0% { transform: scale(1); }
    50% { transform: scale(1.1); box-shadow: 0 0 12px rgba(52, 211, 153, 0.4); }
    100% { transform: scale(1); }
}

/* ============================================
   Calendar Modal
   ============================================ */
.calendar-modal {
    position: fixed;
    inset: 0;
    background: rgba(8, 14, 26, 0.85);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    z-index: 1000;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s cubic-bezier(0.22, 1, 0.36, 1);
}

.calendar-modal.active {
    opacity: 1;
    pointer-events: auto;
}

.calendar-modal-content {
    background: var(--surface-1);
    border: 1px solid var(--glass-border);
    border-radius: 24px;
    width: 100%;
    max-width: 600px;
    max-height: 80vh;
    display: flex;
    flex-direction: column;
    box-shadow: var(--shadow-premium), 0 0 60px rgba(245, 158, 11, 0.05);
    overflow: hidden;
    transform: scale(0.85) translateY(10px);
    transition: transform 0.3s var(--ease-out-quint);
}

.calendar-modal.active .calendar-modal-content {
    transform: scale(1) translateY(0);
}

.calendar-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 18px 22px;
    background: var(--gradient-amber);
    color: white;
}

.calendar-header h2 {
    font-family: 'DM Sans', sans-serif;
    font-size: 18px;
    font-weight: 700;
    margin: 0;
}

.calendar-close {
    background: rgba(255, 255, 255, 0.15);
    border: none;
    color: white;
    width: 32px;
    height: 32px;
    border-radius: 50%;
    font-size: 20px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background var(--transition-fast);
}

.calendar-close:hover {
    background: rgba(255, 255, 255, 0.25);
}

.calendar-body {
    padding: 18px;
    overflow-y: auto;
    max-height: calc(80vh - 75px);
}

.loading-calendar,
.calendar-empty {
    text-align: center;
    padding: 50px 20px;
    color: var(--text-secondary);
}

.calendar-empty .empty-icon {
    font-size: 48px;
    margin-bottom: 14px;
}

.calendar-events-list {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.calendar-event-item {
    display: flex;
    gap: 14px;
    padding: 14px;
    background: var(--glass-bg);
    border: 1px solid var(--glass-border);
    border-radius: var(--radius-md);
    transition: all var(--transition-normal);
}

.calendar-event-item:hover {
    transform: translateX(4px);
    border-color: rgba(245, 158, 11, 0.15);
    box-shadow: var(--shadow-sm);
}

.event-date {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    min-width: 50px;
    padding: 10px;
    background: var(--gradient-amber);
    border-radius: 10px;
    color: white;
}

.event-day {
    font-family: 'DM Sans', sans-serif;
    font-size: 22px;
    font-weight: 700;
    line-height: 1;
}

.event-month {
    font-size: 11px;
    text-transform: uppercase;
    margin-top: 2px;
}

.event-info {
    flex: 1;
    display: flex;
    flex-direction: column;
    justify-content: center;
}

.event-title {
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 4px;
}

.event-type-badge {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    font-size: 10px;
    padding: 3px 8px;
    border-radius: 10px;
    background: rgba(245, 158, 11, 0.1);
    color: var(--amber-500);
}

.event-description {
    font-size: 12px;
    color: var(--text-secondary);
    margin-top: 6px;
}

@media (max-width: 480px) {
    .calendar-modal { padding: 10px; }
    .calendar-modal-content { max-height: 90vh; }
    .calendar-header h2 { font-size: 16px; }
    .calendar-event-item { padding: 12px; gap: 10px; }
    .event-date { min-width: 45px; }
    .event-day { font-size: 18px; }
}

/* Suggestion chips */
.suggestion-chip {
    padding: 10px 18px;
    border-radius: var(--radius-pill);
    border: 1px solid var(--glass-border);
    background: var(--gradient-glass);
    color: var(--amber-400);
    cursor: pointer;
    font-size: 0.9rem;
    transition: all 0.3s var(--ease-out);
    backdrop-filter: blur(8px);
    box-shadow: var(--shadow-sm);
}

.suggestion-chip:hover {
    background: var(--gradient-amber);
    color: white;
    transform: translateY(-2px) scale(1.05); /* Escala más orgánica */
    box-shadow: var(--glow-amber-strong); /* Glow más fuerte */
    border-color: transparent;
}

/* ============================================
   Input Error (Nielsen #5)
   ============================================ */
#userInput.input-error {
    border-color: var(--danger) !important;
    box-shadow: 0 0 0 3px rgba(248, 113, 113, 0.15) !important;
    animation: shake 0.4s ease-in-out;
}

@keyframes shake {
    0%, 100% { transform: translateX(0); }
    20%, 60% { transform: translateX(-6px); }
    40%, 80% { transform: translateX(6px); }
}

/* ============================================
   Error Messages (Nielsen #9)
   ============================================ */
.error-message .message-content { gap: 10px; }

.error-bubble {
    background: rgba(248, 113, 113, 0.08) !important;
    border: 1px solid rgba(248, 113, 113, 0.2) !important;
    color: var(--text-primary) !important;
}

.retry-btn {
    padding: 8px 16px;
    background: rgba(248, 113, 113, 0.08);
    border: 1px solid rgba(248, 113, 113, 0.2);
    border-radius: 18px;
    color: var(--danger);
    font-size: 13px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
    font-family: inherit;
    align-self: flex-start;
}

.retry-btn:hover {
    background: var(--danger);
    border-color: transparent;
    color: white;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(248, 113, 113, 0.3);
}

.retry-btn:active {
    transform: scale(0.95);
}

/* ============================================
   Capabilities Hint (Nielsen #10)
   ============================================ */
.capabilities-hint {
    margin: 16px 0 20px;
    padding: 16px 20px;
    background: rgba(245, 158, 11, 0.04);
    border: 1px solid rgba(245, 158, 11, 0.1);
    border-radius: var(--radius-lg);
    text-align: center;
}

.capabilities-title {
    font-family: 'DM Sans', sans-serif;
    font-size: 12px;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 10px;
}

.capabilities-list {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    justify-content: center;
}

.capability-tag {
    padding: 6px 12px;
    background: rgba(245, 158, 11, 0.06);
    border-radius: var(--radius-md);
    font-size: 12px;
    color: var(--amber-400);
    font-weight: 500;
}

[data-theme="light"] .capabilities-hint {
    background: rgba(180, 83, 9, 0.03);
    border-color: rgba(180, 83, 9, 0.08);
}

[data-theme="light"] .capability-tag {
    background: rgba(245, 158, 11, 0.08);
    color: var(--amber-700);
}

[data-theme="light"] .error-bubble {
    background: rgba(248, 113, 113, 0.06) !important;
}

/* ============================================
   Contact / Human Help
   ============================================ */
.contact-help-wrapper {
    max-width: 85%;
}

.contact-help-btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 8px 16px;
    background: var(--gradient-glass);
    border: 1px solid var(--glass-border);
    border-radius: var(--radius-pill);
    color: var(--amber-400);
    font-size: 13px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.3s ease;
    font-family: inherit;
    backdrop-filter: blur(8px);
}

.contact-help-btn:hover {
    background: rgba(245, 158, 11, 0.12);
    border-color: rgba(245, 158, 11, 0.25);
    transform: translateY(-1px);
    box-shadow: var(--glow-amber);
}

.contact-help-btn.active {
    background: rgba(245, 158, 11, 0.1);
    border-color: rgba(245, 158, 11, 0.2);
}

.contact-card {
    margin-top: 8px;
    padding: 14px 18px;
    background: var(--glass-bg);
    border: 1px solid var(--glass-border);
    border-radius: var(--radius-lg);
    animation: contactSlide 0.3s var(--ease-out);
}

.contact-card p {
    margin: 0;
    padding: 4px 0;
    font-size: 13px;
    color: var(--text-primary);
    line-height: 1.5;
}

.contact-card .contact-msg {
    font-weight: 600;
    margin-bottom: 6px;
    color: var(--amber-400);
}

.contact-card strong {
    color: var(--text-primary);
}

@keyframes contactSlide {
    from { opacity: 0; transform: translateY(-8px); }
    to   { opacity: 1; transform: translateY(0); }
}

[data-theme="light"] .contact-help-btn {
    background: rgba(245, 158, 11, 0.05);
    border-color: rgba(180, 83, 9, 0.15);
    color: var(--amber-700);
}

[data-theme="light"] .contact-help-btn:hover {
    background: rgba(245, 158, 11, 0.1);
}

[data-theme="light"] .contact-card {
    background: rgba(245, 158, 11, 0.04);
    border-color: rgba(180, 83, 9, 0.1);
}

[data-theme="light"] .contact-card .contact-msg {
    color: var(--amber-700);
}

/* ============================================
   Topics Panel (Inline)
   ============================================ */
.view-all-topics-btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    margin-top: 10px;
    padding: 7px 14px;
    background: transparent;
    border: 1px solid rgba(245, 158, 11, 0.25);
    border-radius: var(--radius-pill);
    color: var(--amber-400);
    font-size: 12px;
    font-weight: 500;
    font-family: inherit;
    cursor: pointer;
    transition: all var(--transition-fast);
}

.view-all-topics-btn:hover {
    background: rgba(245, 158, 11, 0.08);
    border-color: var(--amber-500);
    color: var(--amber-500);
}

.view-all-topics-btn:active {
    transform: scale(0.97);
}

.topics-inline-panel {
    margin-top: 8px;
    max-height: 130px;
    overflow-y: auto;
    border: 1px solid var(--glass-border);
    border-radius: var(--radius-md);
    background: rgba(20, 28, 46, 0.55);
    backdrop-filter: blur(8px);
    padding: 4px 0;
    scroll-behavior: smooth;
}

.topics-inline-panel::-webkit-scrollbar { width: 5px; }
.topics-inline-panel::-webkit-scrollbar-track { background: transparent; border-radius: 4px; }
.topics-inline-panel::-webkit-scrollbar-thumb {
    background: linear-gradient(180deg,
        rgba(245, 158, 11, 0.5) 0%,
        rgba(217, 119, 6, 0.25) 100%);
    border-radius: 4px;
    box-shadow: 0 0 6px rgba(245, 158, 11, 0.1) inset;
}
.topics-inline-panel::-webkit-scrollbar-thumb:hover {
    background: linear-gradient(180deg,
        rgba(251, 191, 36, 0.8) 0%,
        rgba(245, 158, 11, 0.55) 100%);
}
.topics-inline-panel {
    scrollbar-width: thin;
    scrollbar-color: rgba(245, 158, 11, 0.35) transparent;
}

.topic-inline-item {
    display: flex;
    align-items: center;
    gap: 8px;
    width: 100%;
    padding: 8px 14px;
    background: transparent;
    border: none;
    border-bottom: 1px solid rgba(255, 255, 255, 0.04);
    color: var(--text-primary);
    font-size: 13px;
    font-family: inherit;
    text-align: left;
    cursor: pointer;
    transition: background var(--transition-fast), color var(--transition-fast),
                transform 0.15s ease;
    overflow: hidden;
}

/* Emoji badge dentro del topic item */
.topic-inline-item .tip-emoji {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 15px;
    transition: transform 0.2s ease;
    flex-shrink: 0;
}

.topic-inline-item:last-child {
    border-bottom: none;
}

.topic-inline-item:hover {
    background: rgba(245, 158, 11, 0.08);
    color: var(--amber-400);
    transform: translateX(2px);
}

.topic-inline-item:hover .tip-emoji {
    transform: scale(1.15);
}

.topic-inline-item:active {
    background: rgba(245, 158, 11, 0.15);
    transform: translateX(0);
}

.topics-loading {
    padding: 12px 14px;
    color: var(--text-muted);
    font-size: 12px;
    text-align: center;
}

[data-theme="light"] .view-all-topics-btn {
    border-color: rgba(180, 83, 9, 0.2);
    color: var(--amber-700);
}

[data-theme="light"] .view-all-topics-btn:hover {
    background: rgba(245, 158, 11, 0.06);
    border-color: var(--amber-700);
    color: var(--amber-700);
}

[data-theme="light"] .topics-inline-panel {
    background: rgba(255, 255, 255, 0.85);
    border-color: rgba(180, 83, 9, 0.08);
}

[data-theme="light"] .topic-inline-item {
    border-bottom-color: rgba(26, 25, 23, 0.06);
    color: var(--text-primary);
}

[data-theme="light"] .topic-inline-item:hover {
    background: rgba(245, 158, 11, 0.06);
    color: var(--amber-700);
}

/* ============================================
   Reduced Motion & Theme Switching
   ============================================ */
.theme-switching * {
    transition: none !important;
}

@media (prefers-reduced-motion: reduce) {
    * {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
}

/* ============================================
   Safe Areas (iOS)
   ============================================ */
@supports (padding: max(0px)) {
    .chat-header {
        padding-top: max(0px, env(safe-area-inset-top));
    }
    .input-area {
        padding-bottom: max(14px, env(safe-area-inset-bottom));
    }
}