/* Time Homes AI chat widget (bottom-right). Every class is prefixed .thc- and everything lives under .thc-root,
   so nothing here can touch the rest of the site, and the site's own button / input styles cannot leak in. */

.thc-root {
    --thc-navy-0: #020F1C; --thc-navy-1: #071D2C; --thc-teal: #0A3342; --thc-teal-2: #0B3A4C;
    --thc-surface: #0F2F42; --thc-field: #0A2231; --thc-bar: #08202F;
    --thc-ink: #EEF3F7; --thc-muted: #9FB0BD; --thc-line: rgba(255, 255, 255, .13);
    --thc-gold: #C9A26B; --thc-bronze: #9A7048; --thc-bronze-hi: #AB7E52; --thc-ok: #34C77B; --thc-danger: #FF8A7A;
    --thc-shadow: 0 20px 56px rgba(0, 0, 0, .55);
    --thc-font: "Raleway", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
    position: static; margin: 0; padding: 0; border: 0; background: none;
    font-family: var(--thc-font); font-size: 15px; line-height: 1.55; color: var(--thc-ink);
    text-align: left; text-transform: none; letter-spacing: normal; -webkit-text-size-adjust: 100%;
}
.thc-root *, .thc-root *::before, .thc-root *::after { box-sizing: border-box; }
.thc-root [hidden] { display: none !important; }
.thc-root button, .thc-root input, .thc-root textarea {
    font-family: inherit; text-transform: none; letter-spacing: normal; margin: 0; -webkit-appearance: none; appearance: none;
}
.thc-root img { max-width: 100%; border: 0; }

/* ---------- Bubble ---------- */
.thc-root .thc-bubble {
    position: fixed; right: max(32px, env(safe-area-inset-right, 0px)); bottom: calc(32px + env(safe-area-inset-bottom, 0px));
    width: 64px; height: 64px; padding: 0; border-radius: 50%; border: 1.5px solid var(--thc-gold);
    background: linear-gradient(145deg, var(--thc-navy-0), var(--thc-teal-2)); color: var(--thc-gold);
    display: flex; align-items: center; justify-content: center; cursor: pointer;
    box-shadow: var(--thc-shadow); z-index: 99990; transition: transform .2s ease; line-height: 1;
}
.thc-root .thc-bubble:hover { transform: scale(1.06); }
.thc-root .thc-bubble svg { width: 27px; height: 27px; fill: currentColor; }
/* Small "LIVE" tag on the launcher; the green tag gently pulses */
.thc-root .thc-badge {
    position: absolute; top: -6px; right: -8px; box-sizing: border-box; height: 20px; padding: 0 7px; border: 2px solid var(--thc-navy-0);
    border-radius: 10px; background: var(--thc-ok); color: #04202E; font-size: 9px; font-weight: 800; letter-spacing: .08em;
    line-height: 16px; text-transform: uppercase; animation: thc-live 2.2s ease-out infinite;
}
@keyframes thc-live {
    0%   { box-shadow: 0 0 0 0 rgba(52, 199, 123, .6); }
    70%  { box-shadow: 0 0 0 9px rgba(52, 199, 123, 0); }
    100% { box-shadow: 0 0 0 0 rgba(52, 199, 123, 0); }
}
@keyframes thc-live-dot {
    0%   { box-shadow: 0 0 0 0 rgba(52, 199, 123, .6); }
    70%  { box-shadow: 0 0 0 6px rgba(52, 199, 123, 0); }
    100% { box-shadow: 0 0 0 0 rgba(52, 199, 123, 0); }
}

