/* ========== UNIWIPER Chatbot v2.0 Styles ========== */

/* ---------- Widget Container ---------- */
#uniwiper-chatbot {
    position: fixed;
    bottom: 20px;
    right: 20px;
    z-index: 999999;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, sans-serif;
    font-size: 14px;
    line-height: 1.5;
}

#uniwiper-chatbot * {
    box-sizing: border-box;
}

#uniwiper-chatbot.position-left {
    right: auto;
    left: 20px;
}

/* ---------- Toggle Button ---------- */
.chatbot-toggle {
    width: 60px;
    height: 60px;
    border-radius: 50%;
    border: none;
    background: linear-gradient(135deg, #1a1a2e 0%, #16213e 50%, #0f3460 100%);
    color: white;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 4px 16px rgba(26, 26, 46, 0.4);
    transition: transform 0.2s ease, box-shadow 0.2s ease;
    position: relative;
}

.chatbot-toggle:hover {
    transform: scale(1.08);
    box-shadow: 0 6px 24px rgba(26, 26, 46, 0.5);
}

.chatbot-toggle::after {
    content: '';
    position: absolute;
    width: 100%;
    height: 100%;
    border-radius: 50%;
    background: rgba(26, 26, 46, 0.3);
    animation: chatbot-pulse 2s ease-out infinite;
    pointer-events: none;
}

.chatbot-toggle.hidden {
    display: none;
}

/* ---------- Online Dot on Toggle ---------- */
.chatbot-online-dot {
    position: absolute;
    top: 2px;
    right: 2px;
    width: 14px;
    height: 14px;
    background: #22c55e;
    border: 2.5px solid white;
    border-radius: 50%;
    z-index: 1;
}

/* ---------- Notification Badge ---------- */
.chatbot-notification-dot {
    position: absolute;
    top: -4px;
    right: -4px;
    width: 22px;
    height: 22px;
    background: #f59e0b;
    border-radius: 50%;
    display: none;
    align-items: center;
    justify-content: center;
    font-size: 11px;
    font-weight: 700;
    color: white;
    z-index: 2;
    animation: chatbot-notification-pulse 2s infinite;
}

.chatbot-notification-dot.visible {
    display: flex;
}

/* ---------- Speech Bubble ---------- */
.chatbot-tooltip {
    position: absolute;
    bottom: 72px;
    right: 0;
    background: #1a1a2e;
    color: #fff;
    padding: 12px 36px 12px 16px;
    border-radius: 16px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.18);
    font-size: 14px;
    font-weight: 500;
    line-height: 1.4;
    max-width: 240px;
    white-space: normal;
    opacity: 0;
    transform: scale(0.9) translateY(8px);
    pointer-events: none;
    transition: opacity 0.4s ease, transform 0.4s ease;
    cursor: pointer;
}

.chatbot-tooltip::after {
    content: '';
    position: absolute;
    bottom: -7px;
    right: 22px;
    width: 14px;
    height: 14px;
    background: #1a1a2e;
    transform: rotate(45deg);
}

.chatbot-tooltip.visible {
    opacity: 1;
    transform: scale(1) translateY(0);
    pointer-events: auto;
    animation: chatbot-bubble-pulse 3s ease-in-out infinite;
}

.chatbot-tooltip-text {
    display: inline;
}

.chatbot-tooltip-close {
    position: absolute;
    top: 4px;
    right: 8px;
    background: none;
    border: none;
    color: rgba(255, 255, 255, 0.6);
    font-size: 18px;
    cursor: pointer;
    padding: 0 4px;
    line-height: 1;
}

.chatbot-tooltip-close:hover {
    color: #fff;
}

@keyframes chatbot-bubble-pulse {
    0%, 100% { transform: scale(1) translateY(0); }
    50% { transform: scale(1.03) translateY(-2px); }
}

#uniwiper-chatbot.position-left .chatbot-tooltip {
    right: auto;
    left: 0;
}

#uniwiper-chatbot.position-left .chatbot-tooltip::after {
    right: auto;
    left: 22px;
}

/* ---------- Chat Window ---------- */
.chatbot-window {
    display: none;
    flex-direction: column;
    width: 380px;
    max-width: calc(100vw - 40px);
    height: 550px;
    max-height: calc(100vh - 100px);
    position: absolute;
    bottom: 0;
    right: 0;
    background: white;
    border-radius: 16px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.18);
    overflow: hidden;
}

.chatbot-window.open {
    display: flex;
    animation: chatbot-window-open 0.3s ease;
}

#uniwiper-chatbot.position-left .chatbot-window {
    right: auto;
    left: 0;
}

