/* ── Widget flotante ──────────────────────────── */
.gemini-chat-widget {
    position: fixed;
    bottom: 24px;
    right: 24px;
    z-index: 99999;
    font-family: 'Poppins', -apple-system, sans-serif;
}

/* ── Botón toggle ─────────────────────────────── */
.gemini-chat-toggle {
    width: 72px;
    height: 72px;
    border-radius: 50%;
    background: linear-gradient(135deg, #2e70a1, #1d5a8a);
    border: none;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 4px 20px rgba(46, 112, 161, 0.4);
    transition: transform 0.2s, box-shadow 0.2s;
}
.gemini-chat-toggle svg {
    width: 34px;
    height: 34px;
}
.gemini-chat-toggle:hover {
    transform: scale(1.08);
    box-shadow: 0 6px 28px rgba(46, 112, 161, 0.55);
}
.gemini-chat-toggle .gemini-badge {
    position: absolute;
    top: -4px;
    right: -4px;
    background: #e74c3c;
    color: #fff;
    font-size: 12px;
    font-weight: 700;
    min-width: 22px;
    height: 22px;
    border-radius: 11px;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0 6px;
    box-shadow: 0 2px 6px rgba(0,0,0,0.2);
    animation: gemini-pulse 2s infinite;
}
@keyframes gemini-pulse {
    0%, 100% { transform: scale(1); }
    50% { transform: scale(1.12); }
}

/* ── Ventana de chat ──────────────────────────── */
.gemini-chat-window {
    position: fixed;
    bottom: 24px;
    right: 24px;
    width: 380px;
    max-width: calc(100vw - 40px);
    height: 560px;
    max-height: calc(100vh - 100px);
    background: #fff;
    border-radius: 16px;
    box-shadow: 0 8px 40px rgba(0,0,0,0.18);
    display: flex;
    flex-direction: column;
    overflow: hidden;
    z-index: 99999;
}

/* ── Header ────────────────────────────────────── */
.gemini-chat-header {
    background: linear-gradient(135deg, #2e70a1, #1d5a8a);
    color: #fff;
    padding: 16px 18px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-weight: 600;
    font-size: 15px;
    min-height: 72px;
    gap: 12px;
    flex-shrink: 0;
}
.gemini-chat-header-left {
    display: flex;
    align-items: center;
    gap: 14px;
    min-width: 0;
}
.gemini-chat-header-avatar {
    width: 56px;
    height: 56px;
    min-width: 56px;
    min-height: 56px;
    border-radius: 50%;
    object-fit: cover;
    object-position: center top;
    border: 2px solid rgba(255,255,255,0.6);
    display: none;
}
.gemini-chat-header-avatar.show {
    display: block;
}
.gemini-chat-header-info {
    display: flex;
    flex-direction: column;
    line-height: 1.3;
}
.gemini-chat-header-name {
    font-weight: 600;
    font-size: 16px;
}
.gemini-chat-header-role {
    font-size: 12px;
    opacity: 0.85;
    font-weight: 400;
}
.gemini-chat-header button {
    background: none;
    border: none;
    color: #fff;
    font-size: 24px;
    cursor: pointer;
    line-height: 1;
    padding: 0 4px;
    flex-shrink: 0;
}

/* ── Botón rápido ejecutivo ───────────────────── */
.gemini-chat-quick-btn {
    background: #2e70a1;
    color: #fff;
    text-align: center;
    padding: 10px;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.2s;
    display: none;
}
.gemini-chat-quick-btn:hover {
    background: #1d5a8a;
}

/* ── Área de mensajes ──────────────────────────── */
.gemini-chat-messages {
    flex: 1;
    overflow-y: auto;
    padding: 14px;
    background: #f7f7f7;
    display: flex;
    flex-direction: column;
    gap: 10px;
}
.gemini-msg {
    display: flex;
    max-width: 88%;
}
.gemini-msg-user {
    align-self: flex-end;
}
.gemini-msg-assistant {
    align-self: flex-start;
}
.gemini-msg-bubble {
    padding: 10px 14px;
    border-radius: 18px;
    font-size: 13.5px;
    line-height: 1.45;
    word-wrap: break-word;
}
.gemini-msg-user .gemini-msg-bubble {
    background: #2e70a1;
    color: #fff;
    border-bottom-right-radius: 4px;
}
.gemini-msg-assistant .gemini-msg-bubble {
    background: #fff;
    color: #333;
    border: 1px solid #e0e0e0;
    border-bottom-left-radius: 4px;
}

/* ── Loader dots ────────────────────────────────── */
.gemini-dot {
    display: inline-block;
    width: 7px;
    height: 7px;
    border-radius: 50%;
    background: #bbb;
    margin: 0 2px;
    animation: geminiBounce 1.4s infinite ease-in-out both;
}
.gemini-dot:nth-child(1) { animation-delay: -0.32s; }
.gemini-dot:nth-child(2) { animation-delay: -0.16s; }
@keyframes geminiBounce {
    0%, 80%, 100% { transform: scale(0); }
    40% { transform: scale(1); }
}

/* ── Input area ─────────────────────────────────── */
.gemini-chat-input-area {
    display: flex;
    padding: 10px 12px;
    border-top: 1px solid #eee;
    gap: 8px;
    background: #fff;
}
.gemini-chat-input-area input {
    flex: 1;
    border: 1px solid #ddd;
    border-radius: 20px;
    padding: 10px 16px;
    font-size: 13.5px;
    outline: none;
    font-family: inherit;
}
.gemini-chat-input-area input:focus {
    border-color: #2e70a1;
}
.gemini-chat-input-area button {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: #2e70a1;
    border: none;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}
.gemini-chat-input-area button:hover {
    background: #1d5a8a;
}

/* ── Responsive ─────────────────────────────────── */
@media (max-width: 480px) {
    .gemini-chat-window {
        position: fixed;
        inset: 0;
        width: 100%;
        height: 100%;
        max-width: 100%;
        max-height: none;
        bottom: 0;
        right: 0;
        border-radius: 0;
    }
    .gemini-chat-header {
        padding: max(14px, env(safe-area-inset-top)) 14px 14px 14px;
        min-height: 68px;
        gap: 10px;
    }
    .gemini-chat-header-left {
        gap: 10px;
    }
    .gemini-chat-header-avatar {
        width: 48px;
        height: 48px;
        min-width: 48px;
        min-height: 48px;
        flex-shrink: 0;
    }
    .gemini-chat-header-name {
        font-size: 14px;
    }
    .gemini-chat-header-role {
        font-size: 11px;
    }
    .gemini-frm-input {
        font-size: 16px !important; /* evitar zoom en iOS */
        padding: 10px !important;
    }
    .gemini-frm-btn {
        font-size: 14px;
        padding: 10px;
    }
}

/* ── Mini formulario en chat ──────────────────── */
.gemini-mini-form {
    display: flex;
    flex-direction: column;
    gap: 6px;
    margin-top: 6px;
}
.gemini-frm-input {
    border: 1px solid #ddd !important;
    border-radius: 8px !important;
    padding: 8px 10px !important;
    font-size: 13px !important;
    font-family: inherit !important;
    outline: none !important;
    background: #fff !important;
    text-transform: none !important;
}
.gemini-frm-input:focus {
    border-color: #2e70a1 !important;
}
.gemini-frm-btn {
    background: #2e70a1;
    color: #fff;
    border: none;
    border-radius: 8px;
    padding: 8px;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    margin-top: 4px;
}
.gemini-frm-btn:hover {
    background: #1d5a8a;
}
