/*
 * Bitech client area — WinDOORS skin.
 *
 * Loaded AFTER huraga.css, so this file only has to restate what differs. It
 * re-skins the logged-in client area (layout_default) into the WinDOORS app
 * shell: tinted page background, fixed white sidebar with an accent bar on the
 * active item, and a raised white content panel.
 *
 * Tokens are copied verbatim from the WinDOORS source (assets/scss/style.css)
 * so the two stay in step; the theme colour already matches the Bitech brand
 * (#015EC2 / #91C300), which is why the storefront needs no changes.
 *
 * Scoped to body.wd — the storefront (layout_storefront) never gets this class,
 * so its existing landing.css design is untouched.
 *
 * GRID CAVEAT: huraga ships a tree-shaken Bootstrap (assets/build/css/vendor.css)
 * that only contains the column classes the stock templates happened to use.
 * `col-6`, `col-lg-5` and `col-lg-7` are among the MISSING ones — using them
 * silently collapses the row to full-width instead of erroring. Before adding a
 * column class to a client template, check it exists:
 *     grep -c '\.col-lg-5[,{ ]' themes/huraga/assets/build/css/vendor.css
 * Known-good: col-12, col-3, col-sm-2/3/4/6/8/9/10/12, col-md-2/4/5/6/7/8/9/10/12,
 * col-lg-3/4/9, col-xl-3.
 */

:root {
  --wd-theme: #015EC2;
  --wd-theme-rgb: 1, 94, 194;
  --wd-theme-darken: #003f83;
  --wd-green: #91C300;
  --wd-red: #f03d4f;
  --wd-yellow: #ffc107;
  --wd-cyan: #00C2FF;
  --wd-sidebar-width: 260px;
  --wd-rounded: 0.35rem;
  --wd-surface: #ffffff;
  --wd-text: #111111;
  --wd-text-muted: #666666;
  --wd-border: rgba(0, 0, 0, 0.085);
  --wd-shadow: 0 0.05rem 0.05rem rgba(0, 0, 0, 0.035), 0 0.1rem 0.2rem rgba(0, 0, 0, 0.065);
}

[data-bs-theme="dark"] {
  --wd-surface: #1b1f24;
  --wd-text: #e9ecef;
  --wd-text-muted: #9aa4b0;
  --wd-border: rgba(255, 255, 255, 0.1);
  --wd-shadow: 0 0.05rem 0.05rem rgba(0, 0, 0, 0.25), 0 0.1rem 0.2rem rgba(0, 0, 0, 0.35);
}

/* ------------------------------------------------------------------ shell */

/* The page tint is only 8.5% opaque, so whatever the browser paints as the
   canvas shows through it. The layout ships <meta name="color-scheme"
   content="light dark">, which lets a browser in OS dark mode paint that canvas
   black — the tint then composites to near-black while every opaque surface
   (sidebar, header, cards, hero) stays light, so the page looks broken rather
   than dark. Pin the canvas to the theme actually in use; landing.css does the
   same for body.storefront. */
html:has(body.wd) {
  color-scheme: light;
}

html[data-bs-theme="dark"]:has(body.wd) {
  color-scheme: dark;
}

body.wd {
  background-color: rgba(var(--wd-theme-rgb), 0.085);
  color: var(--wd-text);
}

[data-bs-theme="dark"] body.wd {
  background-color: #12151a;
}

/* The theme's own .container wrappers would cap the shell at ~1140px and
   re-centre it; the app shell is full-bleed instead. */
body.wd > .container,
body.wd > .container > .container {
  max-width: none;
  width: 100%;
  padding: 0;
  margin: 0;
}

.wd-shell {
  display: flex;
  align-items: flex-start;
  min-height: 100vh;
  gap: 0;
}

/* ---------------------------------------------------------------- sidebar */

.wd-sidebar {
  width: var(--wd-sidebar-width);
  flex: 0 0 var(--wd-sidebar-width);
  position: sticky;
  top: 0;
  height: 100vh;
  overflow-y: auto;
  padding: 1rem 0.75rem;
  background-color: var(--wd-surface);
  border-right: 1px solid var(--wd-border);
}

