/* AI Assistant (Realistant) - όλα τα styles είναι scoped κάτω από #ai-widget ώστε να μην επηρεάζουν το site */

#ai-widget {
    --bot-blue: #0030ff;
    --primary: #0f256e;
    --primary-2: #0030ff;
    --primary-light: #eef2ff;
    --surface: #ffffff;
    --bg-chat: #f8fafc;
    --text: #0f172a;
    --muted: #64748b;
    --border: #e2e8f0;
    --radius-xl: 26px;
}

#ai-widget,
#ai-widget * {
    box-sizing: border-box;
}

#ai-widget button,
#ai-widget input {
    font-family: inherit;
    margin: 0;
}

#ai-widget p,
#ai-widget span,
#ai-widget div {
    letter-spacing: normal;
}

/* =========================================================
   FLOATING WIDGET CONTAINER (Κάτω Δεξιά)
   ========================================================= */
#ai-widget.ai-widget-wrapper {
    position: fixed;
    bottom: 24px;
    right: 24px;
    z-index: 9990;
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    pointer-events: none;
    font-family: 'Inter', system-ui, -apple-system, sans-serif;
    color: var(--text);
    line-height: 1.5;
}

#ai-widget .bot-teaser {
    pointer-events: auto;
    position: absolute;
    bottom: 18px;
    right: 96px;
    background: #ffffff;
    color: var(--text);
    padding: 12px 18px;
    border-radius: 18px 18px 4px 18px;
    box-shadow: 0 14px 34px rgba(15, 23, 42, 0.12), 0 0 0 1px rgba(226, 232, 240, 0.8);
    font-size: 13.5px;
    font-weight: 600;
    white-space: nowrap;
    display: flex;
    align-items: center;
    gap: 8px;
    cursor: pointer;
    transform-origin: bottom right;
    transition: all 0.35s cubic-bezier(0.16, 1, 0.3, 1);
}

#ai-widget .bot-teaser:hover {
    transform: translateY(-2px) scale(1.02);
}

#ai-widget:not(.show-teaser) .bot-teaser {
    display: none;
}

#ai-widget.is-open .bot-teaser {
    opacity: 0;
    transform: translateX(15px) scale(0.85);
    pointer-events: none;
}

/* =========================================================
   BOT LAUNCHER & INLINE SVG ANIMATIONS
   ========================================================= */
#ai-widget .bot-launcher {
    pointer-events: auto;
    width: 80px;
    height: 80px;
    border: none;
    background: transparent;
    cursor: pointer;
    position: relative;
    padding: 0;
    outline: none;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: transform 0.35s cubic-bezier(0.34, 1.56, 0.64, 1), opacity 0.3s ease;
}

#ai-widget .bot-launcher:hover {
    transform: scale(1.07) translateY(-3px);
}


#ai-widget .bot-status-ring {
    position: absolute;
    top: 8px;
    right: 8px;
    width: 14px;
    height: 14px;
    border-radius: 50%;
    background: #22c55e;
    border: 2.5px solid #fff;
    box-shadow: 0 2px 8px rgba(34, 197, 94, 0.5);
    z-index: 2;
}

#ai-widget .bot-actor {
    width: 100%;
    height: 100%;
    overflow: visible;
    filter: drop-shadow(0 4px 8px rgba(15, 23, 42, 0.22));
}

/* Λευκό περίγραμμα γύρω από το bot (το stroke ζωγραφίζεται πρώτα και το μπλε γέμισμα από πάνω) */
#ai-widget .bot-outline {
    stroke: #ffffff;
    stroke-width: 10;
    stroke-linejoin: round;
    paint-order: stroke;
}

/* Στο header το φόντο είναι ήδη λευκό, δεν χρειάζεται περίγραμμα */
#ai-widget .header-bot-wrap .bot-outline {
    stroke: none;
}

#ai-widget .header-bot-wrap .bot-actor {
    filter: drop-shadow(0 4px 10px rgba(0, 0, 0, 0.2));
}

