/* מילון מרכבה - עיצוב משותף לאינדקס, לדפי מונח ולדפי קטגוריה (מבוסס על ה-HTML המקורי) */
:root {
  --bg: #1a0f05;
  --bg-card: rgba(44,31,14,0.65);
  --bg-sidebar: rgba(22,13,4,0.92);
  --text: #f0e6c8;
  --text-muted: #c4a878;
  --text-subtle: #7a6040;
  --headword: #f0c060;
  --link: #d4a843;
  --border: rgba(184,134,11,0.22);
  --border-card: rgba(184,134,11,0.28);
  --shadow: rgba(0,0,0,0.55);
  --gold: #b8860b;
  --gold-light: #d4a843;
  --gold-shine: #f0c060;
}
body.light-theme {
  --bg: #f5ead0;
  --bg-card: rgba(255,248,235,0.9);
  --bg-sidebar: rgba(240,228,196,0.95);
  --text: #3a2000;
  --text-muted: #5a4020;
  --text-subtle: #7a5830;
  --headword: #5a3800;
  --link: #7a5000;
  --border: rgba(139,100,10,0.22);
  --border-card: rgba(139,100,10,0.32);
  --shadow: rgba(0,0,0,0.12);
  --gold: #8a6200;
  --gold-light: #7a5000;
  --gold-shine: #5a3800;
}
* { box-sizing: border-box; margin: 0; padding: 0; }
html { scroll-behavior: smooth; }
[hidden] { display: none !important; }
body {
  direction: rtl;
  font-family: 'Assistant', sans-serif;
  background-color: var(--bg);
  background-image:
    radial-gradient(at 15% 15%, rgba(139,69,19,.28) 0px, transparent 55%),
    radial-gradient(at 85% 85%, rgba(184,134,11,.18) 0px, transparent 55%);
  background-attachment: fixed;
  color: var(--text);
  min-height: 100vh;
  line-height: 1.7;
}
body.light-theme {
  background-image:
    radial-gradient(at 15% 15%, rgba(200,160,80,.18) 0px, transparent 55%),
    radial-gradient(at 85% 85%, rgba(180,130,30,.14) 0px, transparent 55%);
}
a { color: var(--link); }

/* === header === */
.page-header {
  background: rgba(18,10,2,0.88);
  border-bottom: 1px solid var(--border);
  padding: 1rem 2rem;
  position: sticky; top: 0; z-index: 100;
  backdrop-filter: blur(10px);
  box-shadow: 0 2px 20px var(--shadow);
}
body.light-theme .page-header { background: rgba(237,224,196,0.95); }
.header-inner { max-width: 1400px; margin: 0 auto; display: flex; flex-direction: column; gap: 0.6rem; }
.title-row { display: flex; justify-content: space-between; align-items: center; flex-wrap: wrap; gap: 0.75rem; }
.title-texts { display: flex; flex-direction: column; gap: 0.2rem; }
.page-title { font-family: 'Frank Ruhl Libre', serif; font-size: 1.6rem; font-weight: 900; color: var(--headword); letter-spacing: 0.03em; text-shadow: 0 0 20px rgba(240,192,96,0.25); text-decoration: none; }
/* לוגו האתר מימין לשם המילון - עוגן לאתר הראשי */
.brand { display: flex; align-items: center; gap: 0.9rem; }
.brand-logo { display: block; flex-shrink: 0; line-height: 0; }
.brand-logo img { height: 46px; width: auto; }
.brand-logo .logo-light, body.light-theme .brand-logo .logo-dark { display: none; }
body.light-theme .brand-logo .logo-light { display: block; }
.brand-sep { width: 1px; align-self: stretch; margin: 0.2rem 0; background: linear-gradient(to bottom, transparent, var(--gold), transparent); opacity: 0.6; }
.page-tagline { font-family: 'Frank Ruhl Libre', serif; font-size: 0.95rem; color: var(--gold-light); }
.page-subtitle { font-size: 0.7rem; color: var(--text-subtle); letter-spacing: 0.06em; }
.header-actions { display: flex; align-items: center; gap: 0.5rem; flex-wrap: wrap; }
.home-link { font-size: 0.75rem; color: var(--text-muted); text-decoration: none; }
.home-link:hover { color: var(--gold-shine); }
.search-row { display: flex; gap: 0.75rem; align-items: center; }
#search {
  flex: 1;
  background: rgba(44,31,14,0.5);
  border: 1px solid var(--border-card);
  color: var(--text); font-family: inherit; font-size: 0.95rem;
  padding: 0.55rem 1rem 0.55rem 2rem; border-radius: 50px; direction: rtl; outline: none; transition: border-color 0.2s, box-shadow 0.2s;
}
body.light-theme #search { background: rgba(255,248,235,0.8); }
#search:focus { border-color: var(--gold-light); box-shadow: 0 0 0 2px rgba(184,134,11,0.18); }
#search::placeholder { color: var(--text-subtle); }
.search-wrap { position: relative; flex: 1; max-width: 500px; display: flex; align-items: center; }
.search-clear {
  position: absolute; left: 0.65rem; background: none; border: none; cursor: pointer;
  color: var(--text-subtle); font-size: 0.75rem; padding: 0.2rem 0.3rem; line-height: 1;
}
.search-clear:hover { color: var(--gold-shine); }
#count-badge { font-size: 0.72rem; color: var(--text-subtle); white-space: nowrap; }

