/* ============================================================
   LAOR Care Assistant — Premium Redesign
   Design: Apple HIG · Linear · Stripe · ChatGPT
   Font: Inter only. Icons: Lucide SVG only.
   Glassmorphism: toggle button + header only.
   ============================================================ */

/* ── Design tokens ──────────────────────────────────────── */
:root {
  --lc-bg:           #ffffff;
  --lc-chat-bg:      #f7f8fa;
  --lc-surface:      #ffffff;
  --lc-surface-2:    #f0f2f5;
  --lc-surface-3:    #e8eaee;
  --lc-border:       rgba(0, 0, 0, 0.07);
  --lc-border-med:   rgba(0, 0, 0, 0.11);
  --lc-text:         #0e0e0e;
  --lc-text-2:       #5e6673;
  --lc-text-3:       #9ba3af;
  --lc-accent:       #23b9dc;
  --lc-accent-2:     #1aa3c5;
  --lc-danger:       #e24e5a;
  --lc-ok:           #16a34a;
  --lc-shadow-win:   0 24px 72px rgba(0,0,0,0.13), 0 6px 20px rgba(0,0,0,0.07), 0 1px 4px rgba(0,0,0,0.04);
  --lc-shadow-card:  0 1px 3px rgba(0,0,0,0.06), 0 1px 2px rgba(0,0,0,0.04);
  --lc-shadow-btn:   0 6px 24px rgba(35,185,220,0.32), 0 2px 8px rgba(0,0,0,0.12);
  --lc-font:         'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  --lc-r:            14px;
  --lc-r-sm:         10px;
  --lc-r-xs:         7px;
  --lc-w:            396px;
  --lc-h:            596px;
}

[data-lc-dark="true"] {
  --lc-bg:         #0a0a0a;
  --lc-chat-bg:    #0f0f0f;
  --lc-surface:    #161616;
  --lc-surface-2:  #1e1e1e;
  --lc-surface-3:  #252525;
  --lc-border:     rgba(255,255,255,0.08);
  --lc-border-med: rgba(255,255,255,0.13);
  --lc-text:       #f0f0f0;
  --lc-text-2:     #a0a0a0;
  --lc-text-3:     #555555;
  --lc-shadow-win: 0 24px 72px rgba(0,0,0,0.55), 0 6px 20px rgba(0,0,0,0.35);
  --lc-shadow-card:0 1px 3px rgba(0,0,0,0.4),  0 1px 2px rgba(0,0,0,0.3);
}

/* ── Widget root ────────────────────────────────────────── */
#laor-chatbot {
  position: fixed;
  bottom: 24px;
  right: 24px;
  z-index: 99999;
  font-family: var(--lc-font);
  font-size: 14px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

/* ── Toggle button — glassmorphism ──────────────────────── */
.lc-toggle {
  position: relative;
  width: 56px;
  height: 56px;
  border-radius: 50%;
  background: rgba(35, 185, 220, 0.88);
  backdrop-filter: blur(18px) saturate(1.8);
  -webkit-backdrop-filter: blur(18px) saturate(1.8);
  border: 1px solid rgba(255, 255, 255, 0.22);
  box-shadow: var(--lc-shadow-btn);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #ffffff;
  transition: transform 0.18s cubic-bezier(0.34, 1.56, 0.64, 1), box-shadow 0.18s ease;
}
.lc-toggle:hover {
  transform: scale(1.06);
  box-shadow: 0 10px 32px rgba(35,185,220,0.42), 0 3px 10px rgba(0,0,0,0.14);
}
.lc-toggle:active { transform: scale(0.97); }

.lc-toggle svg {
  width: 22px;
  height: 22px;
  transition: transform 0.25s cubic-bezier(0.34, 1.56, 0.64, 1), opacity 0.18s ease;
}
.lc-toggle.is-open .lc-icon-chat { transform: scale(0.7) rotate(-20deg); opacity: 0; position: absolute; }
.lc-toggle .lc-icon-close         { transform: scale(0.7) rotate(20deg);  opacity: 0; position: absolute; }
.lc-toggle.is-open .lc-icon-close { transform: scale(1)   rotate(0deg);   opacity: 1; }

.lc-badge {
  position: absolute;
  top: 1px;
  right: 1px;
  width: 18px;
  height: 18px;
  background: var(--lc-danger);
  color: #fff;
  font-size: 10px;
  font-weight: 700;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  border: 2px solid transparent;
  animation: lc-badge-in 0.25s cubic-bezier(0.34, 1.56, 0.64, 1) both;
}
.lc-badge.hidden { display: none; }
@keyframes lc-badge-in {
  from { transform: scale(0); }
  to   { transform: scale(1); }
}