/* Registered props -> οι τιμές κάθε state κάνουν smooth transition */
@property --ai-amp { syntax: '<length>'; inherits: false; initial-value: 5px; }
@property --ai-rot { syntax: '<angle>'; inherits: false; initial-value: 1deg; }
@property --ai-px  { syntax: '<length>'; inherits: false; initial-value: 0px; }
@property --ai-py  { syntax: '<length>'; inherits: false; initial-value: 0px; }
@property --ai-wx  { syntax: '<length>'; inherits: false; initial-value: 0px; }
@property --ai-ps  { syntax: '<number>'; inherits: false; initial-value: 1; }
@property --ai-ap  { syntax: '<number>'; inherits: false; initial-value: 0; }

#ai-widget .bot-shake { transform-origin: 100px 110px; }
#ai-widget .bot-whole {
    transform-origin: 100px 110px;
    animation: ai-botMotion 2.4s ease-in-out infinite;
    transition: --ai-amp 0.6s ease, --ai-rot 0.6s ease;
}
#ai-widget .bot-antenna-tip {
    transform-origin: 100px 26px;
    animation: ai-antennaPulse 0.9s ease-in-out infinite alternate;
    transition: --ai-ap 0.5s ease;
}
#ai-widget .bot-eye-l { transform-origin: 73px 112px; animation: ai-botBlink 5.5s infinite; }
#ai-widget .bot-eye-r { transform-origin: 127px 112px; animation: ai-botBlink 5.5s infinite; }

#ai-widget .bot-pupil {
    transform-box: fill-box;
    transform-origin: center;
    animation: ai-pupilLook 1.6s ease-in-out infinite;
    transition: --ai-px 0.45s ease, --ai-py 0.45s ease, --ai-wx 0.45s ease, --ai-ps 0.35s ease, opacity 0.25s ease;
}

#ai-widget .bot-x-eyes {
    opacity: 0;
    transform: scale(0.4);
    transform-origin: 100px 112px;
    transition: opacity 0.3s ease, transform 0.35s cubic-bezier(0.34, 1.56, 0.64, 1);
}

#ai-widget .bot-actor.state-idle     { --ai-amp: 5px;   --ai-rot: 1deg;   --ai-px: 0px; --ai-py: 0px;  --ai-wx: 0px; --ai-ps: 1;    --ai-ap: 0; }
#ai-widget .bot-actor.state-thinking { --ai-amp: 3px;   --ai-rot: 2.5deg; --ai-px: 0px; --ai-py: -5px; --ai-wx: 4px; --ai-ps: 0.95; --ai-ap: 0.24; }
#ai-widget .bot-actor.state-writing  { --ai-amp: 2.5px; --ai-rot: 0deg;   --ai-px: 0px; --ai-py: 8px;  --ai-wx: 1px; --ai-ps: 0.95; --ai-ap: 0; }
#ai-widget .bot-actor.state-error    { --ai-amp: 0px;   --ai-rot: 0deg;   --ai-px: 0px; --ai-py: 0px;  --ai-wx: 0px; --ai-ps: 0.2;  --ai-ap: 0; }
#ai-widget .bot-actor.state-error .bot-pupil { opacity: 0; }
#ai-widget .bot-actor.state-error .bot-x-eyes { opacity: 1; transform: scale(1); }
#ai-widget .bot-actor.state-error .bot-shake { animation: ai-botErrorShake 0.55s cubic-bezier(.36,.07,.19,.97) both; }

