/* מהדרין AI — עיצוב 1:1 בהשראת ChatGPT, RTL, בהיר/כהה */
@font-face {
  font-family: 'Heebo';
  font-style: normal;
  font-weight: 100 900;
  font-display: swap;
  src: url('/fonts/heebo-hebrew.woff2') format('woff2');
  unicode-range: U+0307-0308, U+0590-05FF, U+200C-2010, U+20AA, U+25CC, U+FB1D-FB4F;
}
@font-face {
  font-family: 'Heebo';
  font-style: normal;
  font-weight: 100 900;
  font-display: swap;
  src: url('/fonts/heebo-latin.woff2') format('woff2');
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+2000-206F, U+2074, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}
* { margin: 0; padding: 0; box-sizing: border-box; }
:root {
  --bg: #ffffff; --sidebar-bg: #f9f9f9; --border: #e6e6e6;
  --text: #0d0d0d; --text-2: #6b6b6b; --hover: #ececec;
  --user-bubble: #f4f4f4; --accent: #0d0d0d; --accent-fg: #fff;
  --blue: #3b82f6; --green: #10a37f; --danger: #d93025;
  --menu-bg: #ffffff; --shadow: 0 8px 30px rgba(0,0,0,.12);
  font-size: 16px;
}
html.dark {
  --bg: #212121; --sidebar-bg: #171717; --border: #3a3a3a;
  --text: #ececec; --text-2: #9b9b9b; --hover: #2f2f2f;
  --user-bubble: #2f2f2f; --accent: #ececec; --accent-fg: #0d0d0d;
  --menu-bg: #2f2f2f; --shadow: 0 8px 30px rgba(0,0,0,.5);
}
html, body { height: 100%; }
body {
  font-family: "Heebo", "Segoe UI", Arial, sans-serif;
  color: var(--text); background: var(--bg); overflow: hidden;
}
/* מחוון פוקוס נראה — ניווט מקלדת */
button:focus-visible, a:focus-visible, input:focus-visible,
textarea:focus-visible, select:focus-visible {
  outline: 2px solid var(--blue) !important; outline-offset: 2px;
}
/* שדות בתוך מיכל מעוצב — הפוקוס מוצג על המיכל, לא כמלבן על השדה הפנימי */
.composer textarea:focus-visible, .search-modal input:focus-visible,
.gpts-search input:focus-visible { outline: none !important; }
.composer:focus-within { border-color: var(--blue); }
.hidden { display: none !important; }
button { font-family: inherit; cursor: pointer; border: none; background: none; color: inherit; font-size: .9rem; }
input, textarea, select { font-family: inherit; color: var(--text); }
hr { border: none; border-top: 1px solid var(--border); margin: 6px 0; }

