/* Live Chat Widget Styles */

/* Widget Container */
.livechat-widget {
    position: fixed;
    bottom: 20px;
    right: 20px;
    z-index: 9999;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
    font-size: 14px;
    line-height: 1.4;
}

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

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

.livechat-button svg {
    width: 24px;
    height: 24px;
    fill: white;
    transition: transform 0.3s ease;
}

.livechat-button.active svg {
    transform: rotate(180deg);
}

/* Notification Badge */
.livechat-badge {
    position: absolute;
    top: -5px;
    right: -5px;
    background: #ff4757;
    color: white;
    border-radius: 50%;
    width: 20px;
    height: 20px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 11px;
    font-weight: bold;
    animation: pulse 2s infinite;
}

@keyframes pulse {
    0% { transform: scale(1); }
    50% { transform: scale(1.1); }
    100% { transform: scale(1); }
}

/* Chat Window */
.livechat-window {
    position: absolute;
    bottom: 80px;
    right: 0;
    width: 350px;
    height: 500px;
    background: white;
    border-radius: 12px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.2);
    display: none;
    flex-direction: column;
    overflow: hidden;
    animation: slideUp 0.3s ease;
}

.livechat-window.active {
    display: flex;
}

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

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

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

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

.livechat-status-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: #2ed573;
    margin-right: 6px;
    animation: blink 2s infinite;
}

@keyframes blink {
    0%, 50% { opacity: 1; }
    51%, 100% { opacity: 0.3; }
}

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

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

/* Chat Messages */
.livechat-messages {
    flex: 1;
    padding: 20px;
    overflow-y: auto;
    background: #f8f9fa;
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.livechat-messages::-webkit-scrollbar {
    width: 4px;
}

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

.livechat-messages::-webkit-scrollbar-thumb {
    background: #ddd;
    border-radius: 2px;
}

/* Message Bubbles */
.livechat-message {
    max-width: 80%;
    padding: 10px 14px;
    border-radius: 18px;
    word-wrap: break-word;
    animation: messageSlide 0.3s ease;
}

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

.livechat-message.visitor {
    background: #667eea;
    color: white;
    align-self: flex-end;
    margin-left: auto;
}

.livechat-message.admin {
    background: white;
    color: #333;
    align-self: flex-start;
    border: 1px solid #e9ecef;
}

.livechat-message-time {
    font-size: 11px;
    opacity: 0.7;
    margin-top: 4px;
    text-align: right;
}

.livechat-message.admin .livechat-message-time {
    text-align: left;
}

/* Typing Indicator */
.livechat-typing {
    display: none;
    align-items: center;
    padding: 10px 14px;
    background: white;
    border-radius: 18px;
    border: 1px solid #e9ecef;
    align-self: flex-start;
    margin-bottom: 8px;
}

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

.livechat-typing-dots {
    display: flex;
    gap: 3px;
}

.livechat-typing-dot {
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: #999;
    animation: typingDot 1.4s infinite;
}

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

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

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

/* Chat Input */
.livechat-input-container {
    padding: 16px 20px;
    background: white;
    border-top: 1px solid #e9ecef;
    display: flex;
    gap: 10px;
    align-items: flex-end;
}

.livechat-input {
    flex: 1;
    border: 1px solid #ddd;
    border-radius: 20px;
    padding: 10px 16px;
    font-size: 14px;
    resize: none;
    outline: none;
    max-height: 80px;
    min-height: 40px;
    transition: border-color 0.2s ease;
}

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

.livechat-send {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: #667eea;
    border: none;
    color: white;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
    flex-shrink: 0;
}

.livechat-send:hover {
    background: #5a67d8;
    transform: scale(1.05);
}

.livechat-send:disabled {
    background: #ccc;
    cursor: not-allowed;
    transform: none;
}

.livechat-send svg {
    width: 16px;
    height: 16px;
    fill: currentColor;
}

/* Welcome Message */
.livechat-welcome {
    text-align: center;
    padding: 20px;
    color: #666;
}

.livechat-welcome h4 {
    margin: 0 0 8px 0;
    color: #333;
    font-size: 16px;
}

.livechat-welcome p {
    margin: 0;
    font-size: 13px;
    line-height: 1.5;
}

/* Offline State */
.livechat-offline {
    text-align: center;
    padding: 20px;
    color: #666;
}

.livechat-offline h4 {
    margin: 0 0 8px 0;
    color: #333;
    font-size: 16px;
}

.livechat-offline p {
    margin: 0 0 16px 0;
    font-size: 13px;
    line-height: 1.5;
}

.livechat-email-form {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.livechat-email-form input,
.livechat-email-form textarea {
    border: 1px solid #ddd;
    border-radius: 8px;
    padding: 10px 12px;
    font-size: 14px;
    outline: none;
    transition: border-color 0.2s ease;
}

.livechat-email-form input:focus,
.livechat-email-form textarea:focus {
    border-color: #667eea;
}

.livechat-email-form textarea {
    resize: vertical;
    min-height: 80px;
}

.livechat-email-form button {
    background: #667eea;
    color: white;
    border: none;
    border-radius: 8px;
    padding: 12px;
    font-size: 14px;
    cursor: pointer;
    transition: background 0.2s ease;
}

.livechat-email-form button:hover {
    background: #5a67d8;
}

/* Mobile Responsive */
@media (max-width: 480px) {
    .livechat-widget {
        bottom: 10px;
        right: 10px;
        left: 10px;
    }
    
    .livechat-window {
        width: 100%;
        height: 400px;
        bottom: 80px;
        right: 0;
        left: 0;
        border-radius: 12px 12px 0 0;
    }
    
    .livechat-button {
        position: absolute;
        right: 0;
        bottom: 0;
    }
}

/* Loading Animation */
.livechat-loading {
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 20px;
}

.livechat-spinner {
    width: 20px;
    height: 20px;
    border: 2px solid #f3f3f3;
    border-top: 2px solid #667eea;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* Error State */
.livechat-error {
    background: #fee;
    color: #c33;
    padding: 10px;
    border-radius: 8px;
    margin: 10px 0;
    font-size: 13px;
    text-align: center;
}

/* Success State */
.livechat-success {
    background: #efe;
    color: #363;
    padding: 10px;
    border-radius: 8px;
    margin: 10px 0;
    font-size: 13px;
    text-align: center;
}