@keyframes ai-botMotion {
    0%, 100% { transform: translateY(0) rotate(calc(var(--ai-rot) * -1)); }
    50%      { transform: translateY(calc(var(--ai-amp) * -1)) rotate(var(--ai-rot)); }
}
@keyframes ai-pupilLook {
    0%, 100% { transform: translate(calc(var(--ai-px) - var(--ai-wx)), var(--ai-py)) scale(var(--ai-ps)); }
    50%      { transform: translate(calc(var(--ai-px) + var(--ai-wx)), var(--ai-py)) scale(var(--ai-ps)); }
}
/* Σκέψη: τα μάτια κοιτάνε πάνω και σκανάρουν πλάγια, η κεραία αναβοσβήνει γρηγορότερα */
#ai-widget .bot-actor.state-thinking .bot-pupil {
    animation: ai-thinkLook 1.8s ease-in-out infinite;
}
#ai-widget .bot-actor.state-thinking .bot-antenna-tip {
    animation-duration: 0.45s;
}
@keyframes ai-thinkLook {
    0%, 100% { transform: translate(-6px, -9px) scale(0.95); }
    50%      { transform: translate(6px, -11px) scale(0.95); }
}
@keyframes ai-antennaPulse {
    0%   { transform: scale(1); filter: brightness(1); }
    100% { transform: scale(calc(1 + var(--ai-ap))); filter: brightness(calc(1 + var(--ai-ap) * 1.5)); }
}
@keyframes ai-botBlink {
    0%, 46%, 50%, 96%, 100% { transform: scaleY(1); }
    48%, 98% { transform: scaleY(0.1); }
}
@keyframes ai-botErrorShake {
    0%, 100% { transform: translateX(0) rotate(0); }
    15%, 45%, 75% { transform: translateX(-6px) rotate(-3deg); }
    30%, 60%, 90% { transform: translateX(6px) rotate(3deg); }
}
@media (prefers-reduced-motion: reduce) {
    #ai-widget .bot-whole,
    #ai-widget .bot-pupil,
    #ai-widget .bot-antenna-tip,
    #ai-widget .bot-eye-l,
    #ai-widget .bot-eye-r { animation: none; }
}

/* =========================================================
   CHAT WINDOW + RIGHT SIDEBAR SPLIT LAYOUT
   ========================================================= */
#ai-widget .chat-window {
    pointer-events: none;
    position: absolute;
    bottom: 92px;
    right: 0;
    width: 430px;
    max-width: calc(100vw - 32px);
    height: min(670px, calc(100vh - 130px));
    background: var(--surface);
    border-radius: var(--radius-xl);
    box-shadow:
        0 28px 70px -10px rgba(15, 23, 42, 0.22),
        0 10px 25px -5px rgba(0, 56, 255, 0.08);
    display: flex;
    flex-direction: column;
    overflow: hidden;
    opacity: 0;
    transform: translateY(24px) scale(0.92);
    transform-origin: bottom right;
    transition:
        width 0.35s cubic-bezier(0.16, 1, 0.3, 1),
        transform 0.4s cubic-bezier(0.16, 1, 0.3, 1),
        opacity 0.28s ease;
}

/* Όταν υπάρχουν ενεργά φίλτρα ή ανοιχτό το δεξί panel, επεκτείνεται */
#ai-widget .chat-window.has-sidebar {
    width: 690px;
}

#ai-widget.is-open .chat-window {
    pointer-events: auto;
    opacity: 1;
    transform: translateY(0) scale(1);
}

/* =========================================================
   HEADER
   ========================================================= */
#ai-widget .header {
    display: flex;
    align-items: center;
    gap: 11px;
    padding: 14px 16px;
    background: linear-gradient(135deg, #091e5a 0%, #0030ff 100%);
    color: #fff;
    flex-shrink: 0;
}

#ai-widget .header-bot-wrap {
    width: 44px;
    height: 44px;
    border-radius: 13px;
    background: rgba(255, 255, 255, 0.95);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 3px;
    flex-shrink: 0;
}

#ai-widget .header-text {
    flex: 1;
    min-width: 0;
}

#ai-widget .header-title {
    font-weight: 700;
    font-size: 15px;
    display: flex;
    align-items: center;
    gap: 6px;
}