.wd-sidebar__brand {
  display: block;
  padding: 0.25rem 0.5rem 1.25rem;
}

.wd-sidebar__brand img {
  max-width: 150px;
  height: auto;
}

.wd-sidebar__heading {
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--wd-text-muted);
  padding: 0.75rem 0.5rem 0.35rem;
  margin: 0;
}

/* WinDOORS nav item: 40px line, rounded, 4px accent bar that slides in. */
.wd-sidebar .nav-item {
  margin-bottom: 4px;
}

.wd-sidebar .nav-link {
  display: flex;
  align-items: center;
  gap: 0.625rem;
  line-height: 40px;
  padding: 0 0.625rem;
  border-radius: var(--wd-rounded);
  color: var(--wd-text);
  position: relative;
  font-weight: 500;
  transition: background-color 0.25s ease, color 0.25s ease;
}

.wd-sidebar .nav-link::before {
  content: '';
  position: absolute;
  top: 10%;
  left: -4px;
  height: 80%;
  width: 4px;
  border-radius: 2px;
  background-color: var(--wd-theme);
  opacity: 0;
  transition: opacity 0.25s ease, left 0.25s ease;
}

.wd-sidebar .nav-link:hover {
  background-color: rgba(var(--wd-theme-rgb), 0.06);
  color: var(--wd-theme);
}

.wd-sidebar .nav-link.active {
  background-color: rgba(var(--wd-theme-rgb), 0.1);
  color: var(--wd-theme);
}

.wd-sidebar .nav-link.active::before,
.wd-sidebar .nav-link:hover::before {
  opacity: 1;
  left: 0;
}

.wd-sidebar .nav-link .icon {
  width: 20px;
  height: 20px;
  flex: 0 0 20px;
  opacity: 0.75;
}

.wd-sidebar .nav-link.active .icon {
  opacity: 1;
}

/* Balance block pinned under the nav. */
.wd-sidebar__balance {
  margin-top: 1rem;
  padding: 0.875rem 0.75rem;
  border-radius: var(--wd-rounded);
  background: linear-gradient(135deg, rgba(var(--wd-theme-rgb), 0.1), rgba(var(--wd-theme-rgb), 0.02));
}

.wd-sidebar__balance .label {
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--wd-text-muted);
}

.wd-sidebar__balance .value {
  font-size: 1.25rem;
  font-weight: 700;
  color: var(--wd-theme);
}

/* ----------------------------------------------------------------- header */

.wd-main {
  flex: 1 1 auto;
  min-width: 0;
  display: flex;
  flex-direction: column;
}

.wd-header {
  position: sticky;
  top: 0;
  z-index: 9;
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.75rem 1.25rem;
  background-color: var(--wd-surface);
  border-bottom: 1px solid var(--wd-border);
}

.wd-header__title {
  font-family: "Nunito", sans-serif;
  font-size: 1.15rem;
  font-weight: 700;
  margin: 0;
  line-height: 1.2;
}

.wd-header__subtitle {
  font-size: 0.8125rem;
  color: var(--wd-text-muted);
  margin: 0;
}

.wd-header__actions {
  margin-left: auto;
  display: flex;
  align-items: center;
  gap: 0.5rem;
  flex-shrink: 0;
}

/* Header buttons must never wrap — the cluster is allowed to be wide, the
   page title next to it is what gives way. */
.wd-header__actions .btn {
  white-space: nowrap;
}

.wd-header .wd-header__title,
.wd-header .wd-header__subtitle {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.wd-header .form-select {
  min-width: 120px;
}

/* Icon-only round buttons in the header cluster. */
.wd-iconbtn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 38px;
  height: 38px;
  border-radius: 50%;
  border: 1px solid var(--wd-border);
  background-color: transparent;
  color: var(--wd-text);
  transition: background-color 0.2s ease, color 0.2s ease;
}

.wd-iconbtn:hover {
  background-color: rgba(var(--wd-theme-rgb), 0.1);
  color: var(--wd-theme);
}

