/* ============================================================
   Samanvi Live Chat – Chatbot Widget Styles
   Brand: Navy #1f4e8a | Teal #00A896
   v2.0 – Multi-service conversational flow
   ============================================================ */

:root {
    --smcb-navy:     #1f4e8a;
    --smcb-teal:     #00A896;
    --smcb-teal-dk:  #028090;
    --smcb-dark:     #0b2d38;
    --smcb-mid:      #174060;
    --smcb-white:    #ffffff;
    --smcb-bg:       #f4f7fb;
    --smcb-border:   #e2e8f0;
    --smcb-text:     #091628;
    --smcb-muted:    #6fa3c0;
    --smcb-shadow:   0 8px 32px rgba(31,78,138,.18);
    --smcb-radius:   16px;
    --smcb-z:        99999;
    --smcb-font:     'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
}

/* ── Floating root ────────────────────────────────────────── */

#smcb-floating-root {
    position: fixed;
    bottom: 28px;
    right: 28px;
    z-index: var(--smcb-z);
    font-family: var(--smcb-font);
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    gap: 10px;
}

/* ── Hint card (appears above bubble) ────────────────────── */

.smcb-hint-wrap {
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    gap: 0;
    animation: smcbHintIn .5s cubic-bezier(.34,1.56,.64,1) both;
    transform-origin: bottom right;
}

.smcb-hint-card {
    background: var(--smcb-white);
    border-radius: 16px 16px 16px 4px;
    padding: 16px 18px;
    box-shadow: 0 8px 30px rgba(0,0,0,.13), 0 2px 8px rgba(0,0,0,.06);
    max-width: 260px;
    position: relative;
}

.smcb-hint-avatar-row {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 10px;
}

.smcb-hint-logo {
    width: 34px;
    height: 34px;
    border-radius: 50%;
    overflow: hidden;
    background: var(--smcb-white);
    border: 1.5px solid #e0e8f0;
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: center;
}

.smcb-hint-logo img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    border-radius: 50%;
}

.smcb-hint-name {
    font-weight: 700;
    font-size: 13px;
    color: var(--smcb-text);
    line-height: 1.2;
}

.smcb-hint-name span {
    display: block;
    font-weight: 400;
    font-size: 11px;
    color: var(--smcb-muted);
    margin-top: 1px;
}

.smcb-hint-text {
    font-size: 13px;
    color: var(--smcb-text);
    line-height: 1.5;
}

.smcb-hint-text strong {
    color: var(--smcb-teal);
}

.smcb-hint-cta {
    display: inline-block;
    margin-top: 12px;
    background: var(--smcb-teal);
    color: white;
    border: none;
    border-radius: 20px;
    padding: 7px 16px;
    font-size: 12px;
    font-weight: 600;
    cursor: pointer;
    font-family: var(--smcb-font);
    transition: background .2s;
}

.smcb-hint-cta:hover {
    background: var(--smcb-teal-dk);
}

.smcb-hint-dismiss {
    position: absolute;
    top: 8px;
    right: 10px;
    background: none;
    border: none;
    color: #bbb;
    font-size: 14px;
    cursor: pointer;
    line-height: 1;
    padding: 2px 5px;
    transition: color .15s;
}

.smcb-hint-dismiss:hover {
    color: #888;
}

/* Tail pointing down-left toward bubble */
.smcb-hint-tail {
    width: 0;
    height: 0;
    border-right: 10px solid transparent;
    border-top: 10px solid var(--smcb-white);
    align-self: flex-start;
    margin-left: 20px;
    filter: drop-shadow(0 3px 3px rgba(0,0,0,.08));
}

/* ── Bubble (dark pill — matches existing design) ─────────── */

.smcb-bubble {
    display: flex;
    align-items: center;
    gap: 12px;
    background: #333333;
    color: var(--smcb-white);
    border: none;
    border-radius: 50px;
    padding: 13px 24px 13px 18px;
    cursor: pointer;
    box-shadow: 0 6px 24px rgba(0,0,0,.35);
    transition: background .2s, transform .15s;
    white-space: nowrap;
}

