/**
 * Synofex Chatbot Widget Styles
 * Version: 2.0.0
 * Matches website ChatBot styling exactly
 */

/* Base widget styles */
.synofex-chatbot-widget {
    position: fixed;
    z-index: 9999;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, sans-serif;
}

/* Position variations */
.synofex-widget-bottom-right {
    bottom: 24px;
    right: 24px;
}

.synofex-widget-bottom-left {
    bottom: 24px;
    left: 24px;
}

/* Chat toggle button - Match website styling */
.synofex-chat-toggle {
    width: 56px;
    height: 56px;
    border-radius: 50%;
    background: #6566F1;
    color: white;
    border: none;
    cursor: pointer;
    box-shadow: 0 4px 12px rgba(101, 102, 241, 0.4);
    position: relative;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
}

.synofex-chat-toggle:hover {
    background: #5A5BD8;
    transform: scale(1.05);
    box-shadow: 0 6px 20px rgba(101, 102, 241, 0.5);
}

.synofex-chat-toggle:active {
    transform: scale(0.95);
}

.synofex-chat-icon,
.synofex-close-icon {
    width: 24px;
    height: 24px;
}

/* Emoji icon style */
.synofex-chat-emoji {
    font-size: 24px;
    line-height: 1;
    width: auto;
    height: auto;
}

/* Custom SVG icon style */
.synofex-chat-custom-svg {
    width: 24px;
    height: 24px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.synofex-chat-custom-svg svg {
    width: 24px;
    height: 24px;
}

/* Unread indicator */
.synofex-unread-indicator {
    position: absolute;
    top: -4px;
    right: -4px;
    background: #ef4444;
    color: white;
    border-radius: 10px;
    padding: 2px 6px;
    font-size: 11px;
    font-weight: bold;
    min-width: 18px;
    text-align: center;
}

/* Chat window - Match website styling - Reduced size for better visibility */
.synofex-chat-window {
    position: absolute;
    width: 320px;
    height: 400px;
    max-height: calc(100vh - 120px);
    background: white;
    border-radius: 16px;
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.25);
    border: 1px solid #e5e7eb;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    animation: slideUp 0.3s ease;
}

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

.synofex-widget-bottom-right .synofex-chat-window {
    bottom: 80px;
    right: 0;
}

.synofex-widget-bottom-left .synofex-chat-window {
    bottom: 80px;
    left: 0;
}

/* Chat header - Match website styling */
.synofex-chat-header {
    background: #6566F1;
    color: white;
    padding: 16px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-radius: 16px 16px 0 0;
}

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

