/*
 * stockBox — theme layer
 * Loaded AFTER style.css; a full reskin of the stock NiceAdmin UI.
 *
 * Design principles:
 *  - Neutral, near-white canvas; surfaces are flat white with hairline borders.
 *  - One accent color (indigo), used only where attention belongs:
 *    primary actions, links, active states.
 *  - Typography carries the hierarchy — solid ink, tight tracking.
 *  - Depth is whisper-quiet: 1px lines and faint shadows, no glow, no glass.
 */

:root {
  --ink: #1d1d1f;
  --ink-2: #515154;
  --ink-3: #86868b;

  --canvas: #f5f5f7;
  --surface: #ffffff;
  --surface-2: #f2f2f7;
  --hairline: rgba(0, 0, 0, 0.08);
  --hairline-soft: rgba(0, 0, 0, 0.05);

  --accent: #4f46e5;
  --accent-hover: #4338ca;
  --accent-tint: #eef2ff;

  --danger: #dc2626;
  --success: #059669;

  --radius: 14px;
  --radius-sm: 10px;
  --shadow-1: 0 1px 2px rgba(0, 0, 0, 0.04);
  --shadow-2: 0 4px 20px rgba(0, 0, 0, 0.06);
  --focus-ring: 0 0 0 3px rgba(79, 70, 229, 0.22);
}

/* ============================================================
   BASE
   ============================================================ */
