/* Self-hosted Inter (latin subset). No external requests — the server may not
   have outbound internet access in production. */
@font-face {
  font-family: 'Inter';
  font-style: normal;
  font-weight: 400 700;
  font-display: swap;
  src: url('/lib/inter/inter-latin.woff2') format('woff2');
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA,
                 U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122,
                 U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}

:root {
  --cms-sidebar-w: 230px;
  --etisalat-red: #E00800;
  --etisalat-red-dark: #b30600;
  --etisalat-red-light: #ed5b55;
  --etisalat-red-soft: #fdecec;
  --cms-sidebar-bg: #ffffff;
  --cms-sidebar-fg: #374151;
  --cms-sidebar-fg-active: var(--etisalat-red);
  --cms-sidebar-active-bg: var(--etisalat-red-soft);
  --cms-sidebar-border: #e5e7eb;
  --cms-topbar-h: 56px;
  --cms-accent: var(--etisalat-red);
}

html, body { height: 100%; }
body, .cms-body {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI',
               Roboto, 'Helvetica Neue', Arial, sans-serif;
  font-feature-settings: 'cv02', 'cv03', 'cv04', 'cv11';
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  letter-spacing: -0.005em;
}
.cms-body { margin: 0; background: #f3f5f8; min-height: 100vh; font-size: 14px; color: #111827; }

.cms-public {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background: #f5f5f5;
}

/* Override Bootstrap primary buttons / focus rings with the Etisalat red */
.btn-primary {
  --bs-btn-bg: var(--etisalat-red);
  --bs-btn-border-color: var(--etisalat-red);
  --bs-btn-hover-bg: var(--etisalat-red-dark);
  --bs-btn-hover-border-color: var(--etisalat-red-dark);
  --bs-btn-active-bg: var(--etisalat-red-dark);
  --bs-btn-active-border-color: var(--etisalat-red-dark);
}
.btn-outline-primary {
  --bs-btn-color: var(--etisalat-red);
  --bs-btn-border-color: var(--etisalat-red);
  --bs-btn-hover-bg: var(--etisalat-red);
  --bs-btn-hover-border-color: var(--etisalat-red);
  --bs-btn-active-bg: var(--etisalat-red-dark);
  --bs-btn-active-border-color: var(--etisalat-red-dark);
}
a, .btn-link { color: var(--etisalat-red); }
a:hover, .btn-link:hover { color: var(--etisalat-red-dark); }
.form-check-input:checked { background-color: var(--etisalat-red); border-color: var(--etisalat-red); }
.form-control:focus, .form-check-input:focus { border-color: var(--etisalat-red); box-shadow: 0 0 0 0.15rem rgba(224,8,0,0.18); }

.cms-sidebar {
  position: fixed; top: 0; left: 0; bottom: 0;
  width: var(--cms-sidebar-w);
  background: var(--cms-sidebar-bg);
  color: var(--cms-sidebar-fg);
  padding: 0;
  overflow-y: auto;
  border-right: 1px solid var(--cms-sidebar-border);
}
.cms-brand {
  padding: 1rem 1.25rem;
  font-size: 1.1rem; font-weight: 600;
  border-bottom: 1px solid var(--cms-sidebar-border);
  color: var(--etisalat-red);
}
.cms-sidebar .nav-link {
  color: var(--cms-sidebar-fg);
  padding: 0.6rem 1.25rem;
  border-left: 3px solid transparent;
  transition: background-color .12s ease, color .12s ease;
}
.cms-sidebar .nav-link:hover {
  color: var(--etisalat-red);
  background: var(--etisalat-red-soft);
}
.cms-sidebar .nav-link.active,
.cms-sidebar .nav-link[aria-current="page"] {
  color: #ffffff;
  background: var(--etisalat-red-light);
  border-left-color: var(--etisalat-red);
  font-weight: 600;
}
.cms-sidebar .nav-link.active:hover,
.cms-sidebar .nav-link[aria-current="page"]:hover {
  color: #ffffff;
  background: var(--etisalat-red);
}
.cms-sidebar-sep {
  list-style: none;
  border-top: 1px solid var(--cms-sidebar-border);
  margin: 0.6rem 0;
}
/* Server-side validation failures: ASP.NET Core's TagHelper adds .input-validation-error
   to inputs with ModelState errors. We alias it to Bootstrap's .is-invalid look so the
   user immediately sees which fields blocked the save. */
.input-validation-error,
.input-validation-error:focus {
  border-color: var(--bs-danger, #dc3545) !important;
  box-shadow: 0 0 0 .15rem rgba(220, 53, 69, .18) !important;
}
.field-validation-error {
  color: var(--bs-danger, #dc3545);
  font-size: .82rem;
}

/* Indented child entries (e.g. Bundles > Categories/Services/Packages/Plans) */
.cms-sidebar .nav-link.cms-sub {
  padding-left: 2.25rem;
  font-size: 0.92rem;
}

/* ---------------------------------------------------------------------------
   Collapsible sidebar trees.
   Markup:
     <li class="cms-tree [cms-tree--open]" data-tree="ID">
       <a class="nav-link …">
         …icon…&nbsp;Parent label
         <i class="bi bi-chevron-right cms-tree-chevron" data-tree-toggle="ID"></i>
       </a>
     </li>
     <li class="cms-tree-child" data-tree-parent="ID"><a class="nav-link cms-sub" …></a></li>

   Default state: collapsed (children hidden). When .cms-tree--open is set on
   the parent <li>, all children with matching data-tree-parent become visible
   and the chevron rotates 90°. site.js wires the click handler.
   --------------------------------------------------------------------------- */
.cms-tree .cms-tree-chevron {
  float: right;
  margin-top: 4px;
  margin-right: 2px;
  font-size: .8rem;
  transition: transform .18s ease;
  cursor: pointer;
  padding: 2px 6px;
  border-radius: 4px;
}
.cms-tree .cms-tree-chevron:hover {
  background: rgba(0,0,0,.06);
}
.cms-tree--open .cms-tree-chevron {
  transform: rotate(90deg);
}
/* Hide all tree children by default — site.js adds .cms-tree-child--show on
   children whose parent .cms-tree has .cms-tree--open. */
.cms-tree-child { display: none; }
.cms-tree-child--show { display: list-item; }

/* "Reports" parent toggle has no destination page — clicking it should NOT
   navigate, only collapse/expand. Style cursor accordingly. */
.cms-tree-parent-toggle { cursor: pointer; }

.cms-topbar {
  position: fixed; top: 0; right: 0; left: var(--cms-sidebar-w);
  height: var(--cms-topbar-h);
  background: #fff;
  border-bottom: 1px solid #e5e7eb;
  display: flex; align-items: center; justify-content: space-between;
  padding: 0 1.25rem;
  z-index: 10;
}
.cms-topbar-title { font-weight: 600; font-size: 1.05rem; }

.cms-main {
  margin-left: var(--cms-sidebar-w);
  padding: calc(var(--cms-topbar-h) + 1rem) 1.25rem 1.25rem;
  min-height: 100vh;
}

.cms-login-card {
  width: 380px;
  padding: 2rem;
  border-radius: 0.75rem;
  background: #fff;
  box-shadow: 0 10px 30px rgba(0,0,0,0.2);
}
.cms-login-title {
  display: flex; align-items: center; gap: .5rem;
  font-size: 1.2rem; font-weight: 600;
  margin-bottom: 1.25rem;
}

.cms-card { background: #fff; border: 1px solid #e5e7eb; border-radius: .5rem; padding: 1rem; }
.cms-section-title { font-size: 0.85rem; text-transform: uppercase; color: #6b7280; margin-bottom: .5rem; letter-spacing: .04em; }

.table-actions { width: 1%; white-space: nowrap; }
.badge-roles { font-weight: 500; }

.kpi-card {
  background: #fff;
  border: 1px solid #e5e7eb;
  border-radius: .5rem;
  padding: 1rem 1.1rem;
  height: 100%;
}
.kpi-card.kpi-primary {
  background: linear-gradient(135deg, var(--etisalat-red), var(--etisalat-red-dark));
  color: #fff;
  border-color: transparent;
}
.kpi-card.kpi-primary .kpi-label,
.kpi-card.kpi-primary .kpi-foot { color: rgba(255,255,255,0.85); }
.kpi-label { font-size: 0.78rem; text-transform: uppercase; color: #6b7280; letter-spacing: .04em; }
.kpi-value { font-size: 1.9rem; font-weight: 600; line-height: 1.2; margin-top: .1rem; }
.kpi-foot  { font-size: 0.75rem; color: #9ca3af; }

.customer-msisdn { font-family: ui-monospace, "SFMono-Regular", Menlo, monospace; }
.cms-pager { display: flex; align-items: center; gap: .25rem; }
.cms-pager .page-info { font-size: .82rem; color: #6b7280; margin: 0 .5rem; }

.text-na { font-style: italic; color: #9ca3af; }

.banner-thumb {
  height: 44px;
  max-width: 130px;
  object-fit: contain;
  border: 1px solid #e5e7eb;
  border-radius: 4px;
  background: #f9fafb;
  cursor: zoom-in;
}
.banner-preview {
  max-height: 160px;
  max-width: 100%;
  object-fit: contain;
  border: 1px solid #e5e7eb;
  border-radius: 4px;
  background: #f9fafb;
  display: block;
  margin-top: .25rem;
}
/* CMS listing tables: cleaner look — no zebra striping, generous row padding,
   muted header, soft separators. Targets .cms-card .table so every page picks
   it up without changing markup. */
.cms-card .table {
  margin-bottom: 0;
  color: #111827;
  --bs-table-bg: transparent;
}
.cms-card .table > thead > tr > th {
  background: transparent;
  color: #6b7280;
  font-weight: 500;
  font-size: 0.8rem;
  text-transform: none;
  letter-spacing: 0;
  padding: 0.9rem 0.85rem;
  border-bottom: 1px solid #e5e7eb;
  white-space: nowrap;
}
.cms-card .table > tbody > tr > td {
  padding: 0.95rem 0.85rem;
  vertical-align: middle;
  border-bottom: 1px solid #f1f3f5;
  border-top: 0;
  background: transparent;
}
.cms-card .table > tbody > tr:last-child > td {
  border-bottom: 0;
}
/* Override Bootstrap's .table-sm compactness so it matches the new spacing. */
.cms-card .table.table-sm > thead > tr > th,
.cms-card .table.table-sm > tbody > tr > td {
  padding: 0.9rem 0.85rem;
}
/* Subtle zebra striping — alternate rows get a soft grey background.
   Cell-level (> *) so it wins against Bootstrap's --bs-table-bg variable. */
.cms-card .table > tbody > tr:nth-child(even) > * {
  background-color: #f8fafc;
}
.cms-card .table.table-hover > tbody > tr:hover > * {
  background-color: #eef2f7;
}
/* Make the first text cell (typically the name/identifier) read as a strong primary anchor. */
.cms-card .table > tbody > tr > td:first-child {
  font-weight: 600;
  color: #111827;
}
/* Keep the leading numeric/MSISDN column in its monospace identity but still bold. */
.cms-card .table > tbody > tr > td.customer-msisdn {
  font-weight: 600;
}

/* Pill-shaped, softer badges — match the screenshot's status chips. */
.cms-card .badge {
  font-weight: 500;
  font-size: 0.75rem;
  padding: 0.4em 0.75em;
  border-radius: 999px;
  letter-spacing: 0;
}

/* Softer, more rounded buttons & inputs across the CMS. We only set the outer
   .btn / .form-control radius and let Bootstrap's own input-group rules round
   the right segments at the join — overriding those was distorting the search
   bars. */
.btn,
.btn-sm,
.form-control,
.form-control-sm,
.form-select,
.form-select-sm {
  border-radius: 0.55rem;
}
.btn-lg { border-radius: 0.7rem; }
/* Bootstrap's .btn-close (toast/modal X) is also a .btn — keep it round. */
.btn-close { border-radius: 50%; }

/* Global loader overlay (shown by site.js when forms tagged .cms-loader-form
   submit or links tagged .cms-loader-link are clicked). Pages with heavy DB
   queries use this so the operator gets immediate feedback instead of a blank
   browser progress bar. */
.cms-loader {
  position: fixed; inset: 0;
  background: rgba(255, 255, 255, 0.78);
  backdrop-filter: blur(2px);
  z-index: 1090;
  display: flex; align-items: center; justify-content: center;
  animation: cms-loader-fade .15s ease-out;
}
.cms-loader.d-none { display: none !important; }
.cms-loader-box {
  background: #fff;
  border: 1px solid #e5e7eb;
  border-radius: .75rem;
  padding: 1.4rem 1.8rem;
  box-shadow: 0 10px 30px rgba(0,0,0,0.12);
  text-align: center;
  min-width: 260px;
}
.cms-loader-text { font-size: .85rem; color: #4b5563; }
@@keyframes cms-loader-fade { from { opacity: 0; } to { opacity: 1; } }

.banner-thumb-empty {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  height: 44px;
  width: 80px;
  background: #f3f4f6;
  border: 1px dashed #d1d5db;
  border-radius: 4px;
  color: #9ca3af;
  font-size: .7rem;
}