.smcb-bubble:hover {
    background: #444444;
    transform: translateY(-2px);
}

.smcb-bubble-label {
    font-size: 13px;
    font-weight: 700;
    letter-spacing: 1px;
}

/* Waving hand indicator */
.smcb-bubble-dot {
    width: auto;
    height: auto;
    background: none;
    border-radius: 0;
    box-shadow: none;
    flex-shrink: 0;
    position: relative;
    font-size: 20px;
    line-height: 1;
    display: inline-flex;
    align-items: center;
}

.smcb-bubble-dot::before {
    content: '👋';
    display: inline-block;
    transform-origin: 70% 70%;
    animation: smcbWave 2s ease-in-out infinite;
}

@keyframes smcbWave {
    0%   { transform: rotate(0deg); }
    8%   { transform: rotate(18deg); }
    18%  { transform: rotate(-10deg); }
    28%  { transform: rotate(18deg); }
    38%  { transform: rotate(-6deg); }
    48%  { transform: rotate(12deg); }
    58%  { transform: rotate(0deg); }
    100% { transform: rotate(0deg); }
}

.smcb-bubble--hidden {
    display: none !important;
}

/* ── Chat window ──────────────────────────────────────────── */

.smcb-window {
    position: fixed;
    bottom: 88px;
    right: 28px;
    width: 380px;
    height: calc(100vh - 120px);
    max-height: 600px;
    background: var(--smcb-white);
    border-radius: var(--smcb-radius);
    box-shadow: var(--smcb-shadow);
    display: flex;
    flex-direction: column;
    overflow: hidden;
    z-index: var(--smcb-z);
    opacity: 0;
    pointer-events: none;
    transform: translateY(16px) scale(.97);
    transition: opacity .22s ease, transform .22s ease;
}

.smcb-window--open {
    opacity: 1;
    pointer-events: all;
    transform: translateY(0) scale(1);
}

/* Inline (shortcode) mode */
#smcb-shortcode-root .smcb-window {
    position: relative;
    bottom: auto;
    right: auto;
    width: 100%;
    max-width: 480px;
    height: 600px;
    margin: 20px auto;
    opacity: 1;
    pointer-events: all;
    transform: none;
}

/* ── Header ───────────────────────────────────────────────── */

.smcb-header {
    background: linear-gradient(135deg, var(--smcb-dark) 0%, var(--smcb-mid) 100%);
    color: var(--smcb-white);
    padding: 14px 16px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-shrink: 0;
}

.smcb-header-info {
    display: flex;
    align-items: center;
    gap: 10px;
}

.smcb-avatar {
    width: 44px;
    height: 44px;
    background: var(--smcb-white);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    overflow: hidden;
    padding: 3px;
    border: 2px solid rgba(255,255,255,.2);
}

.smcb-avatar-logo {
    width: 100%;
    height: 100%;
    object-fit: cover;
    border-radius: 50%;
}

.smcb-header-text {}

.smcb-title {
    font-size: 15px;
    font-weight: 700;
    line-height: 1.2;
    letter-spacing: .2px;
}

.smcb-subtitle {
    font-size: 11px;
    opacity: .75;
    margin-top: 1px;
}

.smcb-online-row {
    display: flex;
    align-items: center;
    gap: 4px;
    margin-top: 2px;
}

.smcb-online-dot {
    width: 7px;
    height: 7px;
    background: #22c55e;
    border-radius: 50%;
    flex-shrink: 0;
}

.smcb-online-text {
    font-size: 10px;
    color: rgba(255,255,255,.6);
}

.smcb-close {
    background: rgba(255,255,255,.12);
    border: none;
    color: rgba(255,255,255,.85);
    cursor: pointer;
    padding: 7px;
    border-radius: 50%;
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background .15s, color .15s;
    flex-shrink: 0;
}

.smcb-close svg { display: block; }

