/* ==========================================================
   Academia Chatbot — Widget CSS
   ========================================================== */

/* ---------- Botón flotante ---------- */
.acbot-float {
    position: fixed;
    bottom: 32px;
    right: 32px;
    z-index: 8000;
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    gap: 12px;
}

.acbot-float.pos-bottom-left {
    right: auto;
    left: 32px;
    align-items: flex-start;
}

.acbot-float__tooltip {
    background: #fff;
    color: #2c3e50;
    padding: 8px 16px;
    border-radius: 20px;
    font-size: .9rem;
    box-shadow: 0 4px 20px rgba(0,0,0,.12);
    opacity: 0;
    transform: translateY(8px);
    transition: .3s cubic-bezier(.4,0,.2,1);
    pointer-events: none;
    white-space: nowrap;
}

.acbot-float:hover .acbot-float__tooltip {
    opacity: 1;
    transform: translateY(0);
}

.acbot-float__btn {
    width: var(--acbot-btn-size, 60px);
    height: var(--acbot-btn-size, 60px);
    border-radius: 50%;
    background: linear-gradient(135deg, var(--acbot-primary, #269bd1) 0%, var(--acbot-primary-dark, #1e7ba6) 100%);
    border: none;
    color: #fff;
    font-size: 1.5rem;
    cursor: pointer;
    box-shadow: 0 8px 30px rgba(38,155,209,.4);
    transition: .3s cubic-bezier(.4,0,.2,1);
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
}

.acbot-float__btn:hover {
    transform: scale(1.08);
    box-shadow: 0 12px 40px rgba(38,155,209,.55);
}

.acbot-float__btn::before {
    content: '';
    position: absolute;
    inset: -4px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--acbot-primary, #269bd1) 0%, var(--acbot-primary-dark, #1e7ba6) 100%);
    opacity: .3;
    animation: acbot-pulse 2s ease-in-out infinite;
}

@keyframes acbot-pulse {
    0%, 100% { transform: scale(1); opacity: .3; }
    50%      { transform: scale(1.18); opacity: 0; }
}

/* ---------- Panel ---------- */
.acbot-panel {
    position: fixed;
    bottom: 110px;
    right: 32px;
    width: var(--acbot-panel-width, 380px);
    max-height: 500px;
    background: #fff;
    border-radius: 16px;
    box-shadow: 0 20px 60px rgba(0,0,0,.18);
    display: flex;
    flex-direction: column;
    z-index: 9500;
    opacity: 0;
    visibility: hidden;
    transform: translateY(20px) scale(.96);
    transition: .3s cubic-bezier(.4,0,.2,1);
    overflow: hidden;
}

.acbot-panel.pos-bottom-left {
    right: auto;
    left: 32px;
}

.acbot-panel.open {
    opacity: 1;
    visibility: visible;
    transform: translateY(0) scale(1);
}

/* Header */
.acbot-panel__header {
    background: linear-gradient(135deg, var(--acbot-primary, #269bd1) 0%, var(--acbot-primary-dark, #1e7ba6) 100%);
    color: #fff;
    padding: 14px 18px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    font-weight: 600;
    font-size: .95rem;
}

.acbot-panel__close {
    background: none;
    border: none;
    color: #fff;
    font-size: 1.4rem;
    cursor: pointer;
    opacity: .8;
    line-height: 1;
}
.acbot-panel__close:hover { opacity: 1; }

/* Body */
.acbot-panel__body {
    flex: 1;
    overflow-y: auto;
    padding: 16px;
    min-height: 260px;
    max-height: 360px;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

/* Messages */
.acbot-msg {
    padding: 10px 14px;
    border-radius: 14px;
    font-size: .9rem;
    line-height: 1.5;
    max-width: 85%;
    word-wrap: break-word;
}

.acbot-msg--user {
    background: linear-gradient(135deg, var(--acbot-primary, #269bd1), var(--acbot-primary-dark, #1e7ba6));
    color: #fff;
    align-self: flex-end;
    border-bottom-right-radius: 4px;
}

.acbot-msg--bot {
    background: #f1f5f9;
    color: #2c3e50;
    align-self: flex-start;
    border-bottom-left-radius: 4px;
}

.acbot-msg a {
    color: var(--acbot-primary, #269bd1);
    text-decoration: underline;
    word-break: break-all;
}
.acbot-msg a:hover {
    color: var(--acbot-primary-dark, #1e7ba6);
}

/* Typing */
.acbot-typing {
    display: flex;
    gap: 4px;
    align-items: center;
    padding: 10px 14px;
    align-self: flex-start;
}
.acbot-typing span {
    width: 8px;
    height: 8px;
    background: #94a3b8;
    border-radius: 50%;
    animation: acbot-dot .6s ease-in-out infinite;
}
.acbot-typing span:nth-child(2) { animation-delay: .15s; }
.acbot-typing span:nth-child(3) { animation-delay: .3s; }

@keyframes acbot-dot {
    0%, 100% { transform: translateY(0); }
    50%      { transform: translateY(-6px); }
}

/* Input */
.acbot-panel__input {
    display: flex;
    border-top: 1px solid #e2e8f0;
}

.acbot-panel__input input {
    flex: 1;
    border: none;
    padding: 12px 16px;
    font-size: .9rem;
    outline: none;
    font-family: inherit;
}

.acbot-panel__input button {
    background: linear-gradient(135deg, var(--acbot-primary, #269bd1), var(--acbot-primary-dark, #1e7ba6));
    border: none;
    color: #fff;
    padding: 12px 16px;
    cursor: pointer;
    font-size: 1rem;
    transition: .2s;
}
.acbot-panel__input button:hover {
    filter: brightness(1.1);
}

/* ---------- Responsive ---------- */
@media (max-width: 480px) {
    .acbot-panel {
        right: 8px !important;
        left: 8px !important;
        bottom: 90px;
        width: calc(100% - 16px);
    }
    .acbot-float {
        bottom: 20px;
        right: 20px;
    }
    .acbot-float.pos-bottom-left {
        right: auto;
        left: 20px;
    }
}
