/**
 * Marsi Advisor - Public CSS (Marstek Venus Configurator)
 *
 * Dark theme met cyan accenten, matching de Marsi robot.
 *
 * @package Marsi_Advisor
 * @since   2.0.0
 */

/* =================================================================
   CSS VARIABLES
   ================================================================= */
:root {
    --marsi-primary: #4DD0E1;
    --marsi-secondary: #26C6DA;
    --marsi-accent: #4CAF50;
    --marsi-dark: #2D3A48;
    --marsi-darker: #1E293B;
    --marsi-robot: #3A4856;
    --marsi-bg: #ffffff;
    --marsi-text: #333333;
    --marsi-light: #f5f7fa;
    --marsi-shadow: 0 8px 40px rgba(0, 0, 0, 0.25);
    --marsi-radius: 20px;
}

/* =================================================================
   TRIGGER BUTTON
   ================================================================= */
.marsi-widget.marsi-pre-appear { opacity: 0; pointer-events: none; }
.marsi-widget.marsi-appear-in {
    animation: marsiAppearIn 0.5s ease-out both;
}
@keyframes marsiAppearIn {
    0%   { opacity: 0; }
    100% { opacity: 1; }
}
.marsi-trigger {
    position: fixed; z-index: 99998;
    width: 76px; height: 76px; border-radius: 50%;
    background: linear-gradient(135deg, #4DD0E1, #26C6DA);
    border: none; cursor: pointer;
    box-shadow: 0 4px 24px rgba(77,208,225,0.4);
    transition: transform 0.3s cubic-bezier(0.34,1.56,0.64,1), box-shadow 0.3s;
    display: flex; align-items: center; justify-content: center;
    padding: 0; outline: none;
}
.marsi-position-bottom-right .marsi-trigger { bottom: 24px; right: 24px; }
.marsi-position-bottom-left .marsi-trigger { bottom: 24px; left: 24px; }

.marsi-trigger:hover { transform: scale(1.1); box-shadow: 0 6px 32px rgba(77,208,225,0.5); }
.marsi-trigger:active { transform: scale(0.95); }

.marsi-trigger::before {
    content: ''; position: absolute; width: 100%; height: 100%;
    border-radius: 50%; background: #4DD0E1;
    opacity: 0; animation: marsi-pulse 2s ease-out infinite;
}
.marsi-trigger.marsi-active::before { animation: none; }

@keyframes marsi-pulse {
    0% { transform: scale(1); opacity: 0.35; }
    100% { transform: scale(1.8); opacity: 0; }
}

.marsi-trigger-svg { width: 52px; height: 52px; position: relative; z-index: 1; }

/* Badge */
.marsi-badge {
    position: absolute; top: -2px; right: -2px;
    width: 22px; height: 22px; background: var(--marsi-accent);
    border-radius: 50%; display: flex; align-items: center; justify-content: center;
    font-size: 11px; font-weight: 700; color: #fff;
    border: 2px solid #fff; z-index: 2;
    animation: marsi-bounce-in 0.5s cubic-bezier(0.34,1.56,0.64,1);
}
.marsi-trigger.marsi-active .marsi-badge { display: none; }

@keyframes marsi-bounce-in {
    0% { transform: scale(0); opacity: 0; }
    60% { transform: scale(1.2); }
    100% { transform: scale(1); opacity: 1; }
}

/* =================================================================
   CHAT WINDOW
   ================================================================= */
.marsi-chat {
    position: fixed; z-index: 99999;
    width: 420px; max-width: calc(100vw - 32px);
    max-height: calc(100vh - 120px); height: 600px;
    background: var(--marsi-bg);
    border-radius: var(--marsi-radius);
    box-shadow: var(--marsi-shadow);
    display: none; flex-direction: column; overflow: hidden;
}
.marsi-position-bottom-right .marsi-chat { bottom: 108px; right: 24px; }
.marsi-position-bottom-left .marsi-chat { bottom: 108px; left: 24px; }
.marsi-chat.marsi-open { display: flex; opacity: 1; visibility: visible; }

/* =================================================================
   HEADER
   ================================================================= */
.marsi-chat-header {
    background: linear-gradient(135deg, #2D3A48, #1E293B);
    color: #fff; padding: 18px 20px;
    display: flex; align-items: center; gap: 14px; flex-shrink: 0;
    border-bottom: 2px solid #4DD0E1;
}
.marsi-chat-avatar { width: 48px; height: 48px; flex-shrink: 0; }
.marsi-chat-header-info h3 { margin: 0; font-size: 17px; font-weight: 700; color: #fff !important; }
.marsi-chat-header-info p { margin: 3px 0 0; font-size: 12px; opacity: 0.7; color: #fff !important; }

.marsi-chat-close {
    margin-left: auto; background: rgba(255,255,255,0.1);
    border: none; color: #fff; width: 32px; height: 32px;
    border-radius: 50%; cursor: pointer; font-size: 18px;
    display: flex; align-items: center; justify-content: center;
    transition: background 0.2s; flex-shrink: 0;
}
.marsi-chat-close:hover { background: rgba(255,255,255,0.25); }

/* =================================================================
   BODY
   ================================================================= */
.marsi-chat-body {
    flex: 1; overflow-y: auto; overflow-x: hidden; padding: 20px;
    display: flex; flex-direction: column; gap: 14px;
    background: var(--marsi-light); scroll-behavior: smooth;
    box-sizing: border-box;
}
.marsi-chat-body * { box-sizing: border-box; }
.marsi-chat-body::-webkit-scrollbar { width: 5px; }
.marsi-chat-body::-webkit-scrollbar-track { background: transparent; }
.marsi-chat-body::-webkit-scrollbar-thumb { background: #ddd; border-radius: 3px; }

/* =================================================================
   POWERED BY FOOTER
   ================================================================= */
.marsi-powered-by {
    flex-shrink: 0;
    padding: 8px 16px;
    font-size: 11px;
    line-height: 1.2;
    color: #94a3b8;
    text-align: center;
    background: #fff;
    border-top: 1px solid #e5e7eb;
    border-radius: 0 0 20px 20px;
    letter-spacing: 0.2px;
}
.marsi-powered-by a {
    color: var(--marsi-primary);
    text-decoration: none;
    font-weight: 600;
}
.marsi-powered-by a:hover { text-decoration: underline; }
.marsi-powered-by strong { font-weight: 700; }

/* =================================================================
   MESSAGES
   ================================================================= */
.marsi-message { display: flex; gap: 10px; align-items: flex-start; animation: marsi-slide-up 0.4s cubic-bezier(0.34,1.56,0.64,1); }
.marsi-message-user { justify-content: flex-end; }

@keyframes marsi-slide-up {
    from { opacity: 0; transform: translateY(16px); }
    to { opacity: 1; transform: translateY(0); }
}

.marsi-message-avatar { width: 36px; height: 36px; flex-shrink: 0; }
.marsi-message-bubble {
    background: #fff; border-radius: 16px 16px 16px 4px;
    padding: 14px 18px; font-size: 14px; line-height: 1.55;
    color: var(--marsi-text); box-shadow: 0 1px 4px rgba(0,0,0,0.06);
    max-width: 85%;
}
.marsi-message-bubble a { color: #4DD0E1; font-weight: 700; text-decoration: underline; }
.marsi-user-bubble {
    background: var(--marsi-dark) !important;
    color: #fff !important;
    border-radius: 16px 16px 4px 16px !important;
}

/* =================================================================
   TYPING INDICATOR
   ================================================================= */
.marsi-typing-indicator { display: flex; gap: 5px; padding: 14px 18px; }
.marsi-typing-dot {
    width: 8px; height: 8px; background: #bbb;
    border-radius: 50%; animation: marsi-typing 1.4s ease-in-out infinite;
}
.marsi-typing-dot:nth-child(2) { animation-delay: 0.2s; }
.marsi-typing-dot:nth-child(3) { animation-delay: 0.4s; }
@keyframes marsi-typing {
    0%, 60%, 100% { transform: translateY(0); opacity: 0.4; }
    30% { transform: translateY(-8px); opacity: 1; }
}

/* =================================================================
   OPTIONS
   ================================================================= */
.marsi-options {
    display: flex; flex-direction: column; gap: 8px; margin-top: 6px;
    animation: marsi-slide-up 0.5s cubic-bezier(0.34,1.56,0.64,1);
}
.marsi-option-btn {
    display: block; width: 100%; padding: 12px 18px;
    border: 2px solid var(--marsi-primary);
    border-radius: 12px; background: #fff;
    color: #2D3A48; font-size: 14px; font-weight: 600;
    cursor: pointer; text-align: left;
    transition: all 0.25s ease; position: relative; overflow: hidden;
    font-family: inherit;
    box-sizing: border-box;
    text-decoration: none;
    line-height: 1.3;
    -webkit-appearance: none;
    appearance: none;
    margin: 0;
}
.marsi-option-btn,
.marsi-option-btn:hover,
.marsi-option-btn:focus,
.marsi-option-btn:visited { text-decoration: none; }
.marsi-option-btn::before {
    content: ''; position: absolute; top: 0; left: 0;
    width: 0; height: 100%; background: var(--marsi-primary);
    transition: width 0.3s ease; z-index: 0;
}
.marsi-option-btn:hover::before { width: 100%; }
.marsi-option-btn:hover { color: #fff; box-shadow: 0 2px 12px rgba(77,208,225,0.25); }
.marsi-option-btn span { position: relative; z-index: 1; }
.marsi-option-btn.marsi-selected { background: var(--marsi-primary); color: #1E293B; border-color: var(--marsi-primary); pointer-events: none; }
.marsi-option-btn.marsi-selected::before { width: 100%; }

/* =================================================================
   HYBRID INPUT (Solar Wp / kWh vragen)
   ================================================================= */
.marsi-hybrid-container { animation: marsi-slide-up 0.5s cubic-bezier(0.34,1.56,0.64,1); }
.marsi-input-group { margin-top: 12px; }
.marsi-input-label { font-size: 12px; color: #94a3b8; margin-bottom: 6px; font-weight: 600; }
.marsi-input-row { display: flex; gap: 6px; align-items: center; }
.marsi-number-input {
    flex: 1; padding: 11px 14px; border: 2px solid #e2e8f0;
    border-radius: 10px; font-size: 15px; font-family: inherit;
    outline: none; transition: border-color 0.2s; color: #333;
    background: #fff;
}
.marsi-number-input:focus { border-color: var(--marsi-primary); }
.marsi-number-input.marsi-input-error { border-color: #ef4444; animation: marsi-shake 0.4s ease; }
@keyframes marsi-shake {
    0%, 100% { transform: translateX(0); }
    25% { transform: translateX(-6px); }
    75% { transform: translateX(6px); }
}
.marsi-input-suffix {
    font-size: 13px; font-weight: 700; color: #64748b;
    background: #f1f5f9; padding: 11px 12px; border-radius: 10px;
    white-space: nowrap;
}
.marsi-input-submit {
    padding: 11px 18px; background: var(--marsi-primary);
    color: #1E293B; border: none; border-radius: 10px;
    font-size: 14px; font-weight: 700; cursor: pointer;
    transition: background 0.2s, transform 0.2s; font-family: inherit;
    white-space: nowrap;
}
.marsi-input-submit:hover { background: #26C6DA; transform: scale(1.05); }
.marsi-input-submit:disabled { opacity: 0.5; cursor: not-allowed; }
.marsi-input-hint { font-size: 11px; color: #94a3b8; margin-top: 6px; font-style: italic; }

/* =================================================================
   PROGRESS BAR
   ================================================================= */
.marsi-progress { height: 4px; background: #e8e8e8; flex-shrink: 0; overflow: hidden; }
.marsi-progress-bar {
    height: 100%;
    background: linear-gradient(90deg, var(--marsi-primary), var(--marsi-secondary));
    transition: width 0.5s cubic-bezier(0.4,0,0.2,1);
    width: 0%; border-radius: 0 2px 2px 0;
}

/* =================================================================
   RESULT CARD
   ================================================================= */
.marsi-result {
    background: #fff; border-radius: 16px;
    box-shadow: 0 4px 20px rgba(0,0,0,0.08);
    overflow: hidden; margin-top: 10px;
    animation: marsi-card-in 0.6s cubic-bezier(0.34,1.56,0.64,1);
}
@keyframes marsi-card-in {
    from { opacity: 0; transform: translateY(20px) scale(0.95); }
    to { opacity: 1; transform: translateY(0) scale(1); }
}

.marsi-result-header {
    display: flex; align-items: center; gap: 14px;
    padding: 18px 20px; border-bottom: 1px solid #f0f0f0;
}
.marsi-result-icon {
    width: 56px; height: 56px; border-radius: 14px;
    display: flex; align-items: center; justify-content: center;
    flex-shrink: 0;
}
.marsi-result-header h4 { font-size: 18px; font-weight: 800; color: #1E293B; margin: 0 0 2px; }
.marsi-result-header p { font-size: 12px; color: #64748b; margin: 0; }

.marsi-result-specs {
    display: grid; grid-template-columns: 1fr 1fr;
    gap: 1px; background: #f0f0f0;
    border-bottom: 1px solid #f0f0f0;
}
.marsi-spec-item { background: #fff; padding: 14px 18px; }
.marsi-spec-label { display: block; font-size: 10px; color: #94a3b8; text-transform: uppercase; letter-spacing: 0.5px; font-weight: 600; }
.marsi-spec-value { font-size: 16px; font-weight: 800; color: #1E293B; }

.marsi-result-explanation {
    padding: 16px 20px; font-size: 13px; line-height: 1.6;
    color: #475569; background: #f8fafc;
    border-bottom: 1px solid #f0f0f0;
}
.marsi-result-explanation strong { color: #1E293B; }

.marsi-order-btn {
    display: flex; align-items: center; justify-content: center; gap: 8px;
    margin: 16px 20px 20px; padding: 14px 24px;
    background: linear-gradient(135deg, #4CAF50, #43A047);
    color: #fff; border: none; border-radius: 12px;
    font-size: 15px; font-weight: 700; cursor: pointer;
    text-decoration: none; transition: transform 0.2s, box-shadow 0.2s;
    box-shadow: 0 4px 15px rgba(76,175,80,0.3);
    font-family: inherit; width: calc(100% - 40px);
}
.marsi-order-btn:hover { transform: translateY(-2px); box-shadow: 0 6px 20px rgba(76,175,80,0.4); color: #fff; }

.marsi-result-alt {
    padding: 0 20px 16px; font-size: 12px; color: #94a3b8; text-align: center;
}
.marsi-result-alt a { color: var(--marsi-primary); text-decoration: none; font-weight: 600; cursor: pointer; }
.marsi-result-alt a:hover { text-decoration: underline; }

/* =================================================================
   RESTART BUTTON
   ================================================================= */
.marsi-restart {
    margin-top: 12px; padding: 12px; background: none;
    border: 2px dashed #ddd; border-radius: 12px;
    color: #999; font-size: 13px; font-weight: 600;
    cursor: pointer; width: 100%; transition: all 0.2s; font-family: inherit;
}
.marsi-restart:hover { border-color: var(--marsi-primary); color: var(--marsi-primary); background: rgba(77,208,225,0.04); }

/* =================================================================
   TOOLTIP
   ================================================================= */
.marsi-greeting-tooltip {
    position: fixed; z-index: 99997; background: #1E293B; color: #e2e8f0;
    padding: 14px 18px; border-radius: 14px;
    box-shadow: 0 4px 24px rgba(0,0,0,0.2);
    font-size: 14px; max-width: 260px; line-height: 1.4;
    transform: scale(0); opacity: 0;
    transition: transform 0.4s cubic-bezier(0.34,1.56,0.64,1), opacity 0.3s;
    border: 1px solid #334155;
}
.marsi-position-bottom-right .marsi-greeting-tooltip {
    bottom: 108px; right: 24px; transform-origin: bottom right;
}
.marsi-position-bottom-left .marsi-greeting-tooltip {
    bottom: 108px; left: 24px; transform-origin: bottom left;
}
.marsi-greeting-tooltip.marsi-show { transform: scale(1); opacity: 1; }
.marsi-tooltip-close {
    position: absolute; top: 6px; right: 8px;
    width: 24px; height: 24px; padding: 0;
    background: transparent; border: 0; color: #94a3b8;
    font-size: 20px; line-height: 1; cursor: pointer;
    border-radius: 50%;
    display: flex; align-items: center; justify-content: center;
    transition: background 0.2s, color 0.2s;
}
.marsi-tooltip-close:hover { background: rgba(255,255,255,0.1); color: #fff; }
.marsi-greeting-tooltip .marsi-tooltip-content { padding-right: 18px; }
.marsi-greeting-tooltip::after {
    content: ''; position: absolute; bottom: -8px; right: 30px;
    width: 16px; height: 16px; background: #1E293B;
    transform: rotate(45deg); box-shadow: 4px 4px 8px rgba(0,0,0,0.06);
    border-right: 1px solid #334155; border-bottom: 1px solid #334155;
}

/* Inline Marsi-icoon in berichten en tooltip */
.marsi-inline-icon {
    display: inline-flex;
    vertical-align: -0.3em;
    width: 1.3em;
    height: 1.3em;
    margin: 0 2px;
    line-height: 1;
}
.marsi-inline-icon svg {
    width: 100%;
    height: 100%;
}



/* =================================================================
   ANIMATIONS
   ================================================================= */
.marsi-avatar-idle { animation: marsi-idle-bounce 3s ease-in-out infinite; }
@keyframes marsi-idle-bounce { 0%, 100% { transform: translateY(0); } 50% { transform: translateY(-3px); } }
.marsi-eye-highlight { animation: marsi-blink 4s ease-in-out infinite; }
@keyframes marsi-blink { 0%, 45%, 55%, 100% { opacity: 1; } 50% { opacity: 0.1; } }
.marsi-visor-glow { animation: marsi-glow 2s ease-in-out infinite; }
@keyframes marsi-glow { 0%, 100% { opacity: 0.9; } 50% { opacity: 0.5; } }
.marsi-bolt-glow { animation: marsi-bolt 2s ease-in-out infinite; }
@keyframes marsi-bolt { 0%, 100% { opacity: 1; } 50% { opacity: 0.6; } }

/* =================================================================
   RESPONSIVE
   ================================================================= */
/* =================================================================
   HIDE OTHER CHAT WIDGETS (Leadbot Widget on marstek.be)
   When Marsi is active on a page, hide the existing chat widget.
   ================================================================= */
#ldbtwdgt,
div[id="ldbtwdgt"],
.ldbtwdgt,
.ldbtwdgt_avatar,
.ldbtwdgt--right {
    display: none !important;
    visibility: hidden !important;
    opacity: 0 !important;
    pointer-events: none !important;
}

@media (max-width: 480px) {
    .marsi-chat {
        width: calc(100vw - 16px) !important;
        max-height: calc(100vh - 80px);
        bottom: 8px !important; right: 8px !important; left: auto !important;
        border-radius: 16px;
    }
    .marsi-trigger { width: 64px !important; height: 64px !important; bottom: 16px !important; }
    .marsi-trigger-svg { width: 44px !important; height: 44px !important; }
    .marsi-greeting-tooltip { max-width: 200px; font-size: 13px; }
}

/* === 2.1.0: AI / FAQ / Lead form / Quick actions === */

/* AI input */
.marsi-ai-input-wrap {
    display: flex;
    gap: 8px;
    align-items: flex-end;
    background: #fff;
    border: 1.5px solid var(--marsi-primary);
    border-radius: 14px;
    padding: 8px;
    margin-top: 6px;
    box-shadow: 0 1px 4px rgba(0,0,0,0.05);
}
.marsi-ai-input {
    flex: 1;
    border: none;
    outline: none;
    resize: none;
    font-size: 14px;
    font-family: inherit;
    padding: 8px;
    color: var(--marsi-text);
    background: transparent;
    min-height: 36px;
    max-height: 120px;
}
.marsi-ai-send {
    flex-shrink: 0;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: linear-gradient(135deg, #4DD0E1, #26C6DA);
    color: #fff;
    border: none;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: transform 0.2s;
}
.marsi-ai-send:hover { transform: scale(1.08); }
.marsi-ai-send:disabled { opacity: 0.5; cursor: wait; }

/* FAQ */
.marsi-faq-list {
    display: flex;
    flex-direction: column;
    gap: 6px;
    margin-top: 6px;
}
.marsi-faq-row {
    background: #fff;
    border-radius: 10px;
    overflow: hidden;
    border: 1px solid #e5e7eb;
}
.marsi-faq-q {
    width: 100%;
    text-align: left;
    background: #fff;
    border: none;
    padding: 12px 16px;
    font-size: 14px;
    font-weight: 600;
    color: var(--marsi-darker);
    cursor: pointer;
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 10px;
    font-family: inherit;
}
.marsi-faq-q:hover { background: var(--marsi-light); }
.marsi-faq-arrow {
    color: var(--marsi-primary);
    font-size: 20px;
    font-weight: 700;
    width: 20px;
    text-align: center;
    flex-shrink: 0;
}
.marsi-faq-a {
    padding: 0 16px 14px;
    font-size: 13px;
    line-height: 1.6;
    color: #4b5563;
    border-top: 1px solid #f3f4f6;
    padding-top: 12px;
}

/* Lead form */
.marsi-lead-form {
    display: flex;
    flex-direction: column;
    gap: 10px;
    background: #fff;
    border: 1.5px solid var(--marsi-primary);
    border-radius: 14px;
    padding: 16px;
    margin-top: 6px;
    animation: marsi-slide-up 0.4s cubic-bezier(0.34,1.56,0.64,1);
}
.marsi-lead-form label {
    display: flex;
    flex-direction: column;
    gap: 4px;
    font-size: 12px;
    font-weight: 700;
    color: var(--marsi-darker);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}
.marsi-lead-form input,
.marsi-lead-form textarea {
    border: 1.5px solid #e5e7eb;
    border-radius: 8px;
    padding: 10px 12px;
    font-size: 14px;
    font-family: inherit;
    color: var(--marsi-text);
    transition: border-color 0.2s;
    width: 100%;
    box-sizing: border-box;
}
.marsi-lead-form input:focus,
.marsi-lead-form textarea:focus {
    outline: none;
    border-color: var(--marsi-primary);
}
.marsi-honeypot {
    position: absolute !important;
    left: -9999px !important;
    width: 1px !important;
    height: 1px !important;
    opacity: 0 !important;
}
.marsi-lead-submit {
    background: linear-gradient(135deg, #4DD0E1, #26C6DA);
    color: #fff;
    border: none;
    border-radius: 10px;
    padding: 12px 20px;
    font-size: 14px;
    font-weight: 700;
    cursor: pointer;
    transition: transform 0.2s, box-shadow 0.2s;
    margin-top: 4px;
}
.marsi-lead-submit:hover { transform: translateY(-1px); box-shadow: 0 4px 12px rgba(77,208,225,0.4); }
.marsi-lead-submit:disabled { opacity: 0.6; cursor: wait; }
.marsi-lead-status {
    font-size: 13px;
    color: #4b5563;
    text-align: center;
}
.marsi-lead-status-error { color: #dc2626; font-weight: 600; }

/* Quick actions */
.marsi-quick-actions {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 8px;
    margin-top: 6px;
}
.marsi-qa-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 14px 16px;
    background: var(--marsi-dark);
    color: #fff !important;
    text-decoration: none !important;
    border-radius: 12px;
    font-size: 14px;
    font-weight: 600;
    transition: transform 0.2s, box-shadow 0.2s;
}
.marsi-qa-btn:hover { transform: translateY(-2px); box-shadow: 0 4px 14px rgba(0,0,0,0.2); }
.marsi-qa-whatsapp { background: linear-gradient(135deg, #25D366, #128C7E); }
.marsi-qa-phone    { background: linear-gradient(135deg, #4DD0E1, #26C6DA); }
.marsi-qa-email    { background: linear-gradient(135deg, #F59E0B, #D97706); }
.marsi-qa-url      { background: linear-gradient(135deg, #6366F1, #4F46E5); }
