/* ========================================
   Chatbot AI Pro - Frontend Styles v1.4.3
   Tema Profesional - Contraste Perfecto
   ======================================== */

/* Container Principal */
.claude-pro-chatbot {
    position: fixed;
    bottom: 20px;
    right: 20px;
    z-index: 999999;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    /* iOS: isolate stacking context so fixed children behave correctly */
    -webkit-transform: translateZ(0);
    transform: translateZ(0);
}

/* Botón de Chat Flotante */
.claude-pro-chat-button {
    width: 64px;
    height: 64px;
    border-radius: 50%;
    background: linear-gradient(135deg, #10b981 0%, #059669 100%);
    border: none;
    box-shadow: 0 8px 24px rgba(16, 185, 129, 0.5);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    position: relative;
    /* iOS WebKit: force own GPU compositing layer so position:fixed works
       even when a parent element has transform/filter/perspective applied */
    -webkit-transform: translateZ(0);
    transform: translateZ(0);
    -webkit-backface-visibility: hidden;
    backface-visibility: hidden;
}

.claude-pro-chat-button svg {
    width: 28px;
    height: 28px;
    color: white;
}

.claude-pro-chat-button:hover {
    transform: scale(1.1);
    box-shadow: 0 12px 32px rgba(16, 185, 129, 0.6);
}

.claude-pro-chat-button:active {
    transform: scale(0.95);
}

/* iOS: explicit touch target — prevents 300ms tap delay and improves reliability */
.claude-pro-chat-button {
    touch-action: manipulation;
    -webkit-tap-highlight-color: transparent;
    cursor: pointer;
}

/* Badge de Estado Online */
.claude-pro-chat-button::after {
    content: '';
    position: absolute;
    top: 2px;
    right: 2px;
    width: 14px;
    height: 14px;
    background: #10b981;
    border: 3px solid white;
    border-radius: 50%;
    animation: pulse-badge 2s ease-in-out infinite;
}

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

/* Ventana de Chat */
.claude-pro-chat-window {
    position: fixed;
    bottom: 100px;
    right: 20px;
    width: 420px;
    max-width: calc(100vw - 40px);
    height: 650px;
    max-height: calc(100vh - 140px);
    background: white;
    border-radius: 24px;
    box-shadow: 0 24px 64px rgba(0, 0, 0, 0.15), 0 0 0 1px rgba(0, 0, 0, 0.05);
    display: none;
    flex-direction: column;
    overflow: hidden;
    animation: slideUpChat 0.4s cubic-bezier(0.4, 0, 0.2, 1);
    z-index: 999998;
}

@keyframes slideUpChat {
    from {
        opacity: 0;
        transform: translateY(30px) scale(0.95);
    }
    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

.claude-pro-chat-window.active {
    display: flex;
}

/* Header del Chat */
.claude-pro-chat-header {
    background: linear-gradient(135deg, #10b981 0%, #059669 100%);
    color: white;
    padding: 24px 20px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
    position: relative;
}

.claude-pro-chat-header::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: url('data:image/svg+xml,<svg width="100" height="100" xmlns="http://www.w3.org/2000/svg"><defs><pattern id="grid" width="20" height="20" patternUnits="userSpaceOnUse"><path d="M 20 0 L 0 0 0 20" fill="none" stroke="rgba(255,255,255,0.08)" stroke-width="1"/></pattern></defs><rect width="100" height="100" fill="url(%23grid)"/></svg>');
    opacity: 0.4;
    pointer-events: none;
}

.claude-pro-chat-header-content {
    display: flex;
    align-items: center;
    gap: 12px;
    position: relative;
    z-index: 1;
}

.claude-pro-chat-avatar {
    width: 42px;
    height: 42px;
    background: white;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

.claude-pro-chat-avatar svg {
    width: 24px;
    height: 24px;
    color: #667eea;
}

.claude-pro-chat-header-text h3 {
    margin: 0;
    font-size: 17px;
    font-weight: 700;
    line-height: 1.2;
    color: #ffffff;
}

.claude-pro-chat-header-text p {
    margin: 2px 0 0 0;
    font-size: 13px;
    opacity: 0.95;
    line-height: 1.2;
    color: #ffffff;
}

.claude-pro-chat-close {
    background: rgba(255, 255, 255, 0.15);
    backdrop-filter: blur(10px);
    border: none;
    color: white;
    font-size: 24px;
    cursor: pointer;
    width: 36px;
    height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 10px;
    transition: all 0.2s ease;
    line-height: 1;
    position: relative;
    z-index: 1;
}

.claude-pro-chat-close:hover {
    background: rgba(255, 255, 255, 0.25);
    transform: rotate(90deg);
}

.claude-pro-chat-close:active {
    transform: rotate(90deg) scale(0.9);
}

/* Área de Mensajes */
.claude-pro-chat-messages {
    flex: 1;
    overflow-y: auto;
    padding: 24px 20px;
    background: #1a1d2e;
    display: flex;
    flex-direction: column;
    gap: 16px;
    scroll-behavior: smooth;
    /* iOS Safari: momentum/inertia scrolling inside the message container */
    -webkit-overflow-scrolling: touch;
}

.claude-pro-chat-messages::-webkit-scrollbar {
    width: 8px;
}

.claude-pro-chat-messages::-webkit-scrollbar-track {
    background: transparent;
    margin: 8px 0;
}

.claude-pro-chat-messages::-webkit-scrollbar-thumb {
    background: #cbd5e1;
    border-radius: 4px;
    border: 2px solid transparent;
    background-clip: content-box;
}

.claude-pro-chat-messages::-webkit-scrollbar-thumb:hover {
    background: #94a3b8;
    background-clip: content-box;
}

/* Mensaje Individual */
.claude-pro-message {
    display: flex;
    gap: 10px;
    align-items: flex-start;
    animation: fadeInMessage 0.4s cubic-bezier(0.4, 0, 0.2, 1);
}

@keyframes fadeInMessage {
    from { 
        opacity: 0; 
        transform: translateY(12px) scale(0.97);
    }
    to { 
        opacity: 1; 
        transform: translateY(0) scale(1);
    }
}

.claude-pro-message.user {
    flex-direction: row-reverse;
}

/* Avatar del Mensaje */
.claude-pro-message-avatar {
    width: 32px;
    height: 32px;
    border-radius: 10px;
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 14px;
}

.claude-pro-message.assistant .claude-pro-message-avatar {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
}

.claude-pro-message.user .claude-pro-message-avatar {
    background: linear-gradient(135deg, #10b981 0%, #059669 100%);
    color: white;
}

/* Contenido del Mensaje */
.claude-pro-message-content {
    max-width: 75%;
    padding: 14px 18px;
    border-radius: 16px;
    font-size: 15px;
    line-height: 1.6;
    word-wrap: break-word;
    position: relative;
}

.claude-pro-message.assistant .claude-pro-message-content {
    background: #f1f5f9;
    color: #1e293b;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
    border-bottom-left-radius: 6px;
    border: 1px solid rgba(0, 0, 0, 0.08);
}

.claude-pro-message.user .claude-pro-message-content {
    background: linear-gradient(135deg, #10b981 0%, #059669 100%);
    color: white;
    border-bottom-right-radius: 6px;
    box-shadow: 0 4px 12px rgba(16, 185, 129, 0.4);
    border: 1px solid rgba(255, 255, 255, 0.15);
}

/* Formato de Mensajes */
.claude-pro-message-content h3.message-heading {
    font-size: 17px;
    font-weight: 700;
    color: #1e293b;
    margin: 0 0 12px 0;
    padding-bottom: 8px;
    border-bottom: 2px solid #10b981;
    line-height: 1.3;
}

.claude-pro-message-content h4.message-subheading {
    font-size: 15px;
    font-weight: 700;
    color: #334155;
    margin: 12px 0 8px 0;
    padding-left: 10px;
    border-left: 3px solid #10b981;
    line-height: 1.3;
}

.claude-pro-message-content h3 + h4 {
    margin-top: 6px;
}

/* h2/h3/h4 generados por el parser markdown (## ### ####) */
.claude-pro-message-content h3:not(.message-heading),
.claude-pro-message-content h4:not(.message-subheading) {
    font-size: 14px;
    font-weight: 700;
    color: #1e293b;
    margin: 8px 0 3px 0;
    line-height: 1.3;
}

.claude-pro-message-content h3:not(.message-heading):first-child,
.claude-pro-message-content h4:not(.message-subheading):first-child {
    margin-top: 0;
}

.claude-pro-message-content strong {
    font-weight: 700;
    color: #0f172a;
}

.claude-pro-message.user .claude-pro-message-content strong {
    color: white;
    opacity: 1;
}

.claude-pro-message-content em {
    font-style: italic;
    color: #475569;
}

.claude-pro-message.user .claude-pro-message-content em {
    color: white;
    opacity: 0.95;
}

.claude-pro-message-content ul {
    margin: 4px 0;
    padding: 0;
    list-style: none;
    display: flex;
    flex-direction: column;
    gap: 3px;
}

.claude-pro-message-content h4 + ul,
.claude-pro-message-content h3 + ul,
.claude-pro-message-content p + ul {
    margin-top: 2px;
}

.claude-pro-message-content ul + p,
.claude-pro-message-content ul + h3,
.claude-pro-message-content ul + h4 {
    margin-top: 6px;
}

.claude-pro-message-content li {
    padding: 0 0 0 20px;
    margin: 0;
    position: relative;
    line-height: 1.5;
    color: #334155;
}

.claude-pro-message.user .claude-pro-message-content li {
    color: white;
}

.claude-pro-message-content li::before {
    content: '•';
    position: absolute;
    left: 6px;
    top: 0;
    color: #10b981;
    font-weight: 700;
    font-size: 14px;
    line-height: 1.5;
}

.claude-pro-message.user .claude-pro-message-content li::before {
    color: white;
    opacity: 0.9;
}

.claude-pro-message-content p {
    margin: 5px 0;
    line-height: 1.5;
    color: #334155;
}

.claude-pro-message.user .claude-pro-message-content p {
    color: white;
}

.claude-pro-message-content p:first-child {
    margin-top: 0;
}

.claude-pro-message-content p:last-child {
    margin-bottom: 0;
}

/* Estilos para enlaces en mensajes */
.claude-pro-message-content a.chat-link {
    color: #10b981;
    text-decoration: underline;
    font-weight: 600;
    transition: all 0.2s ease;
    word-break: break-all;
}

.claude-pro-message-content a.chat-link:hover {
    color: #059669;
    text-decoration: none;
}

.claude-pro-message.user .claude-pro-message-content a.chat-link {
    color: white;
    text-decoration: underline;
    opacity: 0.95;
}

.claude-pro-message.user .claude-pro-message-content a.chat-link:hover {
    opacity: 1;
    text-decoration: none;
}

.claude-pro-message-content br + br {
    display: none;
}

.claude-pro-message-content > *:first-child {
    margin-top: 0 !important;
}

.claude-pro-message-content > *:last-child {
    margin-bottom: 0 !important;
}

/* Links en mensajes del asistente */
.claude-pro-message.assistant .claude-pro-message-content a {
    color: #10b981;
    text-decoration: underline;
    font-weight: 600;
}

.claude-pro-message.assistant .claude-pro-message-content a:hover {
    color: #059669;
}

/* Asegurar que todo el texto en burbujas del asistente sea oscuro */
.claude-pro-message.assistant .claude-pro-message-content {
    color: #334155 !important;
}

/* Override para elementos específicos que pueden tener color blanco */
.claude-pro-message.assistant .claude-pro-message-content code,
.claude-pro-message.assistant .claude-pro-message-content pre {
    background: #e2e8f0;
    color: #1e293b;
    padding: 2px 6px;
    border-radius: 4px;
    font-family: monospace;
}

/* Indicador de Escritura */
.claude-pro-typing {
    display: flex;
    gap: 5px;
    padding: 14px 18px;
    background: #f1f5f9;
    border-radius: 16px;
    border-bottom-left-radius: 6px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
    width: fit-content;
    border: 1px solid rgba(0, 0, 0, 0.08);
}

.claude-pro-typing span {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: #10b981;
    animation: bounce-typing 1.4s infinite ease-in-out;
}

.claude-pro-typing span:nth-child(1) { animation-delay: -0.32s; }
.claude-pro-typing span:nth-child(2) { animation-delay: -0.16s; }

@keyframes bounce-typing {
    0%, 80%, 100% { 
        transform: scale(0.8); 
        opacity: 0.4; 
    }
    40% { 
        transform: scale(1.1); 
        opacity: 1; 
    }
}

/* Área de Input */
.claude-pro-chat-input-area {
    padding: 16px 20px 20px;
    /* THEME SYSTEM v2.0.2: Usar variables */
    background: var(--claude-input-container-bg, #232738);
    border-top: 1px solid var(--claude-input-container-border, rgba(255, 255, 255, 0.1));
    box-shadow: 0 -2px 8px rgba(0, 0, 0, 0.2);
}

.claude-pro-chat-input-wrapper {
    display: flex;
    gap: 10px;
    align-items: flex-end;
}

.claude-pro-chat-input {
    flex: 1;
    border: 2px solid rgba(16, 185, 129, 0.3);
    border-radius: 20px;
    padding: 11px 18px;
    font-size: 16px;
    font-family: inherit;
    outline: none;
    transition: border-color 0.2s ease, box-shadow 0.2s ease, background-color 0.3s ease, color 0.3s ease;
    resize: none;
    max-height: 120px;
    min-height: 46px;
    height: 46px;
    line-height: 1.5;
    /* THEME SYSTEM v2.0.2: Usar variables */
    background: var(--claude-input-bg, #2d3548);
    color: var(--claude-input-text, #ffffff) !important;
    font-weight: 400;
    box-sizing: border-box;
    overflow-y: auto;
    vertical-align: middle;
}

.claude-pro-chat-input:focus {
    border-color: var(--claude-input-border-focus, #10b981);
    box-shadow: 0 0 0 3px var(--claude-input-shadow-focus, rgba(16, 185, 129, 0.12));
    /* THEME SYSTEM v2.0.2: Focus background */
    background: var(--claude-input-bg, #353a52);
}

.claude-pro-chat-input::placeholder {
    color: var(--claude-input-placeholder, #94a3b8) !important;
    font-weight: 400;
    opacity: 1;
    line-height: 1.5;
}

.claude-pro-chat-input::-webkit-input-placeholder {
    color: var(--claude-input-placeholder, #94a3b8) !important;
    line-height: 1.5;
}

.claude-pro-chat-input::-moz-placeholder {
    color: var(--claude-input-placeholder, #94a3b8) !important;
    opacity: 1;
    line-height: 1.5;
}

.claude-pro-chat-input:-ms-input-placeholder {
    color: var(--claude-input-placeholder, #94a3b8) !important;
    line-height: 1.5;
}

.claude-pro-chat-send {
    width: 46px;
    height: 46px;
    border-radius: 50%;
    background: linear-gradient(135deg, #10b981 0%, #059669 100%);
    border: none;
    color: white;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
    flex-shrink: 0;
    box-shadow: 0 4px 12px rgba(16, 185, 129, 0.4);
}

.claude-pro-chat-send:hover {
    transform: scale(1.08);
    box-shadow: 0 6px 16px rgba(16, 185, 129, 0.5);
}

.claude-pro-chat-send:active {
    transform: scale(0.95);
}

.claude-pro-chat-send:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    transform: scale(1);
}

.claude-pro-chat-send svg {
    width: 20px;
    height: 20px;
    fill: white;
}

/* Título Recomendaciones */
.claude-pro-products-title {
    display: flex;
    align-items: center;
    gap: 7px;
    font-size: 12px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: #6b7280;
    margin: 16px 12px 6px 12px;
}

.claude-pro-products-title-icon {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 20px;
    height: 20px;
    border-radius: 50%;
    background: linear-gradient(135deg, #f59e0b, #d97706);
    flex-shrink: 0;
}

.claude-pro-products-title-icon svg {
    stroke: white;
}

/* Tarjetas de Producto */
.claude-pro-products {
    display: flex;
    flex-direction: column;
    gap: 12px;
    margin-top: 4px;
}

.claude-pro-product-card {
    /* THEME SYSTEM v2.0.3: Usar variables */
    background: var(--claude-product-bg, #2d3548);
    border: 1.5px solid var(--claude-product-border, rgba(255, 255, 255, 0.15));
    border-radius: 14px;
    padding: 14px;
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    gap: 12px;
    align-items: center;
    box-shadow: var(--claude-shadow-sm, 0 2px 8px rgba(0, 0, 0, 0.3));
}

.claude-pro-product-card:hover {
    border-color: #10b981;
    box-shadow: var(--claude-product-hover-shadow, 0 8px 20px rgba(16, 185, 129, 0.25));
    transform: translateY(-2px);
}

.claude-pro-product-card:active {
    transform: translateY(0);
}

.claude-pro-product-card img {
    width: 80px;
    height: 80px;
    object-fit: cover;
    border-radius: 10px;
    flex-shrink: 0;
    background: var(--claude-product-bg, #1a1d2e);
    border: 1px solid var(--claude-product-border, rgba(255, 255, 255, 0.1));
}

.claude-pro-product-info {
    flex: 1;
    min-width: 0;
}

.claude-pro-product-name {
    font-size: 14px;
    font-weight: 600;
    /* THEME SYSTEM v2.0.3: Usar variable */
    color: var(--claude-product-title, #ffffff);
    margin-bottom: 6px;
    overflow: hidden;
    text-overflow: ellipsis;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    line-height: 1.4;
}

.claude-pro-product-price {
    font-size: 17px;
    font-weight: 700;
    /* THEME SYSTEM v2.0.3: Usar variable */
    color: var(--claude-product-price, #34d399);
    margin-top: 4px;
}

.claude-pro-product-old-price {
    font-size: 13px;
    /* THEME SYSTEM v2.0.3: Usar variable */
    color: var(--claude-text-tertiary, #8b92a8);
    text-decoration: line-through;
    margin-right: 6px;
}

/* NEW v2.0.7: Stock Status Indicator */
.claude-pro-product-stock {
    font-size: 12px;
    font-weight: 600;
    margin-top: 6px;
    padding: 4px 8px;
    border-radius: 6px;
    display: inline-block;
}

.claude-pro-product-stock.out-of-stock {
    background: rgba(239, 68, 68, 0.15);
    color: #ef4444;
    border: 1px solid rgba(239, 68, 68, 0.3);
}

.claude-pro-theme-light .claude-pro-product-stock.out-of-stock {
    background: rgba(239, 68, 68, 0.1);
    color: #dc2626;
}

.claude-pro-product-stock.on-backorder {
    background: rgba(251, 191, 36, 0.15);
    color: #fbbf24;
    border: 1px solid rgba(251, 191, 36, 0.3);
}

.claude-pro-theme-light .claude-pro-product-stock.on-backorder {
    background: rgba(251, 191, 36, 0.1);
    color: #d97706;
}

.claude-pro-product-stock.low-stock {
    background: rgba(251, 146, 60, 0.15);
    color: #fb923c;
    border: 1px solid rgba(251, 146, 60, 0.3);
}

.claude-pro-theme-light .claude-pro-product-stock.low-stock {
    background: rgba(251, 146, 60, 0.1);
    color: #ea580c;
}

/* Out of stock card styling */
.claude-pro-product-card.out-of-stock {
    opacity: 0.7;
    cursor: not-allowed;
}

.claude-pro-product-card.out-of-stock:hover {
    border-color: var(--claude-product-border, rgba(255, 255, 255, 0.15));
    transform: none;
    box-shadow: var(--claude-shadow-sm, 0 2px 8px rgba(0, 0, 0, 0.3));
}

/* Mensaje de Bienvenida */
.claude-pro-welcome-message {
    text-align: center;
    padding: 40px 20px;
    opacity: 0.8;
}

.claude-pro-welcome-message svg {
    width: 64px;
    height: 64px;
    margin-bottom: 16px;
    opacity: 0.3;
}

.claude-pro-welcome-message p {
    font-size: 14px;
    color: #64748b;
    line-height: 1.6;
    margin: 0;
}

/* ========================================
   RESPONSIVE - OPTIMIZACIÓN MÓVIL
   ======================================== */

@media (max-width: 768px) {
    .claude-pro-chatbot {
        bottom: 0;
        right: 0;
        left: 0;
        top: 0;
        z-index: 999999;
        position: fixed;
        pointer-events: none;
    }
    
    .claude-pro-chat-button {
        width: 60px;
        height: 60px;
        box-shadow: 0 8px 24px rgba(102, 126, 234, 0.4);
        position: fixed;
        bottom: 20px;
        right: 20px;
        pointer-events: all;
    }
    
    .claude-pro-chat-button svg {
        width: 26px;
        height: 26px;
    }
    
    .claude-pro-chat-window {
        position: fixed;
        bottom: 0;
        right: 0;
        left: 0;
        top: 0;
        width: 100%;
        height: 100%;
        max-width: 100%;
        max-height: 100vh;
        border-radius: 0;
        z-index: 999998;
        margin: 0;
        pointer-events: all;
    }
    
    .claude-pro-chat-header {
        padding: 20px 16px;
        padding-top: max(20px, env(safe-area-inset-top));
        border-radius: 0;
        width: 100%;
        box-sizing: border-box;
    }
    
    .claude-pro-chat-avatar {
        width: 38px;
        height: 38px;
    }
    
    .claude-pro-chat-header-text h3 {
        font-size: 16px;
    }
    
    .claude-pro-chat-header-text p {
        font-size: 12px;
    }
    
    .claude-pro-chat-close {
        width: 34px;
        height: 34px;
        font-size: 22px;
    }
    
    .claude-pro-chat-messages {
        padding: 20px 16px;
        padding-bottom: max(20px, env(safe-area-inset-bottom));
        gap: 14px;
        width: 100%;
        box-sizing: border-box;
    }
    
    .claude-pro-message-avatar {
        width: 28px;
        height: 28px;
        font-size: 12px;
    }
    
    .claude-pro-message-content {
        max-width: 80%;
        font-size: 14px;
        padding: 12px 16px;
        border-radius: 14px;
    }
    
    .claude-pro-message-content h3.message-heading {
        font-size: 16px;
    }
    
    .claude-pro-message-content h4.message-subheading {
        font-size: 14px;
    }
    
    .claude-pro-chat-input-area {
        padding: 14px 16px;
        padding-bottom: max(16px, env(safe-area-inset-bottom));
        width: 100%;
        box-sizing: border-box;
    }
    
    .claude-pro-chat-input {
        font-size: 16px; /* Previene zoom en iOS */
        padding: 11px 16px;
        border-radius: 18px;
    }
    
    .claude-pro-chat-send {
        width: 44px;
        height: 44px;
    }
    
    .claude-pro-product-card {
        padding: 12px;
        border-radius: 12px;
    }
    
    .claude-pro-product-card img {
        width: 72px;
        height: 72px;
    }
    
    .claude-pro-product-name {
        font-size: 13px;
    }
    
    .claude-pro-product-price {
        font-size: 16px;
    }
}

/* Pantallas muy pequeñas */
@media (max-width: 360px) {
    .claude-pro-chat-button {
        width: 56px;
        height: 56px;
    }
    
    .claude-pro-message-content {
        max-width: 85%;
        font-size: 13px;
    }
    
    .claude-pro-chat-input {
        font-size: 15px;
    }
}

/* Landscape en móviles */
@media (max-width: 768px) and (orientation: landscape) {
    .claude-pro-chat-window {
        position: fixed;
        top: 0;
        left: 0;
        right: 0;
        bottom: 0;
        width: 100%;
        height: 100%;
        border-radius: 0;
        max-height: 100vh;
    }
    
    .claude-pro-chat-messages {
        padding: 16px;
    }
    
    .claude-pro-chat-header {
        padding: 16px;
    }
}

/* Dark mode support (enhanced v1.6.0) */
@media (prefers-color-scheme: dark) {
    .claude-pro-chat-window {
        background: #1f2937;
        box-shadow: 0 24px 64px rgba(0, 0, 0, 0.3), 0 0 0 1px rgba(255, 255, 255, 0.1);
    }
    
    .claude-pro-chat-header {
        background: linear-gradient(135deg, #059669 0%, #047857 100%);
    }
    
    .claude-pro-chat-messages {
        background: linear-gradient(to bottom, #111827 0%, #1f2937 100%);
    }
    
    .claude-pro-message.assistant .claude-pro-message-content {
        background: #374151;
        color: #f3f4f6;
    }
    
    .claude-pro-message.user .claude-pro-message-content {
        background: #10b981;
        color: white;
    }
    
    .claude-pro-chat-input-area {
        background: #1f2937;
        border-top-color: #374151;
    }
    
    .claude-pro-chat-input {
        background: #374151;
        border-color: #4b5563;
        color: #f3f4f6;
    }
    
    .claude-pro-chat-input::placeholder {
        color: #9ca3af;
    }
    
    .claude-pro-product-card {
        background: #374151;
        border-color: #4b5563;
    }
    
    .claude-pro-product-name {
        color: #f3f4f6;
    }
    
    .claude-pro-product-price {
        color: #10b981;
    }
    
    .claude-pro-typing span {
        background: #9ca3af;
    }
    
    /* Dark mode for message content */
    .claude-pro-message-content h3.message-heading {
        color: #f9fafb;
        border-bottom-color: #4b5563;
    }
    
    .claude-pro-message-content h4.message-subheading {
        color: #e5e7eb;
        border-left-color: #10b981;
    }
    
    .claude-pro-message-content strong {
        color: #f9fafb;
    }
    
    .claude-pro-message-content code {
        background: #111827;
        border-color: #4b5563;
        color: #10b981;
    }
}

/* Animación de carga */
@keyframes spin {
    to { transform: rotate(360deg); }
}

.claude-pro-loading {
    display: inline-block;
    width: 16px;
    height: 16px;
    border: 2px solid rgba(255, 255, 255, 0.3);
    border-top-color: white;
    border-radius: 50%;
    animation: spin 0.6s linear infinite;
}

/* ========================================
   Mejoras de Accesibilidad v1.5.0
   ======================================== */

/* Reducir movimiento para usuarios con preferencia */
@media (prefers-reduced-motion: reduce) {
    .claude-pro-chat-button,
    .claude-pro-chat-window,
    .claude-pro-message,
    .claude-pro-typing-indicator span,
    .claude-pro-loading {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
    
    @keyframes slideUpChat {
        from, to {
            opacity: 1;
            transform: none;
        }
    }
}

/* Focus visible para navegación por teclado */
.claude-pro-chat-button:focus-visible,
.claude-pro-chat-send:focus-visible,
.claude-pro-chat-close:focus-visible {
    outline: 3px solid #10b981;
    outline-offset: 2px;
}

.claude-pro-chat-input:focus-visible {
    outline: 2px solid #10b981;
    outline-offset: -2px;
}

/* Skip to content para lectores de pantalla */
.claude-pro-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;
}

/* Mejoras para alto contraste */
@media (prefers-contrast: high) {
    .claude-pro-chat-button {
        border: 2px solid #fff;
    }
    
    .claude-pro-message.assistant .claude-pro-message-content {
        border: 1px solid #d1d5db;
    }
    
    .claude-pro-chat-input {
        border: 2px solid #6b7280;
    }
}

/* ========================================
   Mejoras de Rendimiento v1.5.0
   ======================================== */

/* Optimización de will-change para animaciones */
/* NOTE: will-change removed from chat-button — causes position:fixed to break
   on iOS Safari/WebKit (all browsers on iPhone/iPad use WebKit engine) */
.claude-pro-chat-window {
    will-change: opacity, transform;
}

/* Lazy loading hint */
.claude-pro-message img {
    loading: lazy;
}

/* ========================================
   Print Styles
   ======================================== */

@media print {
    .claude-pro-chatbot,
    .claude-pro-chat-button,
    .claude-pro-chat-window {
        display: none !important;
    }
}

/* ── P-01: Streaming bubble ─────────────────────────────────── */
.claude-pro-message.streaming .claude-pro-message-content.streaming-content {
    /* Subtle cursor at end of streaming text */
    border-right: 2px solid currentColor;
    animation: claude-blink 0.7s step-end infinite;
    word-break: break-word;
    /* NOTE: white-space: pre-wrap intentionally removed.
       During streaming the text goes through renderMarkdown() which
       converts \n into <p>/<br>, so pre-wrap was making double-newlines
       render as a large visual gap before the next paragraph chunk arrived. */
}
@keyframes claude-blink {
    0%, 100% { border-color: currentColor; }
    50%       { border-color: transparent; }
}
/* Remove cursor once streaming is done */
.claude-pro-message-content:not(.streaming-content) {
    border-right: none;
    animation: none;
}

/* ════════════════════════════════════════════════════════
   F-11: Human handoff card (usa variables de tema)
   ════════════════════════════════════════════════════════ */

.claude-pro-handoff-card {
    background: var(--claude-handoff-bg, #f5f3ff);
    border: 1.5px solid var(--claude-handoff-border, #ddd6fe);
    border-radius: 14px;
    padding: 14px 16px;
    margin: 8px 0 4px;
    animation: cp-fadein .35s ease;
}

.claude-pro-handoff-msg {
    margin: 0 0 12px;
    font-size: 13.5px;
    color: var(--claude-handoff-text, #4c1d95);
    line-height: 1.5;
}

.claude-pro-handoff-btns {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.claude-pro-handoff-btn {
    display: inline-flex;
    align-items: center;
    gap: 7px;
    padding: 9px 16px;
    /* --ho-color permite override por canal (WhatsApp verde, email azul, etc.) */
    background: var(--ho-color, var(--claude-handoff-btn-bg, #7c3aed));
    color: #fff !important;
    border-radius: 9px;
    font-size: 13px;
    font-weight: 600;
    text-decoration: none !important;
    transition: opacity .15s, transform .1s, box-shadow .15s;
    box-shadow: 0 2px 6px var(--claude-handoff-btn-shadow, rgba(124, 58, 237, 0.3));
    cursor: pointer;
}

.claude-pro-handoff-btn:hover {
    opacity: .9;
    transform: translateY(-1px);
    box-shadow: 0 4px 12px var(--claude-handoff-btn-shadow, rgba(124, 58, 237, 0.3));
}

.claude-pro-handoff-btn:active {
    transform: translateY(0);
}

.claude-pro-handoff-btn svg {
    width: 16px;
    height: 16px;
    flex-shrink: 0;
}

/* Los overrides de tema oscuro son manejados por las variables en chatbot-themes.css */
