/* Τάλως — AI assistant widget. All styles namespaced under .tlc- so they can't
   collide with the site's Tailwind build. Brand: black + cyan #77F2F7, Play font
   (same tokens as the homepage CTAs). */

.tlc-root {
    --tlc-bg: #0a0a0f;
    --tlc-panel: #121219;
    --tlc-line: rgba(255, 255, 255, 0.08);
    --tlc-text: #e8e8ef;
    --tlc-muted: #8b8b9a;
    --tlc-cyan: #77F2F7;
    --tlc-cyan-deep: #0d3f42;
    --tlc-ink: #00201C;
    position: fixed;
    right: 20px;
    bottom: 20px;
    z-index: 2147483000;
    font-family: 'Play', system-ui, sans-serif;
}

/* Launcher bubble (mobile / fallback — on desktop the particle head takes over) */
.tlc-launcher {
    width: 60px;
    height: 60px;
    border-radius: 50%;
    border: none;
    cursor: pointer;
    background: var(--tlc-cyan);
    box-shadow: 0 0 40px rgba(119, 242, 247, 0.45), 0 0 0 1px rgba(119, 242, 247, 0.25);
    display: flex;
    align-items: center;
    justify-content: center;
    transition: transform 0.15s ease, box-shadow 0.2s ease;
}
.tlc-launcher:hover { transform: translateY(-2px) scale(1.03); box-shadow: 0 0 60px rgba(119, 242, 247, 0.7); }
.tlc-launcher svg { width: 26px; height: 26px; fill: var(--tlc-ink); }

/* Mini particle Τάλως (desktop): wrap = canvas + κυανός κύκλος (το hitbox) + label.
   Το wrap ζει έξω από το .tlc-root, οπότε τα χρώματα γράφονται ρητά.
   Η θέση (right/bottom) και το --tlc-lift (πάνω από το #sticky-cta) ορίζονται
   από το talos-head.js — εδώ μόνο εμφάνιση και transitions. */
#tlc-head-wrap {
    position: fixed;
    right: 14px;
    bottom: 10px;
    width: 200px;
    height: 200px;
    z-index: 2147483000;
    pointer-events: none;
    transform-origin: center;
    transition: bottom 0.45s cubic-bezier(0.16, 1, 0.3, 1),
                transform 0.45s cubic-bezier(0.16, 1, 0.3, 1);
}
/* release μετά από drag: γλιστράει στο κοντινότερο anchor (αριστερά/25%/75%/δεξιά) */
#tlc-head-wrap.tlc-snapping {
    transition: right 0.4s cubic-bezier(0.16, 1, 0.3, 1),
                bottom 0.45s cubic-bezier(0.16, 1, 0.3, 1),
                transform 0.45s cubic-bezier(0.16, 1, 0.3, 1);
}
#tlc-head-wrap.tlc-dragging { transition: none; }

#tlc-head-canvas {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    opacity: 0;
    transition: opacity 0.5s ease;
    pointer-events: none;
}
#tlc-head-wrap.tlc-head-on #tlc-head-canvas { opacity: 1; }

/* Ο κύκλος: αχνοφέγγει, αναπνέει, και είναι το ΑΚΡΙΒΕΣ hitbox (border-radius
   50% = κυκλικό hit-testing) + drag handle */
#tlc-head-ring {
    position: absolute;
    left: 50%;
    top: 50%;
    width: 144px;
    height: 144px;
    margin: -72px 0 0 -72px;
    border-radius: 50%;
    border: 1px solid rgba(119, 242, 247, 0.5);
    cursor: pointer;
    pointer-events: none;
    opacity: 0;
    transition: opacity 1.8s ease, transform 0.22s cubic-bezier(0.34, 1.56, 0.64, 1);
}
#tlc-head-ring::before {
    content: '';
    position: absolute;
    inset: -1px;
    border-radius: 50%;
    animation: tlc-ring-breathe 5s ease-in-out infinite;
    pointer-events: none;
}
#tlc-head-wrap.tlc-ring-on #tlc-head-ring { opacity: 1; pointer-events: auto; }
#tlc-head-ring:hover { transform: scale(1.055); border-color: rgba(119, 242, 247, 0.8); }
#tlc-head-ring.tlc-pulse { animation: tlc-ring-pulse 0.45s cubic-bezier(0.34, 1.56, 0.64, 1); }
#tlc-head-wrap.tlc-dragging #tlc-head-ring { cursor: grabbing; transform: none; }
@keyframes tlc-ring-breathe {
    0%, 100% { box-shadow: 0 0 20px rgba(119, 242, 247, 0.16), inset 0 0 24px rgba(119, 242, 247, 0.07); }
    50% { box-shadow: 0 0 34px rgba(119, 242, 247, 0.32), inset 0 0 32px rgba(119, 242, 247, 0.13); }
}
@keyframes tlc-ring-pulse {
    0% { transform: scale(1); }
    40% { transform: scale(1.10); }
    100% { transform: scale(1.055); }
}

