/*
 * KoliCall Guest — phone FAB + intake modal + call stage
 * All classes prefixed .kc-guest-* (owned by Modules/KoliCall guest flow).
 */

/* ── Floating phone button (FAB) ───────────────────────────────────── */
.kc-guest-fab {
    position: fixed;
    bottom: 24px;
    right: 24px;
    width: 56px;
    height: 56px;
    border-radius: 50%;
    background: #22c55e;
    color: #ffffff;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    border: 0;
    outline: 0;
    z-index: 2147483600;
    box-shadow: 0 6px 18px rgba(0, 0, 0, 0.18);
    transition: transform 0.2s ease, background 0.2s ease;
    animation: kc-guest-pulse 2.4s infinite;
    -webkit-tap-highlight-color: transparent;
}

.kc-guest-fab:hover,
.kc-guest-fab:focus { transform: scale(1.06); background: #16a34a; color: #ffffff; outline: 0; }
.kc-guest-fab:active { transform: scale(0.98); }
.kc-guest-fab svg { width: 26px; height: 26px; display: block; pointer-events: none; }

@keyframes kc-guest-pulse {
    0%   { box-shadow: 0 6px 18px rgba(0, 0, 0, 0.18), 0 0 0 0   rgba(34, 197, 94, 0.55); }
    70%  { box-shadow: 0 6px 18px rgba(0, 0, 0, 0.18), 0 0 0 14px rgba(34, 197, 94, 0);    }
    100% { box-shadow: 0 6px 18px rgba(0, 0, 0, 0.18), 0 0 0 0   rgba(34, 197, 94, 0);    }
}

@media (prefers-reduced-motion: reduce) { .kc-guest-fab { animation: none; } }

@media (max-width: 576px) {
    .kc-guest-fab { width: 48px; height: 48px; bottom: 16px; right: 16px; }
    .kc-guest-fab svg { width: 22px; height: 22px; }
}

/* ── Modal backdrop + shell ────────────────────────────────────────── */
.kc-guest-modal-backdrop {
    position: fixed;
    inset: 0;
    background: rgba(15, 23, 42, 0.55);
    z-index: 2147483601;
    display: none;
    align-items: center;
    justify-content: center;
    padding: 16px;
}

.kc-guest-modal-backdrop.kc-open { display: flex; animation: kc-guest-fadein 0.15s ease; }
@keyframes kc-guest-fadein { from { opacity: 0; } to { opacity: 1; } }

.kc-guest-modal {
    position: relative;
    background: #ffffff;
    border-radius: 14px;
    width: 100%;
    max-width: 460px;
    padding: 24px;
    box-shadow: 0 20px 50px rgba(0, 0, 0, 0.25);
    font-family: inherit;
    color: #0f172a;
    max-height: calc(100vh - 32px);
    overflow-y: auto;
}

.kc-guest-modal.kc-guest-modal-wide { max-width: 540px; }

.kc-guest-modal .kc-guest-title {
    margin: 0 0 8px;
    font-size: 20px;
    font-weight: 700;
    color: #0f172a;
    line-height: 1.3;
    padding-right: 40px; /* leave room for top-right X */
}

.kc-guest-modal .kc-guest-sub {
    margin: 0 0 18px;
    font-size: 14px;
    line-height: 1.5;
    color: #475569;
}

.kc-guest-modal .kc-guest-error {
    background: #fef2f2;
    color: #991b1b;
    padding: 10px 12px;
    border-radius: 8px;
    margin-bottom: 14px;
    font-size: 13px;
    line-height: 1.4;
    border: 1px solid #fecaca;
}

/* ── Modal close X (top-right) ─────────────────────────────────────── */
.kc-guest-modal-close {
    position: absolute;
    top: 12px;
    right: 12px;
    width: 36px;
    height: 36px;
    border-radius: 8px;
    border: 0;
    background: transparent;
    color: #64748b;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    transition: background 0.15s, color 0.15s;
}

.kc-guest-modal-close:hover,
.kc-guest-modal-close:focus { background: #f1f5f9; color: #0f172a; outline: 0; }

.kc-guest-modal-close svg { width: 18px; height: 18px; pointer-events: none; }

/* ── SVG flag wrapper ──────────────────────────────────────────────── */
.kc-guest-flag {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 28px;
    height: 20px;
    border-radius: 3px;
    overflow: hidden;
    box-shadow: 0 0 0 1px rgba(15, 23, 42, 0.08);
    flex-shrink: 0;
    background: #f1f5f9;
}

.kc-guest-flag svg,
.kc-guest-flag img { width: 100%; height: 100%; display: block; object-fit: cover; }

.kc-guest-flag-sm { width: 22px; height: 16px; }
.kc-guest-flag-sm img { width: 22px; height: 16px; }

/* ── Step 1 — language pills ──────────────────────────────────────── */
.kc-guest-langs {
    display: grid;
    grid-template-columns: 1fr;
    gap: 10px;
    margin-bottom: 12px;
}

.kc-guest-lang {
    appearance: none;
    -webkit-appearance: none;
    border: 1.5px solid #e2e8f0;
    background: #ffffff;
    color: #0f172a;
    padding: 12px 16px;
    border-radius: 10px;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 12px;
    font-size: 15px;
    text-align: left;
    transition: border-color 0.15s, background 0.15s, transform 0.05s;
}

.kc-guest-lang:hover { border-color: #22c55e; background: #f0fdf4; }
.kc-guest-lang:active { transform: scale(0.99); }

.kc-guest-lang-active {
    border-color: #22c55e;
    background: #f0fdf4;
    box-shadow: inset 0 0 0 1px #22c55e;
}

.kc-guest-lang-label { font-weight: 500; }

.kc-guest-lang-check {
    margin-left: auto;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 24px;
    height: 24px;
    border-radius: 50%;
    background: #22c55e;
    color: #ffffff;
}

.kc-guest-lang-check svg { width: 14px; height: 14px; }

/* ── Step 2 — form ────────────────────────────────────────────────── */
.kc-guest-form {
    display: flex;
    flex-direction: column;
    gap: 14px;
}

.kc-guest-field {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.kc-guest-field-label {
    font-size: 13px;
    font-weight: 600;
    color: #334155;
}

.kc-guest-input {
    appearance: none;
    -webkit-appearance: none;
    border: 1px solid #cbd5e1;
    border-radius: 8px;
    padding: 10px 12px;
    font-size: 14px;
    color: #0f172a;
    background: #ffffff;
    transition: border-color 0.15s, box-shadow 0.15s;
    width: 100%;
    box-sizing: border-box;
}

.kc-guest-input:focus { outline: 0; border-color: #22c55e; box-shadow: 0 0 0 3px rgba(34, 197, 94, 0.18); }

.kc-guest-row-2 {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
}

@media (max-width: 480px) {
    .kc-guest-row-2 { grid-template-columns: 1fr; }
}

/* Geo cascade block — wraps the state + city row. Made explicit so no
   inherited rule (e.g. a theme-level "display:none on bare divs") can
   accidentally hide the il/ilçe dropdowns. */
.kc-guest-geo-block {
    display: block;
    visibility: visible;
    opacity: 1;
    width: 100%;
    min-height: 0;
}

/* ── Segmented control (individual/corporate, WA Y/N, same/diff) ───── */
.kc-guest-segmented {
    display: inline-flex;
    width: 100%;
    border: 1px solid #cbd5e1;
    border-radius: 10px;
    overflow: hidden;
    background: #f8fafc;
}

.kc-guest-segmented-sub { margin-top: 8px; }

.kc-guest-seg-btn {
    appearance: none;
    -webkit-appearance: none;
    border: 0;
    flex: 1 1 0;
    padding: 10px 12px;
    background: transparent;
    color: #475569;
    cursor: pointer;
    font-size: 14px;
    font-weight: 500;
    transition: background 0.15s, color 0.15s;
}

.kc-guest-seg-btn + .kc-guest-seg-btn { border-left: 1px solid #cbd5e1; }
.kc-guest-seg-btn:hover { background: #f1f5f9; color: #0f172a; }

.kc-guest-seg-active {
    background: #22c55e;
    color: #ffffff;
}

.kc-guest-seg-active:hover { background: #16a34a; color: #ffffff; }

/* ── Residence country dropdown (searchable, flagcdn images) ──────── */
.kc-guest-country-wrap-res {
    position: relative;
}

.kc-guest-country-trigger {
    appearance: none;
    -webkit-appearance: none;
    border: 1px solid #cbd5e1;
    background: #ffffff;
    border-radius: 8px;
    padding: 10px 12px;
    display: flex;
    align-items: center;
    gap: 10px;
    cursor: pointer;
    font-size: 14px;
    color: #0f172a;
    width: 100%;
    transition: border-color 0.15s, box-shadow 0.15s;
    text-align: left;
}

.kc-guest-country-trigger:hover { border-color: #94a3b8; }
.kc-guest-country-trigger:focus { outline: 0; border-color: #22c55e; box-shadow: 0 0 0 3px rgba(34, 197, 94, 0.18); }

.kc-guest-country-trigger .kc-guest-country-label { flex: 1 1 auto; font-weight: 500; }

.kc-guest-country-panel-res {
    position: absolute;
    top: calc(100% + 4px);
    left: 0;
    right: 0;
    max-height: 360px;
    min-width: 280px;
    background: #ffffff;
    border: 1px solid #e2e8f0;
    border-radius: 10px;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.12);
    z-index: 2147483602;
    display: none;
    flex-direction: column;
    overflow: hidden;
}

/* Phone-picker variant: the trigger button is narrow (just flag+dial), so
   we override right:auto and let the panel extend to ~340px so full country
   names ("Birleşik Arap Emirlikleri" etc.) don't get clipped. */
.kc-guest-phone-country-wrap .kc-guest-country-panel-res {
    right: auto;
    min-width: 340px;
    width: max-content;
    max-width: calc(100vw - 48px);
}

.kc-guest-country-panel-res.kc-open { display: flex; }

.kc-guest-country-search {
    position: relative;
    padding: 8px;
    border-bottom: 1px solid #e2e8f0;
    background: #f8fafc;
    display: flex;
    align-items: center;
    gap: 6px;
}

.kc-guest-country-search-icon {
    display: inline-flex;
    align-items: center;
    color: #64748b;
    padding-left: 4px;
}

.kc-guest-country-search-icon svg { width: 16px; height: 16px; }

.kc-guest-country-search-input {
    flex: 1 1 auto;
    border: 0;
    background: transparent;
    padding: 6px 4px;
    font-size: 14px;
    color: #0f172a;
    outline: 0;
}

.kc-guest-country-options {
    overflow-y: auto;
    padding: 6px;
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.kc-guest-country-opt {
    appearance: none;
    -webkit-appearance: none;
    border: 0;
    background: transparent;
    text-align: left;
    padding: 8px 10px;
    display: inline-flex;
    align-items: center;
    gap: 10px;
    cursor: pointer;
    border-radius: 6px;
    font-size: 14px;
    color: #0f172a;
}

.kc-guest-country-opt:hover { background: #f0fdf4; }
.kc-guest-country-opt-active { background: #ecfdf5; box-shadow: inset 0 0 0 1px #22c55e; }

.kc-guest-country-opt-name { flex: 1 1 auto; }
.kc-guest-country-opt-iso { color: #94a3b8; font-size: 12px; font-weight: 600; }

/* ── Phone picker (custom, no intlTelInput) ───────────────────────── */
.kc-guest-phone-row {
    display: grid;
    grid-template-columns: auto 1fr;
    gap: 8px;
    align-items: stretch;
}

.kc-guest-phone-country-wrap {
    position: relative;
}

.kc-guest-phone-trigger {
    width: auto;
    min-width: 110px;
    gap: 6px;
    padding: 10px 10px;
}

.kc-guest-phone-trigger .kc-guest-country-code {
    font-weight: 600;
    color: #0f172a;
}

.kc-guest-phone-number {
    min-width: 0; /* let grid shrink the input */
}

/* ── Phone row — country code button + number input (legacy) ─────── */
.kc-guest-phone-row {
    display: grid;
    grid-template-columns: auto 1fr;
    gap: 8px;
    align-items: stretch;
}

.kc-guest-country-wrap {
    position: relative;
}

.kc-guest-country-btn {
    appearance: none;
    -webkit-appearance: none;
    border: 1px solid #cbd5e1;
    background: #ffffff;
    border-radius: 8px;
    padding: 8px 10px;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    cursor: pointer;
    font-size: 14px;
    color: #0f172a;
    min-height: 100%;
    transition: border-color 0.15s, box-shadow 0.15s;
}

.kc-guest-country-btn:hover { border-color: #94a3b8; }
.kc-guest-country-btn:focus { outline: 0; border-color: #22c55e; box-shadow: 0 0 0 3px rgba(34, 197, 94, 0.18); }

.kc-guest-country-code { font-weight: 600; }

.kc-guest-chevron svg { width: 14px; height: 14px; color: #64748b; }

.kc-guest-country-panel {
    position: absolute;
    top: calc(100% + 4px);
    left: 0;
    min-width: 220px;
    max-height: 280px;
    overflow-y: auto;
    background: #ffffff;
    border: 1px solid #e2e8f0;
    border-radius: 10px;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.12);
    z-index: 2147483602;
    padding: 6px;
    display: none;
    flex-direction: column;
    gap: 2px;
}

.kc-guest-country-panel.kc-open { display: flex; }

.kc-guest-country-opt {
    appearance: none;
    -webkit-appearance: none;
    border: 0;
    background: transparent;
    text-align: left;
    padding: 8px 10px;
    display: inline-flex;
    align-items: center;
    gap: 10px;
    cursor: pointer;
    border-radius: 6px;
    font-size: 14px;
    color: #0f172a;
}

.kc-guest-country-opt:hover { background: #f0fdf4; }
.kc-guest-country-opt .kc-guest-country-name { color: #64748b; margin-left: auto; font-size: 13px; }
.kc-guest-country-other { font-weight: 600; color: #475569; justify-content: center; }
.kc-guest-country-other:hover { background: #f1f5f9; color: #0f172a; }

.kc-guest-phone-input { min-width: 0; }

/* ── Email autocomplete dropdown ───────────────────────────────────── */
.kc-guest-email-wrap {
    position: relative;
}

.kc-guest-email-suggest {
    position: absolute;
    top: calc(100% + 4px);
    left: 0;
    right: 0;
    background: #ffffff;
    border: 1px solid #e2e8f0;
    border-radius: 10px;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.10);
    z-index: 2147483602;
    padding: 6px;
    display: none;
    flex-direction: column;
    gap: 2px;
    max-height: 240px;
    overflow-y: auto;
}

.kc-guest-email-suggest.kc-open { display: flex; }

.kc-guest-email-opt {
    appearance: none;
    -webkit-appearance: none;
    border: 0;
    background: transparent;
    text-align: left;
    padding: 8px 10px;
    display: inline-flex;
    align-items: center;
    gap: 10px;
    cursor: pointer;
    border-radius: 6px;
    font-size: 14px;
    color: #0f172a;
}

.kc-guest-email-opt:hover { background: #f0fdf4; }
.kc-guest-email-opt-domain { font-weight: 500; }
.kc-guest-email-opt-tag {
    margin-left: auto;
    font-size: 11px;
    font-weight: 600;
    color: #16a34a;
    background: #dcfce7;
    padding: 2px 6px;
    border-radius: 4px;
}

.kc-guest-email-opt-custom { color: #475569; font-style: italic; }
.kc-guest-email-opt-custom:hover { background: #f1f5f9; color: #0f172a; }

.kc-guest-email-opt-prefix { color: #94a3b8; font-weight: 400; }

/* ── Service cards grid ───────────────────────────────────────────── */
.kc-guest-fieldset {
    border: 0;
    padding: 0;
    margin: 0;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.kc-guest-services-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 10px;
}

@media (max-width: 480px) {
    .kc-guest-services-grid { grid-template-columns: 1fr; }
}

.kc-guest-service {
    appearance: none;
    -webkit-appearance: none;
    border: 1.5px solid #e2e8f0;
    background: #ffffff;
    color: #0f172a;
    border-radius: 10px;
    padding: 12px 12px 12px 14px;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 10px;
    text-align: left;
    transition: border-color 0.15s, background 0.15s, transform 0.05s;
    position: relative;
}

.kc-guest-service:hover { border-color: #22c55e; background: #f0fdf4; }
.kc-guest-service:active { transform: scale(0.99); }

.kc-guest-service-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
    border-radius: 8px;
    background: #f1f5f9;
    color: #16a34a;
    flex-shrink: 0;
    transition: background 0.15s, color 0.15s;
}

.kc-guest-service-icon svg { width: 20px; height: 20px; }

.kc-guest-service-label {
    font-size: 13.5px;
    font-weight: 500;
    line-height: 1.3;
}

.kc-guest-service-check {
    position: absolute;
    top: 8px;
    right: 8px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 20px;
    height: 20px;
    border-radius: 50%;
    background: #22c55e;
    color: #ffffff;
}

.kc-guest-service-check svg { width: 12px; height: 12px; }

.kc-guest-service-active {
    border-color: #22c55e;
    background: #f0fdf4;
    box-shadow: inset 0 0 0 1px #22c55e;
}

.kc-guest-service-active .kc-guest-service-icon {
    background: #22c55e;
    color: #ffffff;
}

/* ── Actions / buttons ────────────────────────────────────────────── */
.kc-guest-actions {
    display: flex;
    gap: 10px;
    margin-top: 18px;
    flex-wrap: wrap;
}

.kc-guest-actions-end { justify-content: flex-end; }

.kc-guest-primary,
.kc-guest-secondary,
.kc-guest-close {
    appearance: none;
    -webkit-appearance: none;
    border: 0;
    padding: 11px 18px;
    border-radius: 8px;
    cursor: pointer;
    font-size: 14px;
    font-weight: 600;
    transition: background 0.15s, transform 0.05s;
}

.kc-guest-primary { background: #22c55e; color: #ffffff; flex: 1 1 auto; }
.kc-guest-primary:hover  { background: #16a34a; }
.kc-guest-primary:active { transform: scale(0.99); }

.kc-guest-secondary { background: #f1f5f9; color: #0f172a; }
.kc-guest-secondary:hover { background: #e2e8f0; }

.kc-guest-close { background: #f1f5f9; color: #0f172a; padding: 8px 16px; }
.kc-guest-close:hover { background: #e2e8f0; }

/* ── Spinner / call stage ─────────────────────────────────────────── */
.kc-guest-spinner-row {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 18px 0;
}

.kc-guest-spinner {
    width: 40px;
    height: 40px;
    color: #22c55e;
    animation: kc-guest-spin 1s linear infinite;
}

@keyframes kc-guest-spin { to { transform: rotate(360deg); } }
@media (prefers-reduced-motion: reduce) { .kc-guest-spinner { animation-duration: 4s; } }

.kc-guest-agent-line {
    text-align: center;
    margin: 0 0 12px;
    font-size: 15px;
    color: #0f172a;
}

.kc-guest-call-timer {
    text-align: center;
    margin: 14px 0 18px;
}

.kc-guest-call-timer-value {
    font-family: 'SF Mono', 'Menlo', 'Consolas', monospace;
    font-size: 30px;
    font-weight: 700;
    color: #16a34a;
    letter-spacing: 1px;
    font-variant-numeric: tabular-nums;
}

.kc-guest-call-controls {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 18px;
    margin-top: 16px;
}

.kc-guest-call-mute,
.kc-guest-call-hangup {
    appearance: none;
    -webkit-appearance: none;
    border: 0;
    width: 56px;
    height: 56px;
    border-radius: 50%;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    color: #ffffff;
    transition: transform 0.08s ease, background 0.15s ease, box-shadow 0.15s ease;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.18);
}

.kc-guest-call-mute  { background: #475569; }
.kc-guest-call-mute:hover { background: #334155; }
.kc-guest-call-mute.kc-guest-muted { background: #ef4444; }
.kc-guest-call-mute.kc-guest-muted:hover { background: #dc2626; }

.kc-guest-call-hangup { background: #ef4444; }
.kc-guest-call-hangup:hover { background: #dc2626; }

.kc-guest-call-mute:active,
.kc-guest-call-hangup:active { transform: scale(0.96); }

.kc-guest-call-mute svg,
.kc-guest-call-hangup svg { width: 22px; height: 22px; pointer-events: none; }

/* ── Mobile tweaks ────────────────────────────────────────────────── */
@media (max-width: 480px) {
    .kc-guest-modal { padding: 18px; border-radius: 12px; }
    .kc-guest-modal .kc-guest-title { font-size: 18px; }
    .kc-guest-actions { flex-direction: column-reverse; }
    .kc-guest-actions .kc-guest-primary,
    .kc-guest-actions .kc-guest-secondary { width: 100%; }

    /* iOS Safari auto-zooms when focusing inputs with font-size < 16px.
       The post-zoom viewport can leave the submit button off-screen and
       feel like "the button doesn't work" — push every focusable form
       control to 16px on mobile to suppress that zoom. */
    .kc-guest-input,
    .kc-guest-country-trigger,
    .kc-guest-country-search-input,
    .kc-guest-phone-trigger,
    .kc-guest-phone-input { font-size: 16px; }

    /* Touch-friendly hit targets: WCAG 2.5.5 / Apple HIG both want ≥44px.
       touch-action: manipulation kills the 300ms tap delay so a single
       tap on submit fires immediately instead of waiting for a possible
       double-tap-zoom gesture. */
    .kc-guest-primary,
    .kc-guest-secondary { min-height: 48px; padding: 14px 18px; font-size: 15px; touch-action: manipulation; }
}
