/* =============================================
   La Galiciana - Chat Widget Styles
   ============================================= */

/* ---- Floating Chat Button ---- */
#chat-btn {
    position: fixed;
    bottom: 2rem;
    right: 2rem;
    z-index: 2000;
    display: flex;
    align-items: center;
    gap: 0.75rem;
    background: rgba(255, 157, 0, 0.9);
    backdrop-filter: blur(10px);
    color: var(--bg-dark);
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 50px;
    padding: 0.85rem 1.6rem;
    font-family: 'Outfit', sans-serif;
    font-weight: 700;
    font-size: 0.95rem;
    cursor: pointer;
    box-shadow: 0 10px 30px rgba(255, 157, 0, 0.4);
    transition: all 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    user-select: none;
    /* overflow: hidden; */
}


#chat-btn:hover {
    transform: scale(1.1) translateY(-5px);
    box-shadow: 0 15px 40px rgba(255, 157, 0, 0.6);
    background: rgba(255, 157, 0, 1);
}


#chat-btn.hidden {
    opacity: 0;
    pointer-events: none;
    transform: scale(0.8) translateY(20px);
}

#chat-icon {
    font-size: 1.4rem;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: transform 0.4s;
}

#chat-btn:hover #chat-icon {
    transform: rotate(15deg) scale(1.2);
}

.chat-badge {
    position: absolute;
    top: -8px;
    /* Move slightly more outside for prominence */
    right: -8px;
    background: var(--accent-red);
    color: white;
    font-size: 0.75rem;
    font-weight: 800;
    width: 24px;
    height: 24px;
    border-radius: 12px;
    display: flex !important;
    align-items: center;
    justify-content: center;
    border: 2px solid #fff;
    /* High contrast border */
    box-shadow: 0 4px 12px rgba(211, 47, 47, 0.6);
    z-index: 2001;
    /* Above the button logo */
    animation: bounce-badge 2s infinite;
}

@keyframes bounce-badge {

    0%,
    20%,
    50%,
    80%,
    100% {
        transform: translateY(0);
    }

    40% {
        transform: translateY(-5px);
    }

    60% {
        transform: translateY(-3px);
    }
}

/* ---- Chat Panel ---- */
#chat-panel {
    position: fixed;
    bottom: 6.5rem;
    right: 2rem;
    z-index: 1999;
    width: 380px;
    max-height: 560px;
    display: flex;
    flex-direction: column;
    background: rgba(22, 22, 22, 0.95);
    backdrop-filter: blur(20px);
    border: 1px solid rgba(255, 157, 0, 0.2);
    border-radius: 16px;
    box-shadow: 0 25px 60px rgba(0, 0, 0, 0.6);
    overflow: hidden;
    opacity: 0;
    transform: translateY(20px) scale(0.96);
    pointer-events: none;
    transition: all 0.35s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

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

/* ---- Chat Header ---- */
#chat-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 1rem 1.2rem;
    background: rgba(255, 157, 0, 0.08);
    border-bottom: 1px solid rgba(255, 157, 0, 0.15);
}

.chat-header-info {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.chat-avatar {
    width: 40px;
    height: 40px;
    background: var(--accent-amber);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.2rem;
}

#chat-header strong {
    display: block;
    font-size: 0.95rem;
    color: var(--text-primary);
}

.chat-status {
    font-size: 0.75rem;
    color: #4caf50;
    font-family: 'Outfit', sans-serif;
}

.chat-header-actions {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

#chat-minimize,
#chat-close {
    background: none;
    border: none;
    color: var(--text-secondary);
    font-size: 1.1rem;
    cursor: pointer;
    padding: 0.4rem;
    border-radius: 6px;
    transition: all 0.2s;
    display: flex;
    align-items: center;
    justify-content: center;
}

#chat-minimize:hover,
#chat-close:hover {
    color: var(--accent-amber);
    background: rgba(255, 157, 0, 0.1);
}

#chat-minimize svg {
    stroke: currentColor;
    transition: transform 0.3s ease;
}

#chat-minimize:hover svg {
    transform: translateX(3px);
}

/* ---- Messages Area ---- */
#chat-messages {
    flex: 1;
    overflow-y: auto;
    padding: 1rem 1.2rem;
    display: flex;
    flex-direction: column;
    gap: 1rem;
    scrollbar-width: thin;
    scrollbar-color: var(--metal-dark) transparent;
}

.chat-msg {
    display: flex;
    flex-direction: column;
    max-width: 80%;
    gap: 0.25rem;
}

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

.chat-msg.user {
    align-self: flex-end;
}

.msg-bubble {
    padding: 0.75rem 1rem;
    border-radius: 12px;
    font-size: 0.9rem;
    line-height: 1.5;
}

.chat-msg.bot .msg-bubble {
    background: var(--metal-dark);
    color: var(--text-primary);
    border-bottom-left-radius: 4px;
}

.chat-msg.user .msg-bubble {
    background: var(--accent-amber);
    color: var(--bg-dark);
    font-weight: 500;
    border-bottom-right-radius: 4px;
}

.msg-time {
    font-size: 0.68rem;
    color: var(--text-secondary);
    padding: 0 0.2rem;
}

.chat-msg.user .msg-time {
    text-align: right;
}

/* ---- Typing Indicator ---- */
.typing-indicator {
    display: flex;
    align-items: center;
    gap: 5px;
    padding: 0.5rem 1.2rem 0;
}

.typing-indicator span {
    width: 8px;
    height: 8px;
    background: var(--text-secondary);
    border-radius: 50%;
    animation: typing-bounce 1.2s infinite;
}

.typing-indicator span:nth-child(2) {
    animation-delay: 0.2s;
}

.typing-indicator span:nth-child(3) {
    animation-delay: 0.4s;
}

@keyframes typing-bounce {

    0%,
    80%,
    100% {
        transform: scale(0.7);
        opacity: 0.5;
    }

    40% {
        transform: scale(1);
        opacity: 1;
    }
}

/* ---- Input Row ---- */
#chat-input-row {
    display: flex;
    align-items: center;
    padding: 0.75rem 1rem;
    border-top: 1px solid rgba(255, 255, 255, 0.06);
    gap: 0.5rem;
}

#chat-input {
    flex: 1;
    background: rgba(255, 255, 255, 0.06);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 8px;
    padding: 0.65rem 0.9rem;
    color: var(--text-primary);
    font-family: 'Outfit', sans-serif;
    font-size: 0.9rem;
    outline: none;
    transition: border-color 0.2s;
}

#chat-input:focus {
    border-color: var(--accent-amber);
}

#chat-input::placeholder {
    color: var(--text-secondary);
}

#chat-send {
    background: var(--accent-amber);
    border: none;
    color: var(--bg-dark);
    font-size: 1rem;
    padding: 0.65rem 0.9rem;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.2s;
    font-weight: 700;
}

#chat-send:hover {
    background: #ffb740;
    transform: scale(1.05);
}

/* ---- Mobile Responsive ---- */
@media (max-width: 500px) {
    #chat-panel {
        width: calc(100vw - 2rem);
        right: 1rem;
        bottom: 5.5rem;
    }

    #chat-btn {
        right: 1rem;
        bottom: 1rem;
    }
}