/* chat.css - Chat widget styles */

/* Chat Widget Button - Hidden since Kardo handles chat now */
#chat-widget-button {
    position: fixed;
    bottom: 20px;
    right: 20px;
    width: 60px;
    height: 60px;
    border-radius: 50%;
    background: #eab308; /* Yellow-500 */
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    cursor: pointer;
    display: none !important; /* Hidden - Kardo widget replaces this */
    align-items: center;
    justify-content: center;
    z-index: 9998;
    transition: all 0.3s ease;
}

#chat-widget-button:hover {
    transform: scale(1.1);
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.2);
    background: #ca8a04; /* Yellow-600 */
}

#chat-widget-button i {
    color: #1f2937; /* Gray-800 */
    font-size: 28px;
}

#chat-widget-button.minimized {
    animation: pulse 2s infinite;
}

@keyframes pulse {
    0%, 100% { transform: scale(1); }
    50% { transform: scale(1.05); }
}

/* Notification Badge */
#chat-widget-badge {
    position: absolute;
    top: -5px;
    right: -5px;
    background-color: #ef4444;
    color: white;
    border-radius: 50%;
    width: 24px;
    height: 24px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 12px;
    font-weight: bold;
    border: 2px solid white;
}

/* Chat Window Container */
#chat-window {
    position: fixed;
    bottom: 90px;
    right: 20px;
    width: 380px;
    height: 550px;
    background: white;
    border-radius: 12px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.2);
    z-index: 9999;
    display: none;
    flex-direction: column;
    overflow: hidden;
    border: 1px solid #e5e7eb;
}

#chat-window.open {
    display: flex;
    animation: slideUp 0.3s ease-out;
}

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

/* Chat Header */
#chat-header {
    background: #1f2937; /* Gray-800 */
    color: white;
    padding: 16px 20px;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

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

#chat-avatar {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background-color: rgba(255, 255, 255, 0.1);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 20px;
    color: #eab308; /* Yellow-500 */
}

#chat-header-text h3 {
    font-size: 16px;
    font-weight: 600;
    margin: 0;
    color: white;
}

#chat-header-text p {
    font-size: 12px;
    margin: 2px 0 0 0;
    opacity: 0.8;
    color: #d1d5db; /* Gray-300 */
}

#chat-header-actions {
    display: flex;
    gap: 8px;
}

.chat-header-btn {
    background: rgba(255, 255, 255, 0.1);
    border: none;
    color: #d1d5db;
    width: 32px;
    height: 32px;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
}

.chat-header-btn:hover {
    background: rgba(255, 255, 255, 0.2);
    color: white;
}

/* Pre-chat Form */
#chat-pre-form {
    padding: 24px;
    display: flex;
    flex-direction: column;
    height: 100%;
}

#chat-pre-form h3 {
    font-size: 18px;
    font-weight: 600;
    margin-bottom: 8px;
    color: #1f2937;
}

#chat-pre-form p {
    font-size: 14px;
    color: #6b7280;
    margin-bottom: 20px;
}

.chat-form-group {
    margin-bottom: 16px;
}

.chat-form-group label {
    display: block;
    font-size: 14px;
    font-weight: 500;
    color: #374151;
    margin-bottom: 6px;
}

.chat-form-group input,
.chat-form-group textarea {
    width: 100%;
    padding: 10px 12px;
    border: 1px solid #d1d5db;
    border-radius: 6px;
    font-size: 14px;
    font-family: inherit;
    transition: border-color 0.2s;
}

.chat-form-group input:focus,
.chat-form-group textarea:focus {
    outline: none;
    border-color: #eab308; /* Yellow-500 */
    box-shadow: 0 0 0 2px rgba(234, 179, 8, 0.1);
}

.chat-form-group textarea {
    resize: vertical;
    min-height: 80px;
}

#chat-start-btn {
    background: #eab308; /* Yellow-500 */
    color: #1f2937; /* Gray-800 */
    border: none;
    padding: 12px 24px;
    border-radius: 6px;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    transition: transform 0.2s, background-color 0.2s;
    margin-top: auto;
}

#chat-start-btn:hover:not(:disabled) {
    transform: translateY(-2px);
    background: #ca8a04; /* Yellow-600 */
}

#chat-start-btn:disabled {
    opacity: 0.6;
    cursor: not-allowed;
    background: #d1d5db;
}

/* Messages Area */
#chat-messages-container {
    flex: 1;
    overflow-y: auto;
    padding: 20px;
    background-color: #f9fafb;
    display: none;
    flex-direction: column;
    gap: 12px;
}

#chat-messages-container.active {
    display: flex;
}

/* Scrollbar styling */
#chat-messages-container::-webkit-scrollbar {
    width: 6px;
}

#chat-messages-container::-webkit-scrollbar-track {
    background: #f1f1f1;
}

#chat-messages-container::-webkit-scrollbar-thumb {
    background: #d1d5db;
    border-radius: 3px;
}

#chat-messages-container::-webkit-scrollbar-thumb:hover {
    background: #9ca3af;
}

