/* ============================================
   Chat Widget - Insurance Claim Chatbot
   WordPress / WPCF7 compatible color scheme
   ============================================ */

/* Chat Widget Toggle Button */
.chat-widget-toggle {
    position: fixed;
    bottom: 24px;
    left: 24px;
    z-index: 9999;
    background: #ff8e30;
    color: white;
    border: none;
    border-radius: 60px;
    padding: 14px 24px;
    font-size: 15px;
    font-weight: 600;
    cursor: pointer;
    box-shadow: 0 4px 20px rgba(255, 142, 48, 0.4);
    display: flex;
    align-items: center;
    gap: 10px;
    transition: all 0.3s ease;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen-Sans, Ubuntu, Cantarell, 'Helvetica Neue', sans-serif;
}
.chat-widget-toggle:hover {
    background: #e07520;
    transform: translateY(-2px);
    box-shadow: 0 6px 28px rgba(255, 142, 48, 0.5);
}
.chat-widget-toggle .chat-icon {
    font-size: 20px;
}
.chat-widget-toggle {
    animation: toggleNudge 3s ease-in-out infinite;
}
.chat-widget-toggle:hover {
    animation: none;
}
@keyframes toggleNudge {
    0%, 100% { transform: translateX(0); }
    20% { transform: translateX(6px); }
    40% { transform: translateX(-6px); }
    60% { transform: translateX(4px); }
    80% { transform: translateX(-2px); }
}
.chat-widget-toggle.is-open {
    opacity: 0;
    pointer-events: none;
    transform: translateY(20px);
    animation: none;
}

/* Chat Window */
.chat-widget-window {
    position: fixed;
    bottom: 24px;
    left: 24px;
    width: 420px;
    height: 620px;
    max-height: calc(100vh - 48px);
    z-index: 10000;
    background: #f0f0f1;
    border-radius: 12px;
    box-shadow: 0 8px 40px rgba(0, 0, 0, 0.25);
    display: flex;
    flex-direction: column;
    overflow: hidden;
    opacity: 0;
    transform: translateY(20px) scale(0.95);
    pointer-events: none;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen-Sans, Ubuntu, Cantarell, 'Helvetica Neue', sans-serif;
}
.chat-widget-window.is-open {
    opacity: 1;
    transform: translateY(0) scale(1);
    pointer-events: auto;
}

/* Header */
.chat-widget-header {
    background: #333333;
    color: #f0f0f1;
    padding: 16px 20px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-shrink: 0;
}
.chat-widget-header-title {
    font-size: 16px;
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 8px;
    color: #ffffff;
}
.chat-widget-header-subtitle {
    font-size: 12px;
    opacity: 0.7;
    margin-top: 2px;
    color: #c3c4c7;
}
.chat-widget-close {
    background: rgba(255, 255, 255, 0.1);
    border: none;
    color: #c3c4c7;
    width: 32px;
    height: 32px;
    border-radius: 6px;
    cursor: pointer;
    font-size: 18px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
}
.chat-widget-close:hover {
    background: rgba(255, 255, 255, 0.2);
    color: #ffffff;
}

/* Back button */
.chat-widget-back {
    background: rgba(255, 255, 255, 0.1);
    border: none;
    color: #c3c4c7;
    width: 32px;
    height: 32px;
    border-radius: 6px;
    cursor: pointer;
    font-size: 16px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
    margin-right: 8px;
}
.chat-widget-back:hover {
    background: rgba(255, 255, 255, 0.2);
    color: #ffffff;
}

/* Messages area */
.chat-widget-messages {
    flex: 1;
    overflow-y: auto;
    padding: 14px;
    background: #f0f0f1;
    display: flex;
    flex-direction: column;
    gap: 8px;
    scroll-behavior: smooth;
}
.chat-widget-messages::-webkit-scrollbar {
    width: 5px;
}
.chat-widget-messages::-webkit-scrollbar-track {
    background: transparent;
}
.chat-widget-messages::-webkit-scrollbar-thumb {
    background: #c3c4c7;
    border-radius: 10px;
}

