/* BookSesh Super Aura — Platform booking concierge
   Copied from CS Agent CSS — same Aura gradient palette: blue #1535E8 · purple #7B5CF0 · terracotta #C4714A
   Scoped to #bksesh-sa-* */

@keyframes sa-flow {
    0%   { background-position: 0% 50%;   }
    50%  { background-position: 100% 50%; }
    100% { background-position: 0% 50%;   }
}
@keyframes sa-pulse {
    0%   { box-shadow: 0 4px 16px rgba(21,53,232,.30), 0 0 0 0   rgba(21,53,232,.22); }
    65%  { box-shadow: 0 4px 16px rgba(21,53,232,.30), 0 0 0 10px rgba(21,53,232,0);  }
    100% { box-shadow: 0 4px 16px rgba(21,53,232,.30), 0 0 0 0   rgba(21,53,232,0);  }
}
@keyframes sa-icon-breathe {
    0%         { opacity: 1; transform: scale(1);   }
    17%, 50%   { opacity: 0; transform: scale(.82); }
    67%, 100%  { opacity: 1; transform: scale(1);   }
}
@keyframes sa-text-breathe {
    0%         { opacity: 0; transform: scale(.82); }
    17%, 50%   { opacity: 1; transform: scale(1);   }
    67%, 100%  { opacity: 0; transform: scale(.82); }
}
@keyframes sa-msg-in {
    from { opacity: 0; transform: translateY(5px); }
    to   { opacity: 1; transform: translateY(0);   }
}
@keyframes sa-bounce {
    0%,60%,100% { transform: translateY(0);    }
    30%          { transform: translateY(-5px); }
}

/* ── Launcher ────────────────────────────────────────────────────────────── */
#bksesh-sa-launcher {
    position: fixed !important;
    bottom: calc(100px + env(safe-area-inset-bottom, 0px)) !important;
    right: 10px !important;
    z-index: 99990 !important;
    width: 56px !important;
    height: 56px !important;
    min-width: 56px !important;
    min-height: 56px !important;
    max-width: 56px !important;
    max-height: 56px !important;
    border-radius: 50% !important;
    border: none !important;
    cursor: pointer !important;
    padding: 12px !important;
    box-sizing: border-box !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    background: linear-gradient(135deg, #1535E8 0%, #7B5CF0 45%, #C4714A 100%) !important;
    background-size: 240% 240% !important;
    animation: sa-flow 7.5s ease-in-out infinite, sa-pulse 3s ease-in-out 2s infinite !important;
    color: #fff !important;
    transition: filter .12s, transform .08s !important;
    -webkit-tap-highlight-color: transparent !important;
    overflow: hidden !important;
    line-height: 1 !important;
    text-transform: none !important;
    letter-spacing: 0 !important;
    font-size: inherit !important;
}
#bksesh-sa-launcher:hover  { filter: brightness(.92); }
#bksesh-sa-launcher:active { filter: brightness(.84); transform: translateY(1px); }
#bksesh-sa-launcher.open   { animation: sa-flow 7.5s ease-in-out infinite; border-radius: 50% !important; }

/* ── Theme override — force white SVG fills, strip Voxel/Elementor interference ── */
#bksesh-sa-launcher svg,
#bksesh-sa-launcher svg path,
#bksesh-sa-launcher svg circle,
#bksesh-sa-launcher svg rect {
    fill: white !important;
    stroke: none !important;
}
#bksesh-sa-launcher .icon-close svg path {
    fill: none !important;
    stroke: white !important;
}
#bksesh-sa-send svg,
#bksesh-sa-send svg path {
    fill: white !important;
}
.bksesh-sa-avatar svg,
.bksesh-sa-avatar svg path {
    fill: white !important;
}


