/* skHadmin UI layer on top of Bootstrap 5.3 (dark theme).
   Brand tokens come from the logo (static/images/logo.svg).
   Loaded after bootstrap.min.css from templates/base.html. */

/* ---------------------------------------------------------------
   1. Brand tokens
   --------------------------------------------------------------- */
:root {
  --brand-blue: #2b94da;        /* logo wordmark, buttons */
  --brand-blue-rgb: 43, 148, 218;
  --brand-blue-light: #4fb6f6;  /* logo top face, links and text on dark */
  --brand-blue-light-rgb: 79, 182, 246;
  --brand-blue-dark: #17638f;   /* logo shadow face, hover and active */
  --brand-blue-hover: #2685c4;

  /* One company font everywhere: Space Grotesk, same as the skhosting.eu website.
     Bootstrap headings inherit it from body. */
  --bs-font-sans-serif: "Space Grotesk Variable", "Space Grotesk", ui-sans-serif, system-ui,
    -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --bs-body-font-family: var(--bs-font-sans-serif);
}

/* Map the brand onto Bootstrap. Repeated for the dark theme selector so it
   wins over Bootstrap's own [data-bs-theme=dark] block. */
:root,
[data-bs-theme="dark"] {
  --bs-primary: var(--brand-blue);
  --bs-primary-rgb: var(--brand-blue-rgb);
  --bs-link-color: var(--brand-blue-light);
  --bs-link-color-rgb: var(--brand-blue-light-rgb);
  --bs-link-hover-color: #8ccdf9;
  --bs-link-hover-color-rgb: 140, 205, 249;
  --bs-focus-ring-color: rgba(var(--brand-blue-rgb), .35);
}

[data-bs-theme="light"] {
  --bs-link-color: var(--brand-blue-dark);
  --bs-link-color-rgb: 23, 99, 143;
  --bs-link-hover-color: var(--brand-blue);
  --bs-link-hover-color-rgb: var(--brand-blue-rgb);
}
[data-bs-theme="light"] .btn-outline-primary {
  --bs-btn-color: var(--brand-blue-dark);
}
[data-bs-theme="light"] .text-primary {
  color: var(--brand-blue-dark) !important;
}