/* Bot message bubble */
.chat-message {
    max-width: 90%;
    animation: chatMsgIn 0.3s ease forwards;
}
@keyframes chatMsgIn {
    from {
        opacity: 0;
        transform: translateY(8px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}
.chat-message-bubble {
    background: #ffffff;
    border-radius: 12px;
    border-top-left-radius: 2px;
    padding: 12px 16px;
    font-size: 13px;
    line-height: 1.5;
    color: #1d2327;
    border: 1px solid #dcdcde;
}
.chat-message-bubble h3 {
    font-size: 13px;
    font-weight: 600;
    color: #1d2327;
    margin: 8px 0 3px 0;
}
.chat-message-bubble h3:first-child {
    margin-top: 0;
}
.chat-message-bubble ul,
.chat-message-bubble ol {
    margin: 2px 0;
    padding-left: 18px;
}
.chat-message-bubble li {
    margin: 0;
    padding: 0;
    font-size: 13px;
    line-height: 1.4;
}
.chat-message-bubble strong {
    color: #1d2327;
}
.chat-message-bubble p {
    margin: 3px 0;
}
.chat-message-bubble p:first-child {
    margin-top: 0;
}
.chat-message-bubble p:last-child {
    margin-bottom: 0;
}

/* Icon badge for message */
.chat-message-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 28px;
    height: 28px;
    background: #dcdcde;
    border-radius: 50%;
    font-size: 14px;
    margin-bottom: 4px;
}

/* Message title */
.chat-message-title {
    font-weight: 600;
    font-size: 14px;
    color: #1d2327;
    margin-bottom: 4px;
}

/* Options / Buttons area */
.chat-options {
    display: flex;
    flex-direction: column;
    gap: 6px;
    margin-top: 8px;
}
.chat-option-btn {
    background: #ffffff;
    border: 1px solid #c3c4c7;
    border-radius: 8px;
    padding: 10px 14px;
    font-size: 13px;
    font-weight: 500;
    color: #2c3338;
    cursor: pointer;
    text-align: left;
    display: flex;
    align-items: center;
    gap: 8px;
    transition: all 0.2s ease;
    font-family: inherit;
    line-height: 1.3;
}
.chat-option-btn:hover {
    border-color: #00a0d2;
    background: #f0f7fc;
    color: #006e9c;
    transform: translateX(4px);
}
.chat-option-btn .option-icon {
    font-size: 18px;
    flex-shrink: 0;
}

/* Selected option (user's choice shown) */
.chat-user-choice {
    align-self: flex-end;
    max-width: 80%;
    animation: chatMsgIn 0.3s ease forwards;
}
.chat-user-choice-bubble {
    background: #00a0d2;
    color: white;
    border-radius: 12px;
    border-top-right-radius: 2px;
    padding: 8px 14px;
    font-size: 13px;
    font-weight: 500;
}

/* Emergency action buttons */
.chat-emergency-actions {
    display: flex;
    flex-direction: column;
    gap: 6px;
    margin-top: 10px;
}
.chat-emergency-btn {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 14px;
    border-radius: 8px;
    font-size: 13px;
    font-weight: 600;
    text-decoration: none;
    transition: all 0.2s ease;
    border: none;
    cursor: pointer;
    font-family: inherit;
}
.chat-emergency-btn.phone {
    background: #dc3232;
    color: white;
}
.chat-emergency-btn.phone:hover {
    background: #c22b2b;
}
.chat-emergency-btn.whatsapp {
    background: #46b450;
    color: white;
}
.chat-emergency-btn.whatsapp:hover {
    background: #3a9a42;
}
.chat-emergency-btn.email {
    background: #00a0d2;
    color: white;
}
.chat-emergency-btn.email:hover {
    background: #0085b0;
}
.chat-emergency-btn-icon {
    font-size: 18px;
}

/* Insurer channels display */
.chat-channels-list {
    margin-top: 8px;
}
.chat-channel-item {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 12px;
    background: #ffffff;
    border-radius: 6px;
    margin-bottom: 5px;
    border: 1px solid #dcdcde;
    transition: border-color 0.2s;
}
.chat-channel-item:hover {
    border-color: #00a0d2;
}
.chat-channel-item a {
    color: #00a0d2;
    text-decoration: none;
    font-weight: 500;
    font-size: 13px;
}
.chat-channel-item a:hover {
    color: #006e9c;
    text-decoration: underline;
}
.chat-channel-icon {
    font-size: 16px;
}

/* Service zone buttons */
.chat-zone-btn {
    background: #ffffff;
    border: 1px solid #c3c4c7;
    border-radius: 8px;
    padding: 10px 14px;
    font-size: 13px;
    font-weight: 500;
    color: #2c3338;
    cursor: pointer;
    text-align: left;
    display: flex;
    align-items: center;
    gap: 8px;
    transition: all 0.2s ease;
    font-family: inherit;
    width: 100%;
    margin-bottom: 5px;
}
.chat-zone-btn:hover {
    border-color: #f56e28;
    background: #fef8f4;
    color: #b44d1c;
    transform: translateX(4px);
}

/* Workshop card */
.chat-workshop-card {
    background: #ffffff;
    border: 1px solid #dcdcde;
    border-radius: 8px;
    padding: 10px 12px;
    margin-bottom: 5px;
}
.chat-workshop-name {
    font-weight: 600;
    font-size: 13px;
    color: #1d2327;
    margin-bottom: 3px;
}
.chat-workshop-detail {
    font-size: 12px;
    color: #646970;
    display: flex;
    align-items: center;
    gap: 5px;
    margin: 2px 0;
}
.chat-workshop-detail a {
    color: #00a0d2;
    text-decoration: none;
    font-weight: 500;
}
.chat-workshop-detail a:hover {
    color: #006e9c;
    text-decoration: underline;
}

/* Betetlap popup overlay */
.betetlap-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.7);
    z-index: 10001;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s ease;
    backdrop-filter: blur(4px);
}
.betetlap-overlay.is-open {
    opacity: 1;
    pointer-events: auto;
}
.betetlap-popup {
    background: #ffffff;
    border-radius: 12px;
    width: 90vw;
    max-width: 800px;
    max-height: 90vh;
    display: flex;
    flex-direction: column;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.4);
    transform: scale(0.9);
    transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}
