/**
 * Live Chat Widget Styles
 */

/* Chat Widget Button - Floating Button (Bottom Right) */
.chat-widget-button {
    position: fixed;
    bottom: 20px;
    right: 20px;
    width: 60px;
    height: 60px;
    border-radius: 50%;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border: none;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 24px;
    z-index: 9998;
    transition: transform 0.3s ease, box-shadow 0.3s ease;
}

.chat-widget-button:hover {
    transform: scale(1.1);
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.25);
}

.chat-widget-button i {
    line-height: 1;
}

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

/* Chat Window */
.chat-widget-window {
    position: fixed;
    bottom: 20px;
    right: 20px;
    width: 380px;
    max-width: calc(100vw - 40px);
    height: 600px;
    max-height: calc(100vh - 40px);
    background: white;
    border-radius: 15px;
    box-shadow: 0 5px 40px rgba(0, 0, 0, 0.16);
    z-index: 9999;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

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

.chat-widget-header-content {
    flex: 1;
}

.chat-widget-title {
    font-weight: 600;
    font-size: 16px;
    margin-bottom: 3px;
}

.chat-widget-status {
    display: flex;
    align-items: center;
    font-size: 12px;
    opacity: 0.9;
}

.status-indicator {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    margin-right: 6px;
}

.status-indicator.online {
    background: #10b981;
    box-shadow: 0 0 6px #10b981;
}

.status-indicator.offline {
    background: #6b7280;
}

.chat-widget-actions {
    display: flex;
    gap: 8px;
}

.chat-action-btn {
    background: transparent;
    border: none;
    color: white;
    cursor: pointer;
    font-size: 18px;
    padding: 5px;
    transition: opacity 0.2s;
}

.chat-action-btn:hover {
    opacity: 0.8;
}

/* Pre-Chat Form */
.chat-pre-form {
    padding: 20px;
    overflow-y: auto;
    flex: 1;
}

.chat-pre-form-content {
    max-width: 100%;
}

/* Chat Messages Area */
.chat-messages-area {
    flex: 1;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.chat-messages {
    flex: 1;
    overflow-y: auto;
    padding: 20px;
    background: #f9fafb;
}

/* Message Bubbles */
.chat-message-bubble {
    margin-bottom: 15px;
    animation: fadeIn 0.3s ease;
}

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

/* Visitor Message (Right - User) */
.chat-message-bubble.visitor-message {
    display: flex;
    justify-content: flex-end;
}

.chat-message-bubble.visitor-message .message-content {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    padding: 10px 15px;
    border-radius: 18px 18px 0 18px;
    max-width: 75%;
    word-wrap: break-word;
}

.chat-message-bubble.visitor-message .message-time {
    font-size: 11px;
    opacity: 0.8;
    text-align: right;
    margin-top: 4px;
}

/* Operator Message (Left - Support) */
.chat-message-bubble.operator-message {
    display: flex;
    justify-content: flex-start;
}

.chat-message-bubble.operator-message .message-sender {
    font-size: 11px;
    color: #6b7280;
    margin-bottom: 3px;
    font-weight: 500;
}

.chat-message-bubble.operator-message .message-content {
    background: white;
    border: 1px solid #e5e7eb;
    color: #1f2937;
    padding: 10px 15px;
    border-radius: 18px 18px 18px 0;
    max-width: 75%;
    word-wrap: break-word;
}

.chat-message-bubble.operator-message .message-time {
    font-size: 11px;
    color: #9ca3af;
    text-align: left;
    margin-top: 4px;
}

/* System Message (Center) */
.chat-message-bubble.system-message {
    text-align: center;
}

.chat-message-bubble.system-message .message-text {
    display: inline-block;
    background: #f3f4f6;
    color: #6b7280;
    padding: 6px 12px;
    border-radius: 12px;
    font-size: 12px;
}

/* Typing Indicator */
.chat-typing-indicator {
    padding: 10px 20px;
    display: flex;
    align-items: center;
    background: #f9fafb;
}

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

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

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

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

/* Offline Form */
.chat-offline-form {
    padding: 20px;
    flex: 1;
    overflow-y: auto;
}

/* Chat Input Area */
.chat-input-area {
    border-top: 1px solid #e5e7eb;
    padding: 15px;
    background: white;
}

.chat-input-form .input-group {
    display: flex;
}

.chat-input-form .form-control {
    flex: 1;
    border: 1px solid #d1d5db;
    border-radius: 25px 0 0 25px;
    padding: 10px 15px;
    font-size: 14px;
}

.chat-input-form .form-control:focus {
    outline: none;
    border-color: #667eea;
    box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.1);
}

.chat-input-form .btn {
    border-radius: 0;
    padding: 10px 15px;
    font-size: 14px;
}

.chat-input-form .btn:last-child {
    border-radius: 0 25px 25px 0;
}

.chat-input-footer {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-top: 8px;
}

.chat-input-footer .btn-link {
    padding: 0;
    text-decoration: none;
    font-size: 12px;
}

.chat-input-footer .btn-link:hover {
    text-decoration: underline;
}

/* Emoji Picker */
.chat-emoji-picker {
    position: fixed;
    background: white;
    border: 1px solid #e5e7eb;
    border-radius: 8px;
    padding: 10px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    z-index: 10000;
}

.emoji-grid {
    display: grid;
    grid-template-columns: repeat(6, 1fr);
    gap: 8px;
}

.emoji-item {
    font-size: 24px;
    cursor: pointer;
    padding: 5px;
    border-radius: 6px;
    transition: background 0.2s;
    text-align: center;
}

.emoji-item:hover {
    background: #f3f4f6;
}

/* Scrollbar Styles */
.chat-messages::-webkit-scrollbar,
.chat-pre-form::-webkit-scrollbar,
.chat-offline-form::-webkit-scrollbar {
    width: 6px;
}

.chat-messages::-webkit-scrollbar-track,
.chat-pre-form::-webkit-scrollbar-track,
.chat-offline-form::-webkit-scrollbar-track {
    background: #f1f1f1;
}

.chat-messages::-webkit-scrollbar-thumb,
.chat-pre-form::-webkit-scrollbar-thumb,
.chat-offline-form::-webkit-scrollbar-thumb {
    background: #d1d5db;
    border-radius: 3px;
}

.chat-messages::-webkit-scrollbar-thumb:hover,
.chat-pre-form::-webkit-scrollbar-thumb:hover,
.chat-offline-form::-webkit-scrollbar-thumb:hover {
    background: #9ca3af;
}

/* Mobile Responsive */
@media (max-width: 576px) {
    .chat-widget-window {
        width: 100%;
        height: 100%;
        max-width: 100%;
        max-height: 100%;
        bottom: 0;
        right: 0;
        border-radius: 0;
    }

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

    .chat-widget-button {
        width: 56px;
        height: 56px;
        font-size: 22px;
        bottom: 15px;
        right: 15px;
    }

    .chat-notification-badge {
        width: 22px;
        height: 22px;
        font-size: 10px;
    }
}

/* Additional Utility Styles */
.border-left-primary {
    border-left: 4px solid #4e73df;
}

.border-left-success {
    border-left: 4px solid #1cc88a;
}

.border-left-info {
    border-left: 4px solid #36b9cc;
}

.border-left-warning {
    border-left: 4px solid #f6c23e;
}

.border-left-danger {
    border-left: 4px solid #e74a3b;
}

.border-left-secondary {
    border-left: 4px solid #858796;
}

.border-left-dark {
    border-left: 4px solid #5a5c69;
}