.smcb-close:hover {
    background: rgba(255,255,255,.25);
    color: var(--smcb-white);
}

/* ── Progress bar ─────────────────────────────────────────── */

.smcb-progress {
    height: 3px;
    background: rgba(0,168,150,.15);
    flex-shrink: 0;
}

.smcb-progress-bar {
    height: 100%;
    background: var(--smcb-teal);
    width: 0%;
    transition: width .4s ease;
    border-radius: 0 3px 3px 0;
}

/* ── Messages area ────────────────────────────────────────── */

.smcb-messages {
    flex: 1;
    overflow-y: auto;
    padding: 16px;
    display: flex;
    flex-direction: column;
    gap: 10px;
    background: var(--smcb-bg);
}

.smcb-messages::-webkit-scrollbar { width: 4px; }
.smcb-messages::-webkit-scrollbar-track { background: transparent; }
.smcb-messages::-webkit-scrollbar-thumb {
    background: #c0d0e0;
    border-radius: 4px;
}

/* Message bubbles */
.smcb-msg {
    max-width: 82%;
    line-height: 1.5;
    font-size: 14px;
    animation: smcbFadeUp .25s ease forwards;
}

.smcb-msg--bot  { align-self: flex-start; }
.smcb-msg--user { align-self: flex-end; }

.smcb-msg-bubble {
    padding: 10px 14px;
    border-radius: 14px;
    word-break: break-word;
}

.smcb-msg--bot .smcb-msg-bubble {
    background: var(--smcb-white);
    color: var(--smcb-text);
    border-radius: 4px 14px 14px 14px;
    box-shadow: 0 1px 3px rgba(0,0,0,.07);
}

.smcb-msg--user .smcb-msg-bubble {
    background: var(--smcb-teal);
    color: var(--smcb-white);
    border-radius: 14px 4px 14px 14px;
}

/* Typing indicator */
.smcb-typing .smcb-msg-bubble {
    display: flex;
    gap: 4px;
    align-items: center;
    padding: 12px 16px;
}

.smcb-dot {
    width: 7px;
    height: 7px;
    background: var(--smcb-muted);
    border-radius: 50%;
    animation: smcbBounce 1.2s infinite;
}
.smcb-dot:nth-child(2) { animation-delay: .2s; }
.smcb-dot:nth-child(3) { animation-delay: .4s; }

/* ── Input area ───────────────────────────────────────────── */

.smcb-input-area {
    background: var(--smcb-white);
    border-top: 1px solid var(--smcb-border);
    padding: 12px 14px;
    flex-shrink: 0;
    /* Safe area for iPhone home indicator */
    padding-bottom: max(12px, env(safe-area-inset-bottom, 12px));
}

/* Choices wrapper — holds option buttons or form rows */
.smcb-choices-wrapper {
    display: flex;
    flex-direction: column;
    gap: 7px;
    padding-bottom: 8px;
    max-height: 300px;
    overflow-y: auto;
}

.smcb-choices-wrapper:empty { display: none; }

/* ── Option buttons (quick-pick) ──────────────────────────── */
.smcb-choice-btn {
    width: 100%;
    padding: 10px 14px;
    border: 1.5px solid var(--smcb-border);
    background: var(--smcb-white);
    color: var(--smcb-text);
    border-radius: 8px;
    font-size: 13px;
    font-weight: 500;
    cursor: pointer;
    transition: border-color .15s, background .15s, color .15s;
    text-align: left;
    font-family: var(--smcb-font);
    line-height: 1.4;
    display: flex;
    align-items: center;
    gap: 8px;
}

.smcb-choice-btn:hover {
    border-color: var(--smcb-teal);
    background: rgba(0,168,150,.04);
    color: var(--smcb-teal);
}

.smcb-choice-btn.smcb-selected {
    border-color: var(--smcb-teal);
    background: rgba(0,168,150,.07);
    color: var(--smcb-teal);
}

/* ── Checkbox / radio form rows ───────────────────────────── */