#ai-widget .ai-badge {
    font-size: 10px;
    font-weight: 700;
    background: rgba(255, 255, 255, 0.2);
    padding: 2px 7px;
    border-radius: 999px;
    border: 1px solid rgba(255, 255, 255, 0.25);
}

#ai-widget .header-sub {
    font-size: 11.8px;
    color: rgba(255, 255, 255, 0.86);
    display: flex;
    align-items: center;
    gap: 6px;
    margin-top: 2px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

#ai-widget .dot-online {
    width: 7px;
    height: 7px;
    border-radius: 50%;
    background: #4ade80;
    box-shadow: 0 0 8px #4ade80;
    flex-shrink: 0;
}

#ai-widget .header-actions {
    display: flex;
    align-items: center;
    gap: 6px;
}

#ai-widget .icon-btn {
    background: rgba(255, 255, 255, 0.13);
    color: #fff;
    border: 1px solid rgba(255, 255, 255, 0.22);
    border-radius: 10px;
    height: 32px;
    padding: 0 10px;
    font-size: 11.5px;
    font-weight: 600;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 4px;
    transition: all 0.18s ease;
}

#ai-widget .icon-btn:hover {
    background: rgba(255, 255, 255, 0.24);
}

#ai-widget .icon-btn.icon-only {
    width: 32px;
    padding: 0;
    position: relative;
}

#ai-widget .icon-btn.icon-only .filter-count-badge {
    position: absolute;
    top: -5px;
    right: -5px;
}

/* Όταν το panel φίλτρων είναι ανοιχτό, το κουμπί αλλάζει background */
#ai-widget .chat-window.has-sidebar #ai-toggle-filters {
    background: #fff;
    color: #0030ff;
    border-color: #fff;
}

#ai-widget .icon-btn.close-btn {
    width: 32px;
    padding: 0;
    font-size: 15px;
}

#ai-widget .filter-count-badge {
    background: #22c55e;
    color: #fff;
    font-size: 10px;
    font-weight: 700;
    padding: 1px 5px;
    border-radius: 999px;
}

/* =========================================================
   BODY SPLIT: ΑΡΙΣΤΕΡΑ CHAT, ΔΕΞΙΑ ACTIVE FILTERS SIDEBAR
   ========================================================= */
#ai-widget .chat-body-split {
    flex: 1;
    display: flex;
    min-height: 0;
    overflow: hidden;
    position: relative;
}

#ai-widget .chat-main-col {
    flex: 1;
    display: flex;
    flex-direction: column;
    min-width: 0;
    background: var(--bg-chat);
}

#ai-widget .filters-sidebar {
    width: 0;
    opacity: 0;
    border-left: 0 solid #e6ecf7;
    background: linear-gradient(180deg, #f7f9ff 0%, #ffffff 46%);
    display: flex;
    flex-direction: column;
    overflow: hidden;
    transition: width 0.32s cubic-bezier(0.16, 1, 0.3, 1), opacity 0.22s ease;
    flex-shrink: 0;
}

#ai-widget .chat-window.has-sidebar .filters-sidebar {
    width: 260px;
    opacity: 1;
    border-left-width: 1px;
}

#ai-widget .sidebar-header {
    padding: 16px 16px 12px;
    border-bottom: 1px solid #eaf0fa;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
}

#ai-widget .sidebar-title {
    font-size: 13px;
    font-weight: 700;
    letter-spacing: -0.01em;
    color: var(--text);
    display: flex;
    align-items: center;
    gap: 8px;
}

#ai-widget .sidebar-title-icon {
    width: 24px;
    height: 24px;
    border-radius: 8px;
    background: linear-gradient(135deg, #0030ff 0%, #1e3a8a 100%);
    color: #fff;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 4px 10px rgba(0, 56, 255, 0.25);
}

#ai-widget .sidebar-clear-btn {
    border: 1px solid #dbe4ff;
    background: #ffffff;
    color: var(--bot-blue);
    font-size: 11px;
    font-weight: 600;
    cursor: pointer;
    padding: 4px 9px;
    border-radius: 999px;
    transition: all 0.18s ease;
}