/* Components that Bootstrap colors at compile time, not through --bs-primary. */
.btn-primary {
  --bs-btn-bg: var(--brand-blue);
  --bs-btn-border-color: var(--brand-blue);
  --bs-btn-hover-bg: var(--brand-blue-hover);
  --bs-btn-hover-border-color: var(--brand-blue-hover);
  --bs-btn-active-bg: var(--brand-blue-dark);
  --bs-btn-active-border-color: var(--brand-blue-dark);
  --bs-btn-disabled-bg: var(--brand-blue);
  --bs-btn-disabled-border-color: var(--brand-blue);
  --bs-btn-focus-shadow-rgb: var(--brand-blue-rgb);
}
.btn-outline-primary {
  --bs-btn-color: var(--brand-blue-light);
  --bs-btn-border-color: var(--brand-blue);
  --bs-btn-hover-bg: var(--brand-blue);
  --bs-btn-hover-border-color: var(--brand-blue);
  --bs-btn-active-bg: var(--brand-blue-dark);
  --bs-btn-active-border-color: var(--brand-blue-dark);
  --bs-btn-disabled-color: var(--brand-blue);
  --bs-btn-disabled-border-color: var(--brand-blue);
  --bs-btn-focus-shadow-rgb: var(--brand-blue-rgb);
}
.form-control:focus,
.form-select:focus,
.form-check-input:focus {
  border-color: var(--brand-blue-light);
  box-shadow: 0 0 0 .25rem rgba(var(--brand-blue-rgb), .25);
}
.form-check-input:checked {
  background-color: var(--brand-blue);
  border-color: var(--brand-blue);
}
.form-range::-webkit-slider-thumb { background-color: var(--brand-blue); }
.form-range::-moz-range-thumb { background-color: var(--brand-blue); }
.form-range::-webkit-slider-thumb:active { background-color: #bfe0f6; }
.form-range::-moz-range-thumb:active { background-color: #bfe0f6; }
.pagination {
  --bs-pagination-color: var(--bs-link-color);
  --bs-pagination-active-bg: var(--brand-blue);
  --bs-pagination-active-border-color: var(--brand-blue);
  --bs-pagination-focus-box-shadow: 0 0 0 .25rem rgba(var(--brand-blue-rgb), .25);
}
.list-group {
  --bs-list-group-active-bg: var(--brand-blue);
  --bs-list-group-active-border-color: var(--brand-blue);
}
.nav-tabs {
  --bs-nav-tabs-link-active-color: var(--bs-body-color);
}

/* ---------------------------------------------------------------
   2. Layout: sidebar, page header, footer helpers
   --------------------------------------------------------------- */
body {
  min-height: 100vh;
}

#sidebar {
  width: 240px;
  min-height: 100vh;
  flex-shrink: 0;
  position: sticky;
  top: 0;
  height: 100vh;
  overflow-x: hidden;
  overflow-y: auto;
  background-color: var(--bs-body-bg);
  border-right: 1px solid var(--bs-border-color);
  transition: width 0.3s ease;
}
#sidebar.collapsed {
  width: 64px;
}
#sidebar .nav-link {
  color: var(--bs-body-color);
  border-radius: 0.375rem;
  padding: 0.4rem 0.75rem;
  font-size: 0.9rem;
  display: flex;
  align-items: center;
  gap: 0.5rem;
  white-space: nowrap;
}
#sidebar .nav-icon {
  width: 1.25rem;
  text-align: center;
  flex-shrink: 0;
}
#sidebar .nav-label {
  flex: 1;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
}
#sidebar .sidebar-section {
  font-size: 0.7rem;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--bs-secondary-color);
  padding: 0.9rem 0.75rem 0.25rem;
  white-space: nowrap;
}
#sidebar .sidebar-brand {
  padding: 0.25rem 0;
}
#sidebar .sidebar-logo-mark {
  display: none;
}
#sidebar .sidebar-user {
  font-size: 0.85rem;
}
#sidebar .sidebar-tools .btn {
  flex: 1;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.35rem;
  white-space: nowrap;
}
#sidebar.collapsed > div {
  padding-left: 0.5rem !important;
  padding-right: 0.5rem !important;
}
#sidebar.collapsed .nav-link {
  justify-content: center;
  padding-left: 0;
  padding-right: 0;
}
#sidebar.collapsed .nav-label,
#sidebar.collapsed .sidebar-section,
#sidebar.collapsed .nav-link .badge,
#sidebar.collapsed .sidebar-logo-full,
#sidebar.collapsed .sidebar-user-name,
#sidebar.collapsed .sidebar-tools .btn-label,
#sidebar.collapsed .sidebar-tools form {
  display: none;
}
#sidebar.collapsed .sidebar-logo-mark {
  display: inline-block;
}
#sidebar.collapsed .sidebar-tools {
  flex-direction: column;
}
#sidebar.collapsed .sidebar-user {
  justify-content: center;
}
#sidebar .nav-link:hover {
  background-color: var(--bs-secondary-bg);
}
#sidebar .nav-link.active {
  background-color: var(--bs-primary);
  color: white;
  font-weight: 600;
}
.main-content {
  flex: 1;
  min-width: 0;
}
.sidebar-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.5);
  z-index: 1039;
}
#scroll-to-top {
  position: fixed;
  bottom: 2rem;
  right: 1.5rem;
  z-index: 2000;
  width: 36px;
  height: 36px;
  border-radius: 50%;
  border: 1px solid var(--bs-border-color);
  background-color: var(--bs-body-bg);
  color: var(--bs-body-color);
  display: none;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  padding: 0;
  opacity: 0.8;
  transition: opacity 0.2s;
}
#scroll-to-top:hover {
  opacity: 1;
}
@media (max-width: 767.98px) {
  #sidebar {
    position: fixed;
    z-index: 1040;
    transform: translateX(-100%);
    transition: transform 0.3s ease;
    width: 240px !important;
    overflow-y: auto;
    overflow-x: hidden;
  }
  #sidebar.show {
    transform: translateX(0);
  }
  .sidebar-overlay.show {
    display: block;
  }
  #sidebar.collapsed {
    width: 240px;
  }
  #sidebar.collapsed .nav-label,
  #sidebar.collapsed .sidebar-section,
  #sidebar.collapsed .nav-link .badge,
  #sidebar.collapsed .sidebar-logo-full,
  #sidebar.collapsed .sidebar-user-name,
  #sidebar.collapsed .sidebar-tools .btn-label,
  #sidebar.collapsed .sidebar-tools form {
    display: revert;
  }
  #sidebar.collapsed .sidebar-logo-mark,
  .sidebar-collapse-btn {
    display: none;
  }
}

