/* Parsbaan Cloud — ظاهرِ اپِ مشتری و پارس‌بان لایت (روی توکن‌های ui-kit.css) */

* { margin: 0; padding: 0; box-sizing: border-box; }
html { height: 100%; }
body { font-family: 'Vazirmatn', sans-serif; min-height: 100vh; }
button, input, select { font-family: inherit; }
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-thumb { background: #24302a; border-radius: 3px; }

/* ── ورود ── */
body.login-mode { display: block; overflow-y: auto !important; padding: 28px 16px 48px; }
#login-page { max-width: 440px; margin: 0 auto; display: flex; flex-direction: column; gap: 16px; align-items: stretch; }
.login-brand { text-align: center; padding: 14px 0 4px; }
.login-brand img.mark { width: 120px; height: 120px; display: block; margin: 0 auto 10px; }
.login-brand img.word { width: min(230px, 62vw); height: auto; display: block; margin: 0 auto; }
.login-brand h1 { font-size: 24px; font-weight: 900; color: var(--s-sand); letter-spacing: -0.01em; }
.login-brand p { font-size: 13px; color: var(--text2); margin-top: 4px; }
.login-card { background: var(--s-panel-solid); border: 1px solid var(--s-line); border-radius: 18px; padding: 20px; }
.login-card h2 { font-size: 16px; font-weight: 800; margin-bottom: 12px; }
.login-card label { display: block; font-size: 12px; color: var(--text2); margin-bottom: 6px; }
.login-card input[type=text] {
  width: 100%; padding: 14px; border-radius: 12px; border: 1px solid var(--s-line-2);
  background: rgba(10,13,11,0.9); color: var(--text); font-size: 17px; letter-spacing: 0.06em;
  font-family: var(--s-mono); direction: ltr; text-align: center; outline: none;
}
.login-card input[type=text]:focus { border-color: rgba(13,190,102,0.55); box-shadow: 0 0 0 4px rgba(13,190,102,0.12); }
.btn-enter { width: 100%; margin-top: 12px; padding: 14px; border: none; border-radius: 12px; font-size: 15px; font-weight: 800; cursor: pointer; }
.error-msg { min-height: 20px; font-size: 13px; color: var(--danger); margin-top: 8px; line-height: 1.8; }
.saved-list { display: flex; flex-direction: column; gap: 8px; }
.saved-item {
  display: flex; align-items: center; gap: 10px; width: 100%; text-align: right;
  padding: 11px 12px; border-radius: 12px; border: 1px solid var(--s-line); background: rgba(16,22,19,0.7);
  color: var(--text); cursor: pointer;
}
.saved-item:hover { border-color: rgba(13,190,102,0.45); }
.saved-item .pbi { color: var(--s-plum-text); }
.saved-item b { font-size: 13.5px; display: block; }
.saved-item small { font-size: 11px; color: var(--text3); font-family: var(--s-mono); direction: ltr; display: block; }
.saved-item .x { margin-inline-start: auto; color: var(--text3); background: none; border: 0; cursor: pointer; padding: 6px; }
.saved-item .x:hover { color: var(--danger); }
.login-foot { text-align: center; font-size: 11px; color: var(--text3); }

/* ── محدودیتِ گوشی ── */
.limit-box { border: 1px solid rgba(251,191,36,0.35); background: rgba(251,191,36,0.07); border-radius: 14px; padding: 14px; }
.limit-box h3 { font-size: 14px; color: var(--warning); margin-bottom: 6px; }
.limit-box p { font-size: 12.5px; color: var(--text2); line-height: 1.8; }
.device-row {
  display: flex; align-items: center; gap: 10px; padding: 10px 12px; border-radius: 12px;
  border: 1px solid var(--s-line); background: rgba(16,22,19,0.7); margin-top: 8px;
}
.device-row .pbi { color: var(--text2); width: 20px; height: 20px; }
.device-row b { font-size: 13px; display: block; }
.device-row small { font-size: 11px; color: var(--text3); display: block; }
.device-row .tag { font-size: 10.5px; color: var(--s-plum-text); border: 1px solid rgba(161,75,116,0.45); border-radius: 999px; padding: 1px 8px; }
.device-row button { margin-inline-start: auto; }

/* ── دکمه‌ها (نام‌های پنلِ محلی؛ ui-kit رنگشان می‌دهد) ── */
.refresh-btn { background: none; border: 1px solid var(--s-line-2); color: var(--text2); padding: 7px 12px; border-radius: 10px; cursor: pointer; font-size: 12.5px; display: inline-flex; align-items: center; gap: 6px; }
.refresh-btn:disabled { opacity: 0.5; cursor: wait; }
.zone-setup-btn { padding: 8px 14px; border: none; border-radius: 8px; font-weight: 700; cursor: pointer; font-size: 13px; background: var(--s-grad); display: inline-flex; align-items: center; gap: 6px; }
.zone-setup-btn:disabled { opacity: 0.5; cursor: not-allowed; }
.btn-plum { background: linear-gradient(135deg, #A14B74, #7B3456) !important; color: #fff !important; }
.btn-danger-ghost { background: none; border: 1px solid rgba(255,90,110,0.45); color: var(--danger); padding: 7px 12px; border-radius: 10px; cursor: pointer; font-size: 12.5px; }
.logout-btn { background: none; border: 1px solid var(--s-line-2); color: var(--text2); cursor: pointer; font-size: 12.5px; }

/* ── صفحه ── */
.page-header { margin-bottom: 18px; display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
.page-header h2 { font-size: 22px; font-weight: 900; }
.page-header p { color: var(--text2); font-size: 13px; margin-top: 3px; }
.dash-section { background: var(--s-panel-solid); border: 1px solid var(--s-line); border-radius: 14px; padding: 16px; }
.dash-section + .dash-section { margin-top: 14px; }
.dash-section-title { font-size: 13px; font-weight: 700; margin-bottom: 12px; display: flex; align-items: center; gap: 7px; }
.empty { text-align: center; padding: 40px 16px; color: var(--text2); font-size: 13px; }
.empty .pbi { width: 40px; height: 40px; opacity: 0.6; margin-bottom: 10px; }
.kv { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: 10px; }
.kv > div { background: var(--surface2); border: 1px solid var(--border); border-radius: 10px; padding: 10px 12px; }
.kv .k { font-size: 11px; color: var(--text2); margin-bottom: 3px; }
.kv .v { font-size: 13px; font-weight: 700; }

/* ── سوییچرِ سیستم در سایدبار ── */
.sys-switch { margin: 0 12px 6px; padding: 10px 12px; border-radius: 12px; border: 1px solid var(--s-line); background: rgba(16,22,19,0.65); display: flex; align-items: center; gap: 10px; }
.sys-switch .pbi { color: var(--s-plum-text); width: 20px; height: 20px; flex-shrink: 0; }
.sys-switch b { font-size: 13px; display: block; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.sys-switch small { font-size: 11px; color: var(--text3); display: block; }
.sys-switch button { margin-inline-start: auto; }

/* ── رویدادها به‌صورتِ کارت ── */
.ev-filters { display: flex; flex-wrap: wrap; gap: 8px; align-items: flex-end; margin-bottom: 12px; }
.ev-filters > div { min-width: 140px; flex: 1; }
.ev-filters label { font-size: 11px; color: var(--text2); display: block; margin-bottom: 4px; }
.ev-filters select, .ev-filters input { width: 100%; border-radius: 9px; padding: 9px; font-size: 12.5px; color: var(--text); border: 1px solid var(--s-line-2); background: rgba(10,13,11,0.85); }
.ev-day { font-size: 12px; color: var(--s-plum-text); margin: 14px 2px 8px; font-weight: 700; }
.ev-day:first-child { margin-top: 2px; }
.ev-list { display: grid; gap: 9px; }
.ev-card {
  display: grid; grid-template-columns: 1fr auto; gap: 6px 12px; align-items: center;
  background: var(--surface2); border: 1px solid var(--border); border-radius: 12px; padding: 11px 13px;
}
.ev-card .top { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.ev-card .cam { font-size: 12.5px; color: var(--text); font-weight: 700; }
.ev-card .time { font-size: 11.5px; color: var(--text3); font-family: var(--s-mono); direction: ltr; }
.ev-card .detail { grid-column: 1 / -1; font-size: 12px; color: var(--text2); line-height: 1.7; }
.ev-card .act { grid-row: 1 / span 2; display: flex; flex-direction: column; align-items: center; gap: 4px; }
.clip-btn {
  width: 44px; height: 44px; border-radius: 12px; cursor: pointer;
  border: 1px solid rgba(13,190,102,0.35); background: rgba(13,190,102,0.12); color: var(--accent);
  display: inline-grid; place-items: center;
}
.clip-btn .pbi { width: 20px; height: 20px; }
.clip-wait { font-size: 10.5px; color: var(--text3); text-align: center; width: 60px; line-height: 1.5; }

/* ── پخش‌کننده ── */
.remote-modal { display: none; position: fixed; inset: 0; z-index: 12000; background: rgba(0,0,0,0.86); align-items: center; justify-content: center; padding: 16px; }
.remote-modal.open { display: flex; }
.remote-modal-box { width: min(760px, 100%); max-height: 94vh; overflow: auto; background: var(--s-panel-solid); border: 1px solid var(--s-line-2); border-radius: 14px; padding: 16px; }
.player-box { width: min(1100px, 100%); background: #050706; border: 1px solid var(--s-line-2); border-radius: 14px; overflow: hidden; display: flex; flex-direction: column; max-height: 96vh; }
.player-head { display: flex; align-items: center; gap: 10px; padding: 10px 12px; border-bottom: 1px solid var(--s-line); }
.player-head strong { font-size: 14px; }
.player-head .sub { font-size: 11.5px; color: var(--text2); }
.player-head .tools { margin-inline-start: auto; display: flex; gap: 6px; }
.player-head .tools button, .player-head .tools a { width: 40px; height: 36px; border-radius: 10px; border: 1px solid var(--s-line-2); background: rgba(16,22,19,0.8); color: var(--text); display: inline-grid; place-items: center; cursor: pointer; }
.player-head .tools .pbi { width: 18px; height: 18px; }
.player-stage { position: relative; background: #000; aspect-ratio: 16 / 9; }
.player-stage video { position: absolute; inset: 0; width: 100%; height: 100%; background: #000; }
.player-status { position: absolute; inset: 0; display: none; place-items: center; text-align: center; color: var(--text); font-size: 13px; background: rgba(0,0,0,0.55); padding: 16px; line-height: 1.9; }
.player-status.show { display: grid; }
.player-status .spin { width: 28px; height: 28px; border: 3px solid rgba(255,255,255,0.2); border-top-color: var(--accent); border-radius: 50%; margin: 0 auto 10px; animation: pspin 0.9s linear infinite; }
@keyframes pspin { to { transform: rotate(360deg); } }
.player-foot { display: flex; align-items: center; gap: 8px; padding: 10px 12px; font-size: 12px; color: var(--text2); flex-wrap: wrap; }
.player-foot .pbi { width: 14px; height: 14px; }
@media (max-width: 640px) {
  .remote-modal { padding: 0; align-items: flex-end; }
  .player-box { border-radius: 14px 14px 0 0; max-height: 100vh; }
  .remote-modal-box { border-radius: 14px 14px 0 0; max-height: 96vh; }
}

/* ── کنترلِ از راه دور (از نسخه‌ی قبل) ── */
.remote-camera { padding: 14px 0; border-bottom: 1px solid var(--border); }
.remote-camera:last-child { border-bottom: 0; }
.remote-toggle { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 9px 0; font-size: 13px; }
.remote-toggle input { appearance: none; width: 42px; height: 22px; border-radius: 12px; background: #1b2420; border: 1px solid #33423a; cursor: pointer; position: relative; transition: .18s; flex: 0 0 42px; }
.remote-toggle input::before { content: ''; position: absolute; width: 16px; height: 16px; border-radius: 50%; background: #8fae9c; top: 2px; right: 3px; transition: .18s; }
.remote-toggle input:checked { background: #0a7a44; border-color: #0DBE66; }
.remote-toggle input:checked::before { right: 21px; background: #eafff2; }
.remote-toggle input:disabled { opacity: .55; cursor: wait; }
.remote-field { width: 100%; background: rgba(10,13,11,0.85); border: 1px solid var(--s-line-2); color: var(--text); border-radius: 9px; padding: 10px; font: inherit; }
.remote-field-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
@media (max-width: 600px) { .remote-field-grid { grid-template-columns: 1fr; } }
#cloud-bh-weekdays label { display: inline-flex; align-items: center; gap: 4px; font-size: 12px; color: var(--text2); margin-inline-end: 6px; }

/* ── نوارِ اعتبار ── */
.days-bar-wrap { background: var(--s-panel-solid); border: 1px solid var(--s-line); border-radius: 12px; padding: 14px 18px; display: flex; align-items: center; gap: 14px; }
.days-bar-bg { flex: 1; height: 6px; background: var(--surface2); border-radius: 3px; overflow: hidden; }
.days-bar-fill { height: 100%; border-radius: 3px; transition: width 1s ease; }
.days-label { font-size: 12px; color: var(--text2); white-space: nowrap; }
.days-label span { color: var(--accent); font-weight: 700; font-size: 14px; }

/* ── توست ── */
#toast { position: fixed; bottom: 22px; left: 50%; transform: translateX(-50%) translateY(20px); padding: 11px 20px; border-radius: 999px; background: var(--surface3); border: 1px solid var(--s-line-2); font-size: 13.5px; font-weight: 600; opacity: 0; pointer-events: none; transition: all .25s; z-index: 20000; color: var(--text); }
#toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }
#toast.err { border-color: rgba(255,90,110,.5); color: #ffb3bd; }
#toast.ok { border-color: rgba(13,190,102,.5); color: #a7f3d0; }

/* ── اعلان‌ها (فهرستِ تازه‌ها + تنظیم) ── */
.notif-row { display: flex; align-items: center; gap: 10px; padding: 11px 12px; border-radius: 12px; border: 1px solid var(--s-line); background: rgba(16,22,19,0.7); }
.notif-row + .notif-row { margin-top: 8px; }
.notif-row .pbi { width: 22px; height: 22px; color: var(--s-plum-text); flex-shrink: 0; }
.notif-row b { font-size: 13px; display: block; }
.notif-row small { font-size: 11.5px; color: var(--text2); display: block; line-height: 1.7; }
.notif-row .act { margin-inline-start: auto; }
.tab-count { display: inline-grid; place-items: center; min-width: 18px; height: 18px; padding: 0 5px; border-radius: 999px; background: var(--danger); color: #fff; font-size: 10.5px; font-weight: 800; margin-inline-start: 5px; vertical-align: middle; }
.tab-count:empty { display: none; }

/* ── پارس‌بان لایت: آلویی به‌جای سبز در عناصرِ تعاملی (ui-kit با !important سبز می‌کند؛ این‌جا هم !important) ── */
body.lite { --accent: #D18FB1; --s-signal: #A14B74; --s-grad: linear-gradient(135deg, #A14B74 0%, #7B3456 100%); --s-grad-soft: linear-gradient(135deg, rgba(161,75,116,0.22), rgba(123,52,86,0.34)); --s-glow: 0 0 0 1px rgba(161,75,116,0.16), 0 8px 24px rgba(0,0,0,0.28); }
body.lite .btn-enter, body.lite .zone-setup-btn, body.lite .btn-primary { color: #fff !important; }
body.lite .clip-btn { border-color: rgba(161,75,116,0.5); background: rgba(161,75,116,0.16); color: #D18FB1; }
body.lite .login-card input[type=text]:focus, body.lite #license-input:focus { border-color: rgba(161,75,116,0.6) !important; box-shadow: 0 0 0 4px rgba(161,75,116,0.14) !important; }
body.lite .player-status .spin { border-top-color: #D18FB1; }
body.lite .refresh-btn:hover { border-color: rgba(161,75,116,0.55) !important; color: #D18FB1 !important; }
body.lite .dash-section:hover { border-color: rgba(161,75,116,0.30) !important; }
body.lite .saved-item:hover { border-color: rgba(161,75,116,0.5); }
body.lite .days-label span { color: #D18FB1; }
body.lite .ev-day { color: var(--s-sand); }
body.lite .sidebar::before { background: radial-gradient(200px 120px at 80% 0%, rgba(161,75,116,0.14), transparent 70%); }
body.lite .remote-toggle input:checked { background: #7B3456; border-color: #A14B74; }
.lite-bar { position: sticky; top: 0; z-index: 50; display: flex; align-items: center; gap: 10px; padding: 10px 14px; background: rgba(7,10,9,0.94); border-bottom: 1px solid var(--s-line); backdrop-filter: blur(10px); }
.lite-bar img { width: 38px; height: 38px; flex-shrink: 0; }
.lite-bar .name { font-weight: 900; font-size: 15px; color: var(--s-sand); line-height: 1.2; }
.lite-bar .name small { display: block; font-weight: 600; font-size: 11px; color: var(--s-plum-text); margin-top: 2px; }
.lite-bar .who { margin-inline-start: auto; text-align: left; font-size: 11.5px; color: var(--text2); max-width: 40%; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.lite-bar .logout-btn { padding: 7px 10px; border-radius: 10px; display: inline-flex; align-items: center; gap: 5px; }
.lite-main { max-width: 760px; margin: 0 auto; padding: 14px 14px 80px; }
.lite-tabs { display: flex; gap: 6px; margin-bottom: 12px; }
.lite-tabs button { flex: 1; padding: 10px; border-radius: 999px; border: 1px solid var(--s-line-2); background: transparent; color: var(--text2); font-size: 13px; font-weight: 700; cursor: pointer; display: inline-flex; align-items: center; justify-content: center; gap: 6px; }
.lite-tabs button.active { background: var(--s-grad); color: #fff; border-color: transparent; }
.lite-tabs button.active .tab-count { background: #fff; color: #7B3456; }
.lite-note { font-size: 11.5px; color: var(--text3); text-align: center; margin-top: 18px; line-height: 1.8; }
.lite-status { display: flex; align-items: center; gap: 8px; font-size: 12px; color: var(--text2); margin-bottom: 12px; }
.lite-status .dot { width: 8px; height: 8px; border-radius: 50%; background: var(--text3); }
.lite-status .dot.on { background: var(--success); box-shadow: 0 0 10px rgba(47,217,138,0.6); }
.lite-status .dot.off { background: var(--danger); }
.login-brand .lite-tag { display: inline-block; margin-top: 8px; font-size: 11.5px; font-weight: 700; color: var(--s-plum-text); border: 1px solid rgba(161,75,116,0.45); border-radius: 999px; padding: 2px 12px; }
