/* AllTeachers — מערכת עיצוב בסיסית
   עקרונות: ללא סגול, ללא כפתורים מעוגלים, ללא אימוג'ים כאייקונים, ללא הנפשות גלילה.
   פונטים: Heebo (עברית, נייטרלי, לא "טרנדי מדי"). */

:root {
  --color-bg: #f6f4ef;
  --color-surface: #ffffff;
  --color-border: #d7d2c4;
  --color-border-strong: #b7b09c;
  --color-text: #211f1a;
  --color-text-muted: #5c584e;
  --color-primary: #1f3346;
  --color-primary-light: #2c4a63;
  --color-primary-dark: #16232f;
  --color-accent: #a45a1f;
  --color-accent-light: #c17a3a;
  --color-accent-dark: #7f4517;
  --color-danger: #8f2d2d;
  --color-success: #2f5d3a;
  --color-warning: #8a6300;
  --focus-ring: #1f3346;
  --radius: 4px;
  --font-main: "Heebo", "Arial Hebrew", Arial, sans-serif;
  --shadow-sm: 0 1px 2px rgba(22, 20, 14, 0.07);
  --shadow-md: 0 4px 14px rgba(22, 20, 14, 0.09);
  --shadow-header: 0 2px 10px rgba(15, 24, 33, 0.18);
}

* {
  box-sizing: border-box;
}

html {
  font-size: 16px;
}

body {
  margin: 0;
  font-family: var(--font-main);
  background: var(--color-bg);
  color: var(--color-text);
  line-height: 1.55;
  direction: rtl;
  text-align: right;
}

img {
  max-width: 100%;
}

a {
  color: var(--color-primary);
}

h1, h2, h3, h4 {
  font-weight: 700;
  margin: 0 0 0.5em 0;
  line-height: 1.3;
}

h1 { font-size: 1.75rem; }
h2 { font-size: 1.35rem; }
h3 { font-size: 1.1rem; }

main > .tab-section > h1:first-child,
.card-title-row h1 {
  padding-bottom: 12px;
  border-bottom: 2px solid var(--color-border);
  position: relative;
}

main > .tab-section > h1:first-child::after,
.card-title-row h1::after {
  content: "";
  position: absolute;
  bottom: -2px;
  right: 0;
  width: 52px;
  height: 2px;
  background: var(--color-accent);
}

p { margin: 0 0 1em 0; }

.container {
  max-width: 1100px;
  margin: 0 auto;
  padding: 0 20px;
}

/* ---------- מבנה עליון ---------- */
.app-header {
  background:
    repeating-linear-gradient(135deg, rgba(255, 255, 255, 0.035) 0px, rgba(255, 255, 255, 0.035) 1px, transparent 1px, transparent 14px),
    linear-gradient(180deg, var(--color-primary-light) 0%, var(--color-primary) 55%, var(--color-primary-dark) 100%);
  color: #fff;
  border-bottom: 3px solid var(--color-accent);
  box-shadow: var(--shadow-header);
}

.app-header .bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 20px;
  max-width: 1100px;
  margin: 0 auto;
  flex-wrap: wrap;
  gap: 10px;
}

.app-header .brand {
  display: flex;
  align-items: center;
  gap: 10px;
  font-weight: 700;
  font-size: 1.15rem;
  color: #fff;
  text-decoration: none;
  letter-spacing: 0.2px;
}

.brand-mark {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 30px;
  height: 30px;
  flex: 0 0 auto;
  background: var(--color-accent);
  color: #fff;
  font-weight: 700;
  font-size: 0.95rem;
  border-radius: var(--radius);
}

.brand-text small {
  display: block;
  font-weight: 400;
  font-size: 0.68rem;
  color: #c7cfd6;
  letter-spacing: 0.3px;
}

.app-header nav {
  display: flex;
  gap: 4px;
  flex-wrap: wrap;
}

.app-header nav a {
  color: #eef1f4;
  text-decoration: none;
  padding: 8px 12px;
  border: 1px solid transparent;
  border-radius: var(--radius);
  font-size: 0.92rem;
}

.app-header nav a:hover,
.app-header nav a.active {
  border-color: rgba(255, 255, 255, 0.35);
  background: rgba(255, 255, 255, 0.08);
}

.header-user {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 0.88rem;
  color: #d9dee3;
}

.btn-logout {
  background: transparent;
  border: 1px solid rgba(255, 255, 255, 0.5);
  color: #fff;
  padding: 6px 12px;
  font-size: 0.85rem;
  cursor: pointer;
  border-radius: var(--radius);
  font-family: var(--font-main);
}

.btn-logout:hover {
  background: rgba(255, 255, 255, 0.12);
}

