/**
 * Livechat Widget Styles
 */

/* Chat Toggle Button (Floating) */
.chat-toggle-btn {
    position: fixed;
    bottom: 20px;
    right: 20px;
    width: 60px;
    height: 60px;
    border-radius: 50%;
    background: var(--accent-blue, #0066cc);
    color: white;
    border: none;
    box-shadow: 0 4px 12px rgba(0, 102, 204, 0.3);
    cursor: pointer;
    z-index: 1000;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 24px;
    transition: all 0.3s ease;
}

.chat-toggle-btn:hover {
    background: var(--accent-blue-dark, #0052a3);
    transform: scale(1.1);
    box-shadow: 0 6px 16px rgba(0, 102, 204, 0.4);
}

.chat-toggle-btn.chat-active {
    background: var(--accent-orange, #ff6b35);
}

.chat-toggle-btn .chat-badge {
    position: absolute;
    top: -5px;
    right: -5px;
    background: #ff4444;
    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 Widget Container */
.chat-widget {
    position: fixed;
    bottom: 90px;
    right: 20px;
    width: 380px;
    max-width: calc(100vw - 40px);
    height: 600px;
    max-height: calc(100vh - 120px);
    background: var(--bg-primary, #ffffff);
    border-radius: 12px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.15);
    display: flex;
    flex-direction: column;
    z-index: 999;
    opacity: 0;
    transform: translateY(20px) scale(0.95);
    pointer-events: none;
    transition: all 0.3s ease;
    border: 1px solid var(--border, #e0e0e0);
}

.chat-widget.chat-open {
    opacity: 1;
    transform: translateY(0) scale(1);
    pointer-events: all;
}

.chat-widget.chat-minimized {
    height: 60px;
    overflow: hidden;
}

/* Chat Header */
.chat-header {
    background: var(--accent-blue, #0066cc);
    color: white;
    padding: 16px;
    border-radius: 12px 12px 0 0;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.chat-header-content {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.chat-header-content h6 {
    color: white;
    margin: 0;
    font-weight: 600;
}

.chat-status {
    font-size: 12px;
    opacity: 0.9;
    display: flex;
    align-items: center;
    gap: 6px;
}

.chat-status i {
    font-size: 8px;
    color: #4ade80;
}

.chat-header-actions {
    display: flex;
    gap: 8px;
}

.chat-btn-icon {
    background: transparent;
    border: none;
    color: white;
    cursor: pointer;
    padding: 4px 8px;
    border-radius: 4px;
    transition: background 0.2s ease;
    font-size: 18px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.chat-btn-icon:hover {
    background: rgba(255, 255, 255, 0.2);
}

/* Chat Body */
.chat-body {
    flex: 1;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    background: var(--bg-secondary, #f8f9fa);
}

.chat-messages {
    flex: 1;
    overflow-y: auto;
    padding: 16px;
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.chat-messages::-webkit-scrollbar {
    width: 6px;
}

.chat-messages::-webkit-scrollbar-track {
    background: transparent;
}

.chat-messages::-webkit-scrollbar-thumb {
    background: var(--border, #ccc);
    border-radius: 3px;
}

.chat-messages::-webkit-scrollbar-thumb:hover {
    background: var(--text-secondary, #999);
}

.chat-loading,
.chat-empty {
    text-align: center;
    color: var(--text-secondary, #666);
    padding: 20px;
    font-size: 14px;
}

/* Chat Messages */
.chat-message {
    max-width: 80%;
    padding: 10px 14px;
    border-radius: 12px;
    word-wrap: break-word;
}

.chat-message-own {
    align-self: flex-end;
    background: var(--accent-blue, #0066cc);
    color: white;
    border-bottom-right-radius: 4px;
}

.chat-message-other {
    align-self: flex-start;
    background: var(--bg-primary, #ffffff);
    color: var(--text-primary, #333);
    border: 1px solid var(--border, #e0e0e0);
    border-bottom-left-radius: 4px;
}

[data-theme="dark"] .chat-message-other {
    background: var(--bg-secondary, #2a2a2a);
    border-color: var(--border, #444);
}

.chat-message-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 4px;
    font-size: 12px;
    opacity: 0.9;
}

.chat-message-time {
    font-size: 11px;
    opacity: 0.7;
}

.chat-message-body {
    font-size: 14px;
    line-height: 1.5;
}

/* Chat Footer */
.chat-footer {
    padding: 16px;
    background: var(--bg-primary, #ffffff);
    border-top: 1px solid var(--border, #e0e0e0);
    border-radius: 0 0 12px 12px;
}

.chat-input-container {
    display: flex;
    gap: 8px;
    align-items: center;
}

.chat-input {
    flex: 1;
    padding: 10px 14px;
    border: 1px solid var(--border, #e0e0e0);
    border-radius: 24px;
    font-size: 14px;
    background: var(--bg-secondary, #f8f9fa);
    color: var(--text-primary, #333);
    outline: none;
    transition: border-color 0.2s ease;
}

.chat-input:focus {
    border-color: var(--accent-blue, #0066cc);
}

.chat-input:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

.chat-send-btn {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: var(--accent-blue, #0066cc);
    color: white;
    border: none;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
    font-size: 18px;
}

.chat-send-btn:hover:not(:disabled) {
    background: var(--accent-blue-dark, #0052a3);
    transform: scale(1.1);
}

.chat-send-btn:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

/* Dark Theme */
[data-theme="dark"] .chat-widget {
    background: var(--bg-primary, #1a1a1a);
    border-color: var(--border, #333);
}

[data-theme="dark"] .chat-body {
    background: var(--bg-secondary, #2a2a2a);
}

[data-theme="dark"] .chat-input {
    background: var(--bg-secondary, #2a2a2a);
    border-color: var(--border, #444);
    color: var(--text-primary, #fff);
}

[data-theme="dark"] .chat-footer {
    background: var(--bg-primary, #1a1a1a);
    border-color: var(--border, #333);
}

/* Responsive */
@media (max-width: 768px) {
    .chat-widget {
        width: calc(100vw - 20px);
        right: 10px;
        bottom: 80px;
        height: calc(100vh - 100px);
        max-height: calc(100vh - 100px);
    }
    
    .chat-toggle-btn {
        bottom: 15px;
        right: 15px;
        width: 56px;
        height: 56px;
    }
}

/* Animation */
@keyframes chatSlideIn {
    from {
        opacity: 0;
        transform: translateY(20px) scale(0.95);
    }
    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

.chat-widget.chat-open {
    animation: chatSlideIn 0.3s ease;
}

