/* ===================================================================
   manage.css — أنماط نظام إدارة الحجوزات (تبويبات لوحة الإدارة)
   بتعتمد على متغيّرات :root المعرّفة في index.html (أبيض/ذهبي/فضي)
   =================================================================== */

/* ===== أدوات عامة ===== */
.hidden { display: none !important; }
.btn:disabled { opacity: .45; cursor: not-allowed; filter: none; transform: none; }
.ltr    { direction: ltr; text-align: right; unicode-bidi: plaintext; }
.green  { color: var(--green); }
.red    { color: var(--red); }
.gold   { color: var(--gold-light); }
.sub    { font-size: .78rem; color: var(--text-muted); }

/* ===== شريط التبويبات ===== */
.tabs {
  max-width: 1120px; margin: 0 auto 18px; display: flex; gap: 6px;
  background: rgb(var(--c-surface-lowest)); border: 1px solid var(--line); border-radius: 18px;
  padding: 6px; overflow-x: auto; box-shadow: 0 10px 30px rgb(var(--c-on-surface-variant) / .07);
}
.tabs::-webkit-scrollbar { height: 0; }
.tab {
  flex: 1; min-width: max-content; white-space: nowrap;
  padding: 11px 16px; border: none; border-radius: 13px; cursor: pointer;
  background: transparent; color: var(--text-muted);
  font-family: inherit; font-size: .92rem; font-weight: 700;
  transition: background .15s ease, color .15s ease;
}
.tab:hover  { background: var(--surface2); color: var(--text); }
.tab.active { background: linear-gradient(135deg, rgb(var(--c-brand-gold)), rgb(var(--c-deep-gold))); color: rgb(var(--c-on-surface)); }

/* ===== النماذج ===== */
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 0 14px; }
.grid4 { display: grid; grid-template-columns: repeat(4, 1fr); gap: 0 12px; }
@media (max-width: 620px) {
  .grid2, .grid4 { grid-template-columns: 1fr; }
}

.f { margin-bottom: 12px; }
.f > label { display: block; font-size: .86rem; color: var(--text-muted); margin: 0 0 6px; }
.f-hint { font-size: .78rem; color: var(--text-muted); margin-top: 5px; line-height: 1.7; }
.form-error { color: var(--red); font-size: .88rem; min-height: 20px; margin-top: 6px; font-weight: 600; }
.form-error b { color: var(--red); }

textarea { resize: vertical; }

.chk {
  display: flex; align-items: center; gap: 8px; cursor: pointer;
  margin: 6px 0 12px; font-size: .92rem; color: var(--text);
}
.chk input { width: auto; }

.seg { display: flex; gap: 8px; flex-wrap: wrap; }
.seg-item {
  flex: 1; min-width: 150px; display: flex; align-items: center; gap: 8px;
  padding: 11px 13px; border: 1px solid rgb(var(--c-brand-gold) / .28); border-radius: 14px;
  cursor: pointer; background: rgb(var(--c-surface-lowest)); margin: 0; font-size: .92rem; color: var(--text);
}
.seg-item input { width: auto; }
.seg-item small { color: var(--text-muted); font-size: .76rem; }
.seg-item:has(input:checked) { border-color: var(--gold); background: var(--surface2); }

.slot-note {
  background: var(--surface2); border: 1px solid rgb(var(--c-brand-gold) / .2);
  border-radius: 14px; padding: 11px 14px; margin-bottom: 12px;
  font-size: .85rem; color: var(--text-muted);
}

/* ===== شريط الأدوات فوق الجداول ===== */
.tools { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; margin-bottom: 14px; }
.tools input  { flex: 2; min-width: 200px; }
.tools select { flex: 1; min-width: 130px; }
.tools .btn   { flex-shrink: 0; }

.list-summary {
  background: var(--surface2); border: 1px solid rgb(var(--c-brand-gold) / .2);
  border-radius: 14px; padding: 10px 14px; margin-bottom: 12px; font-size: .88rem;
}

