/**
 * LiveChat Widget Styles
 */

/* Chat Button */
#livechat-button {
    position: fixed;
    bottom: 20px;
    z-index: 9998;
    width: var(--livechat-button-size, 60px);
    height: var(--livechat-button-size, 60px);
    border-radius: 50%;
    background: transparent;
    color: white;
    border: none;
    cursor: pointer;
    box-shadow: none;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: calc(var(--livechat-button-size, 60px) * 0.47);
    transition: transform 0.2s;
    overflow: hidden;
}

#livechat-button:hover {
    transform: scale(1.1);
}

#livechat-button.bottom-right {
    right: 20px;
}

#livechat-button.bottom-left {
    left: 20px;
}

/* Chat Button Image */
.livechat-button-image {
    width: 80%;
    height: 80%;
    object-fit: contain;
    pointer-events: none;
}

/* SVG icon size adjustment */
#livechat-button svg {
    width: calc(var(--livechat-button-size, 60px) * 0.47);
    height: calc(var(--livechat-button-size, 60px) * 0.47);
}

/* Chat Window */
#livechat-window {
    position: fixed;
    bottom: 90px;
    z-index: 9999;
    width: 380px;
    height: 600px;
    max-height: calc(100vh - 110px);
    background: white;
    border-radius: 12px;
    box-shadow: 0 10px 40px rgba(0,0,0,0.2);
    display: none;
    flex-direction: column;
    overflow: hidden;
}

#livechat-window.show {
    display: flex;
}

#livechat-window.bottom-right {
    right: 20px;
}

#livechat-window.bottom-left {
    left: 20px;
}

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

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

.livechat-header p {
    margin: 4px 0 0 0;
    font-size: 12px;
    opacity: 0.9;
}

.livechat-close {
    background: none;
    border: none;
    color: white;
    font-size: 24px;
    cursor: pointer;
    padding: 0;
    width: 30px;
    height: 30px;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0.8;
    transition: opacity 0.2s;
}

.livechat-close:hover {
    opacity: 1;
}

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

.livechat-message {
    display: flex;
    gap: 8px;
    max-width: 80%;
    flex-direction: column;
}

.livechat-message.customer {
    align-self: flex-end;
    align-items: flex-end;
}

.livechat-message.admin {
    align-self: flex-start;
    align-items: flex-start;
}

.livechat-message-content {
    display: flex;
    flex-direction: column;
}

.livechat-message-bubble {
    padding: 10px 14px;
    border-radius: 18px;
    word-wrap: break-word;
    font-size: 14px;
    line-height: 1.4;
}

.livechat-message.customer .livechat-message-bubble {
    background: linear-gradient(135deg, var(--livechat-color, #667eea) 0%, #764ba2 100%);
    color: white;
    border-bottom-right-radius: 4px;
}

.livechat-message.admin .livechat-message-bubble {
    background: white;
    color: #333;
    border-bottom-left-radius: 4px;
}

.livechat-message-time {
    font-size: 11px;
    color: #999;
    margin-top: 4px;
    padding: 0 4px;
}

/* Read Status */
.message-read-status {
    font-size: 10px;
    color: rgba(255, 255, 255, 0.7);
    margin-top: 2px;
    padding: 0 4px;
    text-align: right;
    font-style: italic;
}

.livechat-message.admin .message-read-status {
    color: #999;
}

.livechat-message-system {
    align-self: center;
    font-size: 12px;
    color: #999;
    padding: 8px;
    text-align: center;
}

/* Typing Indicator */
.livechat-typing {
    display: none;
    padding: 8px 12px;
    background: white;
    border-radius: 18px;
    align-self: flex-start;
    max-width: 60px;
}

.livechat-typing.show {
    display: flex;
    gap: 4px;
}

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

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

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

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

/* Chat Input */
.livechat-input {
    padding: 12px;
    background: white;
    border-top: 1px solid #e0e0e0;
    display: flex;
    gap: 8px;
}

.livechat-input textarea {
    flex: 1;
    border: 1px solid #ddd;
    border-radius: 20px;
    padding: 10px 14px;
    resize: none;
    font-family: inherit;
    font-size: 14px;
    outline: none;
    max-height: 100px;
}

.livechat-input textarea:focus {
    border-color: var(--livechat-color, #667eea);
}

.livechat-send-btn {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--livechat-color, #667eea) 0%, #764ba2 100%);
    color: white;
    border: none;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: transform 0.2s;
    flex-shrink: 0;
}

.livechat-send-btn:hover {
    transform: scale(1.1);
}

.livechat-send-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

/* Attach Button */
.livechat-attach-btn {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: #f5f5f5;
    color: #666;
    border: none;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
    flex-shrink: 0;
}

.livechat-attach-btn:hover {
    background: #e0e0e0;
    transform: scale(1.1);
}

/* Image Message */
.livechat-message-bubble.image {
    padding: 4px;
    background: transparent;
}

.livechat-image {
    max-width: 200px;
    max-height: 200px;
    border-radius: 8px;
    cursor: pointer;
    display: block;
}

.livechat-message.customer .livechat-image {
    border: 2px solid var(--livechat-color, #667eea);
}

.livechat-message.admin .livechat-image {
    border: 2px solid #e0e0e0;
}

/* Customer Info Form */
.livechat-form {
    padding: 20px;
    display: flex;
    flex-direction: column;
    gap: 12px;
}

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

.livechat-form p {
    margin: 0 0 16px 0;
    font-size: 13px;
    color: #666;
}

.livechat-form-group {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.livechat-form-group label {
    font-size: 13px;
    font-weight: 600;
    color: #555;
}

.livechat-form-group input {
    padding: 10px 12px;
    border: 1px solid #ddd;
    border-radius: 6px;
    font-size: 14px;
    outline: none;
}

.livechat-form-group input:focus {
    border-color: var(--livechat-color, #667eea);
}

.livechat-form-btn {
    padding: 12px 24px;
    background: linear-gradient(135deg, var(--livechat-color, #667eea) 0%, #764ba2 100%);
    color: white;
    border: none;
    border-radius: 6px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: transform 0.2s;
}

.livechat-form-btn:hover {
    transform: translateY(-2px);
}

/* Connection Status */
.livechat-status {
    padding: 8px 12px;
    text-align: center;
    font-size: 12px;
    background: #fff3cd;
    color: #856404;
}

.livechat-status.connected {
    background: #d4edda;
    color: #155724;
}

.livechat-status.disconnected {
    background: #f8d7da;
    color: #721c24;
}

/* Scrollbar */
.livechat-messages::-webkit-scrollbar {
    width: 6px;
}

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

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

.livechat-messages::-webkit-scrollbar-thumb:hover {
    background: #555;
}

/* Mobile Responsive */
@media (max-width: 480px) {
    #livechat-window {
        width: calc(100% - 40px);
        height: calc(100% - 110px);
        bottom: 90px;
        left: 20px !important;
        right: 20px !important;
    }

    #livechat-button {
        left: auto !important;
        right: 20px !important;
    }
}

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

#livechat-window.show {
    animation: slideUp 0.3s ease-out;
}
