/* نافذة دور محكمة منبج — مكونات جديدة فوق نظام التصميم.
 * لا ألوان ولا مسافات خارج متغيرات manbij-ds.css.
 */

/* ———— عام ———— */
.court-bar { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: var(--space-3); }
.court-muted { color: var(--text-muted); }
.proto-note { border: 1px dashed var(--border-hover); border-radius: var(--radius-md); padding: var(--space-3) var(--space-4);
  background: var(--warning-soft); color: var(--warning); font-size: 14px; line-height: 1.7; }
.proto-note a { color: var(--warning); font-weight: 700; }

.conn-banner { display: none; position: fixed; inset-inline: 0; top: 0; z-index: 50; padding: var(--space-2) var(--space-4);
  background: var(--color-danger); color: var(--white); text-align: center; font-weight: 700; }
.is-offline .conn-banner { display: block; }

/* مقياس الإشغال: عنصر <progress> أصلي، بلا أنماط داخل الصفحة */
.meter { appearance: none; -webkit-appearance: none; width: 100%; height: 8px; border: 0; border-radius: var(--radius-pill);
  background: var(--bg-subtle); overflow: hidden; display: block; }
.meter::-webkit-progress-bar { background: var(--bg-subtle); border-radius: var(--radius-pill); }
.meter::-webkit-progress-value { background: var(--color-primary); border-radius: var(--radius-pill); }
.meter::-moz-progress-bar { background: var(--color-primary); border-radius: var(--radius-pill); }
.meter--full::-webkit-progress-value { background: var(--gold-700); }
.meter--full::-moz-progress-bar { background: var(--gold-700); }

/* ———— الاستقبال ———— */
.reception { display: grid; gap: var(--space-6); }
@media (min-width: 992px) { .reception { grid-template-columns: minmax(0, 1fr) 340px; align-items: start; } }

.office-tiles { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: var(--space-3); }
.office-tile { position: relative; display: flex; flex-direction: column; gap: var(--space-2); text-align: start; cursor: pointer;
  padding: var(--space-4); border: 2px solid var(--border-color); border-radius: var(--radius-lg); background: var(--bg-surface);
  font: inherit; color: var(--text-primary); transition: border-color .15s, box-shadow .15s, transform .15s; }
.office-tile:hover:not(:disabled) { border-color: var(--border-hover); box-shadow: var(--shadow-md); transform: translateY(-2px); }
.office-tile:focus-visible { outline: 3px solid var(--focus-ring); outline-offset: 2px; }
.office-tile[aria-pressed="true"] { border-color: var(--color-primary); background: var(--info-soft); }
.office-tile:disabled { cursor: not-allowed; background: var(--bg-subtle); color: var(--text-muted); }
.office-tile__top { display: flex; align-items: flex-start; justify-content: space-between; gap: var(--space-2); }
.office-tile__name { font-size: 18px; font-weight: 700; line-height: 1.5; color: var(--text-heading); }
.office-tile:disabled .office-tile__name { color: var(--text-muted); }
.office-tile__check { flex: none; width: 26px; height: 26px; border-radius: var(--radius-pill); border: 2px solid var(--border-input);
  display: grid; place-items: center; color: transparent; }
.office-tile[aria-pressed="true"] .office-tile__check { background: var(--color-primary); border-color: var(--color-primary); color: var(--white); }
.office-tile__check svg { width: 15px; height: 15px; }
.office-tile__meta { display: flex; flex-wrap: wrap; gap: var(--space-1) var(--space-3); font-size: 14px; color: var(--text-secondary); }
.office-tile__meta b { color: var(--text-primary); }
.office-tile__state { font-size: 13px; font-weight: 700; color: var(--warning); }

.issue-row { display: grid; gap: var(--space-3); }
@media (min-width: 640px) { .issue-row { grid-template-columns: minmax(0, 1fr) auto; align-items: end; } }

.issued-card { border: 2px solid var(--color-primary); }
.issued-card__number { font-size: 64px; line-height: 1; font-weight: 700; color: var(--color-primary); }
.recent-list { display: flex; flex-direction: column; }
.recent-list__row { display: flex; align-items: center; justify-content: space-between; gap: var(--space-3);
  padding: var(--space-2) 0; border-bottom: 1px solid var(--border-subtle); font-size: 14px; }
.recent-list__row:last-child { border-bottom: 0; }
.recent-list__num { font-weight: 700; color: var(--text-heading); min-width: 2.5em; }

.ticket-frame { width: 100%; height: 420px; border: 1px solid var(--border-color); border-radius: var(--radius-md); background: var(--white); }

/* ———— هاتف المكتب ———— */
.office-head { display: flex; align-items: center; justify-content: space-between; gap: var(--space-3); }
.office-count { font-size: 40px; font-weight: 700; line-height: 1; color: var(--color-primary); }
.office-count small { font-size: 20px; color: var(--text-muted); font-weight: 400; }
.inroom { display: flex; flex-direction: column; gap: var(--space-3); }
.inroom-item { display: grid; grid-template-columns: auto minmax(0, 1fr) auto; align-items: center; gap: var(--space-3);
  padding: var(--space-3) var(--space-4); border: 1px solid var(--border-color); border-radius: var(--radius-lg); background: var(--bg-surface); }
