/* Chat Widget Styles */

:root {
    --tmblc-primary-color: #0088cc;
    --tmblc-text-color: #333;
    --tmblc-bg-color: #fff;
    --tmblc-border-color: #e0e0e0;
    --tmblc-icon-size: 60px;
    --tmblc-bottom: 20px;
    --tmblc-side-right: 20px;
    --tmblc-side-left: auto;
}

/* Chat Bubble */
.tmblc-chat-bubble {
    position: fixed;
    bottom: var(--tmblc-bottom);
    right: var(--tmblc-side-right);
    left: var(--tmblc-side-left);
    width: var(--tmblc-icon-size);
    height: var(--tmblc-icon-size);
    background: var(--tmblc-primary-color);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    transition: transform 0.3s ease, box-shadow 0.3s ease;
    z-index: 999999;
}

.tmblc-chat-bubble:hover {
    transform: scale(1.1);
    box-shadow: 0 6px 16px rgba(0, 0, 0, 0.2);
}

.tmblc-chat-bubble svg {
    width: calc(var(--tmblc-icon-size) * 0.5);
    height: calc(var(--tmblc-icon-size) * 0.5);
}

.tmblc-icon-chat,
.tmblc-icon-close {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    height: 100%;
    position: absolute;
    top: 0;
    left: 0;
    transition: opacity 0.3s ease, transform 0.3s ease;
}

.tmblc-unread-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;
}

/* Chat Window */
.tmblc-chat-window {
    position: fixed;
    bottom: calc(var(--tmblc-bottom) + var(--tmblc-icon-size) + 20px);
    right: var(--tmblc-side-right);
    left: var(--tmblc-side-left);
    width: 380px;
    height: 600px;
    max-height: calc(100vh - 140px);
    background: var(--tmblc-bg-color);
    border-radius: 12px;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.15);
    display: flex;
    flex-direction: column;
    z-index: 999998;
    animation: tmblc-slide-up 0.3s ease;
}

@keyframes tmblc-slide-up {
    from {
        opacity: 0;
        transform: translateY(20px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Header */
.tmblc-chat-header {
    background: var(--tmblc-primary-color);
    color: white;
    padding: 16px 20px;
    border-radius: 12px 12px 0 0;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.tmblc-header-content h3 {
    margin: 0 0 4px 0;
    font-size: 18px;
    font-weight: 600;
}

.tmblc-status-indicator {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 13px;
    opacity: 0.9;
}

.tmblc-status-dot {
    width: 8px;
    height: 8px;
    background: #4ade80;
    border-radius: 50%;
    animation: tmblc-pulse 2s infinite;
}

@keyframes tmblc-pulse {

    0%,
    100% {
        opacity: 1;
    }

    50% {
        opacity: 0.5;
    }
}

.tmblc-close-btn {
    background: none;
    border: none;
    color: white;
    cursor: pointer;
    padding: 4px;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0.8;
    transition: opacity 0.2s;
}

.tmblc-close-btn:hover {
    opacity: 1;
}

/* Pre-chat Form */
.tmblc-prechat-form {
    padding: 24px;
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.tmblc-prechat-form p {
    margin: 0 0 8px 0;
    color: var(--tmblc-text-color);
    font-size: 14px;
}

.tmblc-prechat-form input {
    width: 100%;
    padding: 12px;
    border: 1px solid var(--tmblc-border-color);
    border-radius: 8px;
    font-size: 14px;
    box-sizing: border-box;
}

.tmblc-prechat-form input:focus {
    outline: none;
    border-color: var(--tmblc-primary-color);
}

.tmblc-btn-primary {
    background: var(--tmblc-primary-color);
    color: white;
    border: none;
    padding: 12px 24px;
    border-radius: 8px;
    font-size: 15px;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.2s;
}

.tmblc-btn-primary:hover {
    background: #0077b3;
}

.tmblc-btn-primary:disabled {
    background: #ccc;
    cursor: not-allowed;
}

/* Messages */
.tmblc-messages {
    flex: 1;
    overflow-y: auto;
    padding: 20px;
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.tmblc-message {
    display: flex;
    gap: 8px;
    animation: tmblc-message-in 0.3s ease;
}

@keyframes tmblc-message-in {
    from {
        opacity: 0;
        transform: translateY(10px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.tmblc-message.tmblc-customer {
    flex-direction: row-reverse;
}

.tmblc-message-bubble {
    max-width: 75%;
    padding: 10px 14px;
    border-radius: 16px;
    font-size: 14px;
    line-height: 1.4;
    word-wrap: break-word;
}

.tmblc-message.tmblc-admin .tmblc-message-bubble {
    background: #f0f0f0;
    color: var(--tmblc-text-color);
    border-bottom-left-radius: 4px;
}

.tmblc-message.tmblc-customer .tmblc-message-bubble {
    background: var(--tmblc-primary-color);
    color: white;
    border-bottom-right-radius: 4px;
}

.tmblc-message-time {
    font-size: 11px;
    color: #999;
    margin-top: 4px;
    display: block;
}

.tmblc-message-image {
    max-width: 100%;
    border-radius: 8px;
    margin-top: 4px;
}

/* Typing Indicator */
.tmblc-typing-indicator {
    padding: 8px 16px;
    display: flex;
    gap: 4px;
    align-items: center;
}

.tmblc-typing-indicator span {
    width: 8px;
    height: 8px;
    background: #999;
    border-radius: 50%;
    animation: tmblc-typing 1.4s infinite;
}

.tmblc-typing-indicator span:nth-child(2) {
    animation-delay: 0.2s;
}

.tmblc-typing-indicator span:nth-child(3) {
    animation-delay: 0.4s;
}

@keyframes tmblc-typing {

    0%,
    60%,
    100% {
        transform: translateY(0);
    }

    30% {
        transform: translateY(-8px);
    }
}

/* Input Area */
.tmblc-input-area {
    padding: 16px;
    border-top: 1px solid var(--tmblc-border-color);
    display: flex;
    gap: 8px;
}

.tmblc-input-area input {
    flex: 1;
    padding: 10px 14px;
    border: 1px solid var(--tmblc-border-color);
    border-radius: 20px;
    font-size: 14px;
}

.tmblc-input-area input:focus {
    outline: none;
    border-color: var(--tmblc-primary-color);
}

.tmblc-send-btn {
    background: var(--tmblc-primary-color);
    color: white;
    border: none;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: background 0.2s;
}

.tmblc-send-btn:hover {
    background: #0077b3;
}

.tmblc-send-btn:disabled {
    background: #ccc;
    cursor: not-allowed;
}

/* Footer */
.tmblc-chat-footer {
    padding: 8px 16px;
    text-align: center;
    border-top: 1px solid var(--tmblc-border-color);
    font-size: 11px;
    color: #999;
}

/* Queue Message */
.tmblc-queue-message {
    padding: 20px;
    text-align: center;
    color: var(--tmblc-text-color);
}

.tmblc-queue-message h4 {
    margin: 0 0 8px 0;
    font-size: 16px;
}

.tmblc-queue-position {
    font-size: 32px;
    font-weight: bold;
    color: var(--tmblc-primary-color);
    margin: 12px 0;
}

/* Mobile Responsive */
@media (max-width: 480px) {
    .tmblc-chat-window {
        width: calc(100vw - 20px);
        height: calc(100vh - 120px);
        right: 10px;
        bottom: 80px;
    }

    .tmblc-chat-bubble {
        bottom: var(--tmblc-bottom);
        right: var(--tmblc-side-right);
        left: var(--tmblc-side-left);
    }
}