/* Chat Widget Styles */
.chat-widget {
    position: fixed;
    bottom: 20px;
    right: 20px;
    z-index: 9999;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, sans-serif;
}

/* Toggle Button */
.chat-toggle-btn {
    width: 60px;
    height: 60px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--primary-color, #FF5A5F) 0%, var(--primary-light, #ff8a8d) 100%);
    border: none;
    color: white;
    font-size: 24px;
    cursor: pointer;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.2);
    transition: all 0.3s ease;
    position: relative;
}

.chat-toggle-btn:hover {
    transform: scale(1.1);
    box-shadow: 0 6px 25px rgba(0, 0, 0, 0.25);
}

.chat-badge {
    position: absolute;
    top: -5px;
    right: -5px;
    background: #ef4444;
    color: white;
    font-size: 12px;
    font-weight: 600;
    min-width: 20px;
    height: 20px;
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0 6px;
}

/* Chat Box */
.chat-box {
    position: absolute;
    bottom: 80px;
    right: 0;
    width: 370px;
    max-width: calc(100vw - 40px);
    height: 500px;
    max-height: calc(100vh - 120px);
    background: white;
    border-radius: 16px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.15);
    display: flex;
    flex-direction: column;
    overflow: hidden;
    animation: chatSlideUp 0.3s ease;
}

@keyframes chatSlideUp {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Chat Header */
.chat-header {
    background: linear-gradient(135deg, var(--primary-color, #FF5A5F) 0%, var(--primary-light, #ff8a8d) 100%);
    color: white;
    padding: 16px;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.chat-header-info {
    display: flex;
    align-items: center;
    gap: 12px;
}

.chat-header-info > i {
    font-size: 28px;
}

.chat-header-info h4 {
    margin: 0;
    font-size: 16px;
    font-weight: 600;
}

.chat-status {
    font-size: 12px;
    opacity: 0.9;
}

.chat-header-actions {
    display: flex;
    align-items: center;
    gap: 8px;
}

.chat-close-btn,
.chat-disconnect-btn {
    background: rgba(255, 255, 255, 0.2);
    border: none;
    color: white;
    width: 32px;
    height: 32px;
    border-radius: 50%;
    cursor: pointer;
    transition: background 0.2s;
}

.chat-close-btn:hover,
.chat-disconnect-btn:hover {
    background: rgba(255, 255, 255, 0.3);
}

.chat-disconnect-btn {
    background: rgba(239, 68, 68, 0.3);
}

.chat-disconnect-btn:hover {
    background: rgba(239, 68, 68, 0.5);
}

/* Start Form */
.chat-start-form {
    flex: 1;
    padding: 20px;
    display: flex;
    flex-direction: column;
    gap: 12px;
    overflow-y: auto;
}

.chat-start-form p {
    margin: 0;
    color: #64748b;
    font-size: 14px;
}

.chat-start-form input,
.chat-start-form textarea {
    width: 100%;
    padding: 12px;
    border: 2px solid #e2e8f0;
    border-radius: 8px;
    font-size: 14px;
    transition: border-color 0.2s;
}

.chat-start-form input:focus,
.chat-start-form textarea:focus {
    outline: none;
    border-color: var(--primary-color, #FF5A5F);
}

.chat-submit-btn {
    background: var(--primary-color, #FF5A5F);
    color: white;
    border: none;
    padding: 12px 20px;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
}

.chat-submit-btn:hover {
    background: var(--primary-hover, #e04e52);
}

/* Messages Container */
.chat-messages {
    flex: 1;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.chat-messages-list {
    flex: 1;
    overflow-y: auto;
    padding: 16px;
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.chat-welcome {
    text-align: center;
    padding: 30px 20px;
    color: #64748b;
}

.chat-welcome i {
    font-size: 40px;
    color: var(--primary-color, #FF5A5F);
    margin-bottom: 12px;
}

.chat-welcome p {
    margin: 0;
}

/* Message Bubbles */
.chat-message {
    max-width: 80%;
    padding: 10px 14px;
    border-radius: 12px;
    font-size: 14px;
    line-height: 1.5;
    position: relative;
}

.chat-message.user,
.chat-message.guest {
    background: linear-gradient(135deg, var(--primary-color, #FF5A5F) 0%, var(--primary-light, #ff8a8d) 100%);
    color: white;
    align-self: flex-end;
    border-bottom-right-radius: 4px;
}

.chat-message.admin {
    background: #f1f5f9;
    color: #1a202c;
    align-self: flex-start;
    border-bottom-left-radius: 4px;
}

.chat-message-time {
    font-size: 10px;
    opacity: 0.7;
    margin-top: 4px;
    display: block;
}

/* Input Area */
.chat-input-area {
    padding: 12px;
    border-top: 1px solid #e2e8f0;
    display: flex;
    gap: 8px;
    background: #f8fafc;
}

.chat-input-area input {
    flex: 1;
    padding: 12px 16px;
    border: 2px solid #e2e8f0;
    border-radius: 24px;
    font-size: 14px;
    transition: border-color 0.2s;
}

.chat-input-area input:focus {
    outline: none;
    border-color: var(--primary-color, #FF5A5F);
}

.chat-send-btn {
    width: 44px;
    height: 44px;
    border-radius: 50%;
    background: var(--primary-color, #FF5A5F);
    border: none;
    color: white;
    cursor: pointer;
    transition: all 0.2s;
    display: flex;
    align-items: center;
    justify-content: center;
}

.chat-send-btn:hover {
    background: var(--primary-hover, #e04e52);
    transform: scale(1.05);
}

.chat-send-btn:disabled {
    background: #cbd5e1;
    cursor: not-allowed;
}

/* Typing indicator */
.chat-typing {
    display: flex;
    align-items: center;
    gap: 4px;
    padding: 10px 14px;
    background: #f1f5f9;
    border-radius: 12px;
    align-self: flex-start;
    border-bottom-left-radius: 4px;
}

.chat-typing span {
    width: 8px;
    height: 8px;
    background: #94a3b8;
    border-radius: 50%;
    animation: chatTyping 1.4s infinite;
}

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

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

@keyframes chatTyping {
    0%, 60%, 100% {
        transform: translateY(0);
    }
    30% {
        transform: translateY(-4px);
    }
}

/* Mobile Responsive */
@media (max-width: 480px) {
    .chat-widget {
        bottom: 10px;
        right: 10px;
    }

    .chat-toggle-btn {
        width: 50px;
        height: 50px;
        font-size: 20px;
    }

    .chat-box {
        width: calc(100vw - 20px);
        height: calc(100vh - 80px);
        bottom: 70px;
        right: 0;
        border-radius: 12px;
    }
}