/* ── Chat window ────────────────────────────────────────── */
.lc-window {
  position: absolute;
  bottom: 68px;
  right: 0;
  width: var(--lc-w);
  height: var(--lc-h);
  background: var(--lc-bg);
  border: 1px solid var(--lc-border-med);
  border-radius: var(--lc-r);
  box-shadow: var(--lc-shadow-win);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  pointer-events: none;
  transform: translateY(14px);
  opacity: 0;
  transform-origin: bottom right;
  transition:
    transform 0.32s cubic-bezier(0.16, 1, 0.3, 1),
    opacity   0.22s ease;
}
.lc-window.open {
  pointer-events: all;
  transform: translateY(0);
  opacity: 1;
}

/* ── Header — professional solid ───────────────────────── */
.lc-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 14px 14px 16px;
  gap: 8px;
  background: var(--lc-accent);
  border-bottom: none;
  flex-shrink: 0;
}
[data-lc-dark="true"] .lc-header {
  background: var(--lc-accent-2);
}

.lc-header-left {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
  flex: 1;
}

.lc-avatar {
  width: 36px;
  height: 36px;
  border-radius: 10px;
  overflow: hidden;
  flex-shrink: 0;
  background: #ffffff;
  border: 1px solid var(--lc-border-med);
  padding: 3px;
  box-sizing: border-box;
}
.lc-avatar img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.lc-header-info { min-width: 0; }
.lc-header-title {
  font-size: 13.5px;
  font-weight: 600;
  color: #ffffff;
  letter-spacing: -0.01em;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.lc-header-sub {
  display: flex;
  align-items: center;
  gap: 5px;
  margin-top: 1px;
}
.lc-status-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: #a8f0c6;
  animation: lc-status-breathe 3s ease-in-out infinite;
}
@keyframes lc-status-breathe {
  0%, 100% { opacity: 1; }
  50%       { opacity: 0.45; }
}
.lc-status-text {
  font-size: 11.5px;
  color: rgba(255, 255, 255, 0.82);
}

.lc-header-actions {
  display: flex;
  align-items: center;
  gap: 2px;
  flex-shrink: 0;
}

.lc-hbtn {
  width: 32px;
  height: 32px;
  border-radius: 8px;
  border: none;
  background: transparent;
  color: rgba(255, 255, 255, 0.82);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 4px;
  font-size: 11px;
  font-weight: 600;
  font-family: var(--lc-font);
  transition: background 0.12s ease, color 0.12s ease;
}
.lc-hbtn:hover { background: rgba(255,255,255,0.18); color: #ffffff; }
.lc-hbtn svg { width: 15px; height: 15px; flex-shrink: 0; }
.lc-lang-btn { width: auto; padding: 0 6px; gap: 4px; }
.lc-lang-label { font-size: 11px; font-weight: 600; color: rgba(255,255,255,0.82); }

/* ── Messages area ──────────────────────────────────────── */
.lc-messages {
  flex: 1;
  overflow-y: auto;
  padding: 20px 14px 12px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  background: var(--lc-chat-bg);
  scroll-behavior: smooth;
}
.lc-messages::-webkit-scrollbar { width: 3px; }
.lc-messages::-webkit-scrollbar-track { background: transparent; }
.lc-messages::-webkit-scrollbar-thumb {
  background: var(--lc-border-med);
  border-radius: 3px;
}

/* ── Message rows ───────────────────────────────────────── */
.lc-msg {
  display: flex;
  gap: 8px;
  max-width: 100%;
  animation: lc-msg-appear 0.2s ease both;
}
@keyframes lc-msg-appear {
  from { opacity: 0; transform: translateY(5px); }
  to   { opacity: 1; transform: translateY(0); }
}

.lc-msg.bot  { align-items: flex-start; }
.lc-msg.user { justify-content: flex-end; }

.lc-msg-icon {
  width: 28px;
  height: 28px;
  border-radius: 8px;
  overflow: hidden;
  flex-shrink: 0;
  margin-top: 1px;
  background: #ffffff;
  border: 1px solid var(--lc-border-med);
  padding: 3px;
  box-sizing: border-box;
}
.lc-msg-icon img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.lc-msg-col {
  display: flex;
  flex-direction: column;
  gap: 3px;
  min-width: 0;
  max-width: calc(100% - 34px);
}
.lc-msg.user .lc-msg-col { max-width: 84%; align-items: flex-end; }

/* ── Bubble ─────────────────────────────────────────────── */
.lc-bubble {
  padding: 11px 14px;
  border-radius: var(--lc-r-sm);
  font-size: 13.5px;
  line-height: 1.65;
  letter-spacing: -0.004em;
  word-break: break-word;
  color: var(--lc-text);
}

.lc-msg.bot .lc-bubble {
  background: var(--lc-surface);
  border: 1px solid var(--lc-border);
  box-shadow: var(--lc-shadow-card);
  border-top-left-radius: 3px;
}

.lc-msg.user .lc-bubble {
  background: var(--lc-surface-2);
  border: 1px solid var(--lc-border);
  border-top-right-radius: 3px;
  color: var(--lc-text);
}

.lc-msg-time {
  font-size: 10.5px;
  color: var(--lc-text-3);
  padding: 0 2px;
}
.lc-msg.user .lc-msg-time { text-align: right; }

/* ── Inline content blocks ──────────────────────────────── */

/* Section label above cards */
.lc-section-label {
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  color: var(--lc-text-3);
  margin: 10px 0 5px;
}
.lc-section-label:first-child { margin-top: 2px; }

/* Info card (price, doctor, etc.) */
.lc-card {
  padding: 8px 0;
  border-bottom: 1px solid var(--lc-border);
  margin-top: 0;
}
.lc-card:last-of-type { border-bottom: none; }
.lc-card + .lc-card { margin-top: 0; }

/* Price card */
.lc-price-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}
.lc-price-name {
  font-size: 13px;
  color: var(--lc-text);
  font-weight: 500;
}
.lc-price-val {
  font-size: 13.5px;
  font-weight: 700;
  color: var(--lc-text);
  white-space: nowrap;
  letter-spacing: -0.02em;
}