/* «Μίλα με τον Τάλως» — αριστερά του κύκλου· δεξιά όταν συρθεί στο αριστερό μισό.
   Έντονο glow για να ξεχωρίζει από τα κείμενα της σελίδας. */
#tlc-head-label {
    position: absolute;
    right: calc(100% - 16px);
    top: 50%;
    transform: translateY(-50%);
    white-space: nowrap;
    color: #A9F7FA;
    font-family: 'Play', system-ui, sans-serif;
    font-size: 16px;
    font-weight: 700;
    letter-spacing: 0.5px;
    text-shadow: 0 0 6px rgba(119, 242, 247, 0.95),
                 0 0 18px rgba(119, 242, 247, 0.6),
                 0 0 38px rgba(119, 242, 247, 0.35);
    opacity: 0;
    transition: opacity 1.8s ease 0.4s;
    pointer-events: none;
}
#tlc-head-wrap.tlc-ring-on #tlc-head-label { opacity: 1; }
#tlc-head-wrap.tlc-chat-open #tlc-head-label,
#tlc-head-wrap.tlc-dragging #tlc-head-label { opacity: 0; transition: opacity 0.2s ease; }
#tlc-head-wrap.tlc-label-right #tlc-head-label {
    right: auto;
    left: calc(100% - 16px);
}

/* One-shot tooltip στο πρώτο hover — φουσκάλα iMessage πάνω από τον κύκλο */
#tlc-head-tip {
    position: absolute;
    left: 50%;
    bottom: calc(100% - 14px);
    transform: translateX(-50%) translateY(8px) scale(0.9);
    background: #77F2F7;
    color: #00201C;
    font-family: 'Play', system-ui, sans-serif;
    font-size: 13.5px;
    font-weight: 700;
    letter-spacing: 0.3px;
    white-space: nowrap;
    padding: 8px 14px;
    border-radius: 16px;
    box-shadow: 0 0 26px rgba(119, 242, 247, 0.45);
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.25s ease, transform 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
}
#tlc-head-tip::after {
    content: '';
    position: absolute;
    top: 100%;
    left: 50%;
    margin-left: -6px;
    border: 6px solid transparent;
    border-top-color: #77F2F7;
}
#tlc-head-wrap.tlc-tip-on #tlc-head-tip {
    opacity: 1;
    transform: translateX(-50%) translateY(0) scale(1);
}

/* Στο hero (μετά το πρώτο ταξίδι): fade out ώστε να μην μπλέκει με τον μεγάλο
   Τάλω, fade in ξανά όταν ο χρήστης κατέβει. Το JS βάζει .tlc-at-hero. */
#tlc-head-wrap.tlc-at-hero #tlc-head-canvas,
#tlc-head-wrap.tlc-at-hero #tlc-head-ring,
#tlc-head-wrap.tlc-at-hero #tlc-head-label {
    opacity: 0;
    transition: opacity 0.6s ease;
}
#tlc-head-wrap.tlc-at-hero #tlc-head-ring { pointer-events: none; }

.tlc-root.tlc-has-head .tlc-launcher { display: none; }
/* Το panel τοποθετείται από το talos-head.js στη θέση του κύκλου (left/right/
   bottom inline) — εδώ μόνο το fixed context και ένα λογικό fallback. */
.tlc-root.tlc-has-head .tlc-panel {
    position: fixed;
    right: 16px;
    bottom: calc(216px + var(--tlc-lift, 0px));
    max-height: calc(100vh - 256px - var(--tlc-lift, 0px));
}
/* Με ανοιχτό chat το .tlc-dot γίνεται διάφανο slot 30px — εκεί «δένει» ο
   ζωντανός κύκλος (ο πραγματικός particle Τάλως σε μικρογραφία). */
