/* ═══════════════════════════════════════
   iMedia Business — Chatbot Widget
   ═══════════════════════════════════════ */

/* ─── BOTON FLOTANTE ─── */
.imedia-chatbot-btn {
    position: fixed;
    bottom: 24px;
    right: 24px;
    width: 60px;
    height: 60px;
    border-radius: 50%;
    border: none;
    cursor: pointer;
    z-index: 9998;
    background: linear-gradient(135deg, #2563EB, #3B82F6);
    box-shadow: 0 0 25px rgba(37, 99, 235, 0.4), 0 4px 16px rgba(0,0,0,0.3);
    display: flex;
    align-items: center;
    justify-content: center;
    transition: transform 0.3s, box-shadow 0.3s;
    animation: imedia-bounce 4s ease-in-out infinite;
}

.imedia-chatbot-btn:hover {
    transform: scale(1.1);
    box-shadow: 0 0 40px rgba(37, 99, 235, 0.6), 0 8px 24px rgba(0,0,0,0.4);
}

.imedia-chatbot-btn svg {
    width: 28px;
    height: 28px;
    fill: #fff;
}

.imedia-chatbot-btn.hidden {
    transform: scale(0);
    opacity: 0;
    pointer-events: none;
    transition: transform 0.3s, opacity 0.3s;
}

/* Badge notificación */
.imedia-chatbot-badge {
    position: absolute;
    top: -2px;
    right: -2px;
    width: 16px;
    height: 16px;
    border-radius: 50%;
    background: #EF4444;
    border: 2px solid #0A0A0A;
    animation: imedia-pulse 2s ease-in-out infinite;
}

@keyframes imedia-bounce {
    0%, 85%, 100% { transform: translateY(0); }
    90% { transform: translateY(-8px); }
    95% { transform: translateY(0); }
}

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

/* ─── PANEL DE CHAT ─── */
.imedia-chatbot-panel {
    position: fixed;
    bottom: 24px;
    right: 24px;
    width: 380px;
    height: 520px;
    max-height: 80vh;
    z-index: 9999;
    border-radius: 20px;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    background: #0A0A0A;
    border: 1px solid rgba(37, 99, 235, 0.12);
    box-shadow: 0 8px 40px rgba(0,0,0,0.5), 0 0 20px rgba(37, 99, 235, 0.1);
    transform-origin: bottom right;
    transition: transform 0.35s cubic-bezier(0.34, 1.56, 0.64, 1), opacity 0.35s;
}

.imedia-chatbot-panel.closed {
    transform: scale(0.5);
    opacity: 0;
    pointer-events: none;
    transition: transform 0.25s ease-in, opacity 0.25s ease-in;
}

/* Header */
.imedia-chatbot-header {
    padding: 16px 20px;
    background: #141414;
    border-bottom: 1px solid rgba(255,255,255,0.05);
    display: flex;
    align-items: center;
    gap: 12px;
    flex-shrink: 0;
}

.imedia-chatbot-avatar {
    width: 40px;
    height: 40px;
    border-radius: 12px;
    background: linear-gradient(135deg, #2563EB, #3B82F6);
    display: flex;
    align-items: center;
    justify-content: center;
    font-family: 'Syne', sans-serif;
    font-weight: 800;
    font-size: 14px;
    color: #fff;
    flex-shrink: 0;
}

.imedia-chatbot-header-info {
    flex: 1;
}

.imedia-chatbot-header-name {
    font-family: 'Syne', sans-serif;
    font-weight: 700;
    font-size: 15px;
    color: #F0F0F0;
}

.imedia-chatbot-header-status {
    font-family: 'DM Sans', sans-serif;
    font-size: 12px;
    color: #9CA3AF;
    display: flex;
    align-items: center;
    gap: 6px;
}

.imedia-chatbot-header-status::before {
    content: '';
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: #10B981;
    display: inline-block;
}

.imedia-chatbot-close {
    width: 32px;
    height: 32px;
    border-radius: 8px;
    border: none;
    background: rgba(255,255,255,0.05);
    color: #9CA3AF;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.2s, color 0.2s;
    flex-shrink: 0;
}

.imedia-chatbot-close:hover {
    background: rgba(255,255,255,0.1);
    color: #F0F0F0;
}

.imedia-chatbot-close svg {
    width: 18px;
    height: 18px;
}

/* Body / mensajes */
.imedia-chatbot-body {
    flex: 1;
    overflow-y: auto;
    padding: 20px 16px;
    display: flex;
    flex-direction: column;
    gap: 12px;
    scroll-behavior: smooth;
}

.imedia-chatbot-body::-webkit-scrollbar {
    width: 4px;
}

.imedia-chatbot-body::-webkit-scrollbar-thumb {
    background: rgba(255,255,255,0.1);
    border-radius: 4px;
}

/* Burbujas */
.imedia-chatbot-msg {
    max-width: 85%;
    padding: 12px 16px;
    border-radius: 16px;
    font-family: 'DM Sans', sans-serif;
    font-size: 14px;
    line-height: 1.55;
    opacity: 0;
    transform: translateY(10px);
    animation: imedia-msg-in 0.3s ease-out forwards;
}

.imedia-chatbot-msg.bot {
    align-self: flex-start;
    background: #1A1A1A;
    color: #F0F0F0;
    border-bottom-left-radius: 4px;
}

.imedia-chatbot-msg.user {
    align-self: flex-end;
    background: #2563EB;
    color: #fff;
    border-bottom-right-radius: 4px;
}

@keyframes imedia-msg-in {
    to { opacity: 1; transform: translateY(0); }
}

/* Typing indicator */
.imedia-chatbot-typing {
    align-self: flex-start;
    background: #1A1A1A;
    border-radius: 16px;
    border-bottom-left-radius: 4px;
    padding: 14px 20px;
    display: flex;
    gap: 5px;
    align-items: center;
}

.imedia-chatbot-typing span {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: #9CA3AF;
    animation: imedia-typing-dot 1.2s ease-in-out infinite;
}

.imedia-chatbot-typing span:nth-child(2) { animation-delay: 0.15s; }
.imedia-chatbot-typing span:nth-child(3) { animation-delay: 0.3s; }

@keyframes imedia-typing-dot {
    0%, 60%, 100% { transform: scale(1); opacity: 0.4; }
    30% { transform: scale(1.3); opacity: 1; }
}

/* Opciones / botones */
.imedia-chatbot-options {
    display: flex;
    flex-direction: column;
    gap: 8px;
    align-self: flex-start;
    max-width: 90%;
}

.imedia-chatbot-opt {
    font-family: 'DM Sans', sans-serif;
    font-size: 14px;
    font-weight: 500;
    color: #F0F0F0;
    background: rgba(255,255,255,0.04);
    border: 1px solid rgba(255,255,255,0.1);
    border-radius: 100px;
    padding: 10px 20px;
    cursor: pointer;
    text-align: left;
    transition: background 0.25s, border-color 0.25s, transform 0.2s;
    opacity: 0;
    transform: translateY(8px);
    animation: imedia-msg-in 0.3s ease-out forwards;
}

.imedia-chatbot-opt:hover {
    background: rgba(37, 99, 235, 0.12);
    border-color: rgba(37, 99, 235, 0.3);
    transform: translateY(-1px);
}

.imedia-chatbot-opt.fade-out {
    opacity: 0;
    transform: scale(0.95);
    transition: opacity 0.2s, transform 0.2s;
    pointer-events: none;
}

/* Botón WhatsApp grande */
.imedia-chatbot-wa-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    font-family: 'DM Sans', sans-serif;
    font-size: 15px;
    font-weight: 600;
    color: #fff;
    background: #25D366;
    border: none;
    border-radius: 14px;
    padding: 14px 28px;
    cursor: pointer;
    align-self: flex-start;
    box-shadow: 0 0 20px rgba(37, 211, 102, 0.3);
    transition: transform 0.3s, box-shadow 0.3s;
    opacity: 0;
    transform: translateY(10px);
    animation: imedia-msg-in 0.3s ease-out forwards;
    text-decoration: none;
}

.imedia-chatbot-wa-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 0 32px rgba(37, 211, 102, 0.5);
}

.imedia-chatbot-wa-btn svg {
    width: 20px;
    height: 20px;
    fill: #fff;
}

/* ─── RESPONSIVE MOBILE ─── */
@media (max-width: 768px) {
    .imedia-chatbot-panel {
        width: 100%;
        height: 100vh;
        max-height: 100vh;
        bottom: 0;
        right: 0;
        border-radius: 0;
    }
}