#bksesh-sa-launcher .icon-sparkle,
#bksesh-sa-launcher .icon-text,
#bksesh-sa-launcher .icon-close {
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
}
#bksesh-sa-launcher .icon-sparkle {
    transition: opacity .25s, transform .25s;
    animation: sa-icon-breathe 7.5s ease-in-out 1.5s infinite;
}
#bksesh-sa-launcher .icon-text {
    font-size: 10px;
    font-weight: 600;
    color: #fff;
    text-align: center;
    line-height: 1.25;
    letter-spacing: .03em;
    opacity: 0;
    transition: opacity .25s;
    animation: sa-text-breathe 7.5s ease-in-out 1.5s infinite;
    pointer-events: none;
    user-select: none;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
}
#bksesh-sa-launcher .icon-close {
    opacity: 0;
    transform: rotate(-90deg) scale(.7);
    transition: opacity .18s, transform .18s;
}
#bksesh-sa-launcher.open .icon-sparkle { opacity: 0; transform: rotate(90deg) scale(.7); animation: none; }
#bksesh-sa-launcher.open .icon-text    { opacity: 0; animation: none; }
#bksesh-sa-launcher.open .icon-close   { opacity: 1; transform: rotate(0) scale(1); }

/* ── Panel ───────────────────────────────────────────────────────────────── */
#bksesh-sa-panel {
    position: fixed;
    bottom: calc(168px + env(safe-area-inset-bottom, 0px));
    right: 10px;
    z-index: 99989;
    width: min(360px, calc(100vw - 32px));
    max-height: min(520px, 70vh);
    display: flex;
    flex-direction: column;
    background: #FFFCF9;
    border-radius: 20px;
    box-shadow: 0 20px 60px rgba(28,42,58,.18), 0 4px 16px rgba(28,42,58,.09);
    overflow: hidden;
    pointer-events: none;
    opacity: 0;
    transform: translateY(14px) scale(.97);
    transition: opacity .24s cubic-bezier(.16,1,.3,1), transform .24s cubic-bezier(.16,1,.3,1);
}
#bksesh-sa-panel.open { opacity: 1; transform: translateY(0) scale(1); pointer-events: all; }