.betetlap-overlay.is-open .betetlap-popup {
    transform: scale(1);
}
.betetlap-popup-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px 24px;
    border-bottom: 1px solid #dcdcde;
    background: #23282d;
    border-radius: 12px 12px 0 0;
}
.betetlap-popup-header h3 {
    margin: 0;
    font-size: 16px;
    font-weight: 600;
    color: #ffffff;
}
.betetlap-popup-close {
    background: rgba(255, 255, 255, 0.1);
    border: none;
    width: 36px;
    height: 36px;
    border-radius: 8px;
    font-size: 20px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #c3c4c7;
    transition: all 0.2s;
}
.betetlap-popup-close:hover {
    background: rgba(255, 255, 255, 0.2);
    color: #ffffff;
}
.betetlap-popup-body {
    flex: 1;
    overflow-y: auto;
    padding: 24px;
}
.betetlap-popup-body img {
    width: 100%;
    height: auto;
    border-radius: 6px;
    border: 1px solid #dcdcde;
}

/* Typing indicator */
.chat-typing {
    display: flex;
    gap: 4px;
    padding: 12px 18px;
    background: #ffffff;
    border: 1px solid #dcdcde;
    border-radius: 12px;
    border-top-left-radius: 2px;
    width: fit-content;
}
.chat-typing-dot {
    width: 8px;
    height: 8px;
    background: #a7aaad;
    border-radius: 50%;
    animation: typingBounce 1.2s ease infinite;
}
.chat-typing-dot:nth-child(2) {
    animation-delay: 0.15s;
}
.chat-typing-dot:nth-child(3) {
    animation-delay: 0.3s;
}
@keyframes typingBounce {
    0%, 60%, 100% {
        transform: translateY(0);
    }
    30% {
        transform: translateY(-6px);
    }
}

/* Restart button */
.chat-restart-btn {
    background: transparent;
    border: 1px solid #c3c4c7;
    color: #646970;
    border-radius: 6px;
    padding: 6px 12px;
    font-size: 11px;
    cursor: pointer;
    margin-top: 6px;
    align-self: center;
    transition: all 0.2s;
    font-family: inherit;
}
.chat-restart-btn:hover {
    background: #ffffff;
    color: #2c3338;
    border-color: #8c8f94;
}

/* Loading spinner */
.chat-loading {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
}
.chat-spinner {
    width: 24px;
    height: 24px;
    border: 3px solid #dcdcde;
    border-top-color: #00a0d2;
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}
@keyframes spin {
    to {
        transform: rotate(360deg);
    }
}

/* MOBILE RESPONSIVE */
@media (max-width: 768px) {
    .chat-widget-window {
        bottom: 0;
        left: 0;
        width: 100%;
        height: 100%;
        max-height: 100vh;
        border-radius: 0;
    }
    .chat-widget-toggle {
        bottom: 16px;
        left: 16px;
        padding: 8px 12px;
        font-size: 10px;
        gap: 4px;
        border-radius: 30px;
        max-width: 150px;
    }
    .chat-widget-toggle .chat-icon {
        font-size: 14px;
    }
    .betetlap-popup {
        width: 100vw;
        max-width: 100vw;
        max-height: 100vh;
        border-radius: 0;
    }
    .betetlap-popup-header {
        border-radius: 0;
    }
}

/* Powered by footer */
.chat-widget-footer {
    padding: 8px 16px;
    text-align: center;
    font-size: 11px;
    color: #a7aaad;
    border-top: 1px solid #dcdcde;
    background: #ffffff;
    flex-shrink: 0;
}
