/* ========================================
   POFSTUDIO Chat Widget Styles
   ======================================== */

/* Chat Toggle Button */
.chat-toggle {
    position: fixed;
    bottom: 30px;
    right: 30px;
    width: 60px;
    height: 60px;
    background: linear-gradient(135deg, var(--color-terracotta), var(--color-coral));
    border: none;
    border-radius: 50%;
    cursor: pointer;
    box-shadow: 0 4px 20px rgba(196, 164, 132, 0.4);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.8rem;
    transition: all 0.3s ease;
    z-index: 1000;
}

.chat-toggle:hover {
    transform: scale(1.1);
    box-shadow: 0 6px 25px rgba(196, 164, 132, 0.5);
}

.chat-toggle.active {
    background: var(--color-dusty-rose);
}

/* Chat Popup */
.chat-popup {
    position: fixed;
    bottom: 100px;
    right: 30px;
    width: 380px;
    max-width: calc(100vw - 40px);
    height: 500px;
    max-height: calc(100vh - 150px);
    background: var(--color-bg-primary);
    border-radius: var(--radius-xl);
    box-shadow: 0 10px 40px rgba(92, 64, 51, 0.2);
    display: flex;
    flex-direction: column;
    overflow: hidden;
    z-index: 999;
    opacity: 0;
    transform: translateY(20px) scale(0.95);
    pointer-events: none;
    transition: all 0.3s ease;
}

.chat-popup.active {
    opacity: 1;
    transform: translateY(0) scale(1);
    pointer-events: all;
}

/* Chat Header */
.chat-header {
    background: linear-gradient(135deg, var(--color-sage), var(--color-sage-light));
    color: white;
    padding: 16px 20px;
    display: flex;
    align-items: center;
    gap: 12px;
}

.chat-avatar {
    width: 45px;
    height: 45px;
    background: rgba(255, 255, 255, 0.2);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.5rem;
}

.chat-info h3 {
    font-family: var(--font-heading);
    font-size: 1.1rem;
    margin: 0;
    color: white;
}

.chat-info p {
    font-size: 0.8rem;
    opacity: 0.9;
    margin: 0;
}

.chat-close {
    margin-left: auto;
    background: rgba(255, 255, 255, 0.2);
    border: none;
    width: 32px;
    height: 32px;
    border-radius: 50%;
    color: white;
    font-size: 1.2rem;
    cursor: pointer;
    transition: var(--transition-fast);
}

.chat-close:hover {
    background: rgba(255, 255, 255, 0.3);
}

/* Chat Messages */
.chat-messages {
    flex: 1;
    overflow-y: auto;
    padding: 16px;
    display: flex;
    flex-direction: column;
    gap: 12px;
    background: var(--color-bg-secondary);
}

.chat-message {
    max-width: 85%;
    padding: 12px 16px;
    border-radius: 18px;
    font-size: 0.95rem;
    line-height: 1.5;
    animation: messageIn 0.3s ease;
}

@keyframes messageIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.chat-message.bot {
    background: var(--color-bg-primary);
    border-bottom-left-radius: 4px;
    align-self: flex-start;
    box-shadow: var(--shadow-sm);
}

.chat-message.user {
    background: linear-gradient(135deg, var(--color-terracotta), var(--color-coral));
    color: white;
    border-bottom-right-radius: 4px;
    align-self: flex-end;
}

.typing-indicator {
    display: flex;
    gap: 4px;
    padding: 8px 0;
}

.typing-indicator span {
    width: 8px;
    height: 8px;
    background: var(--color-terracotta);
    border-radius: 50%;
    animation: typing 1.4s infinite ease-in-out;
}

.typing-indicator span:nth-child(1) {
    animation-delay: 0s;
}

.typing-indicator span:nth-child(2) {
    animation-delay: 0.2s;
}

.typing-indicator span:nth-child(3) {
    animation-delay: 0.4s;
}

@keyframes typing {

    0%,
    60%,
    100% {
        transform: translateY(0);
        opacity: 0.5;
    }

    30% {
        transform: translateY(-8px);
        opacity: 1;
    }
}

/* Chat Input */
.chat-input-container {
    padding: 12px 16px;
    background: var(--color-bg-primary);
    border-top: 1px solid var(--color-beige);
    display: flex;
    gap: 10px;
}

.chat-input {
    flex: 1;
    padding: 12px 16px;
    border: 2px solid var(--color-beige);
    border-radius: var(--radius-full);
    font-family: var(--font-body);
    font-size: 0.95rem;
    background: var(--color-bg-secondary);
    transition: var(--transition-fast);
}

.chat-input:focus {
    outline: none;
    border-color: var(--color-sage);
    background: var(--color-bg-primary);
}

.chat-send {
    width: 45px;
    height: 45px;
    background: linear-gradient(135deg, var(--color-sage), var(--color-sage-light));
    border: none;
    border-radius: 50%;
    color: white;
    font-size: 1.2rem;
    cursor: pointer;
    transition: var(--transition-fast);
    display: flex;
    align-items: center;
    justify-content: center;
}

.chat-send:hover {
    transform: scale(1.05);
    box-shadow: var(--shadow-md);
}

/* Footer Login Link */
.footer-admin-link {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    margin-top: 16px;
    padding: 6px 14px;
    background: rgba(255, 255, 255, 0.1);
    border-radius: var(--radius-full);
    font-size: 0.8rem;
    color: rgba(255, 255, 255, 0.6);
    transition: var(--transition-fast);
}

.footer-admin-link:hover {
    background: rgba(255, 255, 255, 0.2);
    color: rgba(255, 255, 255, 0.9);
}

/* Responsive */
@media (max-width: 480px) {
    .chat-toggle {
        bottom: 20px;
        right: 20px;
        width: 55px;
        height: 55px;
    }

    .chat-popup {
        bottom: 85px;
        right: 10px;
        left: 10px;
        width: auto;
        height: 450px;
    }
}