main {
  padding: 28px 0 60px 0;
}

/* ---------- כרטיסים וטבלאות ---------- */
.card {
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
  padding: 20px;
  margin-bottom: 20px;
  box-shadow: var(--shadow-sm);
}

.card-title-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 14px;
  flex-wrap: wrap;
}

table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.92rem;
}

th, td {
  text-align: right;
  padding: 9px 10px;
  border-bottom: 1px solid var(--color-border);
  vertical-align: middle;
}

th {
  background: #eeebe3;
  font-weight: 700;
  white-space: nowrap;
  font-size: 0.82rem;
  letter-spacing: 0.2px;
  color: var(--color-text-muted);
  border-bottom: 2px solid var(--color-border-strong);
}

tbody tr:hover {
  background: #faf8f3;
}

.table-scroll {
  overflow-x: auto;
}

.empty-row {
  color: var(--color-text-muted);
  text-align: center;
  padding: 28px 10px;
  font-style: italic;
}

/* ---------- טפסים ---------- */
label {
  display: block;
  font-size: 0.88rem;
  font-weight: 600;
  margin-bottom: 4px;
  color: var(--color-text);
}

.field {
  margin-bottom: 14px;
}

.field-row {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 14px;
}

input[type="text"],
input[type="password"],
input[type="number"],
input[type="date"],
input[type="time"],
input[type="email"],
input[type="tel"],
input[type="file"],
select,
textarea {
  width: 100%;
  padding: 9px 10px;
  font-size: 0.95rem;
  font-family: var(--font-main);
  border: 1px solid var(--color-border-strong);
  border-radius: var(--radius);
  background: #fff;
  color: var(--color-text);
}

textarea {
  min-height: 80px;
  resize: vertical;
}

input:focus,
select:focus,
textarea:focus,
button:focus,
a:focus {
  outline: 3px solid var(--focus-ring);
  outline-offset: 1px;
}

.help-text {
  font-size: 0.82rem;
  color: var(--color-text-muted);
  margin-top: 4px;
}

.error-text {
  font-size: 0.85rem;
  color: var(--color-danger);
  margin-top: 6px;
}

/* ---------- כפתורים (ללא עיגול) ---------- */
.btn {
  display: inline-block;
  font-family: var(--font-main);
  font-size: 0.92rem;
  font-weight: 600;
  padding: 10px 18px;
  border-radius: var(--radius);
  border: 1px solid transparent;
  cursor: pointer;
  text-decoration: none;
  text-align: center;
  transition: transform 0.12s ease, box-shadow 0.12s ease, background-color 0.12s ease;
}

.btn:hover {
  transform: translateY(-1px);
}

.btn:active {
  transform: translateY(0);
}

.btn-primary {
  background: var(--color-primary);
  color: #fff;
  border-color: var(--color-primary);
  box-shadow: 0 1px 2px rgba(22, 20, 14, 0.18);
}
.btn-primary:hover { background: var(--color-primary-dark); box-shadow: var(--shadow-md); }

.btn-accent {
  background: var(--color-accent);
  color: #fff;
  border-color: var(--color-accent);
  box-shadow: 0 1px 2px rgba(22, 20, 14, 0.18);
}
.btn-accent:hover { background: var(--color-accent-dark); box-shadow: var(--shadow-md); }