/* Doctor card */
.lc-doctor-name {
  font-size: 13px;
  font-weight: 600;
  color: var(--lc-text);
  letter-spacing: -0.01em;
}
.lc-doctor-spec {
  font-size: 12px;
  color: var(--lc-accent);
  font-weight: 500;
  margin-top: 2px;
}
.lc-doctor-schedule {
  font-size: 12px;
  color: var(--lc-text-2);
  margin-top: 3px;
}

/* Simple info row (contact, etc.) */
.lc-info-row {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 12px;
  padding: 7px 0;
  border-bottom: 1px solid var(--lc-border);
  font-size: 12.5px;
}
.lc-info-row:last-of-type { border-bottom: none; }
.lc-info-label {
  color: var(--lc-text-2);
  white-space: nowrap;
  flex-shrink: 0;
}
.lc-info-val {
  color: var(--lc-text);
  font-weight: 500;
  text-align: right;
}
.lc-info-val a {
  color: var(--lc-accent);
  text-decoration: none;
  font-weight: 600;
}

/* Hours block */
.lc-hours-block { margin-top: 6px; }
.lc-hours-block + .lc-hours-block { margin-top: 12px; }
.lc-hours-title {
  font-size: 12px;
  font-weight: 600;
  color: var(--lc-text);
  letter-spacing: -0.01em;
  margin-bottom: 4px;
}
.lc-hours-row {
  display: flex;
  justify-content: space-between;
  font-size: 12.5px;
  color: var(--lc-text-2);
  padding: 2px 0;
  border-bottom: 1px solid var(--lc-border);
}
.lc-hours-row:last-child { border-bottom: none; }
.lc-hours-time { font-weight: 500; color: var(--lc-text); }
.lc-hours-closed { color: var(--lc-danger); font-weight: 500; }

/* Preparation list */
.lc-prep-title {
  font-size: 13px;
  font-weight: 600;
  color: var(--lc-text);
  margin-bottom: 8px;
  letter-spacing: -0.01em;
}
.lc-prep-list { display: flex; flex-direction: column; gap: 1px; }
.lc-prep-item {
  display: flex;
  align-items: baseline;
  gap: 8px;
  font-size: 12.5px;
  line-height: 1.55;
  color: var(--lc-text-2);
  padding: 2px 0;
}
.lc-prep-item::before {
  content: '';
  width: 5px;
  height: 5px;
  border-radius: 50%;
  flex-shrink: 0;
  margin-top: 5px;
}
.lc-prep-item.ok::before   { background: var(--lc-ok);     }
.lc-prep-item.no::before   { background: var(--lc-danger); }
.lc-prep-item.info::before { background: var(--lc-accent); }
.lc-prep-item.note::before { background: var(--lc-text-3); }
.lc-prep-item strong { color: var(--lc-text); font-weight: 600; }

/* Notice (medical disclaimer) */
.lc-notice {
  background: var(--lc-chat-bg);
  border: 1px solid var(--lc-border);
  border-left: 3px solid var(--lc-danger);
  border-radius: var(--lc-r-xs);
  padding: 10px 12px;
  font-size: 12.5px;
  color: var(--lc-text-2);
  line-height: 1.6;
  margin-top: 2px;
}
.lc-notice strong { color: var(--lc-text); }