/* ===== الجداول ===== */
.tbl-wrap { overflow-x: auto; }
.tbl { width: 100%; border-collapse: collapse; font-size: .89rem; }
.tbl th, .tbl td { padding: 11px 12px; text-align: right; border-bottom: 1px solid var(--line); }
.tbl th { color: var(--text-muted); font-weight: 700; font-size: .8rem; white-space: nowrap; }
.tbl tbody tr[data-open] { cursor: pointer; }
.tbl tbody tr:hover { background: var(--surface2); }
.tbl .row-dim { opacity: .55; }
.t-empty { text-align: center; color: var(--text-muted); padding: 22px 8px; }
.t-empty.err { color: var(--red); }

.row-acts { white-space: nowrap; text-align: left; }
.ico {
  background: transparent; border: 1px solid var(--line); border-radius: 10px;
  width: 32px; height: 32px; cursor: pointer; font-size: .85rem; margin-inline-start: 4px;
  color: var(--text); transition: background .15s ease;
}
.ico:hover { background: var(--surface2); }
.ico-red { color: var(--red); border-color: rgb(var(--c-error-red) / .35); }

.tag {
  font-size: .7rem; background: var(--surface2); border: 1px solid var(--line);
  border-radius: 8px; padding: 1px 5px;
}

.badge {
  display: inline-block; padding: 3px 11px; border-radius: 999px;
  font-size: .76rem; font-weight: 700; white-space: nowrap;
  color: var(--bc, var(--gold-light));
  background: color-mix(in srgb, var(--bc, rgb(var(--c-brand-gold))) 12%, rgb(var(--c-surface-lowest)));
  border: 1px solid color-mix(in srgb, var(--bc, rgb(var(--c-brand-gold))) 40%, rgb(var(--c-surface-lowest)));
}

