/**
 * Synofex Chatbot Widget Styles
 * Version: 1.0.0
 */

/* 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: 20px;
    right: 20px;
}

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

/* Chat toggle button */
.synofex-chat-toggle {
    width: 56px;
    height: 56px;
    border-radius: 50%;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border: none;
    cursor: pointer;
    box-shadow: 0 4px 12px rgba(0,0,0,0.15);
    position: relative;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
}

.synofex-chat-toggle:hover {
    transform: scale(1.05);
    box-shadow: 0 6px 20px rgba(0,0,0,0.25);
}

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

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

/* Chat window */
.synofex-chat-window {
    position: absolute;
    width: 380px;
    height: 600px;
    background: white;
    border-radius: 12px;
    box-shadow: 0 5px 40px rgba(0,0,0,0.16);
    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 */
.synofex-chat-header {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    padding: 16px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

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

.synofex-bot-avatar {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    border: 2px solid rgba(255,255,255,0.3);
}

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

.synofex-status-indicator {
    font-size: 12px;
    opacity: 0.9;
    display: flex;
    align-items: center;
    gap: 4px;
}

.synofex-status-indicator::before {
    content: '';
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: #4ade80;
    display: inline-block;
}

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

.synofex-chat-close:hover {
    opacity: 0.8;
}

/* Chat messages */
.synofex-chat-messages {
    flex: 1;
    overflow-y: auto;
    padding: 20px;
    background: #f8f9fa;
}

.synofex-message {
    margin-bottom: 16px;
    animation: fadeIn 0.3s ease;
}

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

.synofex-message-content {
    padding: 12px 16px;
    border-radius: 18px;
    max-width: 70%;
    word-wrap: break-word;
    position: relative;
}

.synofex-message-bot .synofex-message-content {
    background: white;
    color: #333;
    margin-right: auto;
    border-bottom-left-radius: 4px;
}

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

.synofex-message-time {
    font-size: 11px;
    color: #999;
    margin-top: 4px;
    display: block;
}

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

/* Typing indicator */
.synofex-typing-indicator {
    padding: 0 20px;
    display: flex;
    align-items: center;
    gap: 4px;
}

.synofex-typing-indicator span {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: #999;
    animation: typing 1.4s infinite;
}

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

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

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

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

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

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

.synofex-chat-input {
    width: 100%;
    border: 1px solid #e5e7eb;
    border-radius: 24px;
    padding: 10px 48px 10px 16px;
    resize: none;
    font-family: inherit;
    font-size: 14px;
    outline: none;
    transition: border-color 0.2s;
}

.synofex-chat-input:focus {
    border-color: #667eea;
}

.synofex-send-button {
    position: absolute;
    right: 8px;
    background: transparent;
    border: none;
    color: #667eea;
    cursor: pointer;
    padding: 8px;
    transition: color 0.2s;
}

.synofex-send-button:hover {
    color: #764ba2;
}

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

/* Powered by */
.synofex-powered-by {
    text-align: center;
    margin-top: 8px;
    font-size: 11px;
}

.synofex-powered-by a {
    color: #999;
    text-decoration: none;
    transition: color 0.2s;
}

.synofex-powered-by a:hover {
    color: #667eea;
}

/* Dark theme */
.synofex-theme-dark .synofex-chat-window {
    background: #1a1a1a;
}

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

.synofex-theme-dark .synofex-message-bot .synofex-message-content {
    background: #2a2a2a;
    color: #e5e5e5;
}

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

.synofex-theme-dark .synofex-chat-input {
    background: #2a2a2a;
    color: #e5e5e5;
    border-color: #333;
}

.synofex-theme-dark .synofex-chat-input:focus {
    border-color: #667eea;
}

/* 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-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: #cbd5e1;
    border-radius: 3px;
}

.synofex-chat-messages::-webkit-scrollbar-thumb:hover {
    background: #94a3b8;
}