/* ------------------------------------------------------------------ page */

.wd-page {
  padding: 1.25rem;
  flex: 1 1 auto;
}

.wd-breadcrumb {
  background-color: rgba(var(--wd-theme-rgb), 0.03);
  border-radius: var(--wd-rounded);
  padding: 0.625rem 0.875rem;
  margin-bottom: 1rem;
}

.wd-breadcrumb .breadcrumb {
  margin-bottom: 0;
  font-size: 0.875rem;
}

/* Welcome banner — the WinDOORS "Welcome to your account" hero. */
.wd-hero {
  border-radius: var(--wd-rounded);
  padding: 1.75rem 1.5rem;
  margin-bottom: 1.25rem;
  background: linear-gradient(120deg, #d8e2fc 0%, #eef2fb 45%, #ffffff 100%);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1.5rem;
  flex-wrap: wrap;
}

[data-bs-theme="dark"] .wd-hero {
  background: linear-gradient(120deg, #1e2a44 0%, #1b1f24 60%, #1b1f24 100%);
}

.wd-hero__greeting {
  font-size: 1.1rem;
  color: var(--wd-text-muted);
  margin: 0;
}

.wd-hero__name {
  font-family: "Nunito", sans-serif;
  font-size: 2.25rem;
  font-weight: 700;
  line-height: 1.15;
  margin: 0;
}

.wd-hero__stats {
  display: flex;
  gap: 1.75rem;
  text-align: center;
}

.wd-hero__stat .num {
  font-size: 1.75rem;
  font-weight: 700;
  line-height: 1;
}

.wd-hero__stat .cap {
  font-size: 0.8125rem;
  color: var(--wd-text-muted);
}

/* --------------------------------------------------------------- surfaces */

body.wd .card {
  background-color: var(--wd-surface);
  border: 1px solid var(--wd-border);
  border-radius: var(--wd-rounded);
  box-shadow: var(--wd-shadow);
}

body.wd .card-header {
  background-color: transparent;
  border-bottom: 1px solid var(--wd-border);
  padding: 0.875rem 1rem;
}

body.wd .card-body {
  padding: 1rem;
}

/* Pastel rounded-square icon chip that fronts every WinDOORS card header. */
.wd-chip {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 42px;
  height: 42px;
  flex: 0 0 42px;
  border-radius: var(--wd-rounded);
  background-color: rgba(var(--wd-theme-rgb), 0.15);
  color: var(--wd-theme);
}

.wd-chip .icon {
  width: 22px;
  height: 22px;
}

.wd-chip--green { background-color: rgba(145, 195, 0, 0.18); color: #6f9600; }
.wd-chip--yellow { background-color: rgba(255, 193, 7, 0.2); color: #b98900; }
.wd-chip--red { background-color: rgba(240, 61, 79, 0.15); color: var(--wd-red); }
.wd-chip--cyan { background-color: rgba(0, 194, 255, 0.15); color: #0093c2; }

/* Stat tile: chip on the left, big number + caption on the right. */
.wd-tile {
  display: flex;
  align-items: center;
  gap: 0.875rem;
  padding: 1rem;
}

.wd-tile__num {
  font-size: 1.6rem;
  font-weight: 700;
  line-height: 1.1;
}

.wd-tile__cap {
  font-size: 0.8125rem;
  color: var(--wd-text-muted);
}

/* For tiles whose value is a date, a period label or a badge rather than a
   number — at 1.6rem those wrap out of a quarter-width tile. */
.wd-tile__num--sm {
  font-size: 1.05rem;
  font-weight: 600;
}

/* -------------------------------------------------------------- controls */

body.wd .btn {
  border-radius: var(--wd-rounded);
  font-weight: 600;
}

body.wd .btn-primary {
  background-color: var(--wd-theme);
  border-color: var(--wd-theme);
}

body.wd .btn-primary:hover,
body.wd .btn-primary:focus {
  background-color: var(--wd-theme-darken);
  border-color: var(--wd-theme-darken);
}

/* Stock huraga leans on btn-dark for secondary actions, which reads as a
   heavy black slab against this palette. Soften it into a tinted button. */
body.wd .btn-dark {
  background-color: rgba(var(--wd-theme-rgb), 0.1);
  border-color: transparent;
  color: var(--wd-theme);
}

body.wd .btn-dark:hover,
body.wd .btn-dark:focus {
  background-color: var(--wd-theme);
  border-color: var(--wd-theme);
  color: #fff;
}

body.wd .form-control,
body.wd .form-select {
  border-radius: var(--wd-rounded);
  border-color: var(--wd-border);
}

body.wd .form-control:focus,
body.wd .form-select:focus {
  border-color: var(--wd-theme);
  box-shadow: 0 0 0 0.2rem rgba(var(--wd-theme-rgb), 0.15);
}

/* ---------------------------------------------------------------- tables */

body.wd .table {
  --bs-table-bg: transparent;
  margin-bottom: 0;
}

body.wd .table > thead th {
  background-color: rgba(var(--wd-theme-rgb), 0.04);
  border-bottom: 1px solid var(--wd-border);
  color: var(--wd-text-muted);
  font-size: 0.75rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  padding: 0.75rem 1rem;
}

body.wd .table > tbody td {
  border-color: var(--wd-border);
  padding: 0.75rem 1rem;
  vertical-align: middle;
}

body.wd .table-striped > tbody > tr:nth-of-type(odd) > * {
  --bs-table-accent-bg: rgba(var(--wd-theme-rgb), 0.02);
}

body.wd .list-group-item {
  background-color: transparent;
  border-color: var(--wd-border);
  padding: 0.75rem 1rem;
}

body.wd .list-group-item:hover {
  background-color: rgba(var(--wd-theme-rgb), 0.04);
}

body.wd .badge {
  font-weight: 600;
  border-radius: 999px;
  padding: 0.35em 0.7em;
}

body.wd .alert {
  border: 0;
  border-radius: var(--wd-rounded);
}

body.wd .alert-info {
  background-color: rgba(var(--wd-theme-rgb), 0.08);
  color: var(--wd-theme-darken);
}

/* -------------------------------------------------- services / order pages */

/* Status filter strip under a card header (order list). Sits between the
   header and the body, so it carries its own bottom border. */
.wd-filters {
  display: flex;
  flex-wrap: wrap;
  gap: 0.375rem;
  padding: 0.625rem 1rem;
  border-bottom: 1px solid var(--wd-border);
}

.wd-filter {
  display: inline-block;
  padding: 0.3rem 0.75rem;
  border-radius: 999px;
  font-size: 0.8125rem;
  font-weight: 600;
  color: var(--wd-text-muted);
  text-decoration: none;
  transition: background-color 0.15s ease, color 0.15s ease;
}

.wd-filter:hover {
  background-color: rgba(var(--wd-theme-rgb), 0.08);
  color: var(--wd-theme);
}

.wd-filter.is-active {
  background-color: var(--wd-theme);
  color: #fff;
}

/* Two-line service cell: name on top, muted id/type underneath. */
.wd-svc {
  display: block;
  text-decoration: none;
  color: inherit;
}

.wd-svc__name {
  display: block;
  font-weight: 600;
  color: var(--wd-text);
}

.wd-svc:hover .wd-svc__name {
  color: var(--wd-theme);
}

.wd-svc__meta {
  font-size: 0.75rem;
  color: var(--wd-text-muted);
}

/* Renewal hint pinned next to a due date. */
.wd-due {
  display: inline-block;
  margin-left: 0.375rem;
  padding: 0.1rem 0.45rem;
  border-radius: 999px;
  font-size: 0.6875rem;
  font-weight: 700;
  white-space: nowrap;
}

.wd-due--soon {
  background-color: rgba(255, 193, 7, 0.2);
  color: #8a6800;
}

.wd-due--over {
  background-color: rgba(240, 61, 79, 0.15);
  color: var(--wd-red);
}

[data-bs-theme="dark"] .wd-due--soon { color: var(--wd-yellow); }

/* Empty state inside a card body. */
.wd-empty {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 3rem 1rem;
  text-align: center;
  color: var(--wd-text-muted);
}

/* Key/value detail list. Built on Bootstrap's dl.row — only col-sm-4/8 are
   used because those are present in the tree-shaken grid. */
.wd-kv dt {
  font-weight: 500;
  font-size: 0.8125rem;
  color: var(--wd-text-muted);
  padding-top: 0.4rem;
  padding-bottom: 0.4rem;
}

.wd-kv dd {
  margin-bottom: 0;
  padding-top: 0.4rem;
  padding-bottom: 0.4rem;
}

@media (min-width: 576px) {
  .wd-kv dt,
  .wd-kv dd {
    border-bottom: 1px solid var(--wd-border);
  }

  .wd-kv > dt:last-of-type,
  .wd-kv > dd:last-of-type {
    border-bottom: 0;
  }
}

/* Tab strip that sits flush under a card header (VPS panel). */
body.wd .wd-tabs {
  padding: 0 1rem;
  gap: 0.25rem;
  border-bottom: 1px solid var(--wd-border);
}

body.wd .wd-tabs .nav-link {
  border: 0;
  border-bottom: 2px solid transparent;
  border-radius: 0;
  padding: 0.625rem 0.5rem;
  font-weight: 600;
  font-size: 0.875rem;
  color: var(--wd-text-muted);
  background-color: transparent;
}

body.wd .wd-tabs .nav-link:hover {
  color: var(--wd-theme);
}

body.wd .wd-tabs .nav-link.active {
  color: var(--wd-theme);
  border-bottom-color: var(--wd-theme);
  background-color: transparent;
}

/* Live power-state pill with a leading dot (VPS panel). The dot colour is the
   only thing that changes between states, so the JS just swaps the modifier. */
.wd-state {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.3rem 0.7rem;
  border-radius: 999px;
  font-size: 0.8125rem;
  font-weight: 600;
  background-color: rgba(var(--wd-theme-rgb), 0.08);
  color: var(--wd-text-muted);
}

.wd-state__dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background-color: currentColor;
  flex: 0 0 8px;
}

.wd-state--on {
  background-color: rgba(145, 195, 0, 0.18);
  color: #5f8200;
}

.wd-state--off {
  background-color: rgba(240, 61, 79, 0.15);
  color: var(--wd-red);
}

.wd-state--busy {
  background-color: rgba(255, 193, 7, 0.2);
  color: #8a6800;
}

.wd-state--busy .wd-state__dot {
  animation: wd-pulse 1.2s ease-in-out infinite;
}

@keyframes wd-pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.25; }
}

[data-bs-theme="dark"] .wd-state--on { color: var(--wd-green); }
[data-bs-theme="dark"] .wd-state--busy { color: var(--wd-yellow); }

@media (prefers-reduced-motion: reduce) {
  .wd-state--busy .wd-state__dot { animation: none; }
}

/* ---------------------------------------------------------------- footer */

.wd-footer {
  padding: 1rem 1.25rem 1.5rem;
  text-align: center;
  font-size: 0.8125rem;
  color: var(--wd-text-muted);
}

/* --------------------------------------------------------------- mobile */

@media (max-width: 991.98px) {
  .wd-sidebar {
    position: fixed;
    left: 0;
    top: 0;
    z-index: 1045;
    transform: translateX(-100%);
    transition: transform 0.3s ease;
    box-shadow: var(--wd-shadow);
  }

  .wd-shell.wd-shell--open .wd-sidebar {
    transform: translateX(0);
  }

  .wd-backdrop {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.4);
    z-index: 1040;
  }

  .wd-shell--open .wd-backdrop {
    display: block;
  }

  .wd-page {
    padding: 1rem 0.875rem;
  }

  .wd-hero {
    padding: 1.25rem 1rem;
  }

  .wd-hero__name {
    font-size: 1.75rem;
  }
}

@media (min-width: 992px) {
  .wd-sidebar-toggle {
    display: none;
  }
}
