/* ===== CHAT WIDGET — Asistente SKYLANCH ===== */

.chat-widget {
    position: fixed;
    right: clamp(16px, 4vw, 32px);
    bottom: clamp(16px, 4vw, 32px);
    z-index: 999;
    font-family: 'Plus Jakarta Sans', sans-serif;
}

.chat-toggle {
    width: 60px;
    height: 60px;
    border-radius: 50%;
    background: #2563EB;
    border: none;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 8px 24px rgba(37, 99, 235, 0.35);
    transition: transform 0.25s ease, box-shadow 0.25s ease;
    position: relative;
}

.chat-toggle:hover {
    transform: scale(1.06);
    box-shadow: 0 12px 32px rgba(37, 99, 235, 0.45);
}

.chat-toggle:focus-visible {
    outline: 2px solid #FFFFFF;
    outline-offset: 3px;
}

.chat-toggle svg {
    width: 26px;
    height: 26px;
    color: #FFFFFF;
    position: absolute;
    transition: opacity 0.2s ease, transform 0.2s ease;
}

.chat-toggle-icon-close {
    opacity: 0;
    transform: rotate(-45deg) scale(0.7);
}

.chat-widget--open .chat-toggle-icon-open {
    opacity: 0;
    transform: rotate(45deg) scale(0.7);
}

.chat-widget--open .chat-toggle-icon-close {
    opacity: 1;
    transform: rotate(0) scale(1);
}

.chat-badge {
    position: absolute;
    top: -2px;
    right: -2px;
    width: 14px;
    height: 14px;
    border-radius: 50%;
    background: #10B981;
    border: 2px solid #FFFFFF;
}

.chat-widget--open .chat-badge {
    display: none;
}

.chat-panel {
    position: absolute;
    right: 0;
    bottom: 76px;
    width: min(360px, calc(100vw - 32px));
    height: min(520px, calc(100vh - 140px));
    background: #FFFFFF;
    border-radius: 20px;
    box-shadow: 0 24px 60px rgba(31, 41, 55, 0.25);
    display: flex;
    flex-direction: column;
    overflow: hidden;
    opacity: 0;
    transform: translateY(16px) scale(0.97);
    pointer-events: none;
    transition: opacity 0.25s ease, transform 0.25s ease;
}

.chat-widget--open .chat-panel {
    opacity: 1;
    transform: translateY(0) scale(1);
    pointer-events: auto;
}

.chat-panel-header {
    background: #1F2937;
    color: #FFFFFF;
    padding: 16px 20px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-shrink: 0;
}

.chat-panel-title-group {
    display: flex;
    flex-direction: column;
}

.chat-panel-title {
    font-family: 'Bebas Neue', sans-serif;
    letter-spacing: 0.03em;
    font-size: 1.15rem;
    line-height: 1.2;
}

.chat-panel-subtitle {
    font-size: 0.72rem;
    color: rgba(255, 255, 255, 0.6);
    margin-top: 2px;
}

.chat-panel-close {
    background: none;
    border: none;
    color: #FFFFFF;
    font-size: 1.5rem;
    line-height: 1;
    cursor: pointer;
    opacity: 0.75;
    transition: opacity 0.2s ease;
    padding: 4px 8px;
}

.chat-panel-close:hover {
    opacity: 1;
}

.chat-panel-messages {
    flex: 1;
    overflow-y: auto;
    padding: 16px;
    display: flex;
    flex-direction: column;
    gap: 10px;
    background: #F5F7FA;
}

.chat-message p {
    margin: 0;
    padding: 10px 14px;
    border-radius: 14px;
    font-size: 0.88rem;
    line-height: 1.45;
    max-width: 85%;
    white-space: pre-wrap;
    word-break: break-word;
}

.chat-message--bot p {
    background: #FFFFFF;
    color: #1F2937;
    border-bottom-left-radius: 4px;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.06);
}

.chat-message-link {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    margin-top: 6px;
    padding: 8px 14px;
    border: none;
    border-radius: 999px;
    background: #2563EB;
    color: #FFFFFF;
    font-family: inherit;
    font-size: 0.82rem;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.2s ease, transform 0.15s ease;
}

.chat-message-link:hover {
    background: #1D4ED8;
    transform: translateY(-1px);
}

.chat-message-link::after {
    content: "→";
}

.chat-message--user {
    display: flex;
    justify-content: flex-end;
}

.chat-message--user p {
    background: #2563EB;
    color: #FFFFFF;
    border-bottom-right-radius: 4px;
}

.chat-message--typing {
    padding: 10px 14px;
    display: flex;
    gap: 4px;
    width: fit-content;
    background: #FFFFFF;
    border-radius: 14px;
    border-bottom-left-radius: 4px;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.06);
}

.chat-message--typing span {
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: #9CA3AF;
    animation: chatTypingBounce 1.2s infinite ease-in-out;
}

.chat-message--typing span:nth-child(2) {
    animation-delay: 0.15s;
}

.chat-message--typing span:nth-child(3) {
    animation-delay: 0.3s;
}

@keyframes chatTypingBounce {
    0%, 60%, 100% {
        transform: translateY(0);
        opacity: 0.5;
    }
    30% {
        transform: translateY(-4px);
        opacity: 1;
    }
}

.chat-panel-form {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 12px;
    border-top: 1px solid #E5E7EB;
    background: #FFFFFF;
    flex-shrink: 0;
}

.chat-panel-form input {
    flex: 1;
    border: 1px solid #E5E7EB;
    border-radius: 999px;
    padding: 10px 16px;
    font-family: inherit;
    font-size: 0.88rem;
    outline: none;
    transition: border-color 0.2s ease;
    min-width: 0;
}

.chat-panel-form input:focus {
    border-color: #2563EB;
}

.chat-panel-form input:disabled {
    opacity: 0.6;
}

.chat-panel-form button {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: #2563EB;
    border: none;
    color: #FFFFFF;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    flex-shrink: 0;
    transition: background 0.2s ease, opacity 0.2s ease;
}

.chat-panel-form button:hover {
    background: #1D4ED8;
}

.chat-panel-form button:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

@media (max-width: 480px) {
    .chat-panel {
        width: calc(100vw - 24px);
        right: -8px;
    }
}