.btn-outline {
  background: transparent;
  color: var(--color-primary);
  border-color: var(--color-primary);
}
.btn-outline:hover { background: #eef1f4; }

.btn-danger {
  background: #fff;
  color: var(--color-danger);
  border-color: var(--color-danger);
}
.btn-danger:hover { background: #fbeeee; }

.btn-small {
  padding: 5px 10px;
  font-size: 0.82rem;
}

.btn:disabled {
  opacity: 0.55;
  cursor: not-allowed;
}

/* ---------- תגיות סטטוס ---------- */
.tag {
  display: inline-block;
  padding: 3px 9px;
  border-radius: var(--radius);
  font-size: 0.78rem;
  font-weight: 700;
  border: 1px solid transparent;
}

.tag-signed { background: #e7f0e8; color: var(--color-success); border-color: #bfd8c4; }
.tag-pending { background: #fbf3df; color: var(--color-warning); border-color: #ecd9a3; }
.tag-neutral { background: #eceae3; color: var(--color-text-muted); border-color: var(--color-border); }

/* ---------- לוח מחוונים ---------- */
.stat-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(190px, 1fr));
  gap: 14px;
  margin-bottom: 20px;
}

.stat-box {
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-right: 4px solid var(--color-accent);
  border-radius: var(--radius);
  padding: 16px 18px;
  box-shadow: var(--shadow-sm);
  transition: box-shadow 0.15s ease, transform 0.15s ease;
}

.stat-box:hover {
  box-shadow: var(--shadow-md);
  transform: translateY(-1px);
}

.stat-box .stat-value {
  font-size: 1.85rem;
  font-weight: 700;
  color: var(--color-primary);
  letter-spacing: -0.3px;
}

.stat-box .stat-label {
  font-size: 0.85rem;
  color: var(--color-text-muted);
  margin-top: 2px;
}

/* ---------- טאבים ---------- */
.tabs {
  display: flex;
  gap: 2px;
  border-bottom: 2px solid var(--color-border);
  margin-bottom: 20px;
  flex-wrap: wrap;
}

.tab-btn {
  font-family: var(--font-main);
  background: transparent;
  border: none;
  border-bottom: 3px solid transparent;
  padding: 10px 16px;
  font-size: 0.95rem;
  font-weight: 600;
  color: var(--color-text-muted);
  cursor: pointer;
}

.tab-btn.active {
  color: var(--color-primary);
  border-bottom-color: var(--color-accent);
}

.tab-btn:hover:not(.active) {
  color: var(--color-text);
}

.tab-panel { display: none; }
.tab-panel.active { display: block; }

/* ---------- הודעות ---------- */
.alert {
  padding: 12px 14px;
  border-radius: var(--radius);
  border: 1px solid;
  font-size: 0.9rem;
  margin-bottom: 16px;
}

.alert-error { background: #fbeeee; border-color: #e4b7b7; color: var(--color-danger); }
.alert-success { background: #eaf3ec; border-color: #bfd8c4; color: var(--color-success); }
.alert-info { background: #eef1f4; border-color: #c4ccd4; color: var(--color-primary); }

/* ---------- דף כניסה ---------- */
.login-shell {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  background: var(--color-bg);
}

.login-panels {
  width: 100%;
  max-width: 860px;
  display: flex;
  border-radius: 6px;
  overflow: hidden;
  box-shadow: var(--shadow-md);
}

.login-brand-panel {
  flex: 0 0 42%;
  background:
    radial-gradient(circle, rgba(255, 255, 255, 0.08) 1px, transparent 1.6px) 0 0 / 22px 22px,
    linear-gradient(160deg, var(--color-primary-light) 0%, var(--color-primary) 60%, var(--color-primary-dark) 100%);
  color: #fff;
  padding: 40px 34px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  position: relative;
}

.login-brand-panel .brand-mark {
  width: 42px;
  height: 42px;
  font-size: 1.25rem;
  margin-bottom: 22px;
}

.login-brand-panel h1 {
  font-size: 1.5rem;
  margin-bottom: 10px;
}

.login-brand-panel p {
  color: #d7deE4;
  font-size: 0.92rem;
  line-height: 1.6;
}

.login-brand-list {
  list-style: none;
  padding: 0;
  margin: 22px 0 0 0;
  border-top: 1px solid rgba(255, 255, 255, 0.18);
  padding-top: 18px;
}

.login-brand-list li {
  font-size: 0.85rem;
  color: #dfe5ea;
  padding: 5px 0 5px 0;
  border-right: 2px solid var(--color-accent);
  padding-right: 10px;
  margin-bottom: 6px;
}

.login-footnote {
  font-size: 0.76rem;
  color: #aeb8c1;
}

.login-box {
  flex: 1 1 auto;
  width: 100%;
  background: var(--color-surface);
  padding: 40px 34px;
}

.login-box .logo-line {
  font-size: 1.3rem;
  font-weight: 700;
  color: var(--color-primary);
  margin-bottom: 4px;
}

.login-box .sub-line {
  color: var(--color-text-muted);
  font-size: 0.92rem;
  margin-bottom: 22px;
}

@media (max-width: 720px) {
  .login-panels {
    flex-direction: column;
    box-shadow: none;
  }
  .login-brand-panel {
    flex: 0 0 auto;
    padding: 26px 24px;
  }
  .login-brand-list,
  .login-footnote {
    display: none;
  }
  .login-box {
    border: 1px solid var(--color-border);
    box-shadow: var(--shadow-md);
  }
}

.role-select {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
  margin-bottom: 18px;
}

.role-option {
  border: 1px solid var(--color-border-strong);
  border-radius: var(--radius);
  padding: 10px 6px;
  text-align: center;
  font-size: 0.88rem;
  font-weight: 600;
  background: #fff;
  cursor: pointer;
  color: var(--color-text);
}

.role-option.active {
  border-color: var(--color-primary);
  background: #eef1f4;
  color: var(--color-primary);
}

.login-box .btn-primary {
  width: 100%;
  padding: 11px 18px;
  font-size: 1rem;
}

footer.site-footer {
  border-top: 1px solid var(--color-border);
  padding: 20px 0;
  color: var(--color-text-muted);
  font-size: 0.85rem;
}

footer.site-footer .container {
  display: flex;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 10px;
}

footer.site-footer a {
  color: var(--color-text-muted);
  margin-inline-start: 14px;
}

/* ---------- כפתור ופאנל נגישות ---------- */
#a11y-toggle {
  position: fixed;
  bottom: 18px;
  left: 18px;
  z-index: 500;
  background: var(--color-primary);
  color: #fff;
  border: 2px solid #fff;
  box-shadow: 0 0 0 1px var(--color-primary);
  border-radius: var(--radius);
  width: 48px;
  height: 48px;
  font-size: 1.3rem;
  font-weight: 700;
  cursor: pointer;
  font-family: var(--font-main);
}

#a11y-panel {
  position: fixed;
  bottom: 74px;
  left: 18px;
  z-index: 500;
  background: #fff;
  border: 1px solid var(--color-border-strong);
  border-radius: var(--radius);
  padding: 14px;
  width: 240px;
  box-shadow: 0 2px 10px rgba(0,0,0,0.18);
}

#a11y-panel h2 {
  font-size: 0.95rem;
  margin-bottom: 10px;
}

#a11y-panel button {
  width: 100%;
  text-align: right;
  margin-bottom: 6px;
  background: #f3f1ea;
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
  padding: 8px 10px;
  font-family: var(--font-main);
  font-size: 0.87rem;
  cursor: pointer;
}

#a11y-panel button:hover {
  background: #e9e6dc;
}

[hidden] { display: none !important; }

/* מצבי נגישות גלובליים */
html.a11y-contrast {
  filter: contrast(1.15);
}
html.a11y-contrast body {
  background: #000;
  color: #fff;
}
html.a11y-contrast .card,
html.a11y-contrast .login-box,
html.a11y-contrast .stat-box {
  background: #111;
  border-color: #666;
}
html.a11y-contrast th {
  background: #1a1a1a;
}
html.a11y-contrast a { color: #ffd166; }

html.a11y-underline a { text-decoration: underline; }

html.a11y-font-lg { font-size: 18px; }
html.a11y-font-xl { font-size: 20px; }

/* ---------- עמודי תוכן משפטי ---------- */
.legal-content {
  max-width: 780px;
  margin: 0 auto;
}

.legal-content h2 {
  margin-top: 1.6em;
}

.legal-content ol,
.legal-content ul {
  padding-inline-start: 22px;
}

.legal-content li {
  margin-bottom: 0.5em;
}

.legal-content .updated-note {
  color: var(--color-text-muted);
  font-size: 0.85rem;
  margin-bottom: 24px;
}

.back-link {
  display: inline-block;
  margin-bottom: 18px;
  font-size: 0.9rem;
}

/* ---------- חלונות דיאלוג ---------- */
dialog {
  border: 1px solid var(--color-border-strong);
  border-radius: var(--radius);
  padding: 0;
  width: min(560px, 92vw);
  max-height: 88vh;
  overflow: auto;
}

dialog::backdrop {
  background: rgba(20, 18, 12, 0.55);
}

dialog .dialog-inner {
  padding: 22px 24px;
}

dialog .dialog-title-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 16px;
  padding-bottom: 12px;
  border-bottom: 2px solid var(--color-border);
}

dialog .dialog-close {
  background: transparent;
  border: 1px solid var(--color-border-strong);
  border-radius: var(--radius);
  width: 30px;
  height: 30px;
  cursor: pointer;
  font-size: 1rem;
  font-family: var(--font-main);
}

.form-actions {
  display: flex;
  gap: 10px;
  margin-top: 18px;
  flex-wrap: wrap;
}

.detail-panel {
  border-top: 3px solid var(--color-primary);
}

.link-btn {
  background: none;
  border: none;
  color: var(--color-primary);
  text-decoration: underline;
  cursor: pointer;
  font-family: var(--font-main);
  font-size: 0.9rem;
  padding: 0;
}

.subtle-note {
  color: var(--color-text-muted);
  font-size: 0.85rem;
}

/* מסך קטן */
@media (max-width: 640px) {
  .role-select { grid-template-columns: 1fr; }
  .app-header .bar { flex-direction: column; align-items: flex-start; }
  th, td { font-size: 0.85rem; }
}

/* הדפסת דוחות */
@media print {
  #a11y-toggle, #a11y-panel, .app-header, footer.site-footer, .no-print { display: none !important; }
  body { background: #fff; }
}