/* ---------- מסך התחברות ---------- */
.auth-view {
  height: 100vh; height: 100dvh; display: flex; align-items: center; justify-content: center;
  background: var(--bg);
}
.auth-card { width: 340px; text-align: center; }
.auth-logo {
  width: 52px; height: 52px; border-radius: 50%; margin: 0 auto 22px;
  background: var(--accent); color: var(--accent-fg);
  display: flex; align-items: center; justify-content: center;
  font-size: 1.6rem; font-weight: 700;
}
.auth-card h1 { font-size: 1.6rem; margin-bottom: 6px; }
.auth-sub { color: var(--text-2); font-size: .9rem; margin-bottom: 24px; }
.auth-input {
  width: 100%; padding: 13px 16px; margin-bottom: 12px;
  border: 1px solid var(--border); border-radius: 26px;
  font-size: .95rem; background: var(--bg); outline: none;
}
.auth-input:focus { border-color: var(--blue); }
.auth-btn {
  width: 100%; padding: 13px; border-radius: 26px;
  background: var(--accent); color: var(--accent-fg); font-weight: 600; font-size: .95rem;
}
.auth-error { color: var(--danger); font-size: .85rem; margin-bottom: 10px; }
.auth-divider {
  display: flex; align-items: center; gap: 12px; margin: 16px 0;
  color: var(--text-2); font-size: .8rem;
}
.auth-divider::before, .auth-divider::after {
  content: ''; height: 1px; flex: 1; background: var(--border);
}
.auth-google {
  width: 100%; padding: 12px; border-radius: 26px;
  border: 1px solid var(--border); background: var(--bg);
  font-weight: 600; font-size: .95rem; color: var(--text);
  display: flex; align-items: center; justify-content: center; gap: 10px;
}
.auth-google:hover { background: var(--hover); }
.auth-apple {
  display: none; width: 100%; padding: 12px; margin-bottom: 10px; border-radius: 26px; border: 0;
  background: #000; color: #fff; font-weight: 600; font-size: .95rem;
  align-items: center; justify-content: center; gap: 10px;
}
.auth-switch { margin-top: 18px; font-size: .88rem; color: var(--text-2); }
.auth-switch button { color: var(--blue); font-weight: 600; }
.auth-forgot { margin-top: 12px; font-size: .85rem; }
.auth-forgot button { color: var(--text-2); }
.auth-forgot button:hover { color: var(--blue); }
.auth-ok { color: var(--text-2); font-size: .85rem; margin-bottom: 10px; line-height: 1.5; }
/* באנר "אמתו את האימייל" — מעל הצ'אט, ניתן לסגירה */
.verify-bar {
  display: flex; align-items: center; justify-content: center; gap: 10px; flex-wrap: wrap;
  padding: 9px 14px; background: var(--hover); border-bottom: 1px solid var(--border);
  font-size: .85rem; color: var(--text-2);
}
.verify-bar button { color: var(--blue); font-weight: 600; }
.verify-bar .verify-x { color: var(--text-2); font-weight: 400; font-size: 1.1rem; line-height: 1; }
.auth-footer { margin-top: 34px; font-size: .75rem; color: var(--text-2); }

/* ---------- מבנה ---------- */
.app { display: flex; height: 100vh; height: 100dvh; }
.icon-btn { padding: 7px; border-radius: 8px; color: var(--text-2); display: flex; align-items: center; }
.icon-btn:hover { background: var(--hover); color: var(--text); }
.text-btn {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 7px 12px; border-radius: 20px; font-size: .88rem; color: var(--text);
}
.text-btn:hover { background: var(--hover); }
.text-btn.accent { color: var(--blue); font-weight: 600; }
.text-btn.danger { color: var(--danger); }
.pill-btn {
  border: 1px solid var(--border); border-radius: 20px;
  padding: 6px 14px; font-size: .85rem; font-weight: 600;
}
.pill-btn:hover { background: var(--hover); }
.pill-btn.small { padding: 4px 12px; font-size: .78rem; }