/* ===== التقويم ===== */
.cal-head {
  display: flex; justify-content: space-between; align-items: center;
  gap: 12px; flex-wrap: wrap; margin-bottom: 14px;
}
.cal-nav { display: flex; align-items: center; gap: 8px; }
.cal-nav .btn { padding: 8px 14px; }
.cal-title { font-weight: 800; color: var(--gold-light); font-size: 1.1rem; min-width: 130px; text-align: center; }
.cal-tools { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.cal-tools select { min-width: 150px; }

.cal-legend { display: flex; gap: 14px; flex-wrap: wrap; margin-bottom: 12px; font-size: .78rem; color: var(--text-muted); }
.cal-legend .lg { display: inline-flex; align-items: center; gap: 5px; }
.cal-legend i { width: 10px; height: 10px; border-radius: 3px; display: inline-block; }

.cal-grid { display: grid; grid-template-columns: repeat(7, 1fr); gap: 5px; }
.cal-wd {
  text-align: center; font-size: .76rem; font-weight: 700;
  color: var(--text-muted); padding: 6px 0;
}
/* min-width:0 على كل مستويات الشبكة — من غيرها عناصر الجريد بتاخد عرض
   محتواها ومابتنكمشش، والتقويم بيخرج بره الشاشة على الموبايل */
.cal-cell {
  min-height: 96px; min-width: 0; border: 1px solid var(--line); border-radius: 12px;
  padding: 5px; background: rgb(var(--c-surface-lowest)); display: flex; flex-direction: column; gap: 4px;
}
.cal-wd { min-width: 0; }
.cal-cell.out { background: transparent; border-color: transparent; min-height: 0; }
.cal-cell.today { border-color: var(--gold); box-shadow: 0 0 0 1px var(--gold) inset; }
.cal-d { display: flex; justify-content: space-between; align-items: center; font-size: .8rem; color: var(--text-muted); }
.cal-add {
  width: 20px; height: 20px; border-radius: 7px; border: 1px solid var(--line);
  background: rgb(var(--c-surface-lowest)); cursor: pointer; color: var(--gold-light); line-height: 1;
  font-size: .85rem; opacity: 0; transition: opacity .15s ease;
}
.cal-cell:hover .cal-add { opacity: 1; }
.cal-items { display: flex; flex-direction: column; gap: 3px; overflow: hidden; min-width: 0; }

.chip {
  text-align: right; border: none; border-inline-start: 3px solid var(--cc, rgb(var(--c-brand-gold)));
  background: color-mix(in srgb, var(--cc, rgb(var(--c-brand-gold))) 10%, rgb(var(--c-surface-lowest)));
  border-radius: 7px; padding: 4px 6px; cursor: pointer; font-family: inherit;
  display: flex; flex-direction: column; line-height: 1.35; overflow: hidden; min-width: 0;
}
.chip:hover { filter: brightness(.97); }
.chip.dim { opacity: .5; }
.chip-t { font-size: .74rem; font-weight: 700; color: var(--text); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.chip-s { font-size: .66rem; color: var(--text-muted); }

.cal-wd .wd-short { display: none; }

/* على الموبايل: الشبكة بتتحوّل لنقاط ملوّنة (الشاشة ضيّقة على أسماء
   الحجوزات)، والتفاصيل بتتفتح من ملخّص اليوم عند الضغط على الخانة */
@media (max-width: 620px) {
  .cal-cell { min-height: 58px; padding: 4px; cursor: pointer; }
  .cal-wd .wd-full { display: none; }
  .cal-wd .wd-short { display: inline; }
  .cal-add { display: none; }
  .cal-items { flex-direction: row; flex-wrap: wrap; gap: 4px; align-content: flex-start; }
  .chip {
    width: 9px; height: 9px; padding: 0; border-radius: 50%;
    border: none; background: var(--cc, rgb(var(--c-brand-gold)));
  }
  .chip-t, .chip-s { display: none; }
}

/* ===== مؤشرات الحسابات ===== */
.kpis { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 12px; margin-bottom: 6px; }
.kpi {
  background: var(--surface2); border: 1px solid rgb(var(--c-brand-gold) / .2);
  border-radius: 16px; padding: 14px 16px;
}
.kpi span { display: block; font-size: .8rem; color: var(--text-muted); margin-bottom: 4px; }
.kpi b { font-size: 1.25rem; font-weight: 800; }
.kpi small { font-size: .72rem; font-weight: 600; color: var(--text-muted); }

.sec-h { font-size: 1rem; font-weight: 800; color: var(--gold-light); margin: 22px 0 10px; }

/* ===== كارت الحجز ===== */
.bd-top { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin-bottom: 14px; }
.bd-sub { color: var(--text-muted); font-size: .88rem; }

.info-grid, .money-grid {
  display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: 10px; margin-bottom: 12px;
}
.info-grid > div, .money-grid > div {
  background: var(--surface2); border: 1px solid rgb(var(--c-brand-gold) / .16);
  border-radius: 14px; padding: 10px 12px;
}
.info-grid .wide, .money-grid .wide { grid-column: 1 / -1; }
.info-grid span, .money-grid span { display: block; font-size: .75rem; color: var(--text-muted); margin-bottom: 3px; }
.info-grid b, .money-grid b { font-size: .95rem; font-weight: 700; }
.money-grid b { font-size: 1.05rem; }

.bar { height: 7px; background: var(--surface2); border-radius: 999px; overflow: hidden; margin-bottom: 16px; }
.bar-fill { height: 100%; background: linear-gradient(90deg, rgb(var(--c-brand-gold)), rgb(var(--c-success-green))); transition: width .35s ease; }

.pay-form {
  background: var(--surface2); border: 1px solid rgb(var(--c-brand-gold) / .2);
  border-radius: 16px; padding: 14px; margin-top: 14px;
}
.pay-form .f { margin-bottom: 8px; }
.pay-form input, .pay-form select { padding: 9px 11px; font-size: .9rem; }

.checkin-box { margin-bottom: 6px; }
.ci-off, .ci-on {
  background: var(--surface2); border: 1px dashed rgb(var(--c-brand-gold) / .35);
  border-radius: 16px; padding: 14px; display: flex; flex-direction: column; gap: 10px;
  font-size: .9rem; color: var(--text-muted);
}
.ci-on { border-style: solid; }
.ci-row { display: flex; gap: 14px; align-items: center; flex-wrap: wrap; color: var(--text); }
.ci-row b { color: var(--gold-light); letter-spacing: 2px; }
.ci-acts { display: flex; gap: 8px; flex-wrap: wrap; }
.ci-acts .btn, .ci-off .btn { padding: 9px 16px; font-size: .88rem; }

.bd-actions { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 20px; padding-top: 16px; border-top: 1px solid var(--line); }
.bd-actions .btn { padding: 10px 15px; font-size: .88rem; }

/* ===== الاشتراك ===== */
.lic-warn {
  background: rgb(var(--c-error-red) / .08); border: 1px solid rgb(var(--c-error-red) / .3);
  color: var(--red); border-radius: 14px; padding: 12px 14px;
  margin-bottom: 14px; font-size: .9rem; font-weight: 600;
}
.lic-warn.soft {
  background: rgb(var(--c-brand-gold) / .09); border-color: rgb(var(--c-brand-gold) / .35); color: var(--gold-light);
}

/* ===== النوافذ المنبثقة (امتداد لأنماط .overlay/.modal في index.html) ===== */
.modal-wide { max-width: 780px; }
.m-head { display: flex; justify-content: space-between; align-items: center; gap: 10px; margin-bottom: 14px; }
.m-head h2 { margin: 0; text-align: right; flex: 1; }
.m-x {
  background: transparent; border: none; cursor: pointer; font-size: 1.1rem;
  color: var(--text-muted); padding: 4px 8px; border-radius: 10px;
}
.m-x:hover { background: var(--surface2); color: var(--text); }
.m-foot { display: flex; gap: 10px; justify-content: flex-start; margin-top: 18px; padding-top: 14px; border-top: 1px solid var(--line); }
.m-foot .btn { flex: 1; }
.m-confirm { color: var(--text-muted); line-height: 1.9; margin-bottom: 14px; font-size: .95rem; }

/* ===== شاشة الترخيص المعطّل ===== */
.lic-block {
  max-width: 520px; margin: 60px auto; text-align: center;
}
.lic-block .big { font-size: 2.6rem; margin-bottom: 10px; }

/* ملاحظة تحت روابط الحفل — تشرح الفرق بين الرمزين */
.link-note{ font-size:.78rem; color:var(--t-muted,rgb(var(--c-muted-gold))); line-height:1.6; margin-top:10px; }

/* خلاصة حفل محذوف على بطاقة الحجز — أرقام لا أشخاص */
.ci-summary{ background:rgb(var(--c-surface-container-low)); border:1px solid rgb(var(--c-outline-variant)); border-radius:14px; padding:12px 14px; margin-bottom:12px; }
.ci-summary-title{ font-weight:800; font-size:.9rem; color:rgb(var(--c-deep-gold)); margin-bottom:8px; }
.ci-summary-nums{ display:flex; gap:14px; flex-wrap:wrap; font-size:.9rem; }
.ci-summary-nums b{ color:rgb(var(--c-deep-gold)); }
.ci-summary-note{ font-size:.75rem; color:rgb(var(--c-muted-gold)); margin-top:8px; }


/* ===================================================================
   عنوان فرعي داخل نافذة طويلة — نافذة إعدادات الصفحة العامة تحمل
   أربع مجموعات حقول، وبلا فواصل تقرأ ككتلة واحدة لا يُعرف أولها.
   =================================================================== */
.modal-sub {
  margin: 22px 0 10px;
  padding-bottom: 7px;
  border-bottom: 1px solid var(--line, rgba(0,0,0,.08));
  font-size: .95rem;
  font-weight: 700;
  color: var(--gold, #C9A227);
}
.modal-sub:first-child { margin-top: 0; }