/* === pill buttons (theme / login) === */
.pill-btn {
  display: flex; align-items: center; gap: 0.5rem;
  background: rgba(44,31,14,0.6);
  border: 1px solid rgba(184,134,11,0.35);
  color: var(--gold-light);
  padding: 0.35rem 0.75rem;
  border-radius: 50px; cursor: pointer;
  font-family: inherit; font-size: 0.72rem; font-weight: 600;
  flex-shrink: 0; transition: border-color 0.2s; text-decoration: none;
}
body.light-theme .pill-btn { background: rgba(240,228,196,0.85); border-color: rgba(140,100,10,0.35); color: var(--link); }
.pill-btn:hover { border-color: var(--gold-shine); }
.theme-toggle-track {
  width: 30px; height: 17px;
  background: rgba(184,134,11,0.2);
  border: 1px solid rgba(184,134,11,0.4);
  border-radius: 9px; position: relative; flex-shrink: 0;
}
.theme-toggle-thumb {
  width: 11px; height: 11px; background: var(--gold-light);
  border-radius: 50%; position: absolute; top: 2px; right: 2px;
  transition: transform 0.2s, background 0.2s;
}
body.light-theme .theme-toggle-thumb { transform: translateX(-13px); background: #8a6200; }

/* === layout === */
.layout { max-width: 1400px; margin: 0 auto; display: flex; }
.sidebar {
  width: 210px; flex-shrink: 0;
  background: var(--bg-sidebar);
  border-left: 1px solid var(--border); padding: 1.25rem 0.85rem;
  position: sticky; top: 104px; height: calc(100vh - 104px); overflow-y: auto;
}
.sidebar::-webkit-scrollbar { width: 4px; }
.sidebar::-webkit-scrollbar-thumb { background: var(--border); border-radius: 2px; }
.sb-label { font-size: 0.62rem; letter-spacing: 0.14em; color: var(--text-subtle); margin-bottom: 0.5rem; display: block; }
.sb-section { margin-bottom: 1.25rem; }
.cat-filters { display: flex; flex-direction: column; gap: 0.2rem; }
.cat-btn {
  display: flex; align-items: center; gap: 0.45rem; padding: 0.35rem 0.55rem;
  border-radius: 50px; cursor: pointer; border: none; background: transparent;
  color: var(--text-muted); font-family: inherit;
  font-size: 0.8rem; text-align: right; width: 100%; direction: rtl;
  transition: background 0.15s, color 0.15s;
}
.cat-btn:hover { background: rgba(184,134,11,0.12); color: var(--text); }
.cat-btn.active { background: rgba(184,134,11,0.2); color: var(--gold-shine); font-weight: 700; }
.cat-dot { width: 8px; height: 8px; border-radius: 50%; flex-shrink: 0; }
.cat-count { font-size: 0.62rem; color: var(--text-subtle); margin-right: auto; }
.alpha-nav { display: flex; flex-wrap: wrap; gap: 0.18rem; }
.alpha-btn {
  width: 25px; height: 25px; border-radius: 6px;
  border: 1px solid var(--border);
  background: transparent; color: var(--text-muted);
  font-family: 'Frank Ruhl Libre', serif; font-size: 0.8rem; cursor: pointer;
  display: flex; align-items: center; justify-content: center;
}
.alpha-btn:hover { border-color: var(--gold-light); color: var(--gold-light); }
.alpha-btn.active { background: rgba(184,134,11,0.35); border-color: var(--gold-light); color: var(--gold-shine); }
.stream-nav-btn {
  border-radius: 50px; border: 1px solid; padding: 0.15rem 0.55rem;
  background: transparent; font-family: inherit; font-size: 0.68rem;
  cursor: pointer; opacity: 0.7;
}
.stream-nav-btn:hover { opacity: 1; }
.stream-nav-btn.active { opacity: 1; font-weight: 700; background: rgba(255,255,255,0.07); }
#stream-filter-bar { display: flex; flex-wrap: wrap; gap: 0.4rem; margin-bottom: 1rem; align-items: center; }
.content { flex: 1; padding: 1.5rem 2rem; min-width: 0; }
.card-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(310px, 1fr)); gap: 1rem; }