.inroom-item--new { border-color: var(--color-primary); box-shadow: 0 0 0 3px var(--forest-100); }
.inroom-item__num { min-width: 56px; padding: var(--space-2); text-align: center; border-radius: var(--radius-md);
  background: var(--info-soft); color: var(--text-heading); font-size: 22px; font-weight: 700; }
.inroom-item__name { font-weight: 700; font-size: 17px; line-height: 1.5; overflow-wrap: anywhere; }
.inroom-item__since { font-size: 13px; color: var(--text-muted); }
.inroom-item__since--late { color: var(--warning); font-weight: 700; }
.inroom-item .btn { min-height: 52px; padding-inline: var(--space-5); }

/* ———— شاشة الصالة (تلفاز 16:9) ———— */
.tv-body { margin: 0; min-height: 100vh; background: var(--bg-page); overflow: hidden; }
.tv { display: grid; grid-template-rows: auto minmax(0, 1fr); height: 100vh; padding: 2vh 2.5vw; gap: 2vh; box-sizing: border-box; }
.tv__header { display: flex; align-items: center; justify-content: space-between; gap: 2vw; padding-bottom: 1.5vh; border-bottom: 2px solid var(--border-subtle); }
.tv__brand { display: flex; align-items: center; gap: 1.5vw; }
.tv__brand img { height: 6vh; width: auto; }
.tv__title { font-size: 3.2vh; font-weight: 700; color: var(--text-heading); }
.tv__clock { font-size: 3.6vh; font-weight: 700; color: var(--text-heading); }
.tv__main { display: grid; grid-template-columns: minmax(0, 1.35fr) minmax(0, 1fr); gap: 2vw; min-height: 0; }

.tv-now { display: flex; flex-direction: column; justify-content: center; gap: 2vh; padding: 4vh 3vw; border-radius: var(--radius-xl);
  background: var(--color-primary); color: var(--white); }
.tv-now__label { font-size: 3vh; opacity: .9; }
.tv-now__number { font-size: 22vh; line-height: 1; font-weight: 700; }
.tv-now__name { font-size: 6vh; line-height: 1.3; font-weight: 700; overflow-wrap: anywhere; }
.tv-now__office { display: inline-flex; align-items: center; gap: 1.2vw; align-self: flex-start; padding: 1.2vh 2vw;
  border-radius: var(--radius-pill); background: var(--white); color: var(--text-heading); font-size: 4.4vh; font-weight: 700; }
.tv-now__repeat { font-size: 2.6vh; opacity: .85; }
.tv-now--flash { animation: tv-flash 1.2s ease-out 1; }
@keyframes tv-flash { 0% { box-shadow: 0 0 0 0 var(--gold-500); transform: scale(1.015); } 100% { box-shadow: 0 0 0 3vh transparent; transform: scale(1); } }

.tv-side { display: grid; grid-template-rows: minmax(0, 1fr) auto; gap: 2vh; min-height: 0; }
.tv-panel { background: var(--bg-surface); border: 1px solid var(--border-color); border-radius: var(--radius-xl); padding: 2.4vh 1.8vw; min-height: 0; overflow: hidden; }
.tv-panel__title { font-size: 2.8vh; font-weight: 700; color: var(--text-heading); margin: 0 0 1.4vh; }
.tv-recent { display: flex; flex-direction: column; gap: 1vh; margin: 0; padding: 0; list-style: none; }
.tv-recent li { display: grid; grid-template-columns: 9vh minmax(0, 1fr) auto; align-items: center; gap: 1.2vw;
  padding: 1vh 1vw; border-radius: var(--radius-md); background: var(--bg-page); font-size: 2.9vh; }