.tlc-root.tlc-has-head .tlc-dot {
    width: 30px;
    height: 30px;
    flex: 0 0 30px;
    background: transparent;
    box-shadow: none;
}

/* Panel */
.tlc-panel {
    position: absolute;
    right: 0;
    bottom: 74px;
    width: 380px;
    max-width: calc(100vw - 32px);
    height: 560px;
    max-height: calc(100vh - 120px);
    background: var(--tlc-bg);
    border: 1px solid var(--tlc-line);
    border-radius: 18px;
    box-shadow: 0 24px 70px rgba(0, 0, 0, 0.55);
    display: none;
    flex-direction: column;
    overflow: hidden;
}
.tlc-root.tlc-open .tlc-panel { display: flex; }

.tlc-header {
    padding: 16px 18px;
    border-bottom: 1px solid var(--tlc-line);
    display: flex;
    align-items: center;
    gap: 10px;
    background: linear-gradient(90deg, rgba(119, 242, 247, 0.10), rgba(119, 242, 247, 0.03));
}
.tlc-dot {
    width: 9px; height: 9px; border-radius: 50%;
    background: var(--tlc-cyan);
    box-shadow: 0 0 10px var(--tlc-cyan);
}
.tlc-title { color: var(--tlc-text); font-size: 15px; font-weight: 700; letter-spacing: 0.2px; }
.tlc-sub { color: var(--tlc-muted); font-size: 11px; margin-top: 1px; }
.tlc-close {
    margin-left: auto; background: none; border: none; color: var(--tlc-muted);
    font-size: 22px; line-height: 1; cursor: pointer; padding: 4px;
}
.tlc-close:hover { color: var(--tlc-text); }

/* Easter egg: player της ιστορίας του Τάλω, δίπλα στο όνομα */
.tlc-audio { display: flex; gap: 2px; margin-left: 8px; align-items: center; }
.tlc-audio[hidden] { display: none; }
.tlc-audio-btn {
    background: none; border: none; cursor: pointer;
    padding: 4px; line-height: 0; border-radius: 8px;
}
.tlc-audio-btn svg { width: 15px; height: 15px; fill: var(--tlc-cyan); opacity: 0.7; transition: opacity 0.15s ease; }
.tlc-audio-btn:hover svg { opacity: 1; filter: drop-shadow(0 0 7px rgba(119, 242, 247, 0.9)); }
.tlc-audio .tlc-i-pause { display: none; }
.tlc-audio.tlc-playing .tlc-i-play { display: none; }
.tlc-audio.tlc-playing .tlc-i-pause { display: inline; }
.tlc-audio.tlc-playing .tlc-audio-play svg { opacity: 1; filter: drop-shadow(0 0 7px rgba(119, 242, 247, 0.9)); }

.tlc-messages {
    flex: 1;
    overflow-y: auto;
    padding: 16px;
    display: flex;
    flex-direction: column;
    gap: 12px;
}
.tlc-msg { max-width: 85%; padding: 10px 13px; border-radius: 14px; font-size: 14px; line-height: 1.5; white-space: pre-wrap; word-wrap: break-word; }
.tlc-msg.tlc-user { align-self: flex-end; background: var(--tlc-cyan); color: var(--tlc-ink); border-bottom-right-radius: 4px; }
.tlc-msg.tlc-bot { align-self: flex-start; background: var(--tlc-panel); color: var(--tlc-text); border: 1px solid var(--tlc-line); border-bottom-left-radius: 4px; }
.tlc-msg.tlc-bot { white-space: normal; }