/* Message Bubble */
.chat-message {
    display: flex;
    align-items: flex-end;
    gap: 8px;
    animation: fadeIn 0.3s ease-out;
}

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

.chat-message.visitor {
    flex-direction: row-reverse;
}

.chat-message-bubble {
    max-width: 75%;
    padding: 10px 14px;
    border-radius: 16px;
    word-wrap: break-word;
}

.chat-message.admin .chat-message-bubble,
.chat-message.system .chat-message-bubble {
    background-color: #1f2937; /* Gray-800 */
    color: white;
    border-bottom-left-radius: 4px;
}

.chat-message.visitor .chat-message-bubble {
    background-color: white;
    color: #1f2937;
    border: 1px solid #e5e7eb;
    border-bottom-right-radius: 4px;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.05);
}

.chat-message-text {
    font-size: 14px;
    line-height: 1.5;
    margin: 0;
}

.chat-message-time {
    font-size: 11px;
    color: #9ca3af;
    margin-top: 4px;
    display: block;
}

.chat-message.admin .chat-message-time,
.chat-message.system .chat-message-time {
    color: rgba(255, 255, 255, 0.6);
}

/* Typing Indicator */
.chat-typing-indicator {
    display: none;
    align-items: center;
    gap: 8px;
    padding: 10px 14px;
    background-color: #1f2937; /* Gray-800 */
    color: white;
    border-radius: 16px;
    border-bottom-left-radius: 4px;
    max-width: 75%;
}

.chat-typing-indicator.active {
    display: flex;
}

.chat-typing-dot {
    width: 8px;
    height: 8px;
    background-color: #eab308; /* Yellow-500 */
    border-radius: 50%;
    animation: typing 1.4s infinite;
}

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

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

@keyframes typing {
    0%, 60%, 100% { transform: translateY(0); opacity: 0.7; }
    30% { transform: translateY(-10px); opacity: 1; }
}

/* Input Area */
#chat-input-area {
    border-top: 1px solid #e5e7eb;
    padding: 16px;
    background-color: white;
    display: none;
}

#chat-input-area.active {
    display: block;
}

#chat-input-form {
    display: flex;
    gap: 8px;
}

#chat-message-input {
    flex: 1;
    padding: 10px 14px;
    border: 1px solid #d1d5db;
    border-radius: 20px;
    font-size: 14px;
    font-family: inherit;
    resize: none;
    max-height: 100px;
    overflow-y: auto;
}

#chat-message-input:focus {
    outline: none;
    border-color: #eab308; /* Yellow-500 */
    box-shadow: 0 0 0 2px rgba(234, 179, 8, 0.1);
}

#chat-send-btn {
    background: #eab308; /* Yellow-500 */
    color: #1f2937; /* Gray-800 */
    border: none;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: transform 0.2s, background-color 0.2s;
    flex-shrink: 0;
}

#chat-send-btn:hover:not(:disabled) {
    transform: scale(1.1);
    background: #ca8a04; /* Yellow-600 */
}

#chat-send-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    background: #d1d5db;
}

/* Mobile Responsive */
@media (max-width: 640px) {
    #chat-window {
        bottom: 0;
        right: 0;
        left: 0;
        width: 100%;
        height: 100%;
        max-height: 100vh;
        border-radius: 0;
    }

    #chat-widget-button {
        bottom: 15px;
        right: 15px;
        width: 56px;
        height: 56px;
    }

    #chat-widget-button i {
        font-size: 24px;
    }

    .chat-message-bubble {
        max-width: 85%;
    }
}

/* Loading Spinner */
.chat-loading {
    display: inline-block;
    width: 16px;
    height: 16px;
    border: 2px solid rgba(31, 41, 55, 0.3);
    border-top-color: #1f2937;
    border-radius: 50%;
    animation: spin 0.6s linear infinite;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

/* Error Message */
.chat-error {
    background-color: #fee2e2;
    color: #b91c1c;
    padding: 10px;
    border-radius: 6px;
    font-size: 13px;
    margin-bottom: 10px;
    display: none;
    border: 1px solid #fecaca;
}

.chat-error.active {
    display: block;
}

/* System Messages (Join notifications) */
.chat-system-message {
    text-align: center;
    color: #9ca3af;
    font-size: 13px;
    padding: 12px 0;
    margin: 8px 0;
}

/* Message Sender Name */
.chat-message-sender {
    font-size: 11px;
    font-weight: 600;
    margin-bottom: 4px;
    opacity: 0.8;
}

.chat-message.admin .chat-message-sender {
    color: rgba(255, 255, 255, 0.9);
}

.chat-message.visitor .chat-message-sender {
    color: #6b7280;
}

/* Loader */
.chat-loader {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 40px 20px;
    gap: 12px;
}

.chat-loader-spinner {
    width: 40px;
    height: 40px;
    border: 3px solid #e5e7eb;
    border-top-color: #eab308;
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

.chat-loader-text {
    font-size: 14px;
    color: #6b7280;
    font-weight: 500;
}
