* { 
    box-sizing: border-box; 
    margin: 0; 
    padding: 0; 
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif; 
}

body, html { 
    background-color: #f0f4f8; 
    height: 100%; 
    width: 100%; 
    overflow: hidden;
    display: flex;
    justify-content: center;
}

.chat-container { 
    width: 100%; 
    max-width: 100%; 
    background: #efeae2 !important; /* Fondo clásico de WhatsApp */
    display: flex; 
    flex-direction: column; 
    height: 100%; 
    position: relative; 
}

/* BARRA DE ESTADO REALISTA */
.phone-status-bar {
    background-color: #ffffff;
    height: 24px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0 16px;
    font-size: 12px;
    font-weight: 500;
    color: #1c2d3d;
    flex-shrink: 0;
    user-select: none;
}
.phone-status-icons {
    display: flex;
    gap: 6px;
    align-items: center;
}

/* CABECERA ESTILO WHATSAPP */
.chat-header { 
    background-color: #008069 !important; /* Verde oscuro oficial de WhatsApp */
    color: #ffffff !important; 
    padding: 0 12px; 
    display: flex; 
    align-items: center; 
    justify-content: space-between;
    box-shadow: 0 1px 3px rgba(0,0,0,0.05); 
    z-index: 10; 
    height: 60px;
    flex-shrink: 0;
}

.header-left {
    display: flex;
    align-items: center;
    gap: 4px;
    cursor: pointer;
}

.back-icon {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 4px;
    color: #ffffff !important;
}