/* ---------- Panel ---------- */
.thc-root .thc-panel {
    position: fixed; right: max(32px, env(safe-area-inset-right, 0px)); bottom: calc(108px + env(safe-area-inset-bottom, 0px));
    width: 360px; max-width: calc(100vw - 40px);
    height: min(560px, calc(100vh - 124px)); height: min(560px, calc(100dvh - 124px));
    max-height: 80vh; max-height: 80dvh;
    background: var(--thc-navy-1); color: var(--thc-ink); border-radius: 20px; border: 1px solid rgba(255, 255, 255, .12);
    box-shadow: var(--thc-shadow); display: none; flex-direction: column; overflow: hidden; z-index: 99991;
}
.thc-root .thc-panel.thc-open { display: flex; animation: thc-pop .26s cubic-bezier(.2, .8, .2, 1); }
@keyframes thc-pop { from { opacity: 0; transform: translateY(14px) scale(.97); } to { opacity: 1; transform: none; } }
@keyframes thc-sheet { from { opacity: 0; transform: translateY(28px); } to { opacity: 1; transform: none; } }

.thc-root .thc-panel:focus { outline: none; }

/* ---------- Header ---------- */
.thc-root .thc-head {
    position: relative; flex: none; display: flex; align-items: center; gap: 11px; padding: 12px 14px;
    background: linear-gradient(135deg, var(--thc-navy-0), var(--thc-teal-2));
}
.thc-root .thc-head::after {
    content: ""; position: absolute; left: 0; right: 0; bottom: 0; height: 1px;
    background: linear-gradient(90deg, transparent, var(--thc-gold), transparent);
}
.thc-root .thc-logo {
    position: relative; flex: none; width: 40px; height: 40px; border-radius: 50%; border: 1.5px solid var(--thc-gold);
    background: var(--thc-navy-0); display: flex; align-items: center; justify-content: center;
}
.thc-root .thc-logo img { width: 24px; height: 24px; object-fit: contain; display: block; }
.thc-root .thc-logo::after {
    content: ""; position: absolute; right: -2px; bottom: -1px; width: 11px; height: 11px; border-radius: 50%;
    background: var(--thc-ok); border: 2px solid var(--thc-navy-0); animation: thc-live-dot 2.2s ease-out infinite;
}
.thc-root .thc-ht { flex: 1; min-width: 0; }
.thc-root .thc-title { display: block; font-size: 14.5px; font-weight: 700; letter-spacing: .015em; color: var(--thc-ink); line-height: 1.3; }
.thc-root .thc-sub { display: block; font-size: 11.5px; font-weight: 500; color: var(--thc-gold); line-height: 1.4; }
.thc-root .thc-x {
    flex: none; width: 32px; height: 32px; padding: 0; border: 0; border-radius: 50%; background: none; color: var(--thc-ink);
    font-size: 23px; line-height: 1; cursor: pointer; opacity: .85;
}
.thc-root .thc-x:hover { background: rgba(255, 255, 255, .1); opacity: 1; }