#ai-widget .sidebar-clear-btn:hover {
    background: var(--primary-light);
    border-color: var(--bot-blue);
}

#ai-widget .sidebar-list {
    flex: 1;
    overflow-y: auto;
    padding: 14px 12px;
    display: flex;
    flex-direction: column;
    gap: 9px;
}

#ai-widget .sidebar-empty {
    margin: auto 0;
    font-size: 12px;
    color: var(--muted);
    text-align: center;
    padding: 20px 14px;
    line-height: 1.6;
}

#ai-widget .sidebar-empty::before {
    content: '';
    display: block;
    width: 44px;
    height: 44px;
    margin: 0 auto 12px;
    border-radius: 14px;
    background: var(--primary-light) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%230030ff' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cline x1='4' y1='21' x2='4' y2='14'/%3E%3Cline x1='4' y1='10' x2='4' y2='3'/%3E%3Cline x1='12' y1='21' x2='12' y2='12'/%3E%3Cline x1='12' y1='8' x2='12' y2='3'/%3E%3Cline x1='20' y1='21' x2='20' y2='16'/%3E%3Cline x1='20' y1='12' x2='20' y2='3'/%3E%3C/svg%3E") center / 20px no-repeat;
}

@keyframes ai-filterCardIn {
    from { opacity: 0; transform: translateX(10px); }
    to { opacity: 1; transform: translateX(0); }
}

#ai-widget .active-filter-card {
    position: relative;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    padding: 10px 10px 10px 12px;
    border-radius: 14px;
    background: #ffffff;
    border: 1px solid #e6ecf7;
    border-left: 4.5px solid var(--bot-blue);
    box-shadow: 0 1px 2px rgba(15, 23, 42, 0.03), 0 4px 12px -6px rgba(15, 23, 42, 0.08);
    animation: ai-filterCardIn 0.3s cubic-bezier(0.16, 1, 0.3, 1);
    transition: transform 0.2s ease, box-shadow 0.2s ease, border-color 0.2s ease;
}

#ai-widget .active-filter-card.is-dedicated {
    border-left-color: #f59e0b;
}

#ai-widget .active-filter-card:hover {
    transform: translateY(-1px);
    border-color: #c9d6f2;
    border-left-color: var(--bot-blue);
    box-shadow: 0 2px 4px rgba(15, 23, 42, 0.04), 0 10px 20px -8px rgba(0, 56, 255, 0.18);
}

#ai-widget .active-filter-card.is-dedicated:hover {
    border-left-color: #f59e0b;
}

#ai-widget .filter-info {
    min-width: 0;
    flex: 1;
}

#ai-widget .filter-label {
    font-size: 10px;
    font-weight: 700;
    color: #7b8aa6;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    display: flex;
    align-items: center;
    gap: 5px;
}

#ai-widget .dedicated-dot {
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: #f59e0b;
    display: inline-block;
    box-shadow: 0 0 0 3px rgba(245, 158, 11, 0.18);
}

#ai-widget .filter-val {
    font-size: 13px;
    font-weight: 600;
    color: var(--text);
    margin-top: 2px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

#ai-widget .filter-remove-btn {
    width: 24px;
    height: 24px;
    border-radius: 50%;
    border: none;
    background: #f1f5f9;
    color: #64748b;
    font-size: 11px;
    font-weight: 700;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    transition: all 0.18s ease;
}

#ai-widget .filter-remove-btn:hover {
    background: #fee2e2;
    color: #dc2626;
    transform: rotate(90deg);
}

#ai-widget .sidebar-add-btn {
    margin: 0 12px 12px;
    padding: 10px 12px;
    border-radius: 12px;
    border: 1px solid #dbe4ff;
    background: #ffffff;
    color: var(--bot-blue);
    font-size: 12px;
    font-weight: 600;
    cursor: pointer;
    box-shadow: 0 2px 8px -4px rgba(0, 56, 255, 0.2);
    transition: all 0.18s ease;
}