.tv-recent__num { font-weight: 700; font-size: 3.6vh; color: var(--color-primary); text-align: center; }
.tv-recent__name { font-weight: 700; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.tv-recent__office { color: var(--text-secondary); font-size: 2.5vh; white-space: nowrap; }
.tv-offices { display: grid; grid-template-columns: 1fr 1fr; gap: 1vh 1.4vw; }
.tv-office { display: flex; justify-content: space-between; align-items: baseline; gap: 1vw; font-size: 2.5vh; padding-bottom: .6vh; border-bottom: 1px solid var(--border-subtle); }
.tv-office b { color: var(--text-heading); }
.tv-office__closed { color: var(--text-muted); }

.sound-gate { position: fixed; inset: 0; display: grid; place-items: center; background: rgba(4, 38, 35, .55); z-index: 40; }
.sound-gate[hidden] { display: none; }

/* ———— شاشة البواب (شاشة لمس عمودية) ———— */
.door-body { background: var(--bg-page); min-height: 100vh; }
.door { max-width: 760px; margin: 0 auto; padding: var(--space-5) var(--space-4) var(--space-12); display: flex; flex-direction: column; gap: var(--space-5); }
.door__head { display: flex; align-items: center; justify-content: space-between; gap: var(--space-3); }
.door__head img { height: 44px; width: auto; }
.door-search { display: grid; gap: var(--space-3); padding: var(--space-5); border-radius: var(--radius-xl); background: var(--bg-surface); border: 1px solid var(--border-color); }
.door-search__display { min-height: 72px; display: grid; place-items: center; border-radius: var(--radius-md); border: 2px solid var(--border-input);
  background: var(--bg-input); font-size: 40px; font-weight: 700; color: var(--text-heading); letter-spacing: .08em; }
.keypad { display: grid; grid-template-columns: repeat(3, 1fr); gap: var(--space-2); direction: ltr; }
.keypad button { min-height: 64px; border-radius: var(--radius-md); border: 1px solid var(--border-color); background: var(--bg-page);
  font: inherit; font-size: 28px; font-weight: 700; color: var(--text-heading); cursor: pointer; }
.keypad button:active { background: var(--forest-100); }
.keypad .keypad__wide { font-size: 18px; }
.door-result { padding: var(--space-5); border-radius: var(--radius-xl); text-align: center; display: grid; gap: var(--space-2); }
.door-result[hidden] { display: none; }
.door-result--yes { background: var(--success-soft); border: 2px solid var(--success-border); color: var(--success); }
.door-result--no { background: var(--warning-soft); border: 2px solid var(--warning-border); color: var(--warning); }
.door-result--done { background: var(--bg-subtle); border: 2px solid var(--border-color); color: var(--text-secondary); }
.door-result__big { font-size: 30px; font-weight: 700; line-height: 1.4; }
.door-group { display: flex; flex-direction: column; gap: var(--space-2); }
.door-group__title { display: flex; justify-content: space-between; font-weight: 700; color: var(--text-heading); font-size: 18px; }
.door-row { display: grid; grid-template-columns: 64px minmax(0, 1fr) auto; gap: var(--space-3); align-items: center;
  padding: var(--space-3) var(--space-4); border-radius: var(--radius-md); background: var(--bg-surface); border: 1px solid var(--border-color); font-size: 18px; }
.door-row__num { font-size: 24px; font-weight: 700; color: var(--color-primary); text-align: center; }
.door-row--hit { border-color: var(--color-primary); box-shadow: 0 0 0 3px var(--forest-100); }

/* ———— الإعدادات ———— */
.settings-table { width: 100%; border-collapse: collapse; font-size: 15px; }
.settings-table th, .settings-table td { padding: var(--space-3) var(--space-2); border-bottom: 1px solid var(--border-subtle); text-align: start; vertical-align: middle; }
.settings-table th { font-size: 13px; color: var(--text-muted); font-weight: 700; }
.settings-table .input { min-width: 0; width: 88px; padding-block: var(--space-2); }
.settings-table .input--time { width: 112px; }
.table-scroll { overflow-x: auto; }
.link-reveal { display: flex; flex-wrap: wrap; gap: var(--space-2); align-items: center; padding: var(--space-3);
  border-radius: var(--radius-md); background: var(--success-soft); border: 1px solid var(--success-border); }
.link-reveal code { direction: ltr; font-size: 14px; overflow-wrap: anywhere; }

/* ———— البطاقة المطبوعة (طابعة حرارية 80 مم) ———— */
.ticket-body { margin: 0; background: var(--bg-subtle); }
.ticket { width: 72mm; margin: 6mm auto; padding: 4mm 3mm; background: var(--white); color: #000; text-align: center;
  font-family: var(--font-sans); font-feature-settings: normal; display: flex; flex-direction: column; gap: 2.5mm; }
.ticket img { height: 15mm; width: auto; margin: 0 auto; }
.ticket__court { font-size: 15pt; font-weight: 700; }
.ticket__label { font-size: 10pt; }
.ticket__number { font-size: 54pt; font-weight: 700; line-height: 1; }
.ticket__name { font-size: 14pt; font-weight: 700; border-top: 1px dashed #000; border-bottom: 1px dashed #000; padding: 2mm 0; overflow-wrap: anywhere; }
.ticket__offices { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 1.5mm; font-size: 12pt; font-weight: 700; }
.ticket__offices li { border: 1px solid #000; border-radius: 2mm; padding: 1.5mm; }
.ticket__hint { font-size: 9.5pt; line-height: 1.6; }
.ticket__meta { font-size: 9pt; direction: rtl; }
@page { size: 80mm auto; margin: 0; }
@media print {
  .ticket-body { background: #fff; }
  .ticket { margin: 0 auto; }
  .no-print { display: none !important; }
}

@media (prefers-reduced-motion: reduce) {
  .tv-now--flash { animation: none; }
  .office-tile { transition: none; }
}
