/* Vision-X Bot Styles - Version 3.2.16 (Custom Form Design) */

/* FONTS */
@font-face { font-family: 'DINPro'; src: url('../fonts/DINPro-Light_1.otf') format('opentype'); font-weight: 300; font-style: normal; }
@font-face { font-family: 'DINPro'; src: url('../fonts/DINPro-Regular_1.otf') format('opentype'); font-weight: 400; font-style: normal; }
@font-face { font-family: 'DINPro'; src: url('../fonts/DINPro-Medium_1.otf') format('opentype'); font-weight: 500; font-style: normal; }
@font-face { font-family: 'DINPro'; src: url('../fonts/DINPro-Bold_1.otf') format('opentype'); font-weight: 700; font-style: normal; }
@font-face { font-family: 'DINPro'; src: url('../fonts/DINPro-Black_1.otf') format('opentype'); font-weight: 900; font-style: normal; }

:root {
    --vxb-primary: #6C5CE7;
    --vxb-bg-bot: #ffffff;
    --vxb-text: #333;
    --vxb-input-border: #ccc;
    --vxb-font: 'DINPro', sans-serif;
    
    /* Form Defaults (Fallbacks) */
    --vxb-form-bg: #ffffff;
    --vxb-form-radius: 12px;
    --vxb-inp-bg: #ffffff;
    --vxb-inp-border: #cccccc;
    --vxb-inp-radius: 6px;
    --vxb-btn-bg: #6C5CE7;
    --vxb-btn-text: #ffffff;

    --vxb-card-img-h: 60px;
    --vxb-card-icon-s: 24px;

    --vxb-w-d: 400px; --vxb-h-d: 600px;
}

.vision-x-bot-floating-widget {
    position: fixed; bottom: 20px; right: 20px; z-index: 999999;
    display: flex; flex-direction: column; align-items: flex-end; 
    font-family: var(--vxb-font) !important; pointer-events: none;
}
.vision-x-bot-floating-widget * { font-family: var(--vxb-font) !important; pointer-events: auto; }

