/* ── Chatbot widget — García Smester ── */
#gs-chat-widget {
    position: fixed;
    bottom: 160px;
    right: 1.5rem;
    z-index: 10001;
    font-family: -apple-system, BlinkMacSystemFont, 'Inter', sans-serif;
}

/* ── Botón flotante ── */
.gs-chat-btn {
    width: 68px;
    height: 68px;
    border-radius: 50%;
    background: linear-gradient(135deg, #2a5d52 0%, #187C68 100%);
    border: none;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 6px 24px rgba(42,93,82,.5);
    transition: transform .2s, box-shadow .2s;
    position: relative;
    color: #ffffff;
    z-index: 1;
}

.gs-chat-btn:hover {
    transform: scale(1.08);
    box-shadow: 0 8px 32px rgba(42,93,82,.6);
}

/* Ondas de pulso alrededor del botón */
.gs-chat-btn::before,
.gs-chat-btn::after {
    content: '';
    position: absolute;
    inset: 0;
    border-radius: 50%;
    background: rgba(42, 93, 82, 0.35);
    animation: gs-ripple 2.4s ease-out infinite;
    z-index: -1;
}
.gs-chat-btn::after {
    background: rgba(42, 93, 82, 0.2);
    animation-delay: 1.2s;
}

/* Ocultar ondas cuando el panel está abierto */
.gs-chat-btn[aria-expanded="true"]::before,
.gs-chat-btn[aria-expanded="true"]::after {
    animation: none;
    opacity: 0;
}

@keyframes gs-ripple {
    0%   { transform: scale(1);    opacity: 1; }
    100% { transform: scale(1.9);  opacity: 0; }
}

/* Ícono robot (visible cuando cerrado) */
.gs-chat-btn__icon {
    width: 36px;
    height: 36px;
    position: absolute;
    transition: opacity .2s, transform .2s;
}

.gs-chat-btn__icon--close {
    opacity: 0;
    transform: rotate(-90deg) scale(.7);
}

/* Cuando el panel está abierto */
.gs-chat-btn[aria-expanded="true"] .gs-chat-btn__icon--open {
    opacity: 0;
    transform: rotate(90deg) scale(.7);
}

.gs-chat-btn[aria-expanded="true"] .gs-chat-btn__icon--close {
    opacity: 1;
    transform: rotate(0) scale(1);
}

/* Tooltip "¿En qué te puedo ayudar?" */
.gs-chat-tooltip {
    position: absolute;
    bottom: 78px;
    right: 0;
    background: #ffffff;
    color: #1a3a30;
    font-size: .82rem;
    font-weight: 600;
    padding: .5rem 1rem;
    border-radius: 20px 20px 4px 20px;
    white-space: nowrap;
    box-shadow: 0 4px 20px rgba(0,0,0,.18);
    pointer-events: none;
    animation: gs-tooltip-in .4s ease forwards;
    border: 1px solid rgba(42,93,82,.15);
}

.gs-chat-tooltip::after {
    content: '';
    position: absolute;
    bottom: -8px;
    right: 20px;
    border: 8px solid transparent;
    border-top-color: #ffffff;
    border-bottom: 0;
}

@keyframes gs-tooltip-in {
    from { opacity: 0; transform: translateY(6px) scale(.95); }
    to   { opacity: 1; transform: translateY(0) scale(1); }
}

/* Badge de notificación */
.gs-chat-badge {
    position: absolute;
    top: -3px;
    right: -3px;
    width: 18px;
    height: 18px;
    background: #ed1c24;
    color: #fff;
    font-size: .65rem;
    font-weight: 700;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    border: 2px solid #fff;
}

/* ── Panel ── */
.gs-chat-panel {
    position: fixed;
    bottom: 160px;
    right: 100px;
    width: 340px;
    max-height: 520px;
    background: #1c1c1e;
    border: 1px solid rgba(255,255,255,.12);
    border-radius: 20px;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    box-shadow: 0 16px 48px rgba(0,0,0,.5);
    animation: gs-chat-in .2s ease;
}

.gs-chat-panel[hidden] {
    display: none;
}

@keyframes gs-chat-in {
    from { opacity: 0; transform: translateY(12px) scale(.97); }
    to   { opacity: 1; transform: translateY(0) scale(1); }
}

/* ── Header ── */
.gs-chat-header {
    background: linear-gradient(135deg, #2a5d52 0%, #1e4a40 100%);
    padding: 1rem 1.25rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-shrink: 0;
}

.gs-chat-header__info {
    display: flex;
    align-items: center;
    gap: .75rem;
    color: #ffffff;
}

.gs-chat-header__dot {
    width: 10px;
    height: 10px;
    background: #0a0a0a;
    border-radius: 50%;
    opacity: .7;
    box-shadow: 0 0 0 3px rgba(0,0,0,.15);
    animation: gs-pulse 2s infinite;
}

@keyframes gs-pulse {
    0%, 100% { box-shadow: 0 0 0 3px rgba(0,0,0,.15); }
    50%       { box-shadow: 0 0 0 5px rgba(0,0,0,.05); }
}

.gs-chat-header__info strong {
    display: block;
    font-size: .9rem;
    font-weight: 700;
    color: #ffffff;
}

.gs-chat-header__info small {
    font-size: .72rem;
    color: rgba(255,255,255,.7);
}

.gs-chat-header__close {
    background: rgba(0,0,0,.15);
    border: none;
    color: #ffffff;
    width: 28px;
    height: 28px;
    border-radius: 50%;
    cursor: pointer;
    font-size: .85rem;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background .15s;
}

.gs-chat-header__close:hover { background: rgba(0,0,0,.25); }

/* ── Mensajes ── */
.gs-chat-messages {
    flex: 1;
    overflow-y: auto;
    padding: 1rem;
    display: flex;
    flex-direction: column;
    gap: .75rem;
    scroll-behavior: smooth;
}

.gs-chat-messages::-webkit-scrollbar { width: 4px; }
.gs-chat-messages::-webkit-scrollbar-track { background: transparent; }
.gs-chat-messages::-webkit-scrollbar-thumb { background: rgba(255,255,255,.15); border-radius: 2px; }

.gs-msg {
    display: flex;
    flex-direction: column;
    max-width: 85%;
    animation: gs-msg-in .18s ease;
}

@keyframes gs-msg-in {
    from { opacity: 0; transform: translateY(6px); }
    to   { opacity: 1; transform: translateY(0); }
}

.gs-msg--usuario {
    align-self: flex-end;
    align-items: flex-end;
}

.gs-msg--bot {
    align-self: flex-start;
    align-items: flex-start;
}

.gs-msg__bubble {
    padding: .65rem .9rem;
    border-radius: 16px;
    font-size: .875rem;
    line-height: 1.5;
    word-break: break-word;
}

.gs-msg--usuario .gs-msg__bubble {
    background: #2a5d52;
    color: #ffffff;
    border-bottom-right-radius: 4px;
}

.gs-msg--bot .gs-msg__bubble {
    background: rgba(255,255,255,.07);
    color: #f5f5f7;
    border: 1px solid rgba(255,255,255,.1);
    border-bottom-left-radius: 4px;
}

/* Typing indicator */
.gs-msg--typing .gs-msg__bubble {
    display: flex;
    gap: 4px;
    align-items: center;
    padding: .75rem 1rem;
}

.gs-msg--typing .gs-msg__bubble span {
    width: 7px;
    height: 7px;
    background: rgba(255,255,255,.4);
    border-radius: 50%;
    animation: gs-bounce .9s ease-in-out infinite;
}

.gs-msg--typing .gs-msg__bubble span:nth-child(2) { animation-delay: .15s; }
.gs-msg--typing .gs-msg__bubble span:nth-child(3) { animation-delay: .3s; }

@keyframes gs-bounce {
    0%, 80%, 100% { transform: scale(.7); opacity: .5; }
    40%            { transform: scale(1);  opacity: 1; }
}

/* Botones de acción */
.gs-msg__buttons {
    display: flex;
    flex-wrap: wrap;
    gap: .4rem;
    margin-top: .4rem;
}

.gs-msg__btn {
    display: inline-block;
    padding: .35rem .8rem;
    background: rgba(42,93,82,.12);
    border: 1px solid rgba(42,93,82,.3);
    border-radius: 100px;
    color: #2a5d52;
    font-size: .78rem;
    font-weight: 600;
    text-decoration: none;
    transition: background .15s;
}

.gs-msg__btn:hover {
    background: rgba(42,93,82,.22);
}

/* ── Input form ── */
.gs-chat-form {
    display: flex;
    gap: .5rem;
    padding: .75rem 1rem;
    border-top: 1px solid rgba(255,255,255,.08);
    flex-shrink: 0;
    background: #1c1c1e;
}

.gs-chat-input {
    flex: 1;
    background: rgba(255,255,255,.06);
    border: 1px solid rgba(255,255,255,.1);
    border-radius: 100px;
    padding: .55rem 1rem;
    color: #f5f5f7;
    font-size: .875rem;
    font-family: inherit;
    outline: none;
    transition: border-color .15s;
}

.gs-chat-input:focus { border-color: #2a5d52; }
.gs-chat-input::placeholder { color: rgba(255,255,255,.3); }

.gs-chat-send {
    width: 38px;
    height: 38px;
    border-radius: 50%;
    background: #2a5d52;
    border: none;
    color: #ffffff;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    transition: opacity .15s, transform .1s;
}

.gs-chat-send:hover   { opacity: .85; transform: scale(1.05); }
.gs-chat-send:active  { transform: scale(.95); }

/* ── Burbuja "Asistente Virtual" ── */
.gs-chat-label {
    position: absolute;
    bottom: 68px;
    right: 0;
    background: #2a5d52;
    color: #fff;
    font-size: .82rem;
    font-weight: 600;
    padding: .45rem .9rem;
    border-radius: 20px 20px 4px 20px;
    white-space: nowrap;
    box-shadow: 0 4px 16px rgba(42,93,82,.35);
    pointer-events: none;
    animation: gs-label-in .4s ease forwards, gs-label-out .4s ease 3s forwards;
}

.gs-chat-label::after {
    content: '';
    position: absolute;
    bottom: -7px;
    right: 18px;
    border: 7px solid transparent;
    border-top-color: #2a5d52;
    border-bottom: 0;
}

@keyframes gs-label-in {
    from { opacity: 0; transform: translateY(8px) scale(.9); }
    to   { opacity: 1; transform: translateY(0) scale(1); }
}

@keyframes gs-label-out {
    from { opacity: 1; transform: translateY(0) scale(1); }
    to   { opacity: 0; transform: translateY(-6px) scale(.9); }
}

/* ── Responsive ── */
@media (max-width: 500px) {
    #gs-chat-widget { bottom: 150px; right: 1rem; }
    .gs-chat-panel  { width: calc(100vw - 2rem); right: 1rem; bottom: 240px; }
}