/* ---------- סייד-בר ---------- */
.sidebar {
  width: 232px; min-width: 232px; background: var(--sidebar-bg);
  border-left: 1px solid var(--border);
  display: flex; flex-direction: column; height: 100vh; height: 100dvh;
  transition: margin .22s;
}
.sb-backdrop { display: none; }
.app.rail .sidebar { margin-right: -232px; }
.sb-head { display: flex; align-items: center; justify-content: space-between; padding: 12px 14px 6px; }
.sb-logo {
  width: 30px; height: 30px; border-radius: 50%;
  background: var(--accent); color: var(--accent-fg);
  display: flex; align-items: center; justify-content: center; font-weight: 700; font-size: .95rem;
}
.sb-nav { padding: 6px 8px 0; }
.sb-item {
  display: flex; align-items: center; gap: 10px;
  width: 100%; padding: 9px 10px; border-radius: 10px;
  font-size: .9rem; text-align: right; color: var(--text);
}
.sb-item:hover { background: var(--hover); }
.sb-item svg { color: var(--text-2); }
.sb-recents-head { font-size: .78rem; color: var(--text-2); padding: 16px 18px 6px; font-weight: 600; }
.sb-chats { flex: 1; overflow-y: auto; padding: 0 8px; }
.chat-item {
  display: flex; align-items: center; position: relative;
  padding: 8px 10px; border-radius: 10px; font-size: .88rem; cursor: pointer;
  white-space: nowrap;
}
.chat-item span.t { overflow: hidden; text-overflow: ellipsis; flex: 1; }
.chat-item:hover, .chat-item.active { background: var(--hover); }
.chat-item .pin-ic { font-size: .7rem; color: var(--text-2); margin-left: 4px; }
.chat-item .ci-more { opacity: 0; padding: 2px 6px; border-radius: 6px; color: var(--text-2); }
.chat-item:hover .ci-more { opacity: 1; }
.ci-more:hover { background: var(--border); color: var(--text); }
.sb-bottom { border-top: 1px solid var(--border); padding: 8px; }
.usage-box { padding: 6px 10px 8px; }
.usage-text { font-size: .76rem; color: var(--text-2); margin-bottom: 5px; }
.usage-bar { height: 4px; background: var(--border); border-radius: 3px; overflow: hidden; }
.usage-fill { height: 100%; width: 0; background: var(--green); transition: width .3s; }
.usage-fill.warn { background: #e8a13c; }
.usage-fill.full { background: var(--danger); }
.sb-user {
  display: flex; align-items: center; gap: 10px;
  padding: 8px 10px; border-radius: 10px; cursor: pointer;
}
.sb-user:hover { background: var(--hover); }
.avatar {
  width: 32px; height: 32px; min-width: 32px; border-radius: 50%;
  background: #7c3aed; color: #fff;
  display: flex; align-items: center; justify-content: center;
  font-size: .85rem; font-weight: 700;
}
.sb-user-info { flex: 1; min-width: 0; }
.sb-user-name { font-size: .85rem; font-weight: 600; overflow: hidden; text-overflow: ellipsis; }
.sb-user-plan { font-size: .72rem; color: var(--text-2); }

/* ---------- אזור ראשי ---------- */
.main { flex: 1; display: flex; flex-direction: column; height: 100vh; height: 100dvh; min-width: 0; position: relative; }
.topbar { display: flex; align-items: center; gap: 6px; padding: 10px 16px; }
.only-collapsed { display: none; }
.app.rail .only-collapsed { display: flex; }
.topbar-left { margin-right: auto; display: flex; align-items: center; gap: 4px; }

.model-picker { position: relative; }
.model-btn {
  display: flex; align-items: center; gap: 6px;
  font-size: 1.05rem; font-weight: 700; color: var(--text);
  padding: 6px 10px; border-radius: 8px;
}
.model-btn:hover { background: var(--hover); }
.model-btn svg { color: var(--text-2); }

/* ---------- תפריטים צפים ---------- */
.menu-anchor { position: relative; }
.menu {
  position: absolute; top: 110%; z-index: 60;
  background: var(--menu-bg); border: 1px solid var(--border);
  border-radius: 14px; box-shadow: var(--shadow);
  min-width: 240px; padding: 6px; display: none;
}
.menu.open { display: block; }
.menu.up { top: auto; bottom: 110%; }
.menu-item {
  display: flex; align-items: center; gap: 10px;
  width: 100%; padding: 9px 12px; border-radius: 10px;
  text-align: right; font-size: .88rem; color: var(--text);
}
.menu-item:hover { background: var(--hover); }
.menu-item.danger { color: var(--danger); }
.mi-ic { width: 20px; text-align: center; }
.model-menu { right: 0; min-width: 280px; }
.model-opt { display: flex; align-items: center; gap: 10px; width: 100%; padding: 10px 12px; border-radius: 10px; text-align: right; }
.model-opt:hover { background: var(--hover); }
.model-opt:disabled { opacity: .45; cursor: not-allowed; }
.model-opt:disabled:hover { background: none; }
.model-opt .info { flex: 1; }
.model-opt .name { font-size: .9rem; font-weight: 600; }
.model-opt .desc { font-size: .77rem; color: var(--text-2); }
.model-opt .check { color: var(--text); font-weight: 700; visibility: hidden; }
.model-opt.selected .check { visibility: visible; }
.model-upsell {
  display: flex; align-items: center; gap: 10px; padding: 10px 12px;
  border-radius: 10px;
}
.model-upsell .up-btn {
  margin-right: auto; border: 1px solid var(--border); border-radius: 16px;
  padding: 4px 12px; font-size: .78rem; font-weight: 600;
}
.profile-menu { position: fixed; bottom: 64px; right: 12px; width: 240px; z-index: 70; }
.pm-head { display: flex; align-items: center; gap: 10px; padding: 10px 12px 6px; }
.pm-name { font-size: .9rem; font-weight: 600; }
.pm-plan { font-size: .75rem; color: var(--text-2); }

/* ---------- שיחה ---------- */
.chat-area { flex: 1; overflow-y: auto; scroll-behavior: smooth; }
.empty-state {
  height: 100%; display: flex; flex-direction: column;
  align-items: center; justify-content: center; gap: 22px; padding: 0 20px 8vh;
}
.empty-state h1 { font-size: 1.7rem; font-weight: 600; }
.composer-slot { width: 100%; max-width: 700px; }
.starter-rows { display: flex; flex-direction: column; gap: 2px; width: 100%; max-width: 700px; }
.starter {
  display: flex; align-items: center; gap: 12px;
  padding: 10px 14px; border-radius: 12px;
  color: var(--text-2); font-size: .92rem; text-align: right;
}
.starter:hover { background: var(--hover); color: var(--text); }

.messages { max-width: 760px; margin: 0 auto; padding: 10px 20px 20px; }
.msg { margin-bottom: 8px; line-height: 1.65; position: relative; }
.msg.user { display: flex; justify-content: flex-start; padding: 12px 0 2px; }
.msg.user .bubble {
  background: var(--user-bubble); border-radius: 20px;
  padding: 10px 18px; max-width: 78%; white-space: pre-wrap; overflow-wrap: break-word;
}
.msg.assistant { padding: 6px 0 2px; }
.msg .content { min-width: 0; overflow-wrap: break-word; }
.msg .content p { margin: 0 0 12px; }
.msg .content h1, .msg .content h2, .msg .content h3 { margin: 16px 0 8px; }
.msg .content ul, .msg .content ol { margin: 0 22px 12px 0; }
.msg .content li { margin-bottom: 5px; }
.msg .content code {
  background: var(--user-bubble); border-radius: 5px; padding: 2px 6px;
  font-size: .85em; direction: ltr; unicode-bidi: embed;
}
.msg .content pre {
  background: #0d0d0d; color: #eee; direction: ltr; text-align: left;
  border-radius: 12px; padding: 14px; overflow-x: auto; margin: 12px 0;
}
.msg .content pre code { background: none; padding: 0; }
.msg.blocked .content { color: #b45309; }
.cursor { display: inline-block; width: 9px; height: 18px; background: var(--text); vertical-align: text-bottom; animation: blink 1s infinite; }
@keyframes blink { 50% { opacity: 0; } }

/* פס פעולות מתחת להודעה */
.msg-actions { display: flex; gap: 2px; padding: 2px 0 6px; opacity: 0; transition: opacity .15s; }
.msg:hover .msg-actions, .msg.last .msg-actions { opacity: 1; }
.ma-btn { padding: 6px; border-radius: 7px; color: var(--text-2); display: flex; }
.ma-btn:hover { background: var(--hover); color: var(--text); }
.ma-btn.active { color: var(--blue); }
.msg.user .msg-actions { justify-content: flex-start; }

/* ---------- שורת כתיבה ---------- */
.composer-wrap { padding: 6px 20px 12px; }
.composer {
  max-width: 760px; margin: 0 auto;
  display: flex; align-items: flex-end; gap: 6px;
  border: 1px solid var(--border); border-radius: 28px;
  padding: 9px 12px; background: var(--bg);
  box-shadow: 0 4px 18px rgba(0,0,0,.06);
}
.empty-state .composer { box-shadow: 0 6px 24px rgba(0,0,0,.09); }
.composer textarea {
  flex: 1; border: none; outline: none; resize: none;
  font-size: 1rem; line-height: 1.5; max-height: 200px;
  background: transparent; padding: 6px 4px;
}
.plus-btn, .mic-btn { color: var(--text-2); }
.send-btn {
  width: 36px; height: 36px; min-width: 36px; border-radius: 50%;
  background: var(--accent); color: var(--accent-fg);
  display: flex; align-items: center; justify-content: center;
}
.send-btn:disabled { opacity: .35; cursor: default; }
.disclaimer { text-align: center; font-size: .73rem; color: var(--text-2); margin-top: 8px; }
.disclaimer b { color: var(--green); }

/* ---------- מודאלים ---------- */
.modal-overlay {
  position: fixed; inset: 0; z-index: 80;
  background: rgba(0,0,0,.55);
  display: flex; align-items: center; justify-content: center; padding: 20px;
}
.modal {
  background: var(--menu-bg); border-radius: 18px; padding: 28px;
  max-width: 860px; width: 100%; max-height: 90vh; overflow-y: auto;
  position: relative;
}
.modal-close { position: absolute; top: 14px; left: 14px; color: var(--text-2); padding: 6px; border-radius: 8px; }
.modal-close:hover { background: var(--hover); }
.modal h2 { font-size: 1.35rem; margin-bottom: 6px; }
.modal-sub { color: var(--text-2); font-size: .88rem; margin-bottom: 20px; }
.modal-sub.limit { color: var(--danger); font-weight: 600; }

/* חיפוש */
.search-modal { max-width: 560px; padding: 14px; }
.search-modal input {
  width: 100%; border: none; outline: none; background: transparent;
  font-size: 1.05rem; padding: 10px 12px; border-bottom: 1px solid var(--border);
}
.search-results { max-height: 50vh; overflow-y: auto; margin-top: 8px; }
.sr-item { display: block; width: 100%; text-align: right; padding: 10px 12px; border-radius: 10px; font-size: .9rem; }
.sr-item:hover { background: var(--hover); }
.sr-item small { color: var(--text-2); display: block; }

/* הגדרות */
.settings-modal { display: flex; gap: 20px; max-width: 720px; min-height: 420px; }
.settings-nav { display: flex; flex-direction: column; gap: 2px; min-width: 170px; padding-top: 8px; }
.snav { text-align: right; padding: 9px 12px; border-radius: 10px; font-size: .9rem; color: var(--text); }
.snav:hover, .snav.active { background: var(--hover); }
.settings-body { flex: 1; padding-top: 8px; }
.stab h3 { margin-bottom: 16px; }
.srow {
  display: flex; align-items: center; justify-content: space-between;
  padding: 12px 0; border-bottom: 1px solid var(--border); font-size: .9rem; gap: 10px;
}
.srow select, .s-input {
  border: 1px solid var(--border); border-radius: 10px; padding: 7px 10px;
  background: var(--bg); font-size: .88rem; outline: none;
}
.s-input { width: 100%; margin-bottom: 10px; }
.srow .s-input { width: auto; margin: 0; }
.s-btn { border: 1px solid var(--border); border-radius: 18px; padding: 6px 14px; font-size: .84rem; }
.s-btn:hover { background: var(--hover); }
.s-btn.danger { color: var(--danger); border-color: var(--danger); }
.s-save {
  margin-top: 14px; background: var(--accent); color: var(--accent-fg);
  border-radius: 20px; padding: 8px 20px; font-weight: 600; font-size: .88rem;
}
.s-desc { font-size: .82rem; color: var(--text-2); margin: 10px 0; line-height: 1.6; }
#customInstructions {
  width: 100%; border: 1px solid var(--border); border-radius: 12px;
  padding: 12px; font-size: .9rem; background: var(--bg); outline: none; resize: vertical;
}
.s-group { margin-bottom: 18px; }

/* תמחור */
.pricing { max-width: 1040px; }
.plans { display: grid; grid-template-columns: repeat(auto-fit, minmax(210px, 1fr)); gap: 14px; }
.plan-tagline { font-size: .82rem; color: var(--text-2); margin: 6px 0 2px; }
.plan-card {
  border: 1px solid var(--border); border-radius: 16px; padding: 22px;
  display: flex; flex-direction: column;
}
.plan-card.popular { border: 2px solid var(--green); position: relative; }
.plan-card.popular::before {
  content: "הפופולרי ביותר"; position: absolute; top: -11px; right: 18px;
  background: var(--green); color: #fff; font-size: .7rem;
  padding: 2px 10px; border-radius: 12px;
}
.plan-card h3 { font-size: 1.05rem; margin-bottom: 4px; }
.plan-price { font-size: 1.6rem; font-weight: 700; }
.plan-price small { font-size: .78rem; color: var(--text-2); font-weight: 400; }
.plan-card ul { list-style: none; margin: 14px 0; flex: 1; }
.plan-card li { font-size: .84rem; margin-bottom: 9px; padding-right: 22px; position: relative; }
.plan-card li::before { content: "✓"; position: absolute; right: 0; color: var(--green); font-weight: 700; }
.plan-cta { border-radius: 22px; padding: 9px; font-weight: 600; font-size: .88rem; background: var(--accent); color: var(--accent-fg); }
.plan-cta.current { background: var(--hover); color: var(--text-2); cursor: default; }
.plan-cta.green { background: var(--green); color: #fff; }
.plan-trial-note { font-size: .74rem; color: var(--text-2); text-align: center; margin-top: 6px; line-height: 1.5; }
.plan-manage { font-size: .78rem; color: var(--text-2); text-align: center; margin-top: 8px; line-height: 1.6; }
.plan-manage a { color: var(--text-2); text-decoration: underline; }
.pay-note { text-align: center; font-size: .75rem; color: var(--text-2); margin-top: 16px; }

/* שיתוף */
.share-modal { max-width: 480px; }
.share-row { display: flex; gap: 8px; margin: 14px 0; }
.share-row input {
  flex: 1; border: 1px solid var(--border); border-radius: 10px;
  padding: 9px 12px; font-size: .82rem; background: var(--bg); direction: ltr;
}
.share-row .s-save { margin: 0; white-space: nowrap; }

/* טוסט */
.toast {
  position: fixed; bottom: 26px; right: 50%; transform: translateX(50%);
  background: var(--accent); color: var(--accent-fg);
  padding: 10px 20px; border-radius: 24px; font-size: .85rem;
  z-index: 100; box-shadow: var(--shadow);
}

/* ---------- דף GPTs ---------- */
.gpts-page { max-width: 900px; margin: 0 auto; padding: 20px 24px 60px; position: relative; }
.gpts-create-btn {
  position: sticky; top: 0; float: left;
  background: var(--accent); color: var(--accent-fg);
  border-radius: 20px; padding: 8px 18px; font-weight: 600; font-size: .88rem;
}
.gpts-header { text-align: center; padding: 26px 0 8px; }
.gpts-header h1 { font-size: 2.6rem; font-weight: 800; margin-bottom: 12px; }
.gpts-header p { color: var(--text-2); font-size: .95rem; max-width: 560px; margin: 0 auto 24px; line-height: 1.6; }
.gpts-search {
  display: flex; align-items: center; gap: 10px;
  border: 1px solid var(--border); border-radius: 14px;
  padding: 12px 16px; max-width: 600px; margin: 0 auto 22px;
  color: var(--text-2); background: var(--bg);
}
.gpts-search input { flex: 1; border: none; outline: none; background: transparent; font-size: .95rem; }
.gpts-tabs { display: flex; gap: 4px; justify-content: center; flex-wrap: wrap; border-bottom: 1px solid var(--border); padding-bottom: 0; }
.gtab {
  padding: 9px 14px; font-size: .88rem; color: var(--text-2);
  border-bottom: 2px solid transparent; margin-bottom: -1px;
}
.gtab:hover { color: var(--text); }
.gtab.active { color: var(--text); font-weight: 600; border-bottom-color: var(--text); }
.gpts-section-title { font-size: 1.25rem; font-weight: 700; margin: 26px 0 4px; }
.gpts-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 14px; padding-top: 12px; }
.gpt-card {
  display: flex; gap: 14px; align-items: flex-start; text-align: right;
  border-radius: 16px; padding: 16px; cursor: pointer;
  background: var(--sidebar-bg);
}
.gpt-card:hover { background: var(--hover); }
.gpt-card-icon {
  width: 56px; height: 56px; min-width: 56px; border-radius: 50%;
  background: var(--bg); border: 1px solid var(--border);
  display: flex; align-items: center; justify-content: center; font-size: 1.6rem;
}
.gpt-card-name { font-weight: 700; font-size: .95rem; margin-bottom: 3px; }
.gpt-card-desc { font-size: .8rem; color: var(--text-2); line-height: 1.5; max-height: 3.9em; overflow: hidden; }
.gpt-card-by { font-size: .72rem; color: var(--text-2); margin-top: 5px; }
.gpt-card .gpt-edit { margin-right: auto; color: var(--text-2); padding: 4px 8px; border-radius: 8px; font-size: .8rem; }
.gpt-card .gpt-edit:hover { background: var(--border); color: var(--text); }

/* פתיח שיחה עם GPT / שיחה זמנית */
.gpt-hero, .temp-hero { display: flex; flex-direction: column; align-items: center; gap: 8px; }
.gpt-hero-icon {
  width: 72px; height: 72px; border-radius: 50%;
  background: var(--sidebar-bg); border: 1px solid var(--border);
  display: flex; align-items: center; justify-content: center; font-size: 2.1rem;
}
.gpt-hero h1, .temp-hero h1 { font-size: 1.6rem; }
.gpt-hero-desc { color: var(--text-2); font-size: .9rem; max-width: 480px; text-align: center; line-height: 1.6; }

/* GPT modal */
.gpt-modal { max-width: 560px; }
.gpt-form-row { display: flex; gap: 10px; }
.gpt-emoji-input { width: 64px; text-align: center; font-size: 1.2rem; }
.gpt-form textarea {
  width: 100%; border: 1px solid var(--border); border-radius: 12px;
  padding: 12px; font-size: .9rem; background: var(--bg); outline: none;
  resize: vertical; margin-bottom: 10px;
}
.gpt-form-actions { display: flex; align-items: center; gap: 12px; }

/* מצב שיחה זמנית — שורת כתיבה כהה כמו במקור */
.app.temp .composer { background: #0d0d0d; border-color: #0d0d0d; }
.app.temp .composer textarea { color: #ececec; }
.app.temp .composer textarea::placeholder { color: #8f8f8f; }
.app.temp .composer .plus-btn, .app.temp .composer .mic-btn { color: #9b9b9b; }
.app.temp .composer .send-btn { background: #ececec; color: #0d0d0d; }
.app.temp #tempBtn { color: var(--blue); background: var(--hover); }
html.dark .app.temp .composer { background: #f4f4f4; border-color: #f4f4f4; }
html.dark .app.temp .composer textarea { color: #0d0d0d; }
html.dark .app.temp .composer .send-btn { background: #0d0d0d; color: #fff; }

/* באנר מעבר למודל מהיר (נגמרה המכסה) */
.limit-banner {
  max-width: 760px; margin: 0 auto 8px;
  background: var(--sidebar-bg); border: 1px solid var(--border);
  border-radius: 12px; padding: 10px 14px; font-size: .82rem; color: var(--text-2);
  display: flex; align-items: center; gap: 8px;
}
.limit-banner b { color: var(--text); }
.limit-banner button { color: var(--blue); font-weight: 600; }

@media (max-width: 760px) {
  /* במובייל הסייד-בר סגור כברירת מחדל, נפתח כמגירה עם רקע מוכהה */
  .sidebar {
    position: fixed; z-index: 45; right: 0; margin-right: 0 !important;
    transform: translateX(100%); transition: transform .25s;
  }
  .app.sb-open .sidebar { transform: none; box-shadow: -10px 0 32px rgba(0,0,0,.28); }
  .only-collapsed { display: flex; }
  .sb-backdrop {
    display: block; position: fixed; inset: 0; z-index: 44;
    background: rgba(0,0,0,.42); opacity: 0; pointer-events: none; transition: opacity .25s;
  }
  .app.sb-open .sb-backdrop { opacity: 1; pointer-events: auto; }
  .settings-modal { flex-direction: column; }
  .settings-nav { flex-direction: row; overflow-x: auto; }
  .msg.user .bubble { max-width: 88%; }
}
/* מסכי מגע — כפתורי הפעולות תמיד נראים (אין hover) */
@media (hover: none) {
  .msg-actions { opacity: 1; }
  .chat-item .ci-more { opacity: 1; }
}

/* דיאלוג אישור/קלט מעוצב (במקום prompt/confirm של הדפדפן) */
.dlg-modal { max-width: 400px; }
.dlg-modal .s-input { margin-top: 4px; }
.dlg-actions { display: flex; gap: 10px; justify-content: flex-start; margin-top: 16px; }
.dlg-actions .s-save { margin-top: 0; }
.dlg-actions .s-save.danger { background: var(--danger); color: #fff; }

/* תמונות שנוצרו בצ'אט */
/* ציוני מקור ורשימת מקורות בתשובות לימוד */
.cite { font-size: .68em; font-weight: 600; color: var(--text-2, #6b6b6b); margin-inline-start: 1px; vertical-align: super; line-height: 0; }
.srclink { color: inherit; text-decoration: underline; text-decoration-color: rgba(127,127,127,.5); text-underline-offset: 2px; }
.srclink:hover { text-decoration-color: currentColor; }
.genimg { max-width: min(100%, 420px); border-radius: 12px; margin: 6px 0; display: block; }

/* אפליקציית החנויות (User-Agent MehadrinApp): בלי כפתורי שדרוג/רכישה — חוקי אפל/גוגל */
.in-app #sbUpgradeBtn, .in-app #topUpgradeBtn, .in-app #pmUpgrade, .in-app .model-upsell,
.in-app #lbUpgrade, .in-app #payNote { display: none !important; }
.in-app .plan-card.current-only { max-width: 340px; margin: 0 auto; }
/* באפליקציה: התחברות עם Google נפתחת בדפדפן חיצוני והסשן לא חוזר לאפליקציה (וגם מחייבת Sign in with Apple) — מסתירים; נכנסים עם אימייל+סיסמה */
.in-app #googleWrap { display: none !important; }
/* פיצ'רים שעוד לא קיימים — לא מוצגים בכלל */
[data-soon], .plus-btn, .menu-anchor:has(.plus-btn), .mic-btn { display: none !important; }

/* אזורים בטוחים — נוץ'/Dynamic Island ופס הבית באייפון (דורש viewport-fit=cover) */
.topbar { padding-top: calc(10px + env(safe-area-inset-top, 0px)); }
.sidebar { padding-top: env(safe-area-inset-top, 0px); padding-bottom: env(safe-area-inset-bottom, 0px); }
.composer-wrap { padding-bottom: calc(12px + env(safe-area-inset-bottom, 0px)); }
.modal-overlay { padding: calc(20px + env(safe-area-inset-top, 0px)) 20px calc(20px + env(safe-area-inset-bottom, 0px)); }
.toast { bottom: calc(26px + env(safe-area-inset-bottom, 0px)); }
.profile-menu { bottom: calc(64px + env(safe-area-inset-bottom, 0px)); }
/* iOS מגדיל את הדף אוטומטית (ונשאר מוגדל) כשממקדים שדה עם גופן קטן מ-16px */
@media (hover: none) and (pointer: coarse) {
  input, textarea, select { font-size: 16px !important; }
}
/* תפריט הפרופיל ירש top:110% מ-.menu ולכן נפתח מתחת לקצה המסך (בלתי נראה) */
.profile-menu { top: auto; }
/* תפריט ⋯ של השיחה: נפתח מהקצה השמאלי של הכפתור פנימה, לא החוצה מהמסך */
#chatMoreMenu { left: 0; right: auto; }

.send-btn.empty { opacity: .35; }
/* הלוגו: כחול על רקע בהיר, לבן במצב כהה */
.auth-logo-img { display: block; width: 190px; max-width: 70%; height: auto; margin: 0 auto 22px; }
.sb-logo-img { display: block; height: 30px; width: auto; }
html.dark .auth-logo-img, html.dark .sb-logo-img { filter: brightness(0) invert(1); }

/* אישור תנאים חד-פעמי */
.terms-gate { position: fixed; inset: 0; z-index: 100000; display: flex; align-items: center; justify-content: center; overflow-y: auto; padding: 24px; background: var(--bg); color: var(--text); }
.terms-card { width: 100%; max-width: 460px; margin: auto; text-align: right; line-height: 1.6; font-size: 16px; }
.terms-card h2 { margin: 0 0 12px; font-size: 24px; }
.terms-card p { margin: 0 0 12px; }
.terms-card ul { margin: 0 0 12px; padding-inline-start: 20px; }
.terms-card li { margin-bottom: 8px; }
.terms-card a { color: inherit; text-decoration: underline; }
.terms-error { color: #c0392b; }
.terms-card button { display: block; width: 100%; min-height: 48px; margin-top: 10px; border-radius: 12px; font: inherit; cursor: pointer; }
.terms-yes { background: var(--accent); color: var(--accent-fg); border: 0; }
.terms-no { background: transparent; color: var(--text); border: 1px solid var(--border); }