/* Rendered markdown inside bot bubbles */
.tlc-text > :first-child { margin-top: 0; }
.tlc-text > :last-child { margin-bottom: 0; }
.tlc-text p { margin: 0 0 8px; }
.tlc-text ul, .tlc-text ol { margin: 4px 0 8px; padding-left: 20px; }
.tlc-text li { margin: 2px 0; }
.tlc-text a { color: var(--tlc-cyan); text-decoration: underline; }
.tlc-text strong { color: #fff; font-weight: 700; }
.tlc-text code { background: rgba(255, 255, 255, 0.08); border-radius: 5px; padding: 1px 5px; font-size: 12.5px; font-family: ui-monospace, Menlo, monospace; }

/* Inline CTA / action buttons under an answer */
.tlc-actions { margin-top: 10px; display: flex; flex-wrap: wrap; gap: 8px; }
.tlc-action-btn {
    font-family: inherit; font-size: 12.5px; font-weight: 700; cursor: pointer;
    color: var(--tlc-ink); text-decoration: none; border: none; border-radius: 10px; padding: 8px 12px;
    background: var(--tlc-cyan);
    box-shadow: 0 0 22px rgba(119, 242, 247, 0.35);
    transition: transform 0.12s ease, box-shadow 0.2s ease;
}
.tlc-action-btn:hover { transform: translateY(-1px); box-shadow: 0 0 32px rgba(119, 242, 247, 0.55); }

/* Starter suggestion chips */
.tlc-starters { display: flex; flex-wrap: wrap; gap: 8px; align-self: flex-start; margin-top: -4px; }
.tlc-chip {
    font-family: inherit; font-size: 12.5px; cursor: pointer;
    color: var(--tlc-text); background: var(--tlc-panel);
    border: 1px solid var(--tlc-line); border-radius: 999px; padding: 7px 12px;
    transition: border-color 0.15s ease, background 0.15s ease;
}
.tlc-chip:hover { border-color: var(--tlc-cyan); background: rgba(119, 242, 247, 0.10); }

/* Email-capture handoff form (inside a bot bubble) */
.tlc-handoff { max-width: 100%; width: 100%; }
.tlc-hf {
    display: block; width: 100%; box-sizing: border-box; margin-top: 8px;
    background: var(--tlc-bg); border: 1px solid var(--tlc-line); border-radius: 10px;
    color: var(--tlc-text); font-family: inherit; font-size: 13px; padding: 9px 11px; outline: none;
}
.tlc-hf:focus { border-color: var(--tlc-cyan); }
textarea.tlc-hf { resize: none; }
.tlc-hf-consent { display: flex; align-items: flex-start; gap: 7px; margin-top: 9px; font-size: 11.5px; color: var(--tlc-muted); line-height: 1.4; cursor: pointer; }
.tlc-hf-consent input { margin-top: 1px; accent-color: var(--tlc-cyan); }
.tlc-hf-send { margin-top: 10px; }
.tlc-hf-send:disabled { opacity: 0.5; cursor: default; }
.tlc-hf-status { margin-top: 8px; font-size: 11.5px; color: var(--tlc-cyan); min-height: 1px; }

.tlc-sources { margin-top: 8px; display: flex; flex-wrap: wrap; gap: 6px; }
.tlc-source {
    font-size: 11px; color: var(--tlc-cyan); text-decoration: none;
    border: 1px solid rgba(119, 242, 247, 0.35); border-radius: 999px; padding: 2px 9px;
}
.tlc-source:hover { background: rgba(119, 242, 247, 0.12); }

.tlc-typing { display: flex; gap: 4px; align-self: flex-start; padding: 12px 14px; }
.tlc-typing span { width: 7px; height: 7px; border-radius: 50%; background: var(--tlc-cyan); opacity: 0.7; animation: tlc-bounce 1.2s infinite; }
.tlc-typing span:nth-child(2) { animation-delay: 0.15s; }
.tlc-typing span:nth-child(3) { animation-delay: 0.3s; }
@keyframes tlc-bounce { 0%, 60%, 100% { opacity: 0.3; transform: translateY(0); } 30% { opacity: 1; transform: translateY(-4px); } }

.tlc-input {
    border-top: 1px solid var(--tlc-line);
    padding: 12px;
    display: flex;
    gap: 8px;
    align-items: flex-end;
}
.tlc-input textarea {
    flex: 1;
    resize: none;
    background: var(--tlc-panel);
    border: 1px solid var(--tlc-line);
    border-radius: 12px;
    color: var(--tlc-text);
    font-family: inherit;
    font-size: 14px;
    padding: 10px 12px;
    max-height: 120px;
    outline: none;
}
.tlc-input textarea:focus { border-color: var(--tlc-cyan); }
.tlc-input textarea::placeholder { color: var(--tlc-muted); }
.tlc-send {
    width: 40px; height: 40px; flex: 0 0 40px; border-radius: 12px; border: none; cursor: pointer;
    background: var(--tlc-cyan);
    box-shadow: 0 0 18px rgba(119, 242, 247, 0.3);
    display: flex; align-items: center; justify-content: center;
}
.tlc-send:disabled { opacity: 0.4; cursor: default; }
.tlc-send svg { width: 18px; height: 18px; fill: var(--tlc-ink); }

.tlc-footnote { text-align: center; color: var(--tlc-muted); font-size: 10px; padding: 0 12px 10px; }

@media (prefers-reduced-motion: reduce) {
    .tlc-launcher, .tlc-typing span { transition: none; animation: none; }
    #tlc-head-canvas, #tlc-head-ring, #tlc-head-ring::before, #tlc-head-label { transition: none; animation: none; }
}

/* ── Κινητό/tablet: full-width bottom sheet ──────────────────────────────────
   Ίδιο κατώφλι με το mobile-mode particle head [ !(fine && ≥1024) ] ώστε panel
   και κύκλος να συμφωνούν. Το JS (widget.js) χειρίζεται keyboard/scroll-lock/CTA-lift. */
@media (max-width: 1023px), (pointer: coarse) {
    /* ο launcher πάνω από το #sticky-cta (--tlc-lift από widget.js) + home-indicator safe-area */
    .tlc-root { right: 16px; bottom: calc(16px + env(safe-area-inset-bottom, 0px) + var(--tlc-lift, 0px)); transition: bottom .3s ease; }
    /* με ανοιχτό chat κρύβεται η φούσκα· κλείνει από το × στο header */
    .tlc-root.tlc-open .tlc-launcher { display: none; }
    /* το has-head selector μπαίνει ρητά ώστε το sheet να νικά αν έμεινε .tlc-has-head μετά από resize */
    .tlc-panel,
    .tlc-root.tlc-has-head .tlc-panel {
        position: fixed;
        left: 0; right: 0; bottom: 0;
        width: 100%; max-width: 100%;
        height: 85vh;            /* fallback */
        height: 85dvh;           /* iOS Safari: σέβεται τη μπάρα εργαλείων */
        max-height: 100dvh;
        border-radius: 18px 18px 0 0;
        border-left: none; border-right: none; border-bottom: none;
    }
    /* ≥16px = ο iOS Safari δεν κάνει zoom στο focus των πεδίων */
    .tlc-input textarea, .tlc-hf { font-size: 16px; }
    /* home-indicator safe area κάτω από το footnote */
    .tlc-footnote { padding-bottom: calc(10px + env(safe-area-inset-bottom)); }

    /* ── header: μισό ύψος (63px -> 31px) ΧΩΡΙΣ να αλλάξει ούτε το κείμενο ούτε το
       μέγεθος των γραμμάτων (αίτημα Πάνου). Το ύψος το κρατούσαν δύο πράγματα:
       (α) τίτλος+υπότιτλος σε ΔΥΟ σειρές -> τα βάζουμε σε μία, στην ίδια baseline·
       (β) το 30px slot του dot. */
    .tlc-header { padding: 4px 14px; gap: 8px; }
    /* Ο mini Τάλως ΔΕΝ δένει ποτέ στο header στο κινητό (talos-head.js: dockTransform
       είναι !mobile-gated), οπότε το 30px placeholder έμενε ΑΔΕΙΟ — 40px νεκρός χώρος
       και κανένα dot. Επαναφορά του κανονικού κυανού dot. */
    .tlc-root.tlc-has-head .tlc-dot {
        width: 7px; height: 7px; flex: 0 0 7px;
        background: var(--tlc-cyan); box-shadow: 0 0 8px var(--tlc-cyan);
    }
    .tlc-header > div { display: flex; align-items: baseline; gap: 7px; min-width: 0; }
    .tlc-sub { margin-top: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
    /* μικρότερα εικονίδια, αλλά με ::after που κρατάει το tap target στα 44px */
    .tlc-audio { margin-left: 4px; gap: 0; }
    .tlc-audio-btn { padding: 2px; position: relative; }
    .tlc-audio-btn svg { width: 14px; height: 14px; }
    .tlc-audio-btn::after { content: ''; position: absolute; left: 0; right: 0; top: 50%; height: 44px; transform: translateY(-50%); }
    .tlc-close { font-size: 18px; padding: 0 2px; position: relative; }
    .tlc-close::after { content: ''; position: absolute; left: -10px; right: -10px; top: 50%; height: 44px; transform: translateY(-50%); }
}