/* Contact rows */
.lc-contact-group { margin-bottom: 10px; }
.lc-contact-label {
  font-size: 10.5px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--lc-text-3);
  margin-bottom: 3px;
}
.lc-contact-value {
  font-size: 13px;
  color: var(--lc-text);
  font-weight: 500;
}
.lc-contact-value a {
  color: var(--lc-accent);
  text-decoration: none;
  font-weight: 500;
}
.lc-contact-value a:hover { text-decoration: underline; }
.lc-contact-links {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
  margin-top: 4px;
}
.lc-contact-links a {
  font-size: 12.5px;
  color: var(--lc-text-2);
  text-decoration: none;
  font-weight: 500;
}
.lc-contact-links a:hover { color: var(--lc-accent); }

/* Welcome message */
.lc-welcome-greeting {
  font-size: 14.5px;
  font-weight: 600;
  color: var(--lc-text);
  letter-spacing: -0.02em;
  margin-bottom: 5px;
}
.lc-welcome-sub {
  font-size: 13px;
  color: var(--lc-text-2);
  line-height: 1.65;
}

/* ── Typing indicator ───────────────────────────────────── */
.lc-typing-bubble {
  background: var(--lc-surface);
  border: 1px solid var(--lc-border);
  border-radius: var(--lc-r-sm);
  border-top-left-radius: 3px;
  box-shadow: var(--lc-shadow-card);
  padding: 12px 16px;
  display: flex;
  align-items: center;
  gap: 5px;
}
.lc-typing-dot {
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: var(--lc-text-3);
  animation: lc-typing-fade 1.3s ease-in-out infinite;
}
.lc-typing-dot:nth-child(2) { animation-delay: 0.18s; }
.lc-typing-dot:nth-child(3) { animation-delay: 0.36s; }
@keyframes lc-typing-fade {
  0%, 60%, 100% { opacity: 0.25; transform: scaleY(1); }
  30%            { opacity: 1;    transform: scaleY(1.35); }
}

/* ── Quick actions ──────────────────────────────────────── */
.lc-quick {
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
  padding: 9px 12px;
  border-top: 1px solid var(--lc-border);
  background: var(--lc-bg);
  flex-shrink: 0;
}

.lc-qcard {
  flex-shrink: 0;
  display: flex;
  align-items: center;
  gap: 5px;
  padding: 6px 10px;
  background: var(--lc-surface-2);
  border: 1px solid var(--lc-border);
  border-radius: var(--lc-r-sm);
  color: var(--lc-text-2);
  font-size: 12px;
  font-weight: 500;
  font-family: var(--lc-font);
  cursor: pointer;
  white-space: nowrap;
  transition: background 0.12s ease, color 0.12s ease, border-color 0.12s ease;
}
.lc-qcard svg { width: 13px; height: 13px; flex-shrink: 0; color: var(--lc-text-3); transition: color 0.12s; }
.lc-qcard:hover {
  background: var(--lc-surface-3);
  color: var(--lc-text);
  border-color: var(--lc-border-med);
}
.lc-qcard:hover svg { color: var(--lc-text-2); }
.lc-qcard:active { transform: scale(0.97); }

/* ── Input area ─────────────────────────────────────────── */
.lc-input-area {
  padding: 10px 12px 12px;
  background: var(--lc-bg);
  border-top: 1px solid var(--lc-border);
  flex-shrink: 0;
}
.lc-input-wrap {
  display: flex;
  align-items: center;
  gap: 6px;
  background: var(--lc-surface-2);
  border: 1px solid var(--lc-border);
  border-radius: var(--lc-r-sm);
  padding: 6px 6px 6px 12px;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}
.lc-input-wrap:focus-within {
  border-color: var(--lc-accent);
  box-shadow: 0 0 0 3px rgba(35, 185, 220, 0.10);
}
.lc-input {
  flex: 1;
  border: none;
  background: transparent;
  font-size: 13.5px;
  font-family: var(--lc-font);
  color: var(--lc-text);
  outline: none;
  line-height: 1.5;
  min-height: 22px;
}
.lc-input::placeholder { color: var(--lc-text-3); }
.lc-send {
  width: 32px;
  height: 32px;
  border-radius: var(--lc-r-xs);
  background: var(--lc-accent);
  border: none;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  flex-shrink: 0;
  transition: background 0.12s ease, transform 0.12s ease;
}
.lc-send:hover  { background: var(--lc-accent-2); }
.lc-send:active { transform: scale(0.94); }
.lc-send svg { width: 15px; height: 15px; }
.lc-send:disabled { opacity: 0.38; cursor: not-allowed; }

/* ── Responsive — mobile ────────────────────────────────── */
@media (max-width: 480px) {
  #laor-chatbot { bottom: 16px; right: 16px; }
  .lc-window {
    width:  calc(100vw - 32px);
    height: calc(100dvh - 96px);
    bottom: 68px;
    border-radius: 16px;
  }
}