.smcb-form-section {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.smcb-form-label {
    font-size: 12px;
    font-weight: 600;
    color: var(--smcb-text);
    padding: 4px 2px 2px;
    letter-spacing: .3px;
}

.smcb-form-row {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    padding: 8px 10px;
    border-radius: 6px;
    cursor: pointer;
    transition: background .12s;
    font-size: 13px;
    color: var(--smcb-text);
}

.smcb-form-row:hover {
    background: rgba(0,168,150,.05);
}

/* Custom checkbox */
.smcb-checkbox-input,
.smcb-radio-input {
    appearance: none;
    -webkit-appearance: none;
    width: 17px;
    height: 17px;
    border: 2px solid #c0cfe0;
    border-radius: 4px;
    cursor: pointer;
    flex-shrink: 0;
    margin-top: 1px;
    position: relative;
    transition: border-color .15s, background .15s;
    background: var(--smcb-white);
}

.smcb-radio-input {
    border-radius: 50%;
}

.smcb-checkbox-input:checked,
.smcb-radio-input:checked {
    background: var(--smcb-teal);
    border-color: var(--smcb-teal);
}

.smcb-checkbox-input:checked::after {
    content: '';
    position: absolute;
    left: 4px;
    top: 1px;
    width: 5px;
    height: 9px;
    border: 2px solid white;
    border-top: none;
    border-left: none;
    transform: rotate(45deg);
}

.smcb-radio-input:checked::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 6px;
    height: 6px;
    background: white;
    border-radius: 50%;
}

.smcb-form-row-label {
    line-height: 1.4;
    cursor: pointer;
    flex: 1;
}

.smcb-form-row-label span {
    display: block;
    font-size: 11px;
    color: var(--smcb-muted);
    margin-top: 2px;
}

/* Continue button (multi-select confirm) */
.smcb-continue-btn {
    width: 100%;
    padding: 10px;
    background: var(--smcb-teal);
    color: var(--smcb-white);
    border: none;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: background .15s;
    font-family: var(--smcb-font);
    margin-top: 4px;
}

.smcb-continue-btn:hover {
    background: var(--smcb-teal-dk);
}

/* ── Text input row ───────────────────────────────────────── */

.smcb-text-row {
    display: flex;
    gap: 8px;
    align-items: center;
}

.smcb-text-input {
    flex: 1;
    min-width: 0;
    padding: 10px 14px;
    border: 1.5px solid var(--smcb-border);
    border-radius: 24px;
    font-family: var(--smcb-font);
    /* 16px prevents iOS Safari auto-zoom on focus */
    font-size: 16px;
    outline: none;
    transition: border-color .15s;
    color: var(--smcb-text);
    background: #f9fbfc;
}

.smcb-text-input:focus {
    border-color: var(--smcb-teal);
    background: var(--smcb-white);
    box-shadow: 0 0 0 3px rgba(0,168,150,.1);
}

.smcb-text-input::placeholder {
    color: #b0c0d0;
}