#ai-widget .sidebar-add-btn:hover {
    background: var(--primary-light);
    border-color: var(--bot-blue);
    transform: translateY(-1px);
}

/* =========================================================
   MESSAGES & CHIPS
   ========================================================= */
#ai-widget .messages {
    flex: 1;
    overflow-y: auto;
    padding: 18px 16px;
    scroll-behavior: smooth;
}

#ai-widget .row {
    display: flex;
    margin-bottom: 10px;
    animation: ai-msgSlideIn 0.25s cubic-bezier(0.16, 1, 0.3, 1);
}

#ai-widget .row.user { justify-content: flex-end; }

@keyframes ai-msgSlideIn {
    from { opacity: 0; transform: translateY(8px); }
    to { opacity: 1; transform: translateY(0); }
}

#ai-widget .bubble {
    max-width: 86%;
    padding: 11px 15px;
    border-radius: 17px;
    line-height: 1.5;
    font-size: 13.8px;
    white-space: pre-wrap;
    word-wrap: break-word;
}

#ai-widget .assistant .bubble {
    background: var(--surface);
    color: var(--text);
    border: 1px solid rgba(226, 232, 240, 0.95);
    border-bottom-left-radius: 5px;
    box-shadow: 0 3px 10px rgba(15, 23, 42, 0.04);
}

#ai-widget .user .bubble {
    background: linear-gradient(135deg, #0030ff 0%, #1e40af 100%);
    color: #fff;
    border-bottom-right-radius: 5px;
    box-shadow: 0 6px 16px rgba(0, 56, 255, 0.22);
}

#ai-widget .inline-options {
    display: grid;
    gap: 7px;
    margin: 4px 0 14px 0;
    width: 100%;
    animation: ai-msgSlideIn 0.28s cubic-bezier(0.16, 1, 0.3, 1);
}

#ai-widget .inline-options.cols-1 { grid-template-columns: 1fr; }
#ai-widget .inline-options.cols-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
#ai-widget .inline-options.cols-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }

#ai-widget .inline-options-label {
    grid-column: 1 / -1;
    font-size: 11.5px;
    font-weight: 600;
    color: var(--muted);
    margin-bottom: 2px;
}

#ai-widget .inline-options.chip-row {
    display: flex;
    flex-wrap: wrap;
    gap: 7px;
}

#ai-widget .chip-row .inline-options-label {
    width: 100%;
    margin-bottom: 0;
}

#ai-widget .chip {
    width: 100%;
    min-height: 38px;
    display: flex;
    align-items: center;
    justify-content: center;
    text-align: center;
    border: 1px solid #cbd5e1;
    color: var(--text);
    background: var(--surface);
    border-radius: 11px;
    padding: 7px 10px;
    font-size: 12.8px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.16s ease;
}

#ai-widget .chip.span-full { grid-column: 1 / -1; }

#ai-widget .chip:hover:not(:disabled) {
    border-color: var(--bot-blue);
    background: var(--primary-light);
    color: var(--bot-blue);
    transform: translateY(-1px);
}

#ai-widget .chip-row .chip {
    width: auto;
    min-height: 34px;
    padding: 6px 14px;
    border-radius: 999px;
    font-size: 12.5px;
}

#ai-widget .chip-row .chip.span-full {
    grid-column: auto;
}

#ai-widget .chip.primary-action {
    background: linear-gradient(135deg, #0030ff 0%, #1e3a8a 100%);
    color: #fff;
    border-color: transparent;
    box-shadow: 0 4px 12px rgba(0, 56, 255, 0.22);
}

#ai-widget .chip.primary-action::after {
    content: '→';
    margin-left: 6px;
    font-weight: 500;
}