/* ── Header ──────────────────────────────────────────────────────────────── */
.bksesh-sa-header {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 14px 16px 12px;
    background: linear-gradient(180deg, rgba(21,53,232,.06) 0%, transparent 100%);
    flex-shrink: 0;
}
.bksesh-sa-avatar {
    width: 34px;
    height: 34px;
    border-radius: 50%;
    background: linear-gradient(135deg, #1535E8 0%, #7B5CF0 55%, #C4714A 100%);
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}
.bksesh-sa-name   { flex: 0 0 auto; font-size: 14px; font-weight: 700; color: #1C2A3A; letter-spacing: .01em; }
.bksesh-sa-status { display: flex; align-items: center; gap: 5px; font-size: 11px; color: #72697A; }
.bksesh-sa-status-dot {
    width: 6px; height: 6px; border-radius: 50%; background: #22c55e;
    animation: sa-pulse 2.5s ease-in-out infinite;
}
.bksesh-sa-header-close {
    width: 28px; height: 28px; display: flex; align-items: center; justify-content: center;
    background: none; border: none; border-radius: 8px; color: #9E97A6;
    font-size: 16px; cursor: pointer; transition: background .12s, color .12s;
    margin: -8px; padding: 8px;
}
.bksesh-sa-header-close:hover { background: rgba(0,0,0,.06); color: #1C2A3A; }

.bksesh-sa-header-book {
    flex-shrink: 0;
    margin-right: auto;
    padding: 5px 11px;
    background: linear-gradient(135deg, #1535E8 0%, #7B5CF0 100%);
    color: #fff !important;
    font-size: 11px;
    font-weight: 600;
    font-family: inherit;
    border: none !important;
    border-radius: 20px !important;
    cursor: pointer;
    white-space: nowrap;
    transition: filter .12s, transform .08s;
    -webkit-tap-highlight-color: transparent;
    letter-spacing: .01em;
}
.bksesh-sa-header-book:hover  { filter: brightness(.92); }
.bksesh-sa-header-book:active { transform: translateY(1px); filter: brightness(.84); }

/* ── Messages ─────────────────────────────────────────────────────────────── */
#bksesh-sa-messages {
    flex: 1; overflow-y: auto; padding: 14px 16px; display: flex; flex-direction: column;
    gap: 12px; scroll-behavior: smooth; min-height: 80px;
}
#bksesh-sa-messages::-webkit-scrollbar       { width: 4px; }
#bksesh-sa-messages::-webkit-scrollbar-track { background: transparent; }
#bksesh-sa-messages::-webkit-scrollbar-thumb { background: rgba(28,42,58,.12); border-radius: 2px; }

.bksesh-sa-msg {
    max-width: 86%; font-size: 14px; line-height: 1.6; padding: 10px 13px;
    border-radius: 14px; animation: sa-msg-in .2s ease both;
}
.bksesh-sa-msg.aura {
    white-space: pre-wrap; /* renders \n and \n\n as visual line/paragraph breaks */
    line-height: 1.65;
    word-spacing: .01em;
}
@keyframes sa-cursor-blink {
    0%, 100% { opacity: 1; }
    50%       { opacity: 0; }
}
.bksesh-sa-msg.aura.streaming::after {
    content: '|';
    display: inline;
    color: #7B5CF0;
    font-weight: 300;
    animation: sa-cursor-blink .6s step-end infinite;
    margin-left: 1px;
}

/* ── Book CTA button (appears after Aura message when intent score ≥ 5) ── */
.bksesh-sa-book-btn {
    align-self: flex-start;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 10px 18px;
    background: linear-gradient(135deg, #1535E8 0%, #7B5CF0 100%);
    color: #fff !important;
    font-size: 13px;
    font-weight: 600;
    font-family: inherit;
    border: none !important;
    border-radius: 20px !important;
    cursor: pointer;
    animation: sa-msg-in .2s ease both;
    transition: filter .12s, transform .08s;
    text-decoration: none;
    white-space: nowrap;
    -webkit-tap-highlight-color: transparent;
}
.bksesh-sa-book-btn:hover  { filter: brightness(.92); }
.bksesh-sa-book-btn:active { transform: translateY(1px); filter: brightness(.84); }
.bksesh-sa-msg.aura  { align-self: flex-start; background: #F0F3FF; color: #1C2A3A; border-bottom-left-radius: 3px; }
.bksesh-sa-msg.user  { align-self: flex-end; background: linear-gradient(135deg, #1535E8 0%, #7B5CF0 100%); color: #fff; border-bottom-right-radius: 3px; max-width: 78%; }
.bksesh-sa-msg.error { align-self: flex-start; background: #FEF2F2; color: #991B1B; font-size: 13px; border-bottom-left-radius: 3px; }

/* ── Typing indicator ─────────────────────────────────────────────────────── */
.bksesh-sa-typing {
    align-self: flex-start; display: flex; gap: 3px; align-items: center;
    padding: 11px 14px; background: #F0F3FF; border-radius: 14px; border-bottom-left-radius: 3px;
}
.bksesh-sa-typing span { width: 5px; height: 5px; background: #7B5CF0; border-radius: 50%; animation: sa-bounce 1.3s ease-in-out infinite; }
.bksesh-sa-typing span:nth-child(2) { animation-delay: .18s; }
.bksesh-sa-typing span:nth-child(3) { animation-delay: .36s; }

/* ── Input area ───────────────────────────────────────────────────────────── */
.bksesh-sa-input-wrap {
    display: flex; align-items: flex-end; gap: 8px;
    padding: 10px 14px 14px; border-top: 1px solid rgba(28,42,58,.07);
    background: #FFFCF9; flex-shrink: 0;
}
#bksesh-sa-input {
    flex: 1; font-size: 14px; font-family: inherit; padding: 10px 12px;
    border: 1.5px solid transparent; border-radius: 14px; background: #F3F1EF;
    color: #1C2A3A; resize: none; line-height: 1.45; max-height: 80px;
    overflow-y: auto; outline: none; transition: border-color .15s, background .15s, box-shadow .15s;
}
#bksesh-sa-input:focus { border-color: #1535E8; background: #fff; box-shadow: 0 0 0 3px rgba(21,53,232,.08); }
#bksesh-sa-input::placeholder { color: #9E97A6; }
#bksesh-sa-input:disabled { opacity: .5; }
#bksesh-sa-send {
    flex-shrink: 0; width: 38px; height: 38px; border: none; border-radius: 12px;
    cursor: pointer; display: flex; align-items: center; justify-content: center;
    background: linear-gradient(135deg, #1535E8 0%, #7B5CF0 100%);
    background-size: 200% 200%; animation: sa-flow 7.5s ease-in-out infinite;
    color: #fff; transition: filter .12s, transform .08s; margin-bottom: 1px;
}
#bksesh-sa-send:hover  { filter: brightness(.92); }
#bksesh-sa-send:active { transform: translateY(1px); filter: brightness(.84); }
#bksesh-sa-send:disabled { opacity: .4; cursor: not-allowed; animation: none; background: #9E97A6; }

/* ── Mobile ───────────────────────────────────────────────────────────────── */
@media (max-width: 480px) {
    #bksesh-sa-launcher { bottom: calc(8px + env(safe-area-inset-bottom, 0px)); right: 12px; }
    #bksesh-sa-panel { bottom: calc(168px + env(safe-area-inset-bottom, 0px)); right: 12px; width: calc(100vw - 24px); max-height: 65vh; border-radius: 18px; }
}

/* ── Reduced motion ───────────────────────────────────────────────────────── */
@media (prefers-reduced-motion: reduce) {
    #bksesh-sa-launcher, #bksesh-sa-send { animation: none; }
    #bksesh-sa-launcher .icon-sparkle, #bksesh-sa-launcher .icon-text { animation: none; }
    .bksesh-sa-status-dot { animation: none; }
    .bksesh-sa-typing span { animation: none; opacity: .6; }
    .bksesh-sa-msg { animation: none; }
    #bksesh-sa-panel { transition: opacity .15s; }
}

/* Admin intervention message — distinct from Aura but not alarming */
.bksesh-sa-msg.bksesh-sa-admin-msg {
    background: #dbeafe;
    border-left: 3px solid #3b82f6;
}

/* ── Booking modal ───────────────────────────────────────────────── */
#bksesh-sa-modal { position:fixed; inset:0; z-index:99999; display:none; }
.bksesh-sa-modal-overlay { position:absolute; inset:0; background:rgba(0,0,0,.55); }
.bksesh-sa-modal-frame {
    position:absolute; top:50%; left:50%; transform:translate(-50%,-50%);
    width:min(90vw,780px); height:min(90vh,700px);
    background:#fff; border-radius:16px; overflow:hidden;
    box-shadow:0 24px 80px rgba(0,0,0,.3); display:flex; flex-direction:column;
}
.bksesh-sa-modal-close {
    position:absolute; top:12px; right:14px; z-index:10;
    background:rgba(0,0,0,.35); color:#fff; border:none; border-radius:50%;
    width:28px; height:28px; cursor:pointer; font-size:15px;
    display:flex; align-items:center; justify-content:center;
}
#bksesh-sa-iframe { flex:1; width:100%; border:none; }

/* ── Practitioner cards ──────────────────────────────────────────── */
.bksesh-sa-cards { display:flex; flex-direction:column; gap:8px; width:100%; }
.bksesh-sa-card {
    background:#fff; border:1.5px solid #e0e7ff; border-radius:12px;
    padding:10px 12px; cursor:pointer; transition:border-color .15s, box-shadow .15s;
}
.bksesh-sa-card:hover { border-color:#1535E8; box-shadow:0 2px 12px rgba(21,53,232,.12); }
.bksesh-sa-card-name  { font-weight:700; font-size:13px; color:#1C2A3A; }
.bksesh-sa-card-meta  { font-size:12px; color:#72697A; margin-top:2px; }
.bksesh-sa-card-book  { margin-top:6px; font-size:12px; font-weight:600; color:#1535E8; }

/* ── Booking CTA (mobile-safe visible button) ─── */
.bksesh-sa-book-cta-wrap { padding:6px 16px 10px; }
.bksesh-sa-book-cta { display:inline-block; background:#1535E8; color:#fff!important; font-size:13px; font-weight:700; padding:9px 18px; border-radius:8px; text-decoration:none; transition:background .15s; }
.bksesh-sa-book-cta:hover { background:#0f2bc0; }
.bksesh-sa-card-book-btn { margin-top:8px; width:100%; background:#1535E8; color:#fff; border:none; border-radius:7px; padding:8px 0; font-size:13px; font-weight:700; cursor:pointer; transition:background .15s; }
.bksesh-sa-card-book-btn:hover { background:#0f2bc0; }
