/* ============================================================================
   SchoolNotes - v24 AI CHAT + WhatsApp chat full-screen redesign
   Loaded by includes/footer.php (added below) : always-on, no body-class gate.
   ============================================================================ */

/* ----------- v24: chat panel is full-screen on BOTH desktop and mobile --- */
.sn18-chat { position: fixed; inset: 0; z-index: 1400; }
.sn18-chat[hidden] { display: none; }
.sn18-backdrop { position: absolute; inset: 0; background: rgba(8,18,40,.62); backdrop-filter: blur(6px); opacity: 0; transition: opacity .18s ease; }
.sn18-chat.is-in .sn18-backdrop { opacity: 1; }
.sn18-panel {
  position: absolute; inset: 0; display: flex; flex-direction: column;
  background: linear-gradient(180deg, #fff 0%, #f6fbff 100%);
  opacity: 0; transition: opacity .18s ease, transform .18s ease;
}
.sn18-chat.is-in .sn18-panel { opacity: 1; transform: none; }

/* Big gradient header so the panel truly feels like a full app, not a popover */
.sn18-head {
  flex: 0 0 auto; display: grid; grid-template-columns: auto 1fr auto auto;
  align-items: center; gap: 12px; padding: 14px 18px;
  background: linear-gradient(135deg, #14335c 0%, #1A67C4 100%);
  color: #fff; box-shadow: 0 4px 12px rgba(0,0,0,.18);
}
.sn18-ava  { width: 42px; height: 42px; border-radius: 12px; background: rgba(255,255,255,.12); display: grid; place-items: center; font-size: 1.05rem; }
.sn18-id strong { display: block; font-size: 1.05rem; line-height: 1.18; }
.sn18-id small  { display: block; font-size: .76rem; opacity: .85; }
.sn18-dot   { color: #34d399; font-size: .54rem; margin-right: 4px; vertical-align: middle; }
.sn18-wa, .sn18-x {
  width: 38px; height: 38px; border-radius: 12px; display: grid; place-items: center;
  background: rgba(255,255,255,.10); border: 1px solid rgba(255,255,255,.20); color: #fff;
  font-size: 1rem; cursor: pointer; text-decoration: none; line-height: 1;
}
.sn18-wa { color: #7ef0ab; border-color: rgba(37,211,102,.5); }
.sn18-wa:hover { background: rgba(37,211,102,.22); }
.sn18-x:hover  { background: rgba(255,255,255,.22); }

/* ---------- message area: scrollable, fills the height ---------------- */
.sn18-body  { flex: 1 1 auto; overflow-y: auto; padding: 18px 18px 6px; scroll-behavior: smooth; -webkit-overflow-scrolling: touch; }
.sn18-body:focus { outline: none; }

.sn18-msg   { display: flex; gap: 8px; margin: 0 0 14px; align-items: flex-end; }
.sn18-msg.sn18-me { justify-content: flex-end; }
.sn18-ava-s {
  width: 30px; height: 30px; border-radius: 9px; flex: 0 0 30px;
  background: linear-gradient(135deg, #1A67C4, #14335c); color: #fff;
  display: grid; place-items: center; font-size: .85rem;
}
.sn18-bubble {
  max-width: 84%; padding: 10px 14px; border-radius: 16px; line-height: 1.5;
  background: #fff; color: #16263c; border: 1px solid #d6e4f5; font-size: .93rem;
  box-shadow: 0 2px 6px rgba(20,40,80,.05);
  word-wrap: break-word; overflow-wrap: anywhere;
}
.sn18-msg.sn18-me .sn18-bubble { background: linear-gradient(135deg, #1A67C4, #0b5fce); color: #fff; border-color: #0b5fce; border-bottom-right-radius: 4px; }
.sn18-msg .sn18-bubble { border-bottom-left-radius: 4px; }

/* "links" inside a message read as proper chips with a tiny arrow icon   */
.sn18-bubble a { display: inline-block; color: #1A67C4; font-weight: 600; text-decoration: none; background: #eaf3ff; padding: 3px 9px; border-radius: 999px; margin: 2px 0; }
.sn18-bubble a::after { content: ' \2192'; font-size: .85em; opacity: .55; }
.sn18-msg.sn18-me .sn18-bubble a { color: #fff; background: rgba(255,255,255,.18); }
.sn18-bubble strong { color: #0b3f7a; }
.sn18-bubble ul.sn18-pts { margin: 4px 0 2px; padding-left: 18px; }
.sn18-bubble ul.sn18-pts li { margin: 2px 0; }

/* ---------- product result cards ------ */
.sn18-cards { display: grid; grid-template-columns: 1fr; gap: 8px; margin: 4px 0 14px 38px; }
@media (min-width: 720px) { .sn18-cards { grid-template-columns: 1fr 1fr; } }
.sn18-card  { display: grid; grid-template-rows: auto auto auto; gap: 4px; padding: 10px 12px; border-radius: 12px; background: #f7fafe; border: 1px solid #d4e3f8; color: #16263c; text-decoration: none; transition: transform .14s ease, box-shadow .14s ease; }
.sn18-card:hover { transform: translateY(-1px); box-shadow: 0 6px 14px -8px rgba(20,40,80,.4); border-color: #1A67C4; }
.sn18-card-top strong { font-size: .93rem; }
.sn18-card-meta { font-size: .76rem; color: #4b5c72; }
.sn18-card-buy   { display: flex; align-items: center; gap: 8px; font-size: .84rem; }
.sn18-card-buy b { color: #0b7a43; font-weight: 800; }
.sn18-card-buy s { color: #9aa3b2; font-weight: 600; }
.sn18-card-buy em { background: #16a34a; color: #fff; padding: 2px 7px; border-radius: 999px; font-style: normal; font-size: .72rem; font-weight: 800; }
.sn18-card-buy i  { margin-left: auto; }

/* quick-links scanner: "jump to bottom" pill ---------------------------- */
.sn18-jump {
  position: absolute; right: 16px; bottom: 156px; z-index: 4;
  width: 38px; height: 38px; border-radius: 50%; border: 1px solid #cddcef;
  background: #fff; color: #1A67C4; font-size: .9rem; cursor: pointer;
  box-shadow: 0 8px 18px -10px rgba(9,40,78,.5);
}
.sn18-jump[hidden] { display: none; }

/* ---------- chips area --------------------------------------------------- */
.sn18-chips { flex: 0 0 auto; padding: 8px 14px 4px; display: flex; flex-wrap: wrap; gap: 6px; border-top: 1px dashed #d4e3f8; background: #f1f7fe; }
.sn18-chip  { background: #fff; border: 1px solid #cfdef1; color: #1A67C4; padding: 6px 12px; border-radius: 999px; font-size: .82rem; font-weight: 600; cursor: pointer; }
.sn18-chip:hover { background: #eaf3ff; border-color: #1A67C4; }

/* ---------- input bar (sticks to bottom of the full-screen panel) ----- */
.sn18-form { padding: 10px 14px calc(12px + env(safe-area-inset-bottom)); display: grid; grid-template-columns: 1fr auto auto auto; gap: 8px; border-top: 1px solid #d4e3f8; background: #fff; }
.sn18-form input { height: 44px; padding: 0 14px; border-radius: 12px; border: 1px solid #cfdef1; background: #f7fafe; font-size: 16px; min-width: 0; }
.sn18-form input:focus { outline: 2px solid #1A67C4; border-color: #1A67C4; }
.sn18-mic, .sn18-form button[type="submit"] {
  width: 44px; height: 44px; border-radius: 12px; border: 0; background: #1A67C4; color: #fff; cursor: pointer; font-size: 1rem; display: grid; place-items: center;
}
.sn18-mic { background: #fff; color: #1A67C4; border: 1px solid #cfdef1; }
.sn18-mic.is-on { background: #ef4444; color: #fff; border-color: #ef4444; animation: sn18micPulse 1.2s ease-in-out infinite; }
@keyframes sn18micPulse { 0%,100%{ box-shadow:0 0 0 0 rgba(239,68,68,.55);} 50%{box-shadow:0 0 0 12px rgba(239,68,68,0);} }

.sn18-foot  { flex: 0 0 auto; padding: 0 14px 8px; margin: 0; font-size: .72rem; color: #6b7896; text-align: center; background: #fff; }
.sn18-foot a { color: #1A67C4; }

/* typing indicator ------------------------------------------------------- */
.sn18-typing .sn18-bubble { background: #f7fafe; }
.sn18-typing .sn18-bubble i { display: inline-block; width: 6px; height: 6px; background: #1A67C4; border-radius: 50%; margin: 0 2px; animation: sn18bounce 1.1s ease-in-out infinite; }
.sn18-typing .sn18-bubble i:nth-child(2) { animation-delay: .15s; }
.sn18-typing .sn18-bubble i:nth-child(3) { animation-delay: .3s; }
@keyframes sn18bounce { 0%,80%,100%{transform:translateY(0);} 40%{transform:translateY(-4px);} }

/* error bubble ----------------------------------------------------------- */
.sn18-err .sn18-bubble { background: #FEF2F2; border-color: #FCA5A5; color: #7f1d1d; }
.sn18-err-bubble .sn18-retry { display: inline-block; margin-left: 6px; padding: 3px 9px; border-radius: 999px; background: #1A67C4; color: #fff; border: 0; font-size: .76rem; font-weight: 700; cursor: pointer; }

/* never blur the chat panel (payment-overlay bleed guard) ---------------- */
.sn18-chat, .sn18-chat * { filter: none !important; }

/* ============================================================================
   v24 WhatsApp option picker (full-screen mobile, modal on desktop)
   ============================================================================ */
.sn-wa-pick { position: fixed; inset: 0; z-index: 1450; display: flex; align-items: center; justify-content: center; background: rgba(8,18,40,.55); backdrop-filter: blur(6px); }
.sn-wa-pick[hidden] { display: none; }
.sn-wa-card { background: linear-gradient(180deg, #fff 0%, #f6fbff 100%); width: min(640px, 100%); max-height: 92vh; border-radius: 22px; overflow: hidden; display: flex; flex-direction: column; box-shadow: 0 20px 60px rgba(8,18,40,.35); }
.sn-wa-head { display: grid; grid-template-columns: auto 1fr auto; gap: 12px; align-items: center; padding: 16px 22px; background: linear-gradient(135deg, #14335c 0%, #1A67C4 100%); color: #fff; }
.sn-wa-head .sn-wa-logo { width: 42px; height: 42px; border-radius: 12px; background: rgba(255,255,255,.14); display: grid; place-items: center; color: #7ef0ab; font-size: 1.2rem; }
.sn-wa-head h2 { margin: 0; font-size: 1.05rem; }
.sn-wa-head p  { margin: 0; font-size: .78rem; opacity: .85; }
.sn-wa-close { width: 38px; height: 38px; border-radius: 12px; background: rgba(255,255,255,.10); border: 1px solid rgba(255,255,255,.20); color: #fff; font-size: 1rem; cursor: pointer; }
.sn-wa-body { padding: 18px 22px; overflow-y: auto; }
.sn-wa-pick h3 { margin: 0 0 6px; font-size: .92rem; color: #14335c; font-weight: 700; }
.sn-wa-pick p.sub { margin: 0 0 12px; font-size: .82rem; color: #4b5c72; }
.sn-wa-opts { display: grid; grid-template-columns: 1fr; gap: 9px; }
@media (min-width: 640px) { .sn-wa-opts { grid-template-columns: 1fr 1fr; } }
.sn-wa-opt { display: grid; grid-template-columns: auto 1fr auto; align-items: center; gap: 10px; padding: 12px 14px; border-radius: 14px; background: #fff; border: 1.5px solid #d4e3f8; cursor: pointer; text-align: left; transition: border-color .14s ease, transform .14s ease, background .14s ease; font-size: .9rem; color: #16263c; }
.sn-wa-opt:hover { border-color: #1A67C4; transform: translateY(-1px); }
.sn-wa-opt.is-active { border-color: #16a34a; background: #ecfdf5; }
.sn-wa-opt .ico { width: 32px; height: 32px; border-radius: 9px; background: #eaf3ff; display: grid; place-items: center; font-size: 1rem; color: #1A67C4; }
.sn-wa-opt.is-active .ico { background: #d1fae5; color: #16a34a; }
.sn-wa-opt .lbl { font-weight: 700; }
.sn-wa-opt .chk { color: #16a34a; font-size: 1.05rem; }
.sn-wa-opt textarea, .sn-wa-opt input[type="text"] {
  grid-column: 1 / -1; width: 100%; min-height: 60px; margin-top: 6px;
  padding: 10px 12px; border-radius: 10px; border: 1px solid #cfdef1; background: #f7fafe; font-size: .9rem; resize: vertical;
}
.sn-wa-foot { padding: 14px 22px; display: grid; grid-template-columns: 1fr auto; gap: 10px; border-top: 1px solid #e3edf9; background: #fafdff; }
.sn-wa-foot .btn-go  { background: #25D366; color: #fff; border: 0; padding: 12px 18px; border-radius: 12px; font-weight: 800; cursor: pointer; font-size: .95rem; }
.sn-wa-foot .btn-go:hover { background: #1ebe5a; }
.sn-wa-foot .btn-go i { margin-right: 6px; }

/* ----- compact checkout ----- */
.cc-head { padding: 14px 18px !important; }
.cc-head h2 { font-size: 1rem !important; }
.cc-head p { font-size: .74rem !important; }
.cc-block { padding: 16px 18px !important; }
.cc-block-title { font-size: .92rem !important; margin: 0 0 10px !important; }
.cc-block-title .cc-step { width: 22px !important; height: 22px !important; font-size: .74rem !important; }
.cc-totals { padding: 10px 0 0 !important; }
.cc-total-row { padding: 4px 0 !important; font-size: .9rem !important; }
.cc-total-row.cc-grand { padding-top: 8px !important; font-size: .98rem !important; }
.form-field { margin-bottom: 10px !important; }
.form-field label { font-size: .82rem !important; margin-bottom: 4px !important; }
.form-field .input-icon-wrap input { height: 42px !important; padding: 0 12px 0 38px !important; font-size: 15px !important; }
.checkout-card { border-radius: 14px !important; }
.checkout-pay-btn { padding: 12px !important; font-size: 1rem !important; }

/* shared chat polish additions ------------------------------------------- */
@media (max-width: 760px) {
  .sn18-head { padding: 10px 14px; }
  .sn18-ava { width: 38px; height: 38px; }
  .sn18-body { padding: 14px 14px 4px; }
  .sn18-bubble { font-size: .92rem; }
  .sn18-form input { font-size: 16px; }
}
@media (prefers-reduced-motion: reduce) {
  .sn18-panel, .sn18-backdrop, .sn18-mic, .sn18-jump, .sn18-typing .sn18-bubble i { transition: none !important; animation: none !important; }
}

/* override any older full-screen or centered chat rules from v18.css so the
   v24 pane truly fills the viewport, no longer a small modal */
.sn18-panel { max-width: none !important; max-height: none !important; width: 100% !important; height: 100% !important; border-radius: 0 !important; top: 0 !important; left: 0 !important; transform: none !important; }