#ai-widget .chip.primary-action:hover:not(:disabled) {
    color: #fff;
    background: linear-gradient(135deg, #0030ff 0%, #1e3a8a 100%);
    border-color: transparent;
}

#ai-widget .chip.secondary-action {
    border-color: var(--bot-blue);
    color: var(--bot-blue);
    background: #fff;
}

#ai-widget .chip.subtle-action {
    color: var(--muted);
    border-color: var(--border);
    background: #f1f5f9;
}

#ai-widget .typing {
    display: inline-flex;
    gap: 5px;
    padding: 4px;
    align-items: center;
}

#ai-widget .typing span {
    width: 7px;
    height: 7px;
    border-radius: 50%;
    background: var(--bot-blue);
    animation: ai-bounce 1.2s infinite ease-in-out;
}

#ai-widget .typing span:nth-child(2) { animation-delay: 0.15s; }
#ai-widget .typing span:nth-child(3) { animation-delay: 0.3s; }

@keyframes ai-bounce {
    0%, 80%, 100% { transform: translateY(0); opacity: 0.35; }
    40% { transform: translateY(-5px); opacity: 1; }
}

/* =========================================================
   INPUT FORM
   ========================================================= */
#ai-widget .form {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 11px 14px;
    border-top: 1px solid var(--border);
    background: var(--surface);
}

#ai-widget .form input {
    flex: 1;
    min-width: 0;
    padding: 10px 15px;
    border: 1px solid var(--border);
    border-radius: 999px;
    font-size: 13px;
    color: var(--text);
    outline: none;
    background: var(--bg-chat);
    text-overflow: ellipsis;
    transition: border-color 0.2s ease, background 0.2s ease, box-shadow 0.2s ease;
}

#ai-widget .form input::placeholder {
    color: #94a3b8;
}

#ai-widget .form input:focus {
    border-color: var(--bot-blue);
    background: #fff;
    box-shadow: 0 0 0 3px rgba(0, 56, 255, 0.12);
}

#ai-widget .form button {
    position: relative;
    width: 42px;
    height: 42px;
    border-radius: 50%;
    border: none;
    cursor: pointer;
    background: linear-gradient(135deg, #0030ff 0%, #1e3a8a 100%);
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    box-shadow: 0 6px 14px -4px rgba(0, 56, 255, 0.45);
    transition: transform 0.2s cubic-bezier(0.34, 1.56, 0.64, 1), box-shadow 0.2s ease, opacity 0.2s ease;
}

#ai-widget .form button:hover:not(:disabled) {
    transform: translateY(-1px) scale(1.05);
    box-shadow: 0 10px 20px -4px rgba(0, 56, 255, 0.55);
}

#ai-widget .form button:active:not(:disabled) {
    transform: scale(0.9);
}

#ai-widget .form button:disabled {
    cursor: default;
    opacity: 0.6;
}

#ai-widget .form button .send-icon {
    transition: transform 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
}

#ai-widget .form button:hover:not(:disabled) .send-icon {
    animation: ai-sendNudge 0.6s ease-in-out;
}

#ai-widget .form button.is-ready::after {
    content: '';
    position: absolute;
    inset: -4px;
    border-radius: 50%;
    border: 2px solid rgba(0, 56, 255, 0.35);
    animation: ai-sendRing 1.6s ease-out infinite;
    pointer-events: none;
}

#ai-widget .form button.is-busy .send-icon {
    animation: ai-sendFly 0.9s ease-in-out infinite;
}

@keyframes ai-sendNudge {
    0%   { transform: translate(0, 0); }
    40%  { transform: translate(3px, -3px); }
    70%  { transform: translate(-1px, 1px); }
    100% { transform: translate(0, 0); }
}

@keyframes ai-sendRing {
    0%   { transform: scale(0.9); opacity: 0.9; }
    100% { transform: scale(1.45); opacity: 0; }
}

@keyframes ai-sendFly {
    0%, 100% { transform: translate(0, 0); opacity: 1; }
    50%      { transform: translate(4px, -4px); opacity: 0.4; }
}

