/* =====================================================
   REPLIX CHAT WIDGET - Tawk.to Style
   ===================================================== */

/* Widget Container */
#replix-chat-widget {
    position: fixed;
    bottom: 20px;
    right: 20px;
    z-index: 999999;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
}

/* Chat Button (Minimized State) */
#replix-chat-button {
    width: 60px;
    height: 60px;
    border-radius: 50%;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s ease;
    border: none;
    outline: none;
}

#replix-chat-button:hover {
    transform: scale(1.1);
    box-shadow: 0 6px 16px rgba(0, 0, 0, 0.2);
}

#replix-chat-button svg {
    width: 28px;
    height: 28px;
    color: white;
}

/* Unread Badge */
#replix-chat-badge {
    position: absolute;
    top: -5px;
    right: -5px;
    background: #ef4444;
    color: white;
    border-radius: 50%;
    width: 22px;
    height: 22px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 11px;
    font-weight: bold;
    display: none;
}

/* Chat Window */
#replix-chat-window {
    position: fixed;
    bottom: 90px;
    right: 20px;
    width: 380px;
    height: 600px;
    max-height: calc(100vh - 120px);
    background: white;
    border-radius: 16px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.12);
    display: none;
    flex-direction: column;
    overflow: hidden;
    animation: slideUp 0.3s ease;
}

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

#replix-chat-window.active {
    display: flex;
}

/* Chat Header */
#replix-chat-header {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    padding: 20px;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

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

#replix-chat-avatar {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.2);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 18px;
}

#replix-chat-title {
    font-size: 16px;
    font-weight: 600;
    margin: 0;
}

#replix-chat-status {
    font-size: 12px;
    opacity: 0.9;
    margin: 2px 0 0 0;
}

#replix-chat-close {
    background: transparent;
    border: none;
    color: white;
    cursor: pointer;
    padding: 5px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 4px;
    transition: background 0.2s;
}

#replix-chat-close:hover {
    background: rgba(255, 255, 255, 0.1);
}

#replix-chat-close svg {
    width: 20px;
    height: 20px;
}

/* Contact Form (Initial State) */
#replix-contact-form {
    padding: 24px;
    display: flex;
    flex-direction: column;
    gap: 16px;
    flex: 1;
    overflow-y: auto;
}

#replix-contact-form h3 {
    margin: 0 0 8px 0;
    font-size: 18px;
    color: #1f2937;
}

#replix-contact-form p {
    margin: 0 0 16px 0;
    font-size: 14px;
    color: #6b7280;
}

.replix-form-group {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.replix-form-group label {
    font-size: 13px;
    font-weight: 500;
    color: #374151;
}

.replix-form-group input {
    padding: 10px 12px;
    border: 1px solid #d1d5db;
    border-radius: 8px;
    font-size: 14px;
    transition: border-color 0.2s;
}

.replix-form-group input:focus {
    outline: none;
    border-color: #667eea;
}

.replix-form-note {
    font-size: 12px;
    color: #9ca3af;
    margin-top: -10px;
}

#replix-contact-submit {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border: none;
    padding: 12px;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: transform 0.2s;
    margin-top: 8px;
}

#replix-contact-submit:hover:not(:disabled) {
    transform: translateY(-1px);
}

#replix-contact-submit:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

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

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

/* Message Bubble */
.replix-message {
    display: flex;
    gap: 8px;
    animation: fadeIn 0.3s ease;
}

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

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

.replix-message-content {
    max-width: 75%;
    padding: 10px 14px;
    border-radius: 12px;
    font-size: 14px;
    line-height: 1.5;
    word-wrap: break-word;
}

.replix-message.ai .replix-message-content {
    background: white;
    color: #1f2937;
    border-bottom-left-radius: 4px;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.05);
}

.replix-message.user .replix-message-content {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border-bottom-right-radius: 4px;
}

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

/* Typing Indicator */
.replix-typing {
    display: none;
    align-items: center;
    gap: 8px;
    padding: 10px 14px;
    background: white;
    border-radius: 12px;
    max-width: 75px;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.05);
}

.replix-typing.active {
    display: flex;
}

.replix-typing-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: #9ca3af;
    animation: typing 1.4s infinite;
}

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

.replix-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;
    }
}

/* Chat Input */
#replix-chat-input-container {
    padding: 16px;
    background: white;
    border-top: 1px solid #e5e7eb;
    display: none;
}

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

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

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

#replix-chat-input:focus {
    outline: none;
    border-color: #667eea;
}

#replix-chat-send {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    border: none;
    border-radius: 8px;
    padding: 0 16px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: transform 0.2s;
}

#replix-chat-send:hover:not(:disabled) {
    transform: scale(1.05);
}

#replix-chat-send:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

#replix-chat-send svg {
    width: 20px;
    height: 20px;
    color: white;
}

/* Scrollbar Styling */
#replix-chat-messages::-webkit-scrollbar,
#replix-contact-form::-webkit-scrollbar {
    width: 6px;
}

#replix-chat-messages::-webkit-scrollbar-track,
#replix-contact-form::-webkit-scrollbar-track {
    background: transparent;
}

#replix-chat-messages::-webkit-scrollbar-thumb,
#replix-contact-form::-webkit-scrollbar-thumb {
    background: #d1d5db;
    border-radius: 3px;
}

#replix-chat-messages::-webkit-scrollbar-thumb:hover,
#replix-contact-form::-webkit-scrollbar-thumb:hover {
    background: #9ca3af;
}

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

    #replix-chat-window {
        width: calc(100vw - 20px);
        height: calc(100vh - 80px);
        max-height: calc(100vh - 80px);
        bottom: 70px;
        right: 10px;
    }

    #replix-chat-button {
        width: 56px;
        height: 56px;
    }
}

/* Error Message */
.replix-error {
    background: #fee2e2;
    color: #dc2626;
    padding: 12px;
    border-radius: 8px;
    font-size: 13px;
    margin-bottom: 12px;
    display: none;
}

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