* { box-sizing: border-box; margin: 0; padding: 0; }
html, body { height: 100%; }
body { font-family: "Plex Arabic", "Segoe UI", Tahoma, "Noto Sans Arabic", "Geeza Pro", Arial, sans-serif; background: #111; color: #fff; }
button { font-family: inherit; cursor: pointer; border: 0; }

/* ===== الخطوط (محلية، تعمل بدون إنترنت) ===== */
@font-face { font-family: "Plex Arabic"; src: url("assets/fonts/IBMPlexSansArabic-Regular.ttf") format("truetype"); font-weight: 400; }
@font-face { font-family: "Plex Arabic"; src: url("assets/fonts/IBMPlexSansArabic-SemiBold.ttf") format("truetype"); font-weight: 600; }
@font-face { font-family: "Raleway"; src: url("assets/fonts/Raleway.ttf") format("truetype"); font-weight: 100 900; }

/* ===== شاشة القاعة (حسب التصميم المعتمد) ===== */
.room-page { overflow: hidden; user-select: none; -webkit-user-select: none; -webkit-tap-highlight-color: transparent; font-family: "Plex Arabic", Tahoma, sans-serif; }
#screen { position: relative; height: 100vh; width: 100vw; overflow: hidden; background: var(--c); transition: background .6s; color: #fff; }
.pattern { position: absolute; right: 0; bottom: 0; width: 61vw; aspect-ratio: 660 / 214; background: url("assets/pattern.svg") no-repeat right bottom / contain; opacity: .35; pointer-events: none; }
.top-time, .top-date { position: absolute; top: 7.3vh; font-size: 4.65vh; font-weight: 400; line-height: 1.2; }
.top-time { right: 6.1vw; }
.top-date { left: 6.1vw; }
.room-name { position: absolute; top: 15.05vh; right: 6.1vw; max-width: 60vw; font-size: 4.65vh; font-weight: 600; line-height: 1.3; }
.status-box { position: absolute; top: 36.7vh; right: 6.1vw; max-width: 70vw; text-align: right; }
.status-label { font-size: 15.9vh; font-weight: 400; line-height: 1.25; white-space: nowrap; }
.status-note { font-size: 3.6vh; opacity: .9; margin-top: .5vh; }
.status-note:empty { display: none; }
.room-num { position: absolute; left: 6vw; bottom: 10.2vh; font-family: "Raleway", sans-serif; font-weight: 400; font-size: 50.5vh; line-height: .72; direction: ltr; }
/* الأرقام 3 4 5 7 9 تنزل تحت السطر في خط Raleway، فنرفعها لتطابق التصميم */
.room-num.desc { bottom: 18.6vh; }
.offline { position: absolute; top: 1.5vh; left: 50%; transform: translateX(-50%); background: rgba(0,0,0,.35); padding: .6vh 2vw; border-radius: 1vh; font-size: 2.4vh; color: #ffd54f; }
.offline[hidden] { display: none; }
.ctrl-btn { position: absolute; right: 2.5vw; bottom: 2.5vh; width: 7vh; height: 7vh; border-radius: 50%; background: rgba(255,255,255,.14); color: rgba(255,255,255,.75); font-size: 3.6vh; line-height: 7vh; }

.overlay { position: fixed; inset: 0; background: rgba(0,0,0,.75); display: flex; align-items: center; justify-content: center; z-index: 10; }
.overlay[hidden] { display: none; }
.panel { font-family: "Plex Arabic", Tahoma, sans-serif; background: #1e1e1e; border-radius: 3vh; padding: 4vh 4vw; text-align: center; width: min(420px, 90vw); }
.panel.wide { width: min(760px, 94vw); }
.panel h2 { font-size: 4vh; margin-bottom: 2vh; }
.pin-dots { font-size: 5vh; letter-spacing: 1vw; margin-bottom: 1vh; direction: ltr; }
.pin-msg { color: #ff6b6b; min-height: 3.5vh; font-size: 2.6vh; }
.keypad { display: grid; grid-template-columns: repeat(3, 1fr); gap: 1.5vh; direction: ltr; margin: 1vh 0 2vh; }
.key { font-size: 4.5vh; padding: 2vh 0; border-radius: 1.5vh; background: #333; color: #fff; }
.key:active { background: #555; }
.status-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 2vh; margin-bottom: 2vh; }
.status-btn { background: var(--c); color: #fff; font-size: 4.5vh; font-weight: 800; padding: 4vh 0; border-radius: 2vh; }
.status-btn:active { filter: brightness(1.2); }
#noteInput { width: 100%; font: inherit; font-size: 2.8vh; padding: 1.8vh; border-radius: 1.5vh; border: 0; margin-bottom: 1vh; }
.btn-close { background: #444; color: #fff; font-size: 2.8vh; padding: 1.5vh 5vw; border-radius: 1.5vh; }

/* ===== لوحة التحكم ===== */
.admin-page { background: #f2f3f5; color: #222; min-height: 100%; }
.admin-head { display: flex; flex-wrap: wrap; gap: 16px; align-items: center; justify-content: space-between; padding: 16px 24px; background: #fff; box-shadow: 0 1px 4px rgba(0,0,0,.08); }
.admin-head h1 { font-size: 22px; }
.legend { display: flex; gap: 14px; font-size: 14px; }
.legend span::before { content: ""; display: inline-block; width: 12px; height: 12px; border-radius: 3px; background: var(--c); margin-left: 6px; vertical-align: -1px; }
.logout { color: #555; text-decoration: none; border: 1px solid #ccc; padding: 6px 14px; border-radius: 8px; }
.admin-msg { color: #c62828; text-align: center; font-weight: 700; min-height: 8px; padding-top: 8px; }
.hint { padding: 16px 24px 0; }
.room-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 16px; padding: 16px 24px 32px; }
.card { background: #fff; border-radius: 14px; padding: 14px; border-top: 10px solid var(--c); box-shadow: 0 1px 4px rgba(0,0,0,.08); display: flex; flex-direction: column; gap: 8px; }
.card.link { color: inherit; text-decoration: none; }
.card-top { display: flex; gap: 8px; align-items: center; }
.card-top a { text-decoration: none; font-size: 20px; color: #555; }
.card .name { flex: 1; min-width: 0; width: 100%; font: inherit; font-size: 18px; font-weight: 700; border: 1px solid transparent; border-radius: 6px; padding: 4px 6px; }
.card .name:hover, .card .name:focus { border-color: #ccc; }
.card-status { background: var(--c); color: #fff; font-size: 22px; font-weight: 800; text-align: center; padding: 14px 0; border-radius: 10px; }
.card .note { font: inherit; font-size: 14px; padding: 8px; border: 1px solid #ddd; border-radius: 8px; }
.card-btns { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; }
.mini { background: #eee; color: #333; font-size: 14px; padding: 8px 0; border-radius: 8px; border-right: 6px solid var(--c); }
.mini.on { background: var(--c); color: #fff; font-weight: 700; }
.card small { color: #888; font-size: 12px; }
.login { max-width: 340px; margin: 18vh auto; background: #fff; padding: 32px; border-radius: 14px; display: flex; flex-direction: column; gap: 14px; text-align: center; box-shadow: 0 2px 10px rgba(0,0,0,.1); }
.login input, .login button { font: inherit; font-size: 18px; padding: 12px; border-radius: 8px; border: 1px solid #ccc; }
.login button { background: #1e9e4a; color: #fff; border: 0; }
.err { color: #c62828; }
.card-top .num { background: var(--c); color: #fff; font-weight: 700; font-size: 16px; min-width: 30px; text-align: center; padding: 3px 6px; border-radius: 6px; }
