/* ── Chat toggle button ── */
.chat-toggle {
    position: fixed;
    bottom: 28px;
    left: 28px;
    z-index: 998;
    width: 60px;
    height: 60px;
    background: linear-gradient(135deg, #06102b, #2563eb);
    border-radius: 50%;
    border: none;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #fff;
    font-size: 1.55rem;
    box-shadow: 0 4px 22px rgba(37,99,235,0.45);
    transition: transform 0.25s cubic-bezier(0.34,1.56,0.64,1), box-shadow 0.25s ease;
    animation: chat-pulse 3s infinite;
}
.chat-toggle:hover { transform: scale(1.12); }
@keyframes chat-pulse {
    0%,100%{ box-shadow: 0 4px 22px rgba(37,99,235,.45); }
    50%     { box-shadow: 0 4px 36px rgba(37,99,235,.65), 0 0 0 10px rgba(37,99,235,.08); }
}

.chat-badge {
    position: absolute;
    top: -3px;
    right: -3px;
    width: 20px;
    height: 20px;
    background: #ef4444;
    border-radius: 50%;
    font-size: .68rem;
    font-weight: 700;
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    border: 2px solid #fff;
    animation: badge-pop 1.2s infinite;
}
@keyframes badge-pop {
    0%,100%{ transform: scale(1); }
    50%    { transform: scale(1.25); }
}

/* ── Chat window ── */
.chat-window {
    position: fixed;
    bottom: 102px;
    left: 28px;
    width: 355px;
    max-width: calc(100vw - 40px);
    height: 530px;
    max-height: calc(100vh - 120px);
    background: #fff;
    border-radius: 20px;
    box-shadow: 0 16px 56px rgba(6,16,43,.28);
    z-index: 997;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    transform: scale(0.85) translateY(20px);
    transform-origin: bottom left;
    opacity: 0;
    transition: transform .3s cubic-bezier(.34,1.56,.64,1), opacity .25s ease;
    pointer-events: none;
}
.chat-window.open {
    transform: scale(1) translateY(0);
    opacity: 1;
    pointer-events: all;
}

/* ── Header ── */
.chat-header {
    background: linear-gradient(135deg, #04091c, #06102b);
    padding: 14px 16px;
    display: flex;
    align-items: center;
    gap: 11px;
    flex-shrink: 0;
}
.chat-avatar {
    width: 40px;
    height: 40px;
    background: rgba(255,255,255,.15);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.25rem;
    flex-shrink: 0;
}
.chat-header-info { flex: 1; min-width: 0; }
.chat-header-name { color: #fff; font-weight: 700; font-size: .9rem; font-family: 'Outfit', sans-serif; }
.chat-header-status {
    color: rgba(255,255,255,.7);
    font-size: .73rem;
    display: flex;
    align-items: center;
    gap: 5px;
    margin-top: 2px;
}
.chat-header-status::before {
    content: '';
    width: 7px;
    height: 7px;
    background: #4ade80;
    border-radius: 50%;
    flex-shrink: 0;
}
.chat-close-btn {
    background: rgba(255,255,255,.12);
    border: 1px solid rgba(255,255,255,.15);
    color: #fff;
    width: 28px;
    height: 28px;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: .78rem;
    transition: background .2s;
    flex-shrink: 0;
}
.chat-close-btn:hover { background: rgba(255,255,255,.25); }

/* ── Messages ── */
.chat-messages {
    flex: 1;
    overflow-y: auto;
    padding: 14px;
    display: flex;
    flex-direction: column;
    gap: 10px;
    scroll-behavior: smooth;
    background: #f8fafc;
}
.chat-messages::-webkit-scrollbar { width: 3px; }
.chat-messages::-webkit-scrollbar-thumb { background: #e2e8f0; border-radius: 2px; }

.msg { display: flex; gap: 7px; align-items: flex-end; animation: msg-in .28s ease; }
.msg.user { flex-direction: row-reverse; }
@keyframes msg-in {
    from { opacity: 0; transform: translateY(8px); }
    to   { opacity: 1; transform: translateY(0); }
}

.msg-avatar {
    width: 28px;
    height: 28px;
    border-radius: 50%;
    background: linear-gradient(135deg, #06102b, #2563eb);
    display: flex;
    align-items: center;
    justify-content: center;
    color: #fff;
    font-size: .72rem;
    font-weight: 700;
    flex-shrink: 0;
    margin-bottom: 2px;
}

.msg-bubble {
    max-width: 80%;
    padding: 9px 13px;
    border-radius: 16px;
    font-size: .85rem;
    line-height: 1.55;
    font-family: 'Inter', sans-serif;
}
.msg.bot  .msg-bubble { background: #fff; color: #0f172a; border-bottom-left-radius: 4px; box-shadow: 0 1px 4px rgba(0,0,0,.07); }
.msg.user .msg-bubble { background: #2563eb; color: #fff; border-bottom-right-radius: 4px; }
.msg-bubble.confirm  { background: linear-gradient(135deg, #06102b, #2563eb) !important; color: #fff !important; }
.msg-bubble.confirm a { color: #93c5fd; }

/* Typing dots */
.typing-indicator { display: flex; gap: 4px; padding: 10px 13px; background: #fff; border-radius: 16px; border-bottom-left-radius: 4px; box-shadow: 0 1px 4px rgba(0,0,0,.07); }
.typing-dot { width: 6px; height: 6px; background: #94a3b8; border-radius: 50%; animation: tdot 1.1s infinite; }
.typing-dot:nth-child(2){ animation-delay:.18s; }
.typing-dot:nth-child(3){ animation-delay:.36s; }
@keyframes tdot { 0%,60%,100%{ transform: translateY(0); } 30%{ transform: translateY(-5px); } }

/* Option buttons */
.chat-options { display: flex; flex-wrap: wrap; gap: 6px; padding: 2px 0 2px 35px; animation: msg-in .28s ease; }
.chat-opt {
    background: #fff;
    border: 1.5px solid #2563eb;
    color: #06102b;
    padding: 6px 13px;
    border-radius: 20px;
    font-size: .8rem;
    font-weight: 600;
    cursor: pointer;
    transition: all .2s;
    font-family: inherit;
}
.chat-opt:hover:not(:disabled) { background: #2563eb; color: #fff; }
.chat-opt.selected { background: #06102b; border-color: #06102b; color: #fff; cursor: default; }
.chat-opt:disabled { opacity: .6; cursor: default; }

/* Date grid */
.chat-dates { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; padding: 2px 0 2px 35px; animation: msg-in .28s ease; }
.chat-date-btn {
    background: #fff;
    border: 1.5px solid #e2e8f0;
    color: #0f172a;
    padding: 9px 8px;
    border-radius: 10px;
    font-size: .76rem;
    font-weight: 600;
    cursor: pointer;
    transition: all .2s;
    text-align: center;
    line-height: 1.4;
    font-family: inherit;
}
.chat-date-btn:hover:not(:disabled) { border-color: #2563eb; color: #06102b; background: #eff6ff; }
.chat-date-btn:disabled { opacity: .65; cursor: default; }
.chat-date-btn .d-time { color: #2563eb; font-size: .7rem; margin-top: 2px; }

/* City autocomplete */
.chat-city-wrap { padding: 2px 0 2px 35px; animation: msg-in .28s ease; }
.city-input-wrap { position: relative; }
.chat-city-input {
    width: 100%;
    padding: 9px 13px;
    border: 1.5px solid #e2e8f0;
    border-radius: 10px;
    font-size: .85rem;
    outline: none;
    font-family: inherit;
    transition: border-color .2s;
}
.chat-city-input:focus { border-color: #2563eb; box-shadow: 0 0 0 3px rgba(37,99,235,.12); }
.chat-city-input:disabled { background: #f8fafc; color: #64748b; }
.city-dropdown {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    background: #fff;
    border: 1.5px solid #2563eb;
    border-top: none;
    border-radius: 0 0 10px 10px;
    max-height: 160px;
    overflow-y: auto;
    z-index: 20;
    display: none;
    box-shadow: 0 8px 20px rgba(6,16,43,.12);
}
.city-dropdown.show { display: block; }
.city-opt { padding: 8px 13px; font-size: .83rem; cursor: pointer; transition: background .15s; }
.city-opt:hover { background: #eff6ff; color: #06102b; font-weight: 600; }

/* Text input bar */
.chat-input-area {
    padding: 10px 12px;
    border-top: 1px solid #e2e8f0;
    display: flex;
    gap: 8px;
    align-items: center;
    flex-shrink: 0;
    background: #fff;
}
.chat-txt {
    flex: 1;
    padding: 9px 13px;
    border: 1.5px solid #e2e8f0;
    border-radius: 20px;
    font-size: .85rem;
    outline: none;
    font-family: inherit;
    transition: border-color .2s;
}
.chat-txt:focus { border-color: #2563eb; box-shadow: 0 0 0 3px rgba(37,99,235,.10); }
.chat-send-btn {
    width: 36px;
    height: 36px;
    background: #2563eb;
    border: none;
    border-radius: 50%;
    color: #fff;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: .85rem;
    transition: background .2s, transform .2s;
    flex-shrink: 0;
}
.chat-send-btn:hover { background: #06102b; transform: scale(1.08); }

/* Restart */
.chat-restart {
    background: none;
    border: none;
    color: #94a3b8;
    font-size: .76rem;
    cursor: pointer;
    text-decoration: underline;
    padding: 4px 0 4px 35px;
    font-family: inherit;
    display: block;
    animation: msg-in .28s ease;
}
.chat-restart:hover { color: #2563eb; }

@media (max-width: 420px) {
    .chat-window { left: 10px; right: 10px; width: auto; bottom: 90px; }
    .chat-toggle { left: 16px; bottom: 20px; }
}