body {
  font-family: "Inter", system-ui, -apple-system, "Segoe UI", sans-serif;
  background: var(--canvas);
  color: var(--ink-2);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

h1, h2, h3, h4, h5, h6 {
  font-family: inherit;
  color: var(--ink);
  letter-spacing: -0.015em;
}

a { color: var(--accent); text-decoration: none; }
a:hover { color: var(--accent-hover); }

.pagetitle { margin-bottom: 20px; }
.pagetitle h1 {
  font-size: 28px;
  font-weight: 700;
  letter-spacing: -0.022em;
  color: var(--ink);
}

.breadcrumb { font-size: 12.5px; }
.breadcrumb a { color: var(--ink-3); }
.breadcrumb a:hover { color: var(--ink); }
.breadcrumb .active { color: var(--ink-3); }

/* ============================================================
   HEADER — light, translucent, hairline edge
   ============================================================ */
.header {
  background: rgba(255, 255, 255, 0.82);
  backdrop-filter: saturate(180%) blur(20px);
  -webkit-backdrop-filter: saturate(180%) blur(20px);
  box-shadow: inset 0 -1px 0 var(--hairline);
}

.logo span {
  font-family: inherit;
  font-size: 20px;
  font-weight: 700;
  letter-spacing: -0.02em;
  color: var(--ink);
}

.logo span i { color: var(--accent); }

.header .toggle-sidebar-btn { color: var(--ink-2); }
.header .toggle-sidebar-btn:hover { color: var(--ink); }

.header-nav .nav-icon {
  color: var(--ink-2);
  transition: color 0.15s ease;
}
.header-nav .nav-icon:hover { color: var(--ink); }

.header-nav .nav-profile { color: var(--ink-2); }
.header-nav .nav-profile:hover { color: var(--ink); }

.header-nav .badge-number {
  background-color: var(--accent) !important;
  border-radius: 999px;
  font-weight: 600;
}

/* ============================================================
   SIDEBAR — quiet white rail
   ============================================================ */
.sidebar {
  background-color: var(--surface);
  box-shadow: inset -1px 0 0 var(--hairline);
  border-right: none;
  width: 264px;
  padding: 16px 12px;
}

@media (min-width: 1200px) {
  #main, #footer { margin-left: 264px; }
  .toggle-sidebar #main, .toggle-sidebar #footer { margin-left: 0; }
  .toggle-sidebar .sidebar { left: -264px; }
}
@media (max-width: 1199px) {
  /* Hide fully off-screen regardless of drawer width (it varies on
     small screens), so no sliver is left covering the page. */
  .sidebar { left: -100vw; box-shadow: none; }
  .toggle-sidebar .sidebar {
    left: 0;
    box-shadow: 0 0 0 100vmax rgba(0, 0, 0, 0.25), var(--shadow-2);
  }
}

.sidebar::-webkit-scrollbar { width: 4px; background: transparent; }
.sidebar::-webkit-scrollbar-thumb { background: var(--hairline); border-radius: 999px; }

.sidebar-nav .nav-item { margin-bottom: 2px; }

.sidebar-nav .nav-link,
.sidebar-nav .nav-link.collapsed {
  background: transparent;
  color: var(--ink-2);
  font-weight: 500;
  font-size: 14px;
  border-radius: var(--radius-sm);
  padding: 10px 12px;
  transition: background 0.15s ease, color 0.15s ease;
}

.sidebar-nav .nav-link i,
.sidebar-nav .nav-link.collapsed i {
  color: var(--ink-3);
  font-size: 17px;
  transition: color 0.15s ease;
}

.sidebar-nav .nav-link:hover {
  background: var(--surface-2);
  color: var(--ink);
}
.sidebar-nav .nav-link:hover i { color: var(--ink); }

.sidebar-nav .nav-link:not(.collapsed) {
  background: var(--accent-tint);
  color: var(--accent);
}
.sidebar-nav .nav-link:not(.collapsed) i { color: var(--accent); }

.sidebar-nav .nav-content a {
  color: var(--ink-2);
  font-weight: 400;
  font-size: 13.5px;
  border-radius: 8px;
  padding: 7px 8px 7px 38px;
  transition: background 0.15s ease, color 0.15s ease;
}

.sidebar-nav .nav-content a:hover,
.sidebar-nav .nav-content a.active {
  background: var(--surface-2);
  color: var(--ink);
}

.sidebar-nav .nav-content a i { color: var(--ink-3); }
.sidebar-nav .nav-content a.active i,
.sidebar-nav .nav-content a:hover i { background-color: var(--accent); }

/* ============================================================
   CARDS — flat white, hairline, faint shadow
   ============================================================ */
.card {
  border-radius: var(--radius);
  background: var(--surface);
  border: 1px solid var(--hairline-soft);
  box-shadow: var(--shadow-1);
}

.card-header, .card-footer {
  background-color: transparent;
  border-color: var(--hairline-soft);
  color: var(--ink-2);
}

.card-title {
  font-family: inherit;
  font-weight: 600;
  font-size: 17px;
  color: var(--ink);
  letter-spacing: -0.01em;
}

.card-title span { color: var(--ink-3); font-weight: 400; font-size: 13px; }

/* Dashboard stat cards: quiet tinted icon chips, no gradients */
.dashboard .info-card h6 {
  color: var(--ink);
  font-weight: 700;
  letter-spacing: -0.02em;
}

.dashboard .card-icon {
  border-radius: 12px !important;
  font-size: 26px;
}
.dashboard .sales-card .card-icon {
  color: var(--accent) !important;
  background: var(--accent-tint) !important;
}
.dashboard .revenue-card .card-icon {
  color: var(--success) !important;
  background: #ecfdf5 !important;
}
.dashboard .customers-card .card-icon {
  color: #b45309 !important;
  background: #fffbeb !important;
}

/* ============================================================
   BUTTONS — solid, calm, no effects theater
   ============================================================ */
.btn {
  border-radius: var(--radius-sm);
  font-weight: 500;
  letter-spacing: -0.005em;
  transition: background-color 0.15s ease, border-color 0.15s ease,
    color 0.15s ease, box-shadow 0.15s ease;
}

.btn:focus-visible { box-shadow: var(--focus-ring); }

.btn-primary {
  background-color: var(--accent);
  border-color: var(--accent);
}
.btn-primary:hover, .btn-primary:focus, .btn-primary:active {
  background-color: var(--accent-hover) !important;
  border-color: var(--accent-hover) !important;
}

.btn-outline-primary {
  color: var(--ink);
  border-color: var(--hairline);
  background: var(--surface);
}
.btn-outline-primary:hover, .btn-outline-primary:active {
  color: var(--accent) !important;
  border-color: var(--accent) !important;
  background: var(--accent-tint) !important;
}

.btn-secondary, .btn-outline-secondary {
  color: var(--ink-2);
  background: var(--surface-2);
  border-color: transparent;
}
.btn-secondary:hover, .btn-outline-secondary:hover {
  color: var(--ink);
  background: #e8e8ed;
  border-color: transparent;
}

.btn-success { background-color: var(--success); border-color: var(--success); }
.btn-success:hover { background-color: #047857; border-color: #047857; }

.btn-danger { background-color: var(--danger); border-color: var(--danger); }
.btn-danger:hover { background-color: #b91c1c; border-color: #b91c1c; }

/* ============================================================
   FORMS
   ============================================================ */
.form-control, .form-select, .datatable-input, .datatable-selector {
  border-radius: var(--radius-sm);
  border: 1px solid var(--hairline);
  background-color: var(--surface);
  color: var(--ink);
  padding: 0.5rem 0.75rem;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.form-control:focus, .form-select:focus, .datatable-input:focus {
  border-color: var(--accent);
  box-shadow: var(--focus-ring);
  outline: none;
}

.form-control::placeholder { color: var(--ink-3); }

.form-label {
  color: var(--ink);
  font-weight: 500;
  font-size: 13.5px;
  margin-bottom: 6px;
}

.input-group-text {
  border-radius: var(--radius-sm);
  border: 1px solid var(--hairline);
  background: var(--surface-2);
  color: var(--ink-3);
}

.form-check-input:checked {
  background-color: var(--accent);
  border-color: var(--accent);
}
.form-check-input:focus { box-shadow: var(--focus-ring); }

/* ============================================================
   TABLES — hairline separation, quiet headers
   ============================================================ */
.table { color: var(--ink-2); --bs-table-bg: transparent; }

.table thead th {
  color: var(--ink-3);
  font-weight: 500;
  font-size: 12.5px;
  text-transform: none;
  letter-spacing: 0;
  border-bottom: 1px solid var(--hairline);
  background: transparent;
}

.table > :not(caption) > * > * {
  padding: 0.7rem 0.75rem;
  border-bottom-color: var(--hairline-soft);
  background-color: transparent;
}

.table-hover > tbody > tr:hover > * { background-color: #fafafa; }

.table-striped > tbody > tr:nth-of-type(odd) > * {
  background-color: #fafafa;
  color: inherit;
}

/* ============================================================
   DROPDOWNS / MODALS / ALERTS / BADGES
   ============================================================ */
.dropdown-menu {
  border-radius: 12px;
  border: 1px solid var(--hairline-soft);
  background: var(--surface);
  box-shadow: var(--shadow-2);
  overflow: hidden;
}

.dropdown-menu .dropdown-item { color: var(--ink-2); }
.dropdown-menu .dropdown-item:hover {
  background: var(--surface-2);
  color: var(--ink);
}

@media (min-width: 768px) {
  .dropdown-menu-arrow::before {
    background: var(--surface);
    border-color: var(--hairline-soft);
  }
}

.modal-content {
  border-radius: var(--radius);
  border: none;
  background: var(--surface);
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.18);
}

.alert {
  border-radius: var(--radius-sm);
  border: 1px solid var(--hairline-soft);
}

.badge {
  border-radius: 999px;
  font-weight: 500;
  letter-spacing: 0;
}

/* ============================================================
   MISC
   ============================================================ */
.back-to-top {
  background: var(--ink);
  border-radius: 999px;
}
.back-to-top:hover { background: #000; }

.footer {
  background: transparent;
  color: var(--ink-3);
  font-size: 12.5px;
}

.nav-tabs-bordered .nav-link { color: var(--ink-2); }
.nav-tabs-bordered .nav-link:hover,
.nav-tabs-bordered .nav-link.active { color: var(--ink); }
.nav-tabs-bordered .nav-link.active {
  background: transparent;
  border-bottom: 2px solid var(--ink);
}

.page-link {
  border-radius: 8px;
  margin: 0 2px;
  border: 1px solid transparent;
  color: var(--ink-2);
  background: transparent;
}
.page-link:hover { background: var(--surface-2); color: var(--ink); }
.page-item.active .page-link {
  background: var(--ink);
  border-color: var(--ink);
  color: #fff;
}

.list-group-item {
  background: transparent;
  border-color: var(--hairline-soft);
  color: var(--ink-2);
}
.list-group-item h6 { color: var(--ink); }
.list-group-item-action:hover { background: #fafafa; }

::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-thumb {
  background: #d2d2d7;
  border-radius: 999px;
  border: 2px solid var(--canvas);
}
::-webkit-scrollbar-thumb:hover { background: var(--ink-3); }

/* ============================================================
   AUTH / STANDALONE PAGES (login, signup, choose-*)
   ============================================================ */
.register h1 {
  font-weight: 700;
  letter-spacing: -0.025em;
  color: var(--ink);
  font-size: 28px;
}
.register h1 i { color: var(--accent); }

.register .card {
  border-radius: 18px;
  border: 1px solid var(--hairline-soft);
  box-shadow: var(--shadow-2);
}

/* ============================================================
   MOBILE — global small-screen pass
   ============================================================ */

/* Wide content (tables, calendars) scrolls inside its card instead of
   breaking the page layout. Applies at every size; only kicks in when
   content is actually wider than the card. */
.card-body,
.datatable-container {
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}

/* FullCalendar toolbar: allow wrapping instead of overflowing */
.fc .fc-toolbar {
  flex-wrap: wrap;
  gap: 8px;
}

@media (max-width: 991.98px) {
  .fc .fc-toolbar-title { font-size: 1.05rem; }
  .fc .fc-button { padding: 0.3em 0.55em; font-size: 0.85rem; }
}

@media (max-width: 767.98px) {
  #main {
    padding: 16px 12px;
  }

  .pagetitle h1 { font-size: 22px; }
  .card { border-radius: 12px; }
  .card-title { font-size: 16px; }

  /* 16px inputs prevent iOS Safari from auto-zooming on focus */
  .form-control, .form-select, .datatable-input, .datatable-selector {
    font-size: 16px;
  }

  /* Keep table rows readable; the card scrolls horizontally instead
     of cells collapsing into vertical letter-stacks */
  .table th, .table td { white-space: nowrap; }

  /* Comfortable touch targets */
  .btn { min-height: 40px; }
  .btn-sm { min-height: 34px; padding: 0.3rem 0.65rem; }
  .sidebar-nav .nav-link { padding: 12px; }
  .dropdown-menu .dropdown-item { padding: 12px 15px; }

  /* Header: tighter icon spacing on small screens */
  .header-nav .nav-icon { margin-right: 14px; font-size: 20px; }
  .header { padding-left: 12px; }

  /* Stat cards + section spacing */
  .card { margin-bottom: 16px; }
  .dashboard .card-icon { width: 52px; height: 52px; font-size: 22px; }
  .dashboard .info-card h6 { font-size: 22px; }

  .footer { text-align: center; }

  /* Stack flush-right action rows */
  .text-end .btn { width: 100%; }
}

@media (max-width: 575.98px) {
  /* Sidebar drawer: near-full-width like a native sheet */
  .sidebar { width: min(84vw, 300px); }

  .pagetitle h1 { font-size: 20px; }

  /* Modals get breathing room */
  .modal-dialog { margin: 10px; }
}

/* ============================================================
   DROPDOWNS & SELECTS — never overflow their container/viewport
   ============================================================ */
select,
textarea,
.form-select,
.form-control,
.input-group {
  max-width: 100%;
}

/* Select2 (parts assignment pages): match the design system and
   respect the container width */
.select2-container {
  width: 100% !important;
  max-width: 100%;
}
.select2-container .select2-selection--multiple,
.select2-container .select2-selection--single {
  border: 1px solid var(--hairline);
  border-radius: var(--radius-sm);
  min-height: 40px;
}
.select2-container--default.select2-container--focus .select2-selection--multiple,
.select2-container--default.select2-container--focus .select2-selection--single {
  border-color: var(--accent);
  box-shadow: var(--focus-ring);
}
.select2-dropdown {
  border: 1px solid var(--hairline-soft);
  border-radius: 12px;
  box-shadow: var(--shadow-2);
  overflow: hidden;
}
.select2-container--default .select2-results__option--highlighted[aria-selected] {
  background-color: var(--accent);
}
.select2-container--default .select2-selection--multiple .select2-selection__choice {
  background-color: var(--accent-tint);
  border: none;
  border-radius: 6px;
  color: var(--accent);
  padding: 2px 8px;
}

/* ============================================================
   DETAIL PASS — high-traffic surfaces
   ============================================================ */

/* Card title icons: quiet accent, consistent optical spacing */
.card-title i {
  color: var(--accent);
  margin-right: 6px;
  font-size: 0.95em;
  vertical-align: -1px;
}

/* Three-dots card menus */
.dashboard .filter .icon { color: var(--ink-3); }
.dashboard .filter .icon:hover { color: var(--ink); }

/* Empty states: centered, soft, friendly */
.list-group-item.empty-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  padding: 28px 12px;
  color: var(--ink-3);
  font-size: 13.5px;
  border: none;
}
.list-group-item.empty-state i {
  font-size: 26px;
  color: #c7c7cc;
  line-height: 1;
}

/* Status pills: dot + tint, instant scanability */
.status-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 3px 10px;
  border-radius: 999px;
  font-size: 12.5px;
  font-weight: 500;
  line-height: 1.4;
}
.status-pill::before {
  content: "";
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: currentColor;
}
.status-pill.status-active { color: #067647; background: #ecfdf3; }
.status-pill.status-inactive { color: #55565b; background: #f2f2f7; }
.status-pill.status-damaged { color: #b42318; background: #fef3f2; }

/* Category chips in tables */
.category-chip {
  display: inline-block;
  padding: 3px 10px;
  border-radius: 999px;
  font-size: 12.5px;
  color: var(--ink-2);
  background: var(--surface-2);
}

/* simple-datatables chrome: align with the system */
.datatable-top { padding: 6px 0 14px; }
.datatable-bottom { padding: 14px 0 0; }
.datatable-info { color: var(--ink-3); font-size: 13px; }
.datatable-pagination a {
  border-radius: 8px;
  color: var(--ink-2);
}
.datatable-pagination .active a {
  background: var(--ink);
  color: #fff;
}

/* ---------- Pricing (account-settings) ---------- */
.subscription-options .card {
  border-radius: 16px;
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
}
.subscription-options .card:hover {
  border-color: rgba(79, 70, 229, 0.35);
  box-shadow: var(--shadow-2);
}
.subscription-options .card-body { padding: 24px; }

.subscription-options .card-title {
  font-size: 13px;
  font-weight: 600;
  letter-spacing: 0.06em;
  color: var(--ink-2);
  text-transform: uppercase;
  padding-bottom: 4px;
}
.subscription-options .text-primary { color: var(--accent) !important; }

.subscription-options .card-text {
  color: var(--ink-3);
  font-size: 13.5px;
  min-height: 40px;
}

.subscription-options ul li {
  padding: 5px 0;
  font-size: 14px;
  color: var(--ink-2);
}
.subscription-options ul li i { color: var(--success) !important; }

/* Price typography: the number is the hero */
.pricing-section { margin: 0.75rem 0 0; font-family: inherit; }
.pricing-section .currency {
  font-size: 1.1rem;
  font-weight: 600;
  color: var(--ink);
  vertical-align: 14px;
}
.pricing-section .amount {
  font-size: 2.6rem;
  font-weight: 700;
  letter-spacing: -0.03em;
  color: var(--ink);
}
.pricing-section .interval {
  font-size: 0.9rem;
  color: var(--ink-3);
  font-weight: 400;
}

.subscription-options .checkout-button { width: 100%; }

/* Current plan: accent ring + tint instead of scale/glow */
.subscription-active {
  transform: none;
  border-color: var(--accent) !important;
  box-shadow: 0 0 0 1px var(--accent), var(--shadow-1);
  background: linear-gradient(180deg, var(--accent-tint), var(--surface) 42%);
}
.subscription-active:hover {
  box-shadow: 0 0 0 1px var(--accent), var(--shadow-2);
}

/* "Current Plan" ribbon → clean pill, no rotation theatrics */
.ribbon {
  width: auto;
  height: auto;
  overflow: visible;
  position: absolute;
  z-index: 1;
}
.ribbon.ribbon-top-right { top: 14px; right: 14px; }
.ribbon.ribbon-top-right span {
  position: static;
  display: inline-block;
  transform: none;
  width: auto;
  background: var(--accent);
  color: #fff;
  font-size: 11.5px;
  font-weight: 600;
  letter-spacing: 0.03em;
  padding: 4px 10px;
  border-radius: 999px;
  box-shadow: none;
  text-transform: none;
}

@media (max-width: 767.98px) {
  /* Header dropdowns (announcements, messages, profile) were fixed-width
     panels pushed past the right screen edge. On phones they become
     full-width sheets pinned under the header instead. */
  .header-nav .dropdown-menu.messages,
  .header-nav .dropdown-menu.profile {
    position: fixed !important;
    inset: 68px 8px auto 8px !important;
    width: auto !important;
    min-width: 0 !important;
    max-width: none !important;
    transform: none !important;
  }

  /* Message previews wrap instead of forcing the panel wider */
  .header-nav .messages .message-item p,
  .header-nav .messages .message-item h4 {
    white-space: normal;
    overflow-wrap: anywhere;
  }

  /* Any other dropdown menu stays inside the viewport */
  .dropdown-menu { max-width: calc(100vw - 16px); }
}