/* TEASER */
.vxb-teaser {
    position: absolute; bottom: 92px; right: 0; background: #fff; color: #333;
    padding: 8px 16px; border-radius: 12px; box-shadow: 0 4px 20px rgba(0,0,0,0.15);
    font-size: 14px; font-weight: 500; white-space: nowrap; display: flex; align-items: center; gap: 10px;
    z-index: 999998; animation: vxb-float 3s ease-in-out infinite; transform-origin: bottom right;
}
.vxb-teaser::after {
    content: ''; position: absolute; bottom: -6px; right: 24px; width: 12px; height: 12px;
    background: #fff; transform: rotate(45deg);
}
.vxb-teaser-close { background: none; border: none; color: #999; font-size: 18px; cursor: pointer; padding: 0; line-height: 1; }
@keyframes vxb-float { 0%, 100% { transform: translateY(0); } 50% { transform: translateY(-4px); } }

/* TOGGLE */
.vision-x-bot-toggle {
    width: 60px; height: 60px; border-radius: 50%; cursor: pointer;
    display: flex; align-items: center; justify-content: center;
    box-shadow: 0 4px 12px rgba(0,0,0,0.2); margin-top: 15px;
    transition: transform 0.2s; background-color: var(--vxb-primary) !important;
    -webkit-tap-highlight-color: transparent;
    border: var(--vxb-toggle-border) !important;
}
.vision-x-bot-toggle.has-av {
    width: 65px; height: 65px; border-radius: 50%; overflow: hidden;
    box-shadow: 0 5px 15px rgba(0,0,0,0.2);
}
.vision-x-bot-toggle:active { transform: scale(0.95); }
.vision-x-bot-toggle img { width: 100%; height: 100%; object-fit: cover; }
.vision-x-bot-toggle svg { width: 28px; height: 28px; }

body.vision-x-bot-active .vision-x-bot-toggle { display: none !important; }

/* WINDOW */
.vision-x-bot-chat-window {
    width: var(--vxb-w-d); height: var(--vxb-h-d);
    background: #fff !important; border-radius: 16px; 
    box-shadow: 0 5px 30px rgba(0,0,0,0.2); border: 1px solid #e0e0e0;
    display: none; opacity: 0; transform: translateY(20px);
    transition: opacity 0.3s ease, transform 0.3s ease;
    flex-direction: column; overflow: hidden; margin-bottom: 15px; 
}
.vision-x-bot-chat-window.show { display: flex !important; opacity: 1; transform: translateY(0); }

/* HEADER */
.vision-x-bot-widget-header {
    flex-shrink: 0; padding: 15px 20px; background-color: var(--vxb-primary) !important;
    color: #fff !important; display: grid; grid-template-columns: 70px 1fr 50px; align-items: center;
    position: relative; z-index: 101;
}
.vxb-header-left { display: flex; align-items: center; justify-content: flex-start; }
.vxb-header-img { width: 60px; height: 60px; border-radius: 50%; object-fit: cover; border: 2px solid rgba(255,255,255,0.3); }
.vxb-head-txt { text-align: var(--vxb-h-align); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.vxb-head-txt h3 { margin: 0; font-size: var(--vxb-title-size); font-weight: 900; color: #fff !important; }
.vxb-head-txt p { margin: 2px 0 0 0; font-size: var(--vxb-sub-size); font-weight: 400; opacity: 0.9; color: #fff !important; }
.vxb-header-right { display: flex; justify-content: flex-end; }
.vision-x-bot-close-btn { background: none; border: none; color: #fff !important; font-size: 32px; cursor: pointer; padding: 0; }

/* MESSAGES */
.vision-x-bot-chat-messages {
    flex-grow: 1; overflow-y: auto; padding: 20px; background: #f9f9f9;
    display: flex; flex-direction: column; gap: 15px; -webkit-overflow-scrolling: touch;
    position: relative; /* For loader */
}
.vision-x-bot-message { display: flex; align-items: flex-end; max-width: 100%; }
.vision-x-bot-message.user { justify-content: flex-end; }
.vision-x-bot-message.bot { justify-content: flex-start; }

.vxb-avatar { width: 32px; height: 32px; border-radius: 50%; flex-shrink: 0; overflow: hidden; margin-bottom: 2px; display: flex; align-items: center; justify-content: center; }
.vxb-avatar.bot { margin-right: 10px; }
.vxb-avatar.user { margin-left: 10px; }
.vxb-avatar img { width: 100%; height: 100%; object-fit: cover; }
.vxb-avatar.placeholder { background: #e0e0e0; color: #777; }
.vxb-avatar.placeholder.user { background: #d5d5d5; }

.vxb-msg-content {
    padding: 12px 16px; border-radius: 18px; font-size: 15px; line-height: 1.5; font-weight: 400;
    max-width: 85%; word-wrap: break-word; box-shadow: 0 1px 2px rgba(0,0,0,0.05);
    white-space: pre-wrap;
}
.vxb-msg-content a { text-decoration: underline; font-weight: 500; }
.vision-x-bot-message.user .vxb-msg-content { background-color: var(--vxb-primary) !important; color: #fff !important; border-bottom-right-radius: 4px; }
.vision-x-bot-message.user .vxb-msg-content a { color: #fff !important; }
.vision-x-bot-message.bot .vxb-msg-content { background-color: var(--vxb-bg-bot) !important; color: var(--vxb-text) !important; border: 1px solid #eee; border-bottom-left-radius: 4px; }
.vision-x-bot-message.bot .vxb-msg-content a { color: var(--vxb-primary) !important; }
.vxb-msg-content.typing { color: #999 !important; font-style: italic; padding: 8px 14px; }

/* INPUT AREA */
.vision-x-bot-input-area {
    flex-shrink: 0; background: #fff; border-top: 1px solid #eee; 
    padding: 10px; 
    display: flex; align-items: flex-end; gap: 8px; 
    flex-wrap: wrap !important;
}

.vision-x-bot-attachments { 
    width: 100%; flex-basis: 100%; 
    order: -1; display: flex; flex-wrap: wrap; gap: 5px; margin-bottom: 5px; padding: 0; 
}

.vxb-att-chip { font-size: 12px; background: #f0f0f0; padding: 4px 10px; border-radius: 12px; color: #555; border: 1px solid #ddd; font-weight: 500; display: inline-flex; align-items: center; }
.vxb-remove-att { margin-left: 8px; cursor: pointer; font-weight: 700; color: #999; font-size: 16px; padding: 2px; }
.vxb-remove-att:hover { color: #d63638; }

.vision-x-bot-input {
    flex: 1; border: 1px solid var(--vxb-input-border) !important; 
    border-radius: 24px; 
    padding: 10px 14px; 
    max-height: 100px; resize: none; outline: none; 
    font-family: inherit; color: var(--vxb-text) !important; background: #fcfcfc;
    font-size: 15px !important; font-weight: 400; -webkit-appearance: none;
    line-height: 1.4;
}
.vision-x-bot-input:focus { border-color: var(--vxb-primary) !important; background: #fff; }

.vision-x-bot-send-btn {
    color: #fff !important; border: none; padding: 8px 18px; border-radius: 24px; 
    cursor: pointer; font-weight: 500; font-size: 15px; background-color: var(--vxb-primary) !important; flex-shrink: 0;
    -webkit-tap-highlight-color: transparent;
}
.vision-x-bot-attach-btn { background: none; border: none; cursor: pointer; font-size: 20px; padding: 6px; color: #999; flex-shrink: 0; }

/* FOOTER */
.vision-x-bot-footer {
    flex-shrink: 0; font-size: 11px; text-align: center; color: #aaa; padding: 8px; 
    border-top: 1px solid #f9f9f9; background: #fff; font-weight: 300;
    padding-bottom: env(safe-area-inset-bottom, 8px);
}
.vision-x-bot-footer a { color: var(--vxb-primary) !important; text-decoration: none; font-weight: 500; }

/* MOBILE */
@media (max-width: 480px) {
    .vision-x-bot-chat-window { 
        width: 100% !important; height: 100dvh !important; max-height: 100dvh !important;
        position: fixed; bottom: 0; right: 0; left: 0; top: 0; border-radius: 0; margin: 0; z-index: 1000000;
    }
    .vision-x-bot-floating-widget { right: 20px; left: auto; bottom: 20px; align-items: flex-end; }
    .vision-x-bot-toggle { position: fixed; bottom: 20px; right: 20px; z-index: 999999; }
    .vxb-teaser { display: none !important; }
    body.vision-x-bot-active .vision-x-bot-toggle { display: none; }
    .vision-x-bot-input { font-size: 16px; }
}

/* ANIMATIONS */
.vxb-dots { display: inline-flex; gap: 4px; align-items: center; height: 12px; }
.vxb-dots span { width: 6px; height: 6px; background: #999; border-radius: 50%; animation: vxb-bounce 1.4s infinite ease-in-out both; }
.vxb-dots span:nth-child(1) { animation-delay: -0.32s; }
.vxb-dots span:nth-child(2) { animation-delay: -0.16s; }
@keyframes vxb-bounce { 0%, 80%, 100% { transform: scale(0); } 40% { transform: scale(1); } }

.vxb-wave { display: inline-flex; gap: 3px; align-items: flex-end; height: 16px; }
.vxb-wave span { width: 3px; height: 6px; background: #999; animation: vxb-wave-anim 1s infinite ease-in-out; }
.vxb-wave span:nth-child(2) { animation-delay: 0.1s; }
.vxb-wave span:nth-child(3) { animation-delay: 0.2s; }
@keyframes vxb-wave-anim { 0%,100% { height: 6px; } 50% { height: 14px; } }

.vxb-spinner { width: 16px; height: 16px; border: 2px solid #e0e0e0; border-top-color: #888; border-radius: 50%; animation: vxb-spin 0.8s linear infinite; }
@keyframes vxb-spin { to { transform: rotate(360deg); } }

/* =============================================================================
   WIZARD FORM STYLES (CUSTOMIZABLE)
   ============================================================================= */

.vxb-chat-form {
    /* Styles inherited from parent but reset specific props */
}

.vxb-form-steps-wrapper {
    background: var(--vxb-form-bg);
    border-radius: var(--vxb-form-radius);
    border: 1px solid #e5e5e5; /* Slight border for contrast on white bg */
    padding: 16px;
    margin-top: 5px;
    box-shadow: 0 2px 6px rgba(0,0,0,0.03);
}

/* Override message bubble styles for form container */
.vision-x-bot-message.bot .vxb-msg-content.form-content {
    padding: 0; background: transparent !important; border: none; box-shadow: none; max-width: 100%; width: 100%;
}

.vxb-form-step h4 {
    margin: 0 0 15px 0;
    font-size: 16px;
    color: var(--vxb-primary);
    font-weight: 600;
}

/* Form Group */
.vxb-form-group {
    display: block; /* Fixes alignment issue */
    margin-bottom: 12px;
    width: 100%;
}

.vxb-form-group label {
    display: block;
    font-size: 13px;
    font-weight: 500;
    color: var(--vxb-text);
    margin-bottom: 5px;
}

/* Controls */
.vxb-form-control {
    width: 100%;
    padding: 10px 12px;
    border: 1px solid var(--vxb-inp-border);
    background-color: var(--vxb-inp-bg);
    border-radius: var(--vxb-inp-radius);
    font-family: inherit;
    font-size: 14px;
    box-sizing: border-box;
    transition: all 0.2s;
}
.vxb-form-control:focus {
    outline: none;
    border-color: var(--vxb-primary);
    box-shadow: 0 0 0 2px rgba(108, 92, 231, 0.1); /* Optional glow based on primary */
}
.vxb-form-control.error {
    border-color: #d63638;
    background-color: #fff8f8;
}

/* Cards Grid */
.vxb-cards-container {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px;
    width: 100%;
}

.vxb-card-option {
    background: var(--vxb-inp-bg);
    border: 1px solid var(--vxb-inp-border);
    border-radius: var(--vxb-inp-radius);
    padding: 12px;
    text-align: center;
    cursor: pointer;
    transition: all 0.2s;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 6px;
}
.vxb-card-option:hover {
    border-color: var(--vxb-primary);
    transform: translateY(-1px);
    box-shadow: 0 2px 5px rgba(0,0,0,0.05);
}
.vxb-card-option.selected {
    background: var(--vxb-primary);
    color: #fff;
    border-color: var(--vxb-primary);
}
.vxb-card-option img {
    width: 100%; height: var(--vxb-card-img-h); object-fit: contain; margin-bottom: 4px; border-radius: 4px;
}
.vxb-card-icon { font-size: var(--vxb-card-icon-s); }
.vxb-card-option span { font-size: 13px; font-weight: 500; line-height: 1.2; }

/* Navigation */
.vxb-form-nav {
    display: flex;
    justify-content: space-between;
    margin-top: 20px;
    padding-top: 10px;
    border-top: 1px solid #f0f0f0;
}

.vxb-btn-next, .vxb-btn-back, .vxb-btn-submit {
    padding: 8px 20px;
    border-radius: var(--vxb-inp-radius); /* Consistent radius */
    border: none;
    cursor: pointer;
    font-size: 14px;
    font-weight: 500;
    transition: all 0.2s;
}

.vxb-btn-next, .vxb-btn-submit {
    background: var(--vxb-btn-bg);
    color: var(--vxb-btn-text);
    margin-left: auto;
}
.vxb-btn-next:hover, .vxb-btn-submit:hover {
    opacity: 0.9; transform: translateY(-1px);
}

.vxb-btn-back {
    background: #f0f0f0;
    color: #666;
}
.vxb-btn-back:hover { background: #e0e0e0; }

.vxb-form-sent {
    text-align: center; color: #2ecc71; font-weight: 500; padding: 20px;
}

/* Restore Loader */
.vxb-restore-loader {
    position: absolute;
    top: 0; left: 0; width: 100%; height: 100%;
    background: #ffffff;
    z-index: 100;
    display: flex;
    align-items: center;
    justify-content: center;
}
.vxb-restore-spinner {
    width: 40px; height: 40px;
    border: 4px solid #f3f3f3;
    border-top: 4px solid var(--vxb-primary, #6C5CE7);
    border-radius: 50%;
    animation: vxb-spin 1s linear infinite;
}

/* ACTION CARDS */
.vxb-action-card {
    background: var(--vxb-inp-bg);
    border: 1px solid var(--vxb-inp-border);
    border-radius: var(--vxb-form-radius);
    padding: 0;
    overflow: hidden;
    margin-top: 10px;
    cursor: pointer;
    transition: all 0.2s ease;
    width: 100%;
    max-width: var(--vxb-card-width, 300px);
    height: var(--vxb-card-height, auto);
    display: block; /* Ensure block behavior */
}
.vxb-action-card.vxb-inline {
    display: inline-flex;
    flex-direction: column;
    vertical-align: middle;
    width: auto;
    margin: 2px 4px;
}
.vxb-action-card:hover {
    border-color: var(--vxb-primary);
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0,0,0,0.08);
}
.vxb-ac-image-wrap {
    width: 100%;
    height: var(--vxb-card-img-h, 160px);
    background: transparent;
    overflow: hidden;
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0; /* Fix: Prevent image from collapsing in flex container */
}
.vxb-ac-img {
    width: 100%;
    height: 100%;
    object-fit: contain;
    transition: transform 0.3s ease;
}
.vxb-ac-image-wrap:hover .vxb-ac-img {
    transform: scale(1.05);
}
.vxb-ac-content {
    padding: 12px 15px;
}
.vxb-ac-title {
    margin: 0 0 5px 0;
    font-size: 15px;
    font-weight: 700;
    color: var(--vxb-primary);
}
.vxb-ac-desc {
    margin: 0;
    font-size: 13px;
    color: var(--vxb-text);
    line-height: 1.4;
    opacity: 0.9;
}

/* IMAGE VIEWER */
#vxb-image-viewer {
    position: fixed; top: 0; left: 0; width: 100%; height: 100%;
    z-index: 9999999;
    display: none; /* Flex when active */
    align-items: center;
    justify-content: center;
}
.vxb-viewer-backdrop {
    position: absolute; top: 0; left: 0; width: 100%; height: 100%;
    background: rgba(0,0,0,0.85);
    cursor: pointer;
}
.vxb-viewer-content {
    position: relative;
    z-index: 1;
    max-width: 90%;
    max-height: 90%;
    display: flex;
    flex-direction: column;
    align-items: center;
}
.vxb-viewer-img {
    max-width: 100%;
    max-height: 85vh;
    border-radius: 8px;
    box-shadow: 0 5px 25px rgba(0,0,0,0.5);
}
.vxb-viewer-close {
    position: absolute;
    top: -40px; right: 0;
    background: none; border: none;
    color: #fff; font-size: 30px; cursor: pointer;
    padding: 5px;
    line-height: 1;
}

/* MOBILE IMAGE VIEWER (Bottom Sheet) */
@media (max-width: 480px) {
    #vxb-image-viewer {
        align-items: flex-end; /* Bottom alignment */
    }
    .vxb-viewer-content {
        width: 100%;
        max-width: 100%;
        max-height: 90vh;
        background: #fff;
        border-radius: 20px 20px 0 0;
        padding: 20px;
        padding-top: 40px;
        transform: translateY(100%); /* Start hidden */
        animation: vxb-slide-up 0.3s forwards;
        box-sizing: border-box;
    }
    .vxb-viewer-img {
        width: 100%;
        height: auto;
        max-height: 80vh;
        object-fit: contain;
        border-radius: 8px;
        box-shadow: none;
    }
    .vxb-viewer-close {
        top: 10px; right: 15px;
        color: #333;
        font-size: 24px;
        background: #f0f0f0;
        width: 32px; height: 32px;
        border-radius: 50%;
        display: flex; align-items: center; justify-content: center;
    }
    .vxb-viewer-backdrop {
        background: rgba(0,0,0,0.6);
    }
}
@keyframes vxb-slide-up {
    to { transform: translateY(0); }
}