/* === cards === */
.entry-card {
  background: linear-gradient(160deg, rgba(44,31,14,.65), rgba(26,15,5,.55));
  border: 1px solid var(--border-card);
  border-radius: 18px;
  border-right: 4px solid var(--cat-color, #888);
  padding: 1rem 1.1rem 0.85rem;
  box-shadow: 0 4px 18px var(--shadow);
  transition: box-shadow 0.2s, transform 0.2s;
  scroll-margin-top: 140px;
}
body.light-theme .entry-card { background: linear-gradient(160deg, rgba(255,248,235,.9), rgba(250,240,220,.8)); }
.entry-card:hover { box-shadow: 0 8px 28px var(--shadow); transform: translateY(-2px); }
.entry-card.highlighted { outline: 2px solid var(--gold-light); outline-offset: 2px; }
.card-top { display: flex; align-items: flex-start; gap: 0.4rem; margin-bottom: 0.2rem; }
.headword { font-family: 'Frank Ruhl Libre', serif; font-size: 1.3rem; font-weight: 700; color: var(--headword); line-height: 1.3; text-decoration: none; flex: 1; }
a.headword:hover { text-decoration: underline; text-decoration-thickness: 1px; }
.abbrev-badge {
  font-size: 0.67rem; background: rgba(184,134,11,0.15); color: var(--gold-light);
  border: 1px solid rgba(184,134,11,0.3);
  padding: 0.12rem 0.38rem; border-radius: 50px; white-space: nowrap; flex-shrink: 0; margin-top: 0.2rem;
}
.english { font-style: italic; font-size: 0.88rem; color: var(--text-muted); margin-bottom: 0.35rem; direction: ltr; text-align: right; }
.cat-badge, .stream-badge, .lock-badge {
  display: inline-flex; align-items: center; gap: 0.25rem;
  font-size: 0.62rem; border: 1px solid; padding: 0.08rem 0.42rem; border-radius: 50px; opacity: 0.85;
  text-decoration: none;
}
.stream-badge { cursor: pointer; }
.stream-badge.stream-active { opacity: 1; font-weight: 700; box-shadow: 0 0 0 1.5px currentColor; }
.lock-badge { color: var(--gold-shine); border-color: var(--gold-shine); }
.badge-row { display: flex; align-items: center; gap: 0.3rem; flex-wrap: wrap; margin-bottom: 0.65rem; }
.definition { font-size: 0.86rem; line-height: 1.8; color: var(--text); margin-bottom: 0.65rem; white-space: pre-line; }
.card-footer { border-top: 1px solid var(--border); padding-top: 0.5rem; display: flex; flex-direction: column; gap: 0.4rem; }
.cross-refs { display: flex; flex-wrap: wrap; gap: 0.3rem; align-items: center; }
.xref-label { font-size: 0.58rem; color: var(--text-subtle); letter-spacing: 0.07em; }
.xref-link {
  font-size: 0.75rem; color: var(--link); text-decoration: none;
  border: none; border-bottom: 1px dotted var(--link); opacity: 0.85; cursor: pointer;
  background: none; font-family: inherit; padding: 0;
}
.xref-link:hover { opacity: 1; color: var(--gold-shine); }
.card-actions { display: flex; gap: 0.35rem; justify-content: flex-start; }
.icon-btn {
  flex-shrink: 0; min-width: 26px; height: 24px; padding: 0 0.35rem;
  background: rgba(184,134,11,0.12); border: 1px solid rgba(184,134,11,0.35);
  border-radius: 7px; color: var(--gold-light);
  font-size: 0.8rem; font-weight: 600; font-family: inherit; cursor: pointer;
  display: inline-flex; align-items: center; justify-content: center; gap: 0.15rem;
  line-height: 1;
}
.icon-btn:hover { background: rgba(184,134,11,0.3); border-color: rgba(240,192,96,0.7); }
.icon-btn.on { background: rgba(184,134,11,0.4); color: var(--gold-shine); }
.icon-btn .lk { font-size: 0.55rem; opacity: 0.75; }
.info-box, .panel {
  font-size: 0.8rem; line-height: 1.6; color: var(--gold-light);
  background: rgba(184,134,11,0.1); border: 1px solid rgba(184,134,11,0.2);
  border-radius: 10px; padding: 8px 12px; margin: 0.1rem 0 0.5rem;
}
.info-box-label { font-weight: 700; margin-left: 0.25rem; }
.panel textarea, .panel select, .login-box input {
  width: 100%; font-family: inherit; font-size: 0.85rem; color: var(--text);
  background: rgba(26,15,5,0.6); border: 1px solid var(--border-card); border-radius: 8px;
  padding: 0.45rem 0.6rem; margin: 0.35rem 0; direction: rtl;
}
body.light-theme .panel textarea, body.light-theme .panel select, body.light-theme .login-box input { background: #fffaf0; }
.panel textarea { min-height: 80px; resize: vertical; }
.panel .row { display: flex; gap: 0.4rem; justify-content: flex-start; margin-top: 0.3rem; }
.gold-btn {
  background: linear-gradient(135deg, rgba(184,134,11,.45), rgba(184,134,11,.25));
  border: 1px solid rgba(240,192,96,.6); color: var(--gold-shine);
  padding: 0.4rem 1rem; border-radius: 20px; font-family: inherit; font-weight: 700; font-size: 0.82rem;
  cursor: pointer; text-decoration: none; display: inline-block;
}
.gold-btn:hover { background: linear-gradient(135deg, rgba(184,134,11,.6), rgba(184,134,11,.35)); }
.ghost-btn { background: none; border: none; color: var(--text-muted); font-family: inherit; font-size: 0.8rem; cursor: pointer; }
.no-results, .locked-panel { text-align: center; padding: 3rem 2rem; color: var(--text-muted); grid-column: 1 / -1; font-size: 0.9rem; }
.locked-panel { max-width: 560px; margin: 0 auto; line-height: 1.9; }
.locked-panel .lock-icon { font-size: 2rem; display: block; margin-bottom: 0.5rem; }
.locked-panel h2 { font-family: 'Frank Ruhl Libre', serif; color: var(--headword); font-size: 1.4rem; margin-bottom: 0.6rem; }
.locked-panel p { margin-bottom: 1rem; }

/* === login modal === */
.modal-bg { position: fixed; inset: 0; background: rgba(0,0,0,0.6); z-index: 1000; display: flex; align-items: center; justify-content: center; padding: 16px; }
.login-box {
  width: 100%; max-width: 380px; background: var(--bg); border: 1px solid var(--border-card);
  border-radius: 16px; padding: 1.5rem; box-shadow: 0 10px 40px var(--shadow); position: relative;
}
.login-box h2 { font-family: 'Frank Ruhl Libre', serif; color: var(--headword); font-size: 1.3rem; margin-bottom: 0.3rem; }
.login-box p { font-size: 0.82rem; color: var(--text-muted); margin-bottom: 0.6rem; }
.login-box .err { color: #e57373; font-size: 0.8rem; min-height: 1.2em; }
.login-box .close { position: absolute; top: 0.6rem; left: 0.8rem; background: none; border: none; color: var(--text-subtle); font-size: 1rem; cursor: pointer; }

/* === term & category pages === */
.term-wrap { max-width: 760px; margin: 0 auto; padding: 2rem 1.5rem 4rem; }
.crumbs { font-size: 0.78rem; color: var(--text-subtle); margin-bottom: 1.2rem; }
.crumbs a { color: var(--text-muted); text-decoration: none; }
.crumbs a:hover { color: var(--gold-shine); }
.term-wrap .entry-card { padding: 1.6rem 1.6rem 1.2rem; }
.term-wrap .entry-card:hover { transform: none; }
.term-wrap h1.headword { font-size: 2rem; }
.term-wrap .definition { font-size: 1rem; }
.term-wrap .english { font-size: 1rem; }
.cat-intro { color: var(--text-muted); font-size: 0.9rem; margin-bottom: 1.2rem; }
.term-list { list-style: none; columns: 2 220px; column-gap: 2rem; }
.term-list li { break-inside: avoid; padding: 0.2rem 0; font-size: 0.92rem; }
.term-list a { text-decoration: none; color: var(--text); }
.term-list a:hover { color: var(--gold-shine); }
.term-list .en { color: var(--text-subtle); font-size: 0.78rem; margin-right: 0.35rem; }
.back-all { display: inline-block; margin-top: 1.5rem; font-size: 0.85rem; text-decoration: none; }
.cat-links { display: flex; flex-wrap: wrap; gap: 0.4rem; margin-top: 2rem; }
.cat-links a { font-size: 0.75rem; border: 1px solid var(--border-card); border-radius: 50px; padding: 0.15rem 0.6rem; text-decoration: none; color: var(--text-muted); }
.site-foot { text-align: center; color: var(--text-subtle); font-size: 0.78rem; padding: 2rem 1rem; border-top: 1px solid var(--border); margin-top: 2rem; }
.site-foot a { color: var(--gold-light); text-decoration: none; }

/* === mobile === */
.mobile-filters-btn { display: none; }
@media (max-width: 760px) {
  .page-header { padding: 0.75rem 16px; }
  .page-title { font-size: 1.3rem; }
  .brand { gap: 0.6rem; }
  .brand-logo img { height: 36px; }
  .page-subtitle { display: none; }
  .layout { flex-direction: column; }
  .sidebar { width: 100%; position: static; height: auto; border-left: none; border-bottom: 1px solid var(--border); display: none; }
  .sidebar.open { display: block; }
  .mobile-filters-btn { display: inline-flex; }
  .content { padding: 1rem 16px; }
  .card-grid { grid-template-columns: 1fr; }
  .term-wrap { padding: 1.2rem 16px 3rem; }
  .term-wrap h1.headword { font-size: 1.6rem; }
}

/* === auth tabs / intro === */
.login-box .intro { color: var(--gold-light); background: rgba(184,134,11,0.1); border: 1px solid rgba(184,134,11,0.2); border-radius: 10px; padding: 8px 12px; }
.login-box .fine { font-size: 0.72rem; color: var(--text-subtle); margin: 0.8rem 0 0; }
.auth-tabs { display: flex; gap: 0.3rem; margin: 0.4rem 0 0.2rem; }
.auth-tabs button { flex: 1; background: none; border: 1px solid var(--border-card); color: var(--text-muted); border-radius: 50px; padding: 0.3rem; font-family: inherit; font-size: 0.8rem; cursor: pointer; }
.auth-tabs button.on { background: rgba(184,134,11,0.25); color: var(--gold-shine); border-color: var(--gold-light); font-weight: 700; }
.panel .row { flex-wrap: wrap; align-items: center; }
.panel .note { font-size: 0.72rem; color: var(--text-muted); margin-bottom: 0.2rem; }