/* Breadcrumb: hidden automatically when it only holds the Home item. */
.page-breadcrumb .breadcrumb {
  font-size: 0.85rem;
  margin-bottom: 0.5rem;
}
.page-breadcrumb:has(.breadcrumb > li:only-child) {
  display: none;
}

/* Auth pages (login, register, reset): centered card, no sidebar. */
.auth-wrap {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 2rem 1rem;
}
.auth-card {
  width: 100%;
  max-width: 440px;
}
.auth-links {
  font-size: 0.9rem;
}

/* Page header: one h1 per page plus an actions slot on the right. */
.page-header {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem 1rem;
  margin-bottom: 1rem;
}
.page-header:empty,
.page-header .page-title:empty {
  display: none;
}
.page-title {
  font-size: 1.5rem;
  font-weight: 600;
  margin: 0;
}
.page-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.5rem;
}
.page-actions:empty {
  display: none;
}

/* Section titles inside cards keep the h5 look but sit under the page h1. */
.card-header .card-section-title {
  font-size: 1.25rem;
  margin: 0;
}

/* ---------------------------------------------------------------
   3. Shared components
   --------------------------------------------------------------- */
/* Small info tiles (VPS detail) */
.info-box {
  background-color: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(255, 255, 255, 0.1);
}
.info-box code {
  color: inherit;
  background: transparent;
}

/* Billing address picker: the whole card is a radio label. */
.billing-address-card {
  cursor: pointer;
  transition: border-color 0.15s, box-shadow 0.15s;
}
.billing-address-card:hover {
  border-color: var(--brand-blue-light);
}
.billing-address-card.is-selected {
  border-color: var(--brand-blue);
  box-shadow: 0 0 0 0.2rem rgba(var(--brand-blue-rgb), 0.25);
}
.billing-address-card .form-check-input {
  cursor: pointer;
}

/* Empty state block (lists and tables with no rows) */
.empty-state {
  color: var(--bs-secondary-color);
}
.empty-state .btn {
  color: #fff;
}

/* Price summary box (VPS order, cart) */
.price-total-box {
  background: rgba(var(--brand-blue-rgb), 0.1);
  border: 1px solid rgba(var(--brand-blue-rgb), 0.25);
}

/* Stat tiles and the dashboard */
.stat-tile {
  color: inherit;
  transition: border-color 0.15s;
}
a.stat-tile:hover {
  border-color: var(--brand-blue-light);
}
.stat-icon {
  width: 2.75rem;
  height: 2.75rem;
  border-radius: 0.6rem;
  display: grid;
  place-items: center;
  flex-shrink: 0;
  font-size: 1.15rem;
  background: rgba(var(--brand-blue-rgb), 0.14);
  color: var(--brand-blue-light);
}
[data-bs-theme="light"] .stat-icon {
  color: var(--brand-blue-dark);
}
.stat-label {
  font-size: 0.8rem;
  color: var(--bs-secondary-color);
}
.stat-value {
  font-size: 1.75rem;
  font-weight: 600;
  line-height: 1.15;
}
.hero-balance {
  font-size: 2.75rem;
  font-weight: 600;
  line-height: 1.1;
}
.attention-list .list-group-item {
  gap: 0.75rem;
}
.attention-icon {
  width: 1.5rem;
  text-align: center;
  font-size: 1.1rem;
}

/* VPS status (loaded after the page renders) */
.status-dot {
  width: 0.6rem;
  height: 0.6rem;
  border-radius: 50%;
  display: inline-block;
  background: var(--bs-secondary-color);
  vertical-align: middle;
}
.status-dot.is-running { background: var(--bs-success); }
.status-dot.is-stopped { background: var(--bs-danger); }
.vps-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem 0.9rem;
  font-size: 0.85rem;
  color: var(--bs-secondary-color);
}

/* Sortable table headers */
.sort-link {
  color: inherit;
  text-decoration: none;
  white-space: nowrap;
}
.sort-link:hover,
.sort-link.active {
  color: var(--brand-blue-light);
}
[data-bs-theme="light"] .sort-link:hover,
[data-bs-theme="light"] .sort-link.active {
  color: var(--brand-blue-dark);
}
.sort-link .fa-sort {
  opacity: 0.4;
}