.back-icon svg { width: 24px; height: 24px; fill: #ffffff !important; }

.avatar { 
    width: 40px; height: 40px; background-color: #90e0ef; border-radius: 50%; 
    display: flex; align-items: center; justify-content: center; 
    font-size: 20px; color: white; overflow: hidden; margin-right: 4px;
}
.avatar img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.profile-info { display: flex; flex-direction: column; }
.profile-name { font-size: 16px; font-weight: 500; color: #ffffff !important; }
.status { font-size: 12px; color: #e2fef2 !important; margin-top: 1px; transition: color 0.3s ease; font-weight: 500; }

/* BOTÓN DE IA EN LA CABECERA - CORREGIDO */
.ai-guide-btn {
    background: linear-gradient(135deg, #00b4d8, #0077b6);
    color: white;
    border: none;
    padding: 6px 10px;
    border-radius: 6px;
    font-size: 11px;
    font-weight: bold;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 4px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.15);
    transition: transform 0.2s ease;
    margin-left: auto;
    margin-right: 15px;
    white-space: nowrap;
    flex-shrink: 0;
}
.ai-guide-btn:active {
    transform: scale(0.95);
}

/* CABECERA DERECHA - CORREGIDA PARA ALINEACIÓN */
.header-right { 
    display: flex; 
    align-items: center; 
    justify-content: flex-end;
    gap: 15px; 
    position: relative; 
    padding-right: 4px;
    min-width: 90px;
}
.header-right svg, .icon-btn svg { 
    fill: #ffffff !important; 
    width: 24px; 
    height: 24px; 
    cursor: pointer; 
    flex-shrink: 0; 
}

.icon-btn { background: none; border: none; display: flex; align-items: center; justify-content: center; padding: 0; cursor: pointer; }

.dropdown-menu {
    display: none; position: absolute; top: 50px; right: 2px; background-color: white;
    box-shadow: 0 2px 8px rgba(0,0,0,0.15); border-radius: 4px; width: 190px; z-index: 100; padding: 6px 0;
}

.option-item {
    display: block; padding: 11px 16px; color: #1c2d3d; font-size: 15px; cursor: pointer; user-select: none; text-align: left;
}
.option-item:hover { background-color: #f5f5f5; }

/* ÁREA DE MENSAJES */
.messages-area { 
    flex: 1; overflow-y: auto; padding: 14px 16px; display: flex; flex-direction: column; gap: 6px; 
    background-color: #efeae2 !important; /* Fondo de chat WhatsApp */
}

.msg-row { display: flex; align-items: flex-end; gap: 6px; width: 100%; margin-bottom: 2px; }
.msg-row.sent { justify-content: flex-end; }
.msg-row.received { justify-content: flex-start; }

.msg { 
    max-width: 85%; padding: 6px 7px 6px 9px; border-radius: 8px; font-size: 14.5px; 
    line-height: 1.4; position: relative; word-wrap: break-word; box-shadow: 0 1px 0.5px rgba(0,0,0,0.08); color: #111b21 !important;
    display: inline-block; white-space: pre-wrap;
}
.msg.sent { background-color: #d9fdd3 !important; border-top-right-radius: 0px; border-top-left-radius: 8px; }
.msg.received { background-color: #ffffff !important; border-top-left-radius: 0px; border-top-right-radius: 8px; }

.meta-container {
    float: right;
    margin-top: 5px;
    margin-left: 8px;
    padding-top: 2px;
    display: flex;
    align-items: center;
    gap: 3px;
    position: relative;
    bottom: -2px;
    user-select: none;
}

.time {
    font-size: 10.5px;
    color: #667781 !important;
    white-space: nowrap;
}

.checks {
    font-size: 15px;
    line-height: 1;
    color: #53bdeb !important; /* Azul de leído oficial de WhatsApp */
    display: flex;
    align-items: center;
}

/* BURBUJA DE AUDIO */
.audio-bubble {
    width: 270px;
    padding: 8px 10px !important;
    display: flex;
    align-items: center;
    gap: 10px;
}
.audio-player-btn {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background-color: #00a884 !important;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    flex-shrink: 0;
    border: none;
}
.audio-player-btn svg {
    fill: white;
    width: 16px;
    height: 16px;
}
.audio-wave-container {
    flex: 1;
    display: flex;
    flex-direction: column;
    justify-content: center;
    gap: 4px;
}
.audio-wave-bars {
    display: flex;
    align-items: center;
    gap: 2px;
    height: 20px;
}
.wave-bar {
    flex: 1;
    height: 60%;
    background-color: #b0c4de;
    border-radius: 1px;
    transition: background-color 0.3s;
}
.msg.sent .wave-bar.active { background-color: #00a884 !important; }
.msg.received .wave-bar.active { background-color: #53bdeb !important; }

.audio-info-row {
    display: flex;
    justify-content: space-between;
    font-size: 11px;
    color: #667781 !important;
}
.audio-avatar-mini {
    width: 26px;
    height: 26px;
    border-radius: 50%;
    background: #90e0ef;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 13px;
    overflow: hidden;
    flex-shrink: 0;
    border: 1px solid rgba(0,0,0,0.05);
}
.audio-avatar-mini img { width: 100%; height: 100%; object-fit: cover; }

.typing-bubble {
    display: flex; align-items: center; gap: 4px; height: 28px; padding: 0 12px !important;
}
.typing-dot {
    width: 6px; height: 6px; background-color: #00a884 !important; border-radius: 50%;
    animation: bounceDot 1.4s infinite ease-in-out both;
}
.typing-dot:nth-child(1) { animation-delay: -0.32s; }
.typing-dot:nth-child(2) { animation-delay: -0.16s; }

@keyframes bounceDot {
    0%, 80%, 100% { transform: scale(0); }
    40% { transform: scale(1.0); }
}

.system-alert-bubble {
    align-self: center; background-color: #ffffff; color: #7b8c9c; font-size: 11.5px; padding: 5px 12px; 
    border-radius: 7.5px; text-align: center; max-width: 90%; box-shadow: 0 1px 1px rgba(0,0,0,0.03); margin: 12px 0; line-height: 1.3;
}

.input-area { 
    background-color: #f0f2f5 !important; padding: 6px 8px; display: flex; flex-direction: column; gap: 4px; 
    position: relative; flex-shrink: 0; z-index: 20;
}

.input-row-main { display: flex; width: 100%; align-items: center; gap: 6px; }
.input-wrapper {
    flex: 1; background: white; border-radius: 24px; display: flex; align-items: center; padding: 2px 12px; box-shadow: 0 1px 1px rgba(0,0,0,0.05); min-height: 44px; gap: 10px;
}

.input-wrapper textarea { 
    flex: 1; border: none; outline: none; font-size: 15.5px; background: transparent; 
    padding: 10px 0; color: #111b21 !important; resize: none; max-height: 90px; height: 24px; 
    line-height: 20px; overflow-y: auto;
}

.input-side-icons { display: flex; align-items: center; gap: 8px; padding-right: 5px; }
.input-side-icons svg { fill: #54656f !important; width: 22px; height: 22px; cursor: pointer; }

.send-btn { 
    background-color: #00a884 !important; color: white; border: none; width: 44px; height: 44px; border-radius: 50%; 
    cursor: pointer; display: flex; align-items: center; justify-content: center; box-shadow: 0 1px 1.5px rgba(0,0,0,0.15); flex-shrink: 0;
    transition: transform 0.15s ease;
}
.send-btn:active { transform: scale(0.88); }
.send-btn svg { width: 18px; height: 18px; fill: white; }

.blocked-banner {
    display: none; width: 100%; background-color: #f0f2f5; color: #7b8c9c; text-align: center; padding: 12px; font-size: 12.5px; box-shadow: 0 -1px 2px rgba(0,0,0,0.05); border-radius: 6px; line-height: 1.4;
}

.recording-warning-banner {
    background-color: #fff3cd;
    color: #856404;
    border: 1px solid #ffeeba;
    padding: 6px 12px;
    font-size: 11px;
    border-radius: 4px;
    text-align: center;
    font-weight: 500;
}

.disclaimer-professional-bar {
    background-color: #ffffff;
    color: #0077b6;
    font-size: 11px;
    text-align: center;
    padding: 8px 10px;
    line-height: 1.3;
    border-top: 1px solid #e3edf7;
    width: 100%;
    user-select: none;
    z-index: 25;
    font-weight: 600;
    letter-spacing: 0.3px;
}

/* ===== NUEVO: PANEL PRO CON ANIMACIÓN ===== */
.pro-sidebar {
    position: fixed;
    top: 0;
    left: 0;
    width: 85%;
    max-width: 320px;
    height: 100%;
    background: #0f172a;
    z-index: 999;
    transform: translateX(0);
    transition: transform 0.4s cubic-bezier(0.68, -0.55, 0.265, 1.55); /* Rebote pro */
    display: flex;
    flex-direction: column;
    box-shadow: 4px 0 20px rgba(0,0,0,0.3);
}
.pro-sidebar.closed {
    transform: translateX(-100%); /* Se oculta con animación */
}

.pro-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 16px;
    background: #1e293b;
    color: white;
}
.pro-header h3 { font-size: 16px; }

.pro-close {
    width: 44px !important;
    height: 44px !important;
    font-size: 28px !important;
    background: #1e293b !important;
    border: 1px solid #334155 !important;
    border-radius: 12px !important;
    color: #f8fafc !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    cursor: pointer !important;
    transition: all 0.2s;
    animation: shake 2s infinite; /* Llama la atención */
}
.pro-close:hover {
    background: #ef4444 !important;
    transform: scale(1.05);
}
.pro-close:active {
    transform: scale(0.9) rotate(180deg);
}
@keyframes shake {
    0%, 100% { transform: translateX(0); }
    25% { transform: translateX(-3px); }
    75% { transform: translateX(3px); }
}

.pro-block {
    padding: 16px;
    border-bottom: 1px solid #1e293b;
    color: #e2e8f0;
}
.pro-label { font-size: 12px; color: #94a3b8; margin-bottom: 8px; }
.pro-fichas-big { font-size: 24px; font-weight: bold; display: flex; align-items: center; gap: 8px; }
.btn-green, .btn-primary { padding: 10px; border-radius: 8px; border: none; font-weight: bold; cursor: pointer; }
.btn-green { background: #10b981; color: white; }
.btn-primary { background: linear-gradient(135deg, #00b4d8, #0077b6); color: white; }

.pro-trigger-btn {
    position: absolute;
    top: 70px;
    left: 10px;
    z-index: 998;
    background: #008069;
    color: white;
    border: none;
    width: 44px;
    height: 44px;
    border-radius: 50%;
    font-size: 20px;
    cursor: pointer;
    box-shadow: 0 2px 8px rgba(0,0,0,0.2);
    transition: transform 0.2s;
}
.pro-trigger-btn:active { transform: scale(0.9); }

/* PANEL DE CONTROL */
.control-top-bar {
    background: #008069 !important; color: white; display: flex; flex-direction: column; padding: 8px 12px; gap: 8px; box-shadow: 0 2px 5px rgba(0,0,0,0.1); z-index: 11;
}
.top-row-actions { display: flex; justify-content: space-between; align-items: center; width: 100%; gap: 10px; }
.tiktok-trigger-bar { font-weight: bold; font-size: 13px; cursor: pointer; background: rgba(0,0,0,0.2); padding: 6px 12px; border-radius: 6px; border: 1px solid rgba(255,255,255,0.3); flex: 1; text-align: center; }
.speed-panel-grid { display: flex; flex-wrap: wrap; gap: 10px; background: rgba(0,0,0,0.1); padding: 8px; border-radius: 6px; align-items: center; }
.speed-box-unit { display: flex; align-items: center; gap: 4px; font-size: 11px; font-weight: bold; }
.speed-box-unit select { background: white; border: none; font-size: 11px; font-weight: bold; color: #008069 !important; padding: 2px 4px; border-radius: 4px; }

.floating-show-controls {
    display: none; position: absolute; bottom: 100px; left: 10px; background: rgba(0,0,0,0.6); color: white;
    padding: 8px 12px; border-radius: 20px; font-size: 11px; font-weight: bold; z-index: 999; cursor: pointer;
}

.config-modal { display: none; position: absolute; top: 0; left: 0; width: 100%; height: 100%; background-color: #f0f2f5; z-index: 200; flex-direction: column; }
.modal-header { background-color: #008069 !important; color: white; padding: 15px; font-size: 18px; font-weight: bold; display: flex; align-items: center; gap: 15px; }
.modal-body { flex: 1; overflow-y: auto; padding: 16px; display: flex; flex-direction: column; gap: 20px; }
.config-section { background: white; padding: 14px; border-radius: 8px; box-shadow: 0 1px 3px rgba(0,0,0,0.05); }
.config-section h3 { font-size: 14px; color: #008069 !important; margin-bottom: 12px; text-transform: uppercase; }
.form-group { display: flex; flex-direction: column; gap: 6px; margin-bottom: 12px; }
.form-group label { font-size: 13px; color: #7b8c9c; font-weight: bold; }
.form-group input, .form-group select, .form-group textarea { padding: 10px; border: 1px solid #e1e9eb; border-radius: 6px; font-size: 15px; outline: none; background: #fafafa; }

.file-upload-wrapper { display: flex; gap: 10px; align-items: center; margin-top: 4px; }
.file-upload-btn { background: #e1e9eb; color: #1c2d3d; padding: 8px 12px; font-size: 13px; border-radius: 6px; cursor: pointer; font-weight: 500; border: 1px solid #ccc; text-align: center; }

.btn-gray { background-color: #7b8c9c; color: white; border: none; padding: 8px 12px; border-radius: 6px; font-weight: 600; cursor: pointer; }
.btn-close-modal { background: none; border: none; color: white; font-size: 22px; cursor: pointer; }
.phrases-area-list { display: flex; flex-direction: column; gap: 12px; margin-top: 10px; }

.phrase-row-edit { background: #f8f9fa; padding: 12px; border-radius: 8px; border-left: 5px solid #00a884 !important; display: flex; flex-direction: column; gap: 8px; position: relative; }
.phrase-edit-header { display: flex; justify-content: space-between; align-items: center; gap: 6px; }
.phrase-edit-header select { padding: 4px; font-size: 12px; border-radius: 4px; border: 1px solid #ccc; }
.btn-delete-phrase { background: #ef5350; color: white; border: none; padding: 4px 8px; font-size: 11px; border-radius: 4px; cursor: pointer; }

.preset-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin-bottom: 12px; }

.legal-corporate-box {
    background-color: #f8f9fa;
    border: 1px solid #e1e9eb;
    border-radius: 6px;
    padding: 12px;
    font-size: 11px;
    color: #5c6b73;
    line-height: 1.4;
}

/* TECLADO FLOTANTE SÍMBOLOS */
.custom-keyboard-dock {
    display: none; 
    background-color: #1c2429;
    width: 100%;
    padding: 8px 4px 12px 4px; 
    flex-shrink: 0;
    z-index: 30;
    user-select: none;
}

.keyboard-tab-row { display: flex; background: #232d36; margin-bottom: 8px; border-radius: 6px; overflow: hidden; padding: 2px; }
.keyboard-tab-btn { flex: 1; background: transparent; border: none; color: #a9b5bc; padding: 7px 0; font-size: 12px; font-weight: bold; cursor: pointer; text-align: center; }
.keyboard-tab-btn.active { background: #00a884 !important; color: white; border-radius: 4px; }

.keyboard-grid-content { display: none; grid-template-columns: repeat(6, 1fr); gap: 5px; }
.keyboard-grid-content.active { display: grid; }

.key-unit-btn { background: #2a3942; border: none; color: #e9edef; padding: 12px 2px; font-size: 16px; font-weight: 500; border-radius: 5px; cursor: pointer; text-align: center; }
.key-unit-btn:active { background: #00a884 !important; color: white; }

.key-unit-btn.special-action { background: #374248; font-size: 12px; font-weight: bold; color: #00a884 !important; }
.key-unit-btn.special-danger { background: #462328; color: #ff6961; font-size: 11px; font-weight: bold; }

.keyboard-footer-close { text-align: center; color: #7b8c9c; font-size: 11px; margin-top: 6px; cursor: pointer; }

/* VISUALIZADOR DE MONEDAS */
.token-counter-bar {
    background-color: #2a3942;
    color: #ffffff;
    padding: 6px 12px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 13px;
    font-weight: bold;
    z-index: 12;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}
.token-display {
    display: flex;
    align-items: center;
    gap: 6px;
    background: rgba(0, 0, 0, 0.3);
    padding: 4px 10px;
    border-radius: 12px;
}
.token-display span.coin-icon {
    color: #ffd700;
    animation: spinCoin 2s infinite linear;
}
@keyframes spinCoin {
    0% { transform: rotateY(0deg); }
    100% { transform: rotateY(360deg); }
}
.alert-insufficient-tokens {
    background-color: #ff6961 !important;
    color: white !important;
    animation: shakeAlert 0.4s ease-in-out;
}
@keyframes shakeAlert {
    0%, 100% { transform: translateX(0); }
    25% { transform: translateX(-4px); }
    75% { transform: translateX(4px); }
}

/* POPUP RECARGA Y ANUNCIOS */
.recharge-overlay-modal {
    display: none; position: absolute; top: 0; left: 0; width: 100%; height: 100%;
    background: rgba(0,0,0,0.75); z-index: 300; justify-content: center; align-items: center; padding: 20px;
}
.recharge-card {
    background: white; border-radius: 12px; width: 100%; max-width: 320px; padding: 20px;
    text-align: center; box-shadow: 0 4px 15px rgba(0,0,0,0.3); animation: scaleUp 0.3s ease;
}
@keyframes scaleUp { from { transform: scale(0.9); opacity: 0; } to { transform: scale(1); opacity: 1; } }

.ad-simulator-box {
    display: none; background: #1c2429; color: white; border-radius: 8px; padding: 15px;
    margin-top: 15px; text-align: center; position: relative;
}
.ad-progress-bar {
    height: 4px; background: #00a884 !important; width: 100%; margin-top: 10px; border-radius: 2px;
    transform-origin: left; animation: shrinkWidth linear forwards;
}
@keyframes shrinkWidth { from { transform: scaleX(1); } to { transform: scaleX(0); } }

.ai-badge {
    background: linear-gradient(135deg, #00b4d8, #0077b6); color: white;
    font-size: 9px; padding: 2px 6px; border-radius: 4px; font-weight: bold; margin-left: 5px;
}