/* =========================================================
   PREMIUM ENTRANCE (launcher + glow + teaser)
   ========================================================= */
#ai-widget #ai-launcher-bot {
    animation: ai-launcherIn 1s cubic-bezier(0.22, 1.2, 0.36, 1) 1.2s backwards;
}

#ai-widget .bot-launcher::before {
    content: '';
    position: absolute;
    inset: 6px;
    border-radius: 50%;
    background: radial-gradient(circle, rgba(0, 48, 255, 0.38) 0%, rgba(0, 48, 255, 0) 70%);
    opacity: 0;
    pointer-events: none;
    animation: ai-launcherGlow 1.6s ease-out 1.3s both;
}

#ai-widget .bot-teaser {
    animation: ai-teaserIn 0.7s cubic-bezier(0.16, 1, 0.3, 1) 2.4s backwards;
}

@keyframes ai-launcherIn {
    0%   { opacity: 0; transform: translateY(34px) scale(0.35) rotate(-8deg); filter: blur(8px); }
    60%  { opacity: 1; transform: translateY(-5px) scale(1.06) rotate(2deg); filter: blur(0); }
    100% { opacity: 1; transform: translateY(0) scale(1) rotate(0); filter: blur(0); }
}

@keyframes ai-launcherGlow {
    0%   { opacity: 0; transform: scale(0.4); }
    35%  { opacity: 1; }
    100% { opacity: 0; transform: scale(1.9); }
}

@keyframes ai-teaserIn {
    from { opacity: 0; transform: translateX(14px) scale(0.9); }
    to   { opacity: 1; transform: translateX(0) scale(1); }
}

@media (prefers-reduced-motion: reduce) {
    #ai-widget #ai-launcher-bot,
    #ai-widget .bot-launcher::before,
    #ai-widget .bot-teaser { animation: none; }
}

/* Mobile: το chat γεμίζει την οθόνη και το panel φίλτρων καλύπτει το chat */
@media (max-width: 720px) {
	#ai-widget .bot-launcher {
        width: 72px;
        height: 72px;
    }
	#ai-widget.ai-widget-wrapper {
        bottom: 10px;
        right: 8px;
    }
	#ai-widget .bot-teaser {
		right: 88px;
    	padding: 14px 25px;
	}
	    /* Σκούρο backdrop πίσω από το chat */
    #ai-widget::before {
        content: '';
        position: fixed;
        inset: 0;
        background: rgba(15, 23, 42, 0.6);
        opacity: 0;
        pointer-events: none;
        transition: opacity 0.3s ease;
    }
    #ai-widget.is-open::before {
        opacity: 1;
        pointer-events: auto;
    }

    /* Στο mobile ο launcher κρύβεται όταν ανοίγει το chat */
    #ai-widget.is-open .bot-launcher {
        opacity: 0;
        pointer-events: none;
        transform: scale(0.6) translateY(20px);
    }
    #ai-widget .chat-window,
    #ai-widget .chat-window.has-sidebar {
        position: fixed;
        top: 6vh;
        top: 6dvh;
        bottom: auto;
        right: 10px;
        left: 16px;
        width: auto;
        height: 88vh;   /* fallback */
        height: 88dvh;
    }
    #ai-widget .filters-sidebar {
        position: absolute;
        top: 0;
        right: 0;
        bottom: 0;
        z-index: 20;
        box-shadow: -10px 0 30px rgba(15, 23, 42, 0.12);
    }
    #ai-widget .chat-window.has-sidebar .filters-sidebar {
        width: 100%;
        border-left-width: 0;
    }
    #ai-widget .header {
        padding: 12px 12px;
        gap: 8px;
    }
    #ai-widget #ai-reset-label {
        display: none;
    }
    #ai-widget #ai-reset {
        width: 32px;
        padding: 0;
        justify-content: center;
    }
}