/* ---------- Messages ---------- */
.thc-root .thc-msgs {
    flex: 1; min-height: 0; overflow-y: auto; overscroll-behavior: contain; padding: 12px 14px 8px;
    display: flex; flex-direction: column; gap: 7px; scroll-behavior: smooth; background: none;
}
.thc-root .thc-msgs, .thc-root .thc-text { scrollbar-width: thin; scrollbar-color: rgba(201, 162, 107, .55) transparent; }
.thc-root .thc-msgs::-webkit-scrollbar, .thc-root .thc-text::-webkit-scrollbar { width: 6px; }
.thc-root .thc-msgs::-webkit-scrollbar-thumb, .thc-root .thc-text::-webkit-scrollbar-thumb { background: rgba(201, 162, 107, .55); border-radius: 3px; }
.thc-root .thc-msgs::-webkit-scrollbar-track, .thc-root .thc-text::-webkit-scrollbar-track { background: transparent; }
.thc-root .thc-m {
    max-width: 86%; margin: 0; padding: 9px 13px; border-radius: 16px; font-size: 14px; line-height: 1.5;
    white-space: pre-wrap; overflow-wrap: anywhere; animation: thc-in .22s ease-out;
}
.thc-root .thc-m.thc-a { align-self: flex-start; background: var(--thc-surface); color: var(--thc-ink); border-bottom-left-radius: 6px; }
.thc-root .thc-m.thc-u { align-self: flex-end; background: var(--thc-bronze); color: #fff; border-bottom-right-radius: 6px; }
.thc-root .thc-m.thc-e { align-self: flex-start; background: rgba(255, 138, 122, .16); color: var(--thc-ink); border-bottom-left-radius: 6px; }
@keyframes thc-in { from { opacity: 0; transform: translateY(7px); } to { opacity: 1; transform: none; } }

.thc-root .thc-typing {
    align-self: flex-start; display: flex; gap: 5px; padding: 12px 14px; background: var(--thc-surface);
    border-radius: 16px; border-bottom-left-radius: 6px;
}
.thc-root .thc-typing i { width: 7px; height: 7px; border-radius: 50%; background: var(--thc-gold); animation: thc-b 1.2s infinite; display: block; }
.thc-root .thc-typing i:nth-child(2) { animation-delay: .16s; }
.thc-root .thc-typing i:nth-child(3) { animation-delay: .32s; }
@keyframes thc-b { 0%, 60%, 100% { transform: translateY(0); opacity: .45; } 30% { transform: translateY(-5px); opacity: 1; } }

/* ---------- Details form (no card: the fields sit directly on the panel) ---------- */
.thc-root .thc-card {
    display: flex; flex-direction: column; gap: 12px; padding: 0; margin: 6px 0 0; background: none; border: 0; animation: thc-in .26s ease-out;
}
.thc-root .thc-field { display: flex; flex-direction: column; gap: 4px; margin: 0; }
.thc-root .thc-label { font-size: 11.5px; font-weight: 600; letter-spacing: .03em; color: var(--thc-gold); }
.thc-root .thc-input {
    width: 100%; height: auto; padding: 11px 12px; border: 0; border-radius: 12px;
    background: var(--thc-surface); color: var(--thc-ink); font-size: 14px; font-weight: 500; line-height: 1.3; outline: none; box-shadow: none;
}
.thc-root .thc-input::placeholder, .thc-root .thc-text::placeholder { color: #6F8392; opacity: 1; }
.thc-root .thc-input:focus, .thc-root .thc-text:focus { box-shadow: 0 0 0 2px var(--thc-gold); }
/* an invalid field also gets a ring (not only colour in the message), so the problem is easy to find */
.thc-root .thc-input[aria-invalid="true"] { box-shadow: 0 0 0 2px var(--thc-danger); }
.thc-root .thc-input[aria-invalid="true"]:focus { box-shadow: 0 0 0 2px var(--thc-gold); }
.thc-root .thc-err { min-height: 0; margin: 0; font-size: 12px; font-weight: 600; color: var(--thc-danger); }
.thc-root .thc-err:empty { display: none; }
.thc-root .thc-go {
    width: 100%; padding: 11px; border: 0; border-radius: 999px; background: var(--thc-bronze); color: #fff;
    font-size: 14px; font-weight: 700; letter-spacing: .03em; line-height: 1.2; cursor: pointer;
}
.thc-root .thc-go:hover { background: var(--thc-bronze-hi); }
.thc-root .thc-go:disabled { opacity: .6; cursor: default; }
.thc-root .thc-fine { margin: 0; font-size: 11px; line-height: 1.4; color: var(--thc-muted); }
/* Honeypot: off-screen, never visible to people */
.thc-root .thc-hp { position: absolute !important; left: -9999px !important; top: auto !important; width: 1px !important; height: 1px !important; overflow: hidden !important; opacity: 0 !important; }

/* ---------- Input bar ---------- */
.thc-root .thc-bar { display: none; flex: none; align-items: flex-end; gap: 8px; padding: 6px 12px 8px; border: 0; background: none; }
.thc-root .thc-bar.thc-show { display: flex; }
.thc-root .thc-text {
    flex: 1; min-width: 0; height: auto; max-height: 96px; resize: none; padding: 10px 14px; border: 0; border-radius: 14px;
    background: var(--thc-surface); color: var(--thc-ink); font-size: 14px; line-height: 1.4; outline: none; box-shadow: none; overflow-y: hidden;
}
.thc-root .thc-send {
    flex: none; width: 40px; height: 40px; padding: 0; border: 0; border-radius: 50%; background: var(--thc-bronze); color: #fff;
    display: flex; align-items: center; justify-content: center; cursor: pointer;
}
.thc-root .thc-send:hover { background: var(--thc-bronze-hi); }
.thc-root .thc-send:disabled { opacity: .45; cursor: default; }
.thc-root .thc-send svg { width: 18px; height: 18px; fill: currentColor; }

.thc-root .thc-foot { flex: none; margin: 0; padding: 2px 6px 8px; text-align: center; font-size: 10.5px; letter-spacing: .04em; color: var(--thc-muted); background: none; border: 0; }

/* ---------- Phone field: flag + dial code + searchable country list (intl-tel-input, the library the site already uses) ---------- */
.thc-root .iti { display: block; width: 100%; color: var(--thc-ink); }
.thc-root .iti input.thc-input { width: 100%; }
.thc-root .iti__selected-country { position: relative; padding-right: 12px; color: var(--thc-ink); background: none; border: 0; }
.thc-root .iti__selected-country::after { content: ""; position: absolute; right: 0; top: 24%; bottom: 24%; width: 1px; background: rgba(255, 255, 255, .14); }
.thc-root .iti__selected-country-primary { padding: 0 0 0 12px; border-radius: 12px 0 0 12px; }
.thc-root .iti__selected-country-primary:hover, .thc-root .iti--allow-dropdown .iti__selected-country:focus-visible { background: rgba(255, 255, 255, .07); }
.thc-root .iti__selected-dial-code { margin-left: 6px; font-size: 14px; font-weight: 500; color: var(--thc-ink); }
.thc-root .iti__arrow { margin-left: 6px; border-top-color: var(--thc-gold); }
.thc-root .iti__arrow--up { border-top-color: transparent; border-bottom-color: var(--thc-gold); }

/* The country list opens in a layer that covers the panel (never clipped by the message area) */
.thc-root .thc-drop { position: absolute; left: 0; right: 0; top: 0; bottom: 0; z-index: 5; pointer-events: none; }
.thc-root .thc-drop .iti--container {
    position: absolute !important; left: 12px !important; right: 12px !important; top: 64px !important; bottom: auto !important;
    width: auto !important; padding: 0 !important; z-index: 6; pointer-events: auto;
}
.thc-root .iti__dropdown-content {
    width: 100% !important; margin: 0; overflow: hidden; background: var(--thc-surface); border: 0;
    border-radius: 12px; box-shadow: 0 12px 32px rgba(0, 0, 0, .45); color: var(--thc-ink);
}
.thc-root .iti__search-input {
    display: block; width: 100%; padding: 12px 14px; border: 0; border-radius: 0;
    background: var(--thc-field); color: var(--thc-ink); font-size: 14px; line-height: 1.3; outline: none; box-shadow: none;
}
.thc-root .iti__search-input:focus { box-shadow: inset 0 -2px 0 var(--thc-gold); }
.thc-root .iti__country-list {
    max-height: min(260px, calc(100dvh - 260px)); margin: 0; padding: 4px 0; overflow-y: auto; background: transparent;
    scrollbar-width: thin; scrollbar-color: rgba(201, 162, 107, .55) transparent;
}
.thc-root .iti__country { display: flex; align-items: center; gap: 8px; padding: 8px 12px; color: var(--thc-ink); }
.thc-root .iti__country.iti__highlight, .thc-root .iti__country:hover { background: rgba(201, 162, 107, .18); }
/* the site's own stylesheet forces country names to black on some pages; keep them readable on the dark list */
.thc-root .iti__country-name { margin: 0; color: var(--thc-ink) !important; font-size: 14px; }
.thc-root .iti__dial-code { margin-left: auto; color: var(--thc-muted) !important; font-size: 13px; }
.thc-root .iti__divider { margin: 4px 0; border-bottom: 1px solid rgba(255, 255, 255, .08); padding: 0; }
.thc-root .iti__flag-box, .thc-root .iti__flag { flex: none; }

/* ---------- Teaser pill (to the right of the bubble) ---------- */
.thc-root .thc-teaser {
    position: fixed; right: calc(max(32px, env(safe-area-inset-right, 0px)) + 76px); bottom: calc(44px + env(safe-area-inset-bottom, 0px));
    z-index: 99989; display: none; align-items: center; max-width: calc(100vw - 130px);
    background: var(--thc-surface); border: 1px solid rgba(201, 162, 107, .5); border-radius: 999px; box-shadow: 0 10px 28px rgba(0, 0, 0, .4);
}
.thc-root .thc-teaser.thc-show { display: flex; animation: thc-in .3s ease-out; }
.thc-root .thc-teaser-btn {
    min-width: 0; padding: 10px 6px 10px 16px; border: 0; border-radius: 999px 0 0 999px; background: none; color: var(--thc-ink);
    font-size: 13px; font-weight: 600; line-height: 1.3; text-align: left; cursor: pointer;
}
.thc-root .thc-teaser-btn:hover { color: #fff; }
.thc-root .thc-teaser-x {
    flex: none; width: 26px; height: 26px; margin-right: 6px; padding: 0; border: 0; border-radius: 50%; background: none;
    color: var(--thc-muted); font-size: 16px; line-height: 1; cursor: pointer;
}
.thc-root .thc-teaser-x:hover { background: rgba(255, 255, 255, .1); color: var(--thc-ink); }
.thc-root .thc-teaser-btn:focus-visible, .thc-root .thc-teaser-x:focus-visible { outline: 2px solid var(--thc-gold); outline-offset: 2px; }

/* ---------- Focus (visible) ---------- */
.thc-root .thc-bubble:focus-visible, .thc-root .thc-x:focus-visible, .thc-root .thc-send:focus-visible,
.thc-root .thc-go:focus-visible { outline: 2px solid var(--thc-gold); outline-offset: 3px; }

/* ---------- Phones: full screen ---------- */
@media (max-width: 480px) {
    /* ---- Launcher: a little above the browser's bottom bar ---- */
    .thc-root .thc-bubble { right: max(20px, env(safe-area-inset-right, 0px)); bottom: calc(48px + env(safe-area-inset-bottom, 0px)); }

    /* ---- Teaser: one line, as a speech bubble above the launcher pointing down at it ---- */
    .thc-root .thc-teaser {
        left: auto; right: max(16px, env(safe-area-inset-right, 0px)); bottom: calc(48px + 64px + 14px + env(safe-area-inset-bottom, 0px));
        max-width: calc(100vw - 32px); border-radius: 999px;
    }
    .thc-root .thc-teaser::after {
        content: ""; position: absolute; right: 30px; bottom: -7px; width: 12px; height: 12px; background: var(--thc-surface);
        border-right: 1px solid rgba(201, 162, 107, .5); border-bottom: 1px solid rgba(201, 162, 107, .5); transform: rotate(45deg);
    }
    .thc-root .thc-teaser-btn {
        min-height: 40px; padding: 10px 6px 10px 16px; border-radius: 999px 0 0 999px; font-size: 13px;
        white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
    }
    .thc-root .thc-teaser-x { width: 36px; height: 36px; margin-right: 2px; font-size: 18px; }

    /* ---- Panel: full screen (follows the visible area, so the on-screen keyboard never covers the input) ---- */
    .thc-root .thc-panel {
        left: 0; right: 0; top: var(--thc-vvt, 0px); bottom: auto; width: 100%; max-width: none;
        height: 100vh; height: 100dvh; height: var(--thc-vvh, 100dvh); max-height: none;
        border: 0; border-radius: 0; z-index: 1000001;
    }
    .thc-root .thc-panel.thc-open { animation: thc-sheet .24s ease-out; }

    /* ---- Header ---- */
    .thc-root .thc-head {
        gap: 10px; padding: calc(10px + env(safe-area-inset-top, 0px)) calc(10px + env(safe-area-inset-right, 0px)) 10px calc(14px + env(safe-area-inset-left, 0px));
    }
    .thc-root .thc-logo { width: 38px; height: 38px; }
    .thc-root .thc-logo img { width: 22px; height: 22px; }
    .thc-root .thc-title { font-size: 15px; }
    .thc-root .thc-sub { font-size: 12px; }
    .thc-root .thc-x { width: 40px; height: 40px; font-size: 24px; }

    /* ---- Messages: the same 14px as on desktop ---- */
    .thc-root .thc-msgs {
        gap: 8px; padding: 14px calc(14px + env(safe-area-inset-right, 0px)) 8px calc(14px + env(safe-area-inset-left, 0px));
    }
    .thc-root .thc-m { max-width: 86%; padding: 9px 13px; border-radius: 16px; font-size: 14px; line-height: 1.45; }
    .thc-root .thc-typing { padding: 12px 14px; border-radius: 16px; }

    /* ---- Form: compact fields with 14px text (iPhones get 16px again at the end of this block, see there) ---- */
    .thc-root .thc-card { gap: 14px; margin-top: 8px; }
    .thc-root .thc-field { gap: 5px; }
    .thc-root .thc-label { font-size: 12px; }
    .thc-root .thc-input { min-height: 42px; padding: 10px 12px; border-radius: 12px; font-size: 14px; }
    .thc-root .thc-err { font-size: 12px; }
    .thc-root .thc-go { min-height: 44px; padding: 11px; font-size: 14px; }
    .thc-root .thc-fine { font-size: 12px; line-height: 1.4; }
    .thc-root .iti__selected-dial-code { font-size: 14px; }

    /* ---- Chat bar and footer ---- */
    .thc-root .thc-bar { gap: 8px; padding: 6px calc(12px + env(safe-area-inset-right, 0px)) 4px calc(12px + env(safe-area-inset-left, 0px)); }
    .thc-root .thc-text { min-height: 40px; padding: 9px 14px; border-radius: 20px; font-size: 14px; }
    .thc-root .thc-send { width: 40px; height: 40px; }
    .thc-root .thc-send svg { width: 18px; height: 18px; }
    .thc-root .thc-foot { padding: 2px 6px calc(8px + env(safe-area-inset-bottom, 0px)); font-size: 11px; }

    /* ---- Country list ---- */
    .thc-root .thc-drop .iti--container { top: calc(68px + env(safe-area-inset-top, 0px)) !important; left: 12px !important; right: 12px !important; }
    .thc-root .iti__search-input { padding: 12px 14px; font-size: 14px; }
    .thc-root .iti__country-list { max-height: calc(var(--thc-vvh, 100dvh) - 220px); }
    .thc-root .iti__country { padding: 10px 12px; }
    .thc-root .iti__country-name { font-size: 14px; }
    .thc-root .iti__dial-code { font-size: 13px; }

    /* iPhones (Safari / Chrome on iOS) zoom the whole page in when a field's text is smaller than 16px, so only there
       the typing fields keep 16px. Everything else uses the compact sizes above. */
    @supports (-webkit-touch-callout: none) {
        .thc-root .thc-input, .thc-root .thc-text, .thc-root .iti__search-input, .thc-root .iti__selected-dial-code { font-size: 16px; }
    }
}

/* very narrow phones: let the teaser wrap rather than cut its text */
@media (max-width: 340px) {
    .thc-root .thc-teaser-btn { white-space: normal; border-radius: 22px 0 0 22px; }
    .thc-root .thc-teaser { border-radius: 22px; }
}

@media (prefers-reduced-motion: reduce) {
    .thc-root *, .thc-root *::before, .thc-root *::after { animation: none !important; transition: none !important; scroll-behavior: auto !important; }
}