/* ---------- Header ---------- */
.chatbot-header {
    background: linear-gradient(135deg, #1a1a2e 0%, #16213e 100%);
    color: white;
    padding: 14px 16px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-shrink: 0;
}

.chatbot-agent-row {
    display: flex;
    align-items: center;
    gap: 12px;
}

.chatbot-avatar {
    width: 42px;
    height: 42px;
    border-radius: 50%;
    overflow: hidden;
    flex-shrink: 0;
    background: #e8d5c4;
    border: 2px solid rgba(255, 255, 255, 0.3);
}

.chatbot-avatar svg {
    display: block;
}

.chatbot-header-info {
    display: flex;
    flex-direction: column;
}

.chatbot-agent-name {
    font-size: 15px;
    font-weight: 600;
    line-height: 1.2;
}

.chatbot-agent-status {
    font-size: 12px;
    opacity: 0.85;
    display: flex;
    align-items: center;
    gap: 5px;
}

.chatbot-status-dot {
    display: inline-block;
    width: 8px;
    height: 8px;
    background: #22c55e;
    border-radius: 50%;
    animation: chatbot-status-blink 2s infinite;
}

.chatbot-header-actions {
    display: flex;
    align-items: center;
    gap: 8px;
}

.chatbot-restart-btn {
    background: rgba(255, 255, 255, 0.12);
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 14px;
    padding: 4px 10px;
    font-size: 11px;
    font-weight: 500;
    color: white;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 4px;
    opacity: 0.85;
    transition: opacity 0.2s, background 0.2s;
    font-family: inherit;
    white-space: nowrap;
}

.chatbot-restart-btn:hover {
    opacity: 1;
    background: rgba(255, 255, 255, 0.22);
}

.chatbot-close {
    background: rgba(255, 255, 255, 0.15);
    border: none;
    width: 32px;
    height: 32px;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.2s;
}

.chatbot-close:hover {
    background: rgba(255, 255, 255, 0.25);
}

/* ---------- Messages ---------- */
.chatbot-messages {
    flex: 1;
    padding: 16px;
    background: #f8f9fa;
    display: flex;
    flex-direction: column;
    gap: 12px;
}

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

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

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

.chatbot-messages::-webkit-scrollbar-thumb:hover {
    background: #94a3b8;
}

/* ---------- Message Bubbles ---------- */
.chatbot-msg {
    max-width: 85%;
    padding: 10px 14px;
    border-radius: 16px;
    word-wrap: break-word;
    animation: chatbot-msg-in 0.3s ease;
}

.chatbot-msg-bot {
    align-self: flex-start;
    background: white;
    color: #1a1a2e;
    border: 1px solid #e2e8f0;
    border-bottom-left-radius: 4px;
}

.chatbot-msg-user {
    align-self: flex-end;
    background: linear-gradient(135deg, #1a1a2e 0%, #16213e 100%);
    color: white;
    border-bottom-right-radius: 4px;
}

.chatbot-msg strong {
    font-weight: 600;
}

/* ---------- Options (Make/Model/Year buttons) ---------- */
.chatbot-options {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    padding: 4px 0;
    animation: chatbot-msg-in 0.3s ease;
}

.chatbot-options.chatbot-scrollable {
    max-height: 180px;
    overflow-y: auto;
    padding-right: 4px;
}

.chatbot-option-btn {
    background: white;
    border: 1px solid #d1d5db;
    border-radius: 20px;
    padding: 7px 14px;
    font-size: 13px;
    font-weight: 500;
    color: #1a1a2e;
    cursor: pointer;
    transition: all 0.15s ease;
    font-family: inherit;
}

.chatbot-option-btn:hover {
    background: #1a1a2e;
    color: white;
    border-color: #1a1a2e;
}

/* ---------- Suggestions (Action buttons) ---------- */
.chatbot-suggestions {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    padding: 4px 0;
    animation: chatbot-msg-in 0.3s ease;
}

.chatbot-suggestion-btn {
    background: white;
    border: 1.5px solid #1a1a2e;
    border-radius: 20px;
    padding: 8px 16px;
    font-size: 13px;
    font-weight: 500;
    color: #1a1a2e;
    cursor: pointer;
    transition: all 0.15s ease;
    font-family: inherit;
}

.chatbot-suggestion-btn:hover {
    background: #1a1a2e;
    color: white;
}

.chatbot-suggestion-btn.chatbot-btn-primary {
    background: #059669;
    color: white;
    border-color: #059669;
}

.chatbot-suggestion-btn.chatbot-btn-primary:hover {
    background: #047857;
    border-color: #047857;
}

/* ---------- Wiper Sizes Card ---------- */
.chatbot-wiper-card {
    background: white;
    border: 1px solid #e2e8f0;
    border-radius: 12px;
    padding: 16px;
    margin: 4px 0;
    animation: chatbot-msg-in 0.3s ease;
    align-self: flex-start;
    max-width: 90%;
}

.chatbot-images-row {
    display: flex;
    gap: 8px;
    margin-bottom: 12px;
}

.chatbot-img-link {
    flex: 1;
    min-width: 0;
    cursor: pointer;
}

.chatbot-vehicle-img,
.chatbot-product-img {
    width: 100%;
    height: 80px;
    object-fit: contain;
    border-radius: 8px;
    background: #f1f5f9;
    transition: opacity 0.2s;
}

.chatbot-img-link:hover img {
    opacity: 0.8;
}

.chatbot-images-row .chatbot-vehicle-img,
.chatbot-images-row .chatbot-product-img {
    flex: 1;
}

.chatbot-product-name {
    font-weight: 600;
    font-size: 14px;
    margin-bottom: 8px;
    color: #1a1a1a;
}


.chatbot-price {
    font-size: 20px;
    font-weight: 700;
    color: #059669;
    text-align: center;
    margin-top: 12px;
    padding-top: 12px;
    border-top: 1px solid #e2e8f0;
}

/* ---------- Feedback Thumbs ---------- */
.chatbot-feedback {
    display: flex;
    gap: 6px;
    align-self: flex-start;
    padding: 2px 0;
    animation: chatbot-msg-in 0.3s ease;
}

.chatbot-thumb {
    background: none;
    border: 1px solid #e2e8f0;
    border-radius: 16px;
    padding: 4px 10px;
    font-size: 14px;
    cursor: pointer;
    opacity: 0.5;
    transition: all 0.2s;
    font-family: inherit;
}

.chatbot-thumb:hover {
    opacity: 1;
    background: #f1f5f9;
}

.chatbot-thumb-selected {
    opacity: 1 !important;
    border-color: #059669;
    background: #ecfdf5;
}

.chatbot-thumb-disabled {
    opacity: 0.2 !important;
    cursor: default;
    pointer-events: none;
}

/* ---------- Typing Indicator ---------- */
.chatbot-typing {
    display: flex;
    align-items: center;
    gap: 4px;
    padding: 12px 16px;
    background: white;
    border: 1px solid #e2e8f0;
    border-radius: 16px;
    border-bottom-left-radius: 4px;
    align-self: flex-start;
    animation: chatbot-msg-in 0.3s ease;
}

.chatbot-typing-dot {
    width: 8px;
    height: 8px;
    background: #94a3b8;
    border-radius: 50%;
    animation: chatbot-typing-bounce 1.4s infinite;
}

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

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

/* ---------- Input Area ---------- */
.chatbot-input-area {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 12px 16px;
    background: white;
    border-top: 1px solid #e2e8f0;
    flex-shrink: 0;
}

.chatbot-input-area input {
    flex: 1;
    height: 42px;
    border: 1px solid #d1d5db;
    border-radius: 21px;
    padding: 0 16px;
    font-size: 14px;
    font-family: inherit;
    outline: none;
    transition: border-color 0.2s;
    background: #f8f9fa;
    color: #1a1a2e;
}

.chatbot-input-area input:focus {
    border-color: #1a1a2e;
    background: white;
}

.chatbot-input-area input::placeholder {
    color: #94a3b8;
}

.chatbot-send {
    width: 42px;
    height: 42px;
    border-radius: 50%;
    border: none;
    background: linear-gradient(135deg, #1a1a2e, #16213e);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    transition: transform 0.15s ease, opacity 0.15s ease;
}

.chatbot-send:hover {
    transform: scale(1.05);
}

.chatbot-send:disabled,
.chatbot-input-area input:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

/* ---------- Footer ---------- */
.chatbot-footer {
    text-align: center;
    padding: 6px;
    font-size: 11px;
    color: #94a3b8;
    background: white;
    border-top: 1px solid #f1f5f9;
    flex-shrink: 0;
}

/* ---------- Animations ---------- */
@keyframes chatbot-pulse {
    0% { transform: scale(1); opacity: 0.5; }
    100% { transform: scale(1.6); opacity: 0; }
}

@keyframes chatbot-notification-pulse {
    0%, 100% { transform: scale(1); }
    50% { transform: scale(1.15); }
}

@keyframes chatbot-status-blink {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.5; }
}

@keyframes chatbot-window-open {
    from { opacity: 0; transform: scale(0.95) translateY(10px); }
    to { opacity: 1; transform: scale(1) translateY(0); }
}

@keyframes chatbot-msg-in {
    from { opacity: 0; transform: translateY(8px); }
    to { opacity: 1; transform: translateY(0); }
}

@keyframes chatbot-typing-bounce {
    0%, 60%, 100% { transform: scale(0.8); opacity: 0.4; }
    30% { transform: scale(1.2); opacity: 1; }
}

/* ---------- Mobile Responsive ---------- */
@media (max-width: 480px) {
    #uniwiper-chatbot {
        bottom: 10px;
        right: 10px;
    }

    #uniwiper-chatbot.position-left {
        left: 10px;
    }

    .chatbot-toggle {
        width: 54px;
        height: 54px;
    }

    .chatbot-window {
        width: calc(100vw - 20px);
        height: calc(100vh - 80px);
        bottom: 0;
        right: -10px;
        border-radius: 16px 16px 0 0;
    }

    #uniwiper-chatbot.position-left .chatbot-window {
        left: -10px;
        right: auto;
    }

    .chatbot-msg {
        max-width: 90%;
    }

    .chatbot-wiper-card {
        max-width: 95%;
    }

    .chatbot-tooltip {
        max-width: 200px;
        font-size: 13px;
    }
}