.synofex-bot-avatar-container {
    width: 32px;
    height: 32px;
    background: white;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.synofex-bot-avatar-container svg {
    width: 20px;
    height: 20px;
    color: #6566F1;
}

.synofex-bot-avatar {
    width: 32px;
    height: 32px;
    border-radius: 8px;
}

.synofex-chat-header-text h3 {
    margin: 0;
    font-size: 16px;
    font-weight: 600;
}

.synofex-chat-header-text p {
    margin: 0;
    font-size: 12px;
    color: rgba(255, 255, 255, 0.8);
}

.synofex-header-actions {
    display: flex;
    align-items: center;
    gap: 4px;
}

.synofex-header-btn {
    background: transparent;
    border: none;
    color: white;
    cursor: pointer;
    padding: 4px;
    border-radius: 4px;
    transition: background 0.2s;
    display: flex;
    align-items: center;
    justify-content: center;
}

.synofex-header-btn:hover {
    background: rgba(255, 255, 255, 0.1);
}

.synofex-chat-close {
    background: transparent;
    border: none;
    color: white;
    cursor: pointer;
    padding: 4px;
    border-radius: 4px;
    transition: background 0.2s;
}

.synofex-chat-close:hover {
    background: rgba(255, 255, 255, 0.1);
}

/* Chat messages - Match website styling */
.synofex-chat-messages {
    flex: 1;
    overflow-y: auto;
    padding: 16px;
    background: white;
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.synofex-message {
    display: flex;
    gap: 8px;
    align-items: flex-start;
    animation: fadeIn 0.3s ease;
}

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

.synofex-user-message {
    flex-direction: row-reverse;
}

.synofex-message-avatar {
    width: 24px;
    height: 24px;
    border-radius: 50%;
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: center;
}

.synofex-avatar-placeholder {
    width: 24px;
    height: 24px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 12px;
}

.synofex-bot-message .synofex-avatar-placeholder {
    background: white;
    border: 1px solid #e5e7eb;
    color: #6566F1;
}

.synofex-user-message .synofex-avatar-placeholder {
    background: #d1d5db;
    color: #4b5563;
}

.synofex-agent-message .synofex-avatar-placeholder {
    background: #10b981;
    color: white;
}

.synofex-message-content {
    max-width: 80%;
    display: flex;
    flex-direction: column;
}

.synofex-message-bubble {
    padding: 8px 12px;
    border-radius: 16px;
    font-size: 14px;
    line-height: 1.5;
    word-wrap: break-word;
}

.synofex-bot-message .synofex-message-bubble {
    background: #f3f4f6;
    color: #111827;
    border-bottom-left-radius: 4px;
}

.synofex-user-message .synofex-message-bubble {
    background: #6566F1;
    color: white;
    border-bottom-right-radius: 4px;
}

.synofex-agent-message .synofex-message-bubble {
    background: #ecfdf5;
    color: #065f46;
    border: 1px solid #a7f3d0;
    border-bottom-left-radius: 4px;
}

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

.synofex-message-user .synofex-message-time {
    text-align: right;
}

/* Typing indicator - Match website styling */
.synofex-typing-indicator {
    display: flex;
    align-items: flex-start;
    gap: 8px;
    padding: 0;
}

.synofex-typing-avatar {
    width: 24px;
    height: 24px;
    border-radius: 50%;
    background: white;
    border: 1px solid #e5e7eb;
    display: flex;
    align-items: center;
    justify-content: center;
}

.synofex-typing-dots {
    display: flex;
    gap: 4px;
    padding: 8px 12px;
    background: #f3f4f6;
    border-radius: 16px;
    border-bottom-left-radius: 4px;
}

.synofex-typing-dots span {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: #4b5563;
    animation: bounce 1.4s infinite;
}

.synofex-typing-dots span:nth-child(2) {
    animation-delay: 0.1s;
}

.synofex-typing-dots span:nth-child(3) {
    animation-delay: 0.2s;
}

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

/* System notifications - Small style */
.synofex-system-notification {
    text-align: center;
    padding: 8px 0;
}

.synofex-notification-content {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    background: #f3f4f6;
    color: #6b7280;
    padding: 6px 12px;
    border-radius: 16px;
    font-size: 12px;
    font-weight: 500;
}

.synofex-notification-content.notification-human {
    background: #ecfdf5;
    color: #059669;
}

.synofex-notification-content.notification-ai {
    background: #eff6ff;
    color: #3b82f6;
}

/* Chat input section - Match website styling */
.synofex-chat-input-container {
    padding: 12px 16px;
    background: white;
    border-top: 1px solid #e5e7eb;
}

/* Action buttons - Simple text links */
.synofex-action-buttons {
    display: none;
    gap: 16px;
    margin-bottom: 8px;
    justify-content: center;
}

.synofex-action-buttons.visible {
    display: flex;
}

.synofex-action-btn {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 0;
    font-size: 12px;
    font-weight: 500;
    color: #6b7280;
    background: transparent;
    border: none;
    cursor: pointer;
    transition: color 0.2s;
    text-decoration: none;
}

.synofex-action-btn:hover {
    color: #6566F1;
}

.synofex-action-btn svg {
    width: 14px;
    height: 14px;
}

.synofex-action-btn.request-human {
    color: #6b7280;
}

.synofex-action-btn.request-human:hover {
    color: #059669;
}

.synofex-action-btn.report-issue {
    color: #6b7280;
}

.synofex-action-btn.report-issue:hover {
    color: #dc2626;
}

/* Input row with End and Send buttons */
.synofex-input-row {
    display: flex;
    align-items: center;
    gap: 8px;
}

.synofex-chat-form {
    flex: 1;
    margin: 0;
}

.synofex-input-group {
    position: relative;
    display: flex;
    align-items: center;
}

.synofex-chat-input {
    width: 100%;
    border: 1px solid #d1d5db;
    border-radius: 8px;
    padding: 8px 12px;
    resize: none;
    font-family: inherit;
    font-size: 14px;
    outline: none;
    transition: border-color 0.2s;
    color: #111827;
}

.synofex-chat-input::placeholder {
    color: #9ca3af;
}

.synofex-chat-input:focus {
    border-color: #6566F1;
    box-shadow: 0 0 0 2px rgba(101, 102, 241, 0.1);
}

.synofex-end-btn {
    padding: 8px 12px;
    font-size: 12px;
    font-weight: 500;
    color: #4b5563;
    background: #f3f4f6;
    border: 1px solid #d1d5db;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.2s;
    white-space: nowrap;
}

.synofex-end-btn:hover {
    background: #e5e7eb;
}

.synofex-send-button {
    width: 40px;
    height: 40px;
    background: #6566F1;
    border: none;
    border-radius: 8px;
    color: white;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.2s;
    flex-shrink: 0;
}

.synofex-send-button:hover {
    background: #5A5BD8;
}

.synofex-send-button:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.synofex-send-button svg {
    width: 16px;
    height: 16px;
}

/* Footer */
.synofex-footer {
    text-align: center;
    margin-top: 8px;
    font-size: 11px;
    color: #9ca3af;
}

.synofex-footer a {
    color: #9ca3af;
    text-decoration: none;
}

.synofex-footer a:hover {
    color: #6566F1;
}

/* Mode indicator in header */
.synofex-mode-indicator {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 4px 10px;
    border-radius: 12px;
    font-size: 11px;
    font-weight: 500;
    margin-left: 8px;
}

.synofex-mode-indicator.mode-ai {
    background: rgba(255, 255, 255, 0.2);
    color: white;
}

.synofex-mode-indicator.mode-human {
    background: #10b981;
    color: white;
}

.synofex-mode-dot {
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: currentColor;
}

/* Dark theme */
.synofex-theme-dark .synofex-chat-window {
    background: #1f2937;
    border-color: #374151;
}

.synofex-theme-dark .synofex-chat-messages {
    background: #111827;
}

.synofex-theme-dark .synofex-bot-message .synofex-message-bubble {
    background: #374151;
    color: #f3f4f6;
}

.synofex-theme-dark .synofex-chat-input-container {
    background: #1f2937;
    border-top-color: #374151;
}

.synofex-theme-dark .synofex-chat-input {
    background: #374151;
    color: #f3f4f6;
    border-color: #4b5563;
}

.synofex-theme-dark .synofex-chat-input:focus {
    border-color: #6566F1;
}

.synofex-theme-dark .synofex-action-btn {
    background: #374151;
    border-color: #4b5563;
    color: #d1d5db;
}

.synofex-theme-dark .synofex-end-btn {
    background: #374151;
    border-color: #4b5563;
    color: #d1d5db;
}

.synofex-theme-dark .synofex-notification-content {
    background: #374151;
    color: #d1d5db;
}

.synofex-theme-dark .synofex-typing-dots {
    background: #374151;
}

.synofex-theme-dark .synofex-avatar-placeholder {
    background: #374151;
    border-color: #4b5563;
}

/* Responsive design */
@media (max-width: 480px) {
    .synofex-chat-window {
        width: 100vw;
        height: 100vh;
        bottom: 0 !important;
        right: 0 !important;
        left: 0 !important;
        border-radius: 0;
        max-height: 100vh;
    }

    .synofex-chat-header {
        border-radius: 0;
    }

    .synofex-chat-toggle {
        bottom: 20px;
        right: 20px;
    }
}

/* Custom scrollbar */
.synofex-chat-messages::-webkit-scrollbar {
    width: 6px;
}

.synofex-chat-messages::-webkit-scrollbar-track {
    background: transparent;
}

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

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

/* Offline status */
.synofex-status-indicator.synofex-status-offline::before {
    background: #ef4444;
}

/* Disabled chat state */
.synofex-chat-input:disabled {
    background: #f3f4f6;
    color: #9ca3af;
    cursor: not-allowed;
}

.synofex-chat-input:disabled::placeholder {
    color: #9ca3af;
}

/* Small notification style for handoff events */
.synofex-notification {
    display: flex;
    justify-content: center;
    padding: 4px 0;
    animation: fadeIn 0.3s ease;
}

.synofex-notification-text {
    display: inline-block;
    background: linear-gradient(135deg, #f0f9ff 0%, #e0f2fe 100%);
    color: #0369a1;
    padding: 6px 14px;
    border-radius: 20px;
    font-size: 11px;
    font-weight: 500;
    border: 1px solid #bae6fd;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.05);
}

/* System message style (larger than notification) */
.synofex-system-message {
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 8px 0;
    animation: fadeIn 0.3s ease;
}

.synofex-system-content {
    display: flex;
    align-items: center;
    gap: 6px;
    background: #f3f4f6;
    color: #6b7280;
    padding: 8px 16px;
    border-radius: 16px;
    font-size: 13px;
}

.synofex-system-icon {
    font-size: 14px;
}

.synofex-system-text {
    font-weight: 500;
}

/* Dark theme for notifications */
.synofex-theme-dark .synofex-notification-text {
    background: linear-gradient(135deg, #1e3a5f 0%, #1e40af 100%);
    color: #93c5fd;
    border-color: #3b82f6;
}

.synofex-theme-dark .synofex-system-content {
    background: #374151;
    color: #d1d5db;
}

/* Report Issue Form Overlay */
.synofex-report-overlay {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.5);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 100;
    animation: fadeIn 0.2s ease;
}

.synofex-report-form {
    background: white;
    border-radius: 12px;
    padding: 20px;
    width: calc(100% - 40px);
    max-width: 320px;
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.2);
    animation: slideUp 0.3s ease;
}

.synofex-report-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 16px;
}

.synofex-report-header h4 {
    margin: 0;
    font-size: 16px;
    font-weight: 600;
    color: #111827;
}

.synofex-report-close {
    background: transparent;
    border: none;
    color: #6b7280;
    cursor: pointer;
    padding: 4px;
    border-radius: 4px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.synofex-report-close:hover {
    background: #f3f4f6;
    color: #111827;
}

.synofex-report-field {
    margin-bottom: 12px;
}

.synofex-report-field label {
    display: block;
    font-size: 13px;
    font-weight: 500;
    color: #374151;
    margin-bottom: 4px;
}

.synofex-report-field label .required {
    color: #dc2626;
}

.synofex-report-field input,
.synofex-report-field textarea {
    width: 100%;
    padding: 8px 12px;
    border: 1px solid #d1d5db;
    border-radius: 6px;
    font-size: 14px;
    font-family: inherit;
    color: #111827;
    transition: border-color 0.2s, box-shadow 0.2s;
    box-sizing: border-box;
}

.synofex-report-field input:focus,
.synofex-report-field textarea:focus {
    outline: none;
    border-color: #6566F1;
    box-shadow: 0 0 0 2px rgba(101, 102, 241, 0.1);
}

.synofex-report-field input.error,
.synofex-report-field textarea.error {
    border-color: #dc2626;
}

.synofex-report-field .error-message {
    font-size: 11px;
    color: #dc2626;
    margin-top: 4px;
}

.synofex-report-field textarea {
    min-height: 80px;
    resize: vertical;
}

.synofex-report-actions {
    display: flex;
    gap: 8px;
    margin-top: 16px;
}

.synofex-report-cancel {
    flex: 1;
    padding: 8px 16px;
    background: #f3f4f6;
    border: 1px solid #d1d5db;
    border-radius: 6px;
    color: #374151;
    font-size: 13px;
    font-weight: 500;
    cursor: pointer;
    transition: background 0.2s;
}

.synofex-report-cancel:hover {
    background: #e5e7eb;
}

.synofex-report-submit {
    flex: 1;
    padding: 8px 16px;
    background: #6566F1;
    border: none;
    border-radius: 6px;
    color: white;
    font-size: 13px;
    font-weight: 500;
    cursor: pointer;
    transition: background 0.2s;
}

.synofex-report-submit:hover {
    background: #5A5BD8;
}

.synofex-report-submit:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

/* Dark theme for report form */
.synofex-theme-dark .synofex-report-form {
    background: #1f2937;
}

.synofex-theme-dark .synofex-report-header h4 {
    color: #f3f4f6;
}

.synofex-theme-dark .synofex-report-field label {
    color: #d1d5db;
}

.synofex-theme-dark .synofex-report-field input,
.synofex-theme-dark .synofex-report-field textarea {
    background: #374151;
    border-color: #4b5563;
    color: #f3f4f6;
}

.synofex-theme-dark .synofex-report-cancel {
    background: #374151;
    border-color: #4b5563;
    color: #d1d5db;
}