.smcb-send-btn {
    width: 42px;
    height: 42px;
    background: var(--smcb-teal);
    border: none;
    border-radius: 50%;
    cursor: pointer;
    flex-shrink: 0;
    transition: background .15s, transform .1s;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpolygon points='22,2 15,22 11,13 2,9' fill='white'/%3E%3Cline x1='22' y1='2' x2='11' y2='13' stroke='white' stroke-width='2' stroke-linecap='round'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: center;
    background-size: 20px 20px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.smcb-send-btn svg { display: none; }

.smcb-send-btn:hover {
    background-color: var(--smcb-teal-dk);
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpolygon points='22,2 15,22 11,13 2,9' fill='white'/%3E%3Cline x1='22' y1='2' x2='11' y2='13' stroke='white' stroke-width='2' stroke-linecap='round'/%3E%3C/svg%3E");
    transform: scale(1.05);
}

.smcb-send-btn:disabled {
    opacity: .5;
    cursor: not-allowed;
    transform: none;
}

/* ── Summary card ─────────────────────────────────────────── */

.smcb-summary-card {
    background: rgba(0,168,150,.07);
    border: 1px solid rgba(0,168,150,.2);
    border-radius: 10px;
    padding: 12px 14px;
    font-size: 13px;
    line-height: 1.6;
    color: var(--smcb-text);
}

.smcb-summary-card strong {
    display: block;
    color: var(--smcb-teal);
    font-size: 12px;
    font-weight: 700;
    letter-spacing: .5px;
    text-transform: uppercase;
    margin-bottom: 6px;
}

.smcb-summary-item {
    margin-bottom: 3px;
}

/* ── Completion / CTA card ────────────────────────────────── */

.smcb-complete-card {
    background: linear-gradient(135deg, var(--smcb-navy), var(--smcb-teal));
    color: var(--smcb-white);
    border-radius: 12px;
    padding: 16px;
    margin: 4px 0;
    text-align: center;
}

.smcb-complete-card h4 {
    margin: 0 0 6px;
    font-size: 16px;
}

.smcb-complete-card p {
    margin: 0;
    font-size: 13px;
    opacity: .85;
}

/* ── Animations ───────────────────────────────────────────── */

@keyframes smcbFadeUp {
    from { opacity: 0; transform: translateY(8px); }
    to   { opacity: 1; transform: translateY(0); }
}

@keyframes smcbBounce {
    0%, 60%, 100% { transform: translateY(0); }
    30%           { transform: translateY(-5px); }
}

@keyframes smcbHintIn {
    from { opacity: 0; transform: scale(.8) translateY(10px); }
    to   { opacity: 1; transform: scale(1) translateY(0); }
}

/* ── WhatsApp button ──────────────────────────────────────── */

.smcb-whatsapp-btn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    margin-top: 6px;
    padding: 10px 18px;
    background: #25d366;
    color: #fff !important;
    border-radius: 50px;
    text-decoration: none !important;
    font-weight: 600;
    font-size: 14px;
    transition: background .2s;
}

.smcb-whatsapp-btn:hover { background: #1ebe5a; }
.smcb-whatsapp-btn i { font-size: 18px; }

/* ── Mobile: full-screen chat ─────────────────────────────── */

@media (max-width: 480px) {

    #smcb-floating-root {
        bottom: 20px;
        right: 16px;
    }

    /* Chat window becomes full-screen overlay */
    .smcb-window,
    #smcb-floating-root .smcb-window {
        position: fixed;
        top: 0;
        left: 0;
        right: 0;
        bottom: 0;
        width: 100%;
        height: 100%;
        border-radius: 0;
        max-height: none;
    }

    /* Input area: extra bottom padding for home indicator */
    .smcb-input-area {
        padding: 10px 14px;
        padding-bottom: max(20px, env(safe-area-inset-bottom, 20px));
        padding-right: 16px;
    }

    /* Ensure send button never gets clipped */
    .smcb-text-row {
        align-items: center;
    }

    .smcb-send-btn {
        flex-shrink: 0;
        width: 40px;
        height: 40px;
    }

    /* Bubble slightly smaller on mobile */
    .smcb-bubble {
        padding: 11px 18px 11px 14px;
        gap: 10px;
    }

    .smcb-bubble-label {
        font-size: 12px;
    }

    /* Hint card narrower */
    .smcb-hint-card {
        max-width: 220px;
        padding: 12px 14px;
        font-size: 12px;
    }

    /* Replace close X with ← back arrow on mobile */
    .smcb-close::before {
        content: '←';
        font-size: 18px;
    }

    .smcb-close svg {
        display: none;
    }

}

/* === hint-card logo hard size cap === */
.smcb-hint-logo { width:36px !important; height:36px !important; min-width:36px !important; overflow:hidden !important; border-radius:50% !important; }
.smcb-hint-logo img { width:36px !important; height:36px !important; max-width:36px !important; max-height:36px !important; object-fit:cover !important; border-radius:50% !important; display:block !important; }
.smcb-hint-card { max-width:260px !important; }
