/* --- Persistent Sidebar Layout --- */
html, body {
  height: auto;
  min-height: 100%;
  overflow-x: hidden;
  overflow-y: auto;
}

* {
  box-sizing: border-box;
}

.admin-container {
  background-color: #0e1117;
  color: #ddd;
  height: 100vh;
  overflow: hidden;
  font-family: 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;
}

.sidebar {
  height: 100vh;
  background-color: #1c2128;
  border-right: 1px solid #2c323b;
  padding: 25px 0;
  position: fixed;
  width: 16%;
  top: 0;
  left: 0;
  display: flex;
  flex-direction: column;
  justify-content: flex-start;
  z-index: 1030;
}

.sidebar-title {
  color: #00bfff;
  font-size: 1.4rem;
  font-weight: 700;
  text-align: center;
  margin-bottom: 10px;
}

.sidebar-divider {
  border-color: #2c323b;
  margin: 10px 20px;
}

.sidebar-link {
  color: #bbb !important;
  font-weight: 500;
  padding: 12px 20px;
  border-radius: 6px;
  transition: all 0.25s ease-in-out;
  text-decoration: none !important;
  display: flex;
  align-items: center;
  gap: 10px;
  margin: 5px 15px;
}

.sidebar-link:hover {
  background-color: #242a32 !important;
  color: #00bfff !important;
}

.sidebar-link.active {
  background-color: #00bfff !important;
  color: #fff !important;
  font-weight: 600;
}

.logout-link {
  color: #ff6b6b !important;
  margin-top: auto;
}

.main-content {
  margin-left: 16%;
  padding: 40px 40px 220px 40px;
  min-height: 100vh;
  overflow: visible;
  background-color: #0e1117;
}

.login-content {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
}

/* --- Page Elements --- */
.page-title {
  color: #00bfff;
  font-weight: 700;
  margin-bottom: 20px;
}

.page-output {
  margin-top: 20px;
  background-color: #1c2128;
  padding: 15px;
  border-radius: 8px;
  border: 1px solid #2c323b;
  white-space: pre-wrap;
}

/* Latest Dash datepicker root class override */
.dash-datepicker {
  width: 260px !important;
  max-width: 260px !important;
  flex: 0 0 auto !important;
  color: #111111 !important;
}

.dash-dropdown {
  color: #111111 !important;
}

.dash-dropdown-wrapper {
  color: #111111 !important;
}

.ts-dash-dropdown {
  width: 260px !important;
  max-width: 260px !important;
  flex: 0 0 auto !important;
}

.dash-input-container {
  color: #111111 !important;
}

:root {
    --Dash-Fill-Interactive-Strong: #00bfff;
}

.portal-shell {
  align-items: stretch;
}

.portal-sidebar-col,
.portal-content-col {
  min-width: 0;
}

.portal-page-loading-stack {
  position: relative;
}

.portal-page-content-slot {
  min-height: 58vh;
}

.portal-page-loading-overlay {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  pointer-events: none;
  background: rgba(8, 12, 18, 0.2) !important;
  z-index: 20;
}

.portal-route-spinner {
  width: 72px;
  height: 72px;
  border-radius: 999px;
  border: 5px solid rgba(30, 200, 255, 0.16);
  border-top-color: #1ec8ff;
  border-right-color: #0b82f1;
  box-shadow: 0 0 22px rgba(11, 130, 241, 0.22);
  filter: drop-shadow(0 0 18px rgba(11, 130, 241, 0.28));
  animation: portal-route-spin 0.9s linear infinite;
}

@keyframes portal-route-spin {
  from {
    transform: rotate(0deg);
  }
  to {
    transform: rotate(360deg);
  }
}

.sidebar-nav {
  overflow-y: auto;
  overflow-x: hidden;
  padding-bottom: 12px;
}

.admin-company-dropdown,
.admin-company-dropdown .Select-control,
.admin-company-dropdown .Select-menu-outer {
  width: 100%;
}

.labeling-workspace-row {
  align-items: flex-start;
}

.labeling-tools-card .card-body {
  padding: 1.4rem 1.35rem 1.5rem;
}

.labeling-tool-selectors {
  row-gap: 14px;
  margin-bottom: 18px !important;
}

.labeling-tool-selectors .ts-dash-dropdown {
  margin-top: 6px;
}

.labeling-tool-radio {
  margin-top: 8px;
  margin-bottom: 18px !important;
}

.labeling-tools-card .rc-slider {
  margin-top: 10px;
}

.labeling-tools-card hr {
  margin-top: 24px !important;
  margin-bottom: 16px !important;
}

.labeling-toolbar {
  flex-wrap: wrap;
  gap: 8px;
}

.labeling-toolbar .btn-group {
  flex-wrap: wrap;
}

.labeling-toolbar .btn,
.labeling-action-buttons .btn {
  min-height: 44px;
}

.labeling-toolbar-button {
  min-height: 46px;
  border-radius: 12px !important;
  border-width: 1px !important;
  font-weight: 600;
  padding: 0.7rem 0.95rem !important;
  box-shadow: 0 10px 22px rgba(0, 0, 0, 0.18);
  transition: transform 0.18s ease, box-shadow 0.18s ease, background-color 0.18s ease, border-color 0.18s ease;
}

.labeling-toolbar-button:hover {
  transform: translateY(-1px);
  box-shadow: 0 14px 28px rgba(0, 0, 0, 0.22);
}

.labeling-toolbar-button-secondary {
  background: linear-gradient(180deg, rgba(61, 70, 84, 0.92), rgba(37, 44, 56, 0.96));
  border-color: rgba(138, 153, 176, 0.35) !important;
  color: #f3f6fb !important;
}

.labeling-toolbar-button-primary {
  background: linear-gradient(135deg, rgba(30, 200, 255, 0.95), rgba(11, 130, 241, 0.98) 55%, rgba(6, 95, 212, 0.98));
  border-color: rgba(109, 206, 255, 0.38) !important;
  color: #ffffff !important;
  box-shadow: 0 16px 34px rgba(11, 130, 241, 0.28);
}

.labeling-toolbar-button:focus {
  box-shadow: 0 0 0 0.2rem rgba(30, 200, 255, 0.2), 0 12px 28px rgba(0, 0, 0, 0.18);
}

.labeling-help-text {
  max-width: 760px;
  margin-left: auto;
  margin-right: auto;
}

.labeling-canvas-wrapper {
  overflow: auto;
  overscroll-behavior: contain;
  touch-action: none;
  -ms-touch-action: none;
}

.labeling-canvas {
  touch-action: none;
  -webkit-user-select: none;
  user-select: none;
}

.labeling-action-buttons {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 8px;
  margin-bottom: 18px;
}

.labeling-action-buttons .btn {
  flex: 1 1 140px;
  border-radius: 12px;
  border-width: 1px;
  font-weight: 600;
  padding: 0.72rem 0.95rem;
  letter-spacing: 0;
  box-shadow: 0 10px 22px rgba(0, 0, 0, 0.18);
  transition: transform 0.18s ease, box-shadow 0.18s ease, background-color 0.18s ease, border-color 0.18s ease;
}

.labeling-action-buttons .btn:hover,
.labeling-save-button:hover {
  transform: translateY(-1px);
  box-shadow: 0 14px 28px rgba(0, 0, 0, 0.22);
}

.labeling-action-buttons .btn-outline-secondary {
  background: linear-gradient(180deg, rgba(61, 70, 84, 0.92), rgba(37, 44, 56, 0.96));
  border-color: rgba(138, 153, 176, 0.35);
  color: #f3f6fb;
}

.labeling-action-buttons .btn-outline-warning {
  background: linear-gradient(180deg, rgba(122, 88, 20, 0.94), rgba(88, 62, 10, 0.98));
  border-color: rgba(255, 204, 102, 0.36);
  color: #fff2d6;
}

.labeling-action-buttons .btn-outline-danger {
  background: linear-gradient(180deg, rgba(133, 42, 55, 0.96), rgba(100, 24, 35, 0.98));
  border-color: rgba(255, 146, 161, 0.34);
  color: #ffe7eb;
}

.labeling-save-button {
  width: 100%;
  min-height: 58px;
  margin-top: 10px;
  border: none;
  border-radius: 14px;
  font-size: 1rem;
  font-weight: 700;
  letter-spacing: 0;
  padding: 0.95rem 1.1rem;
  background: linear-gradient(135deg, #1ec8ff 0%, #0b82f1 55%, #065fd4 100%);
  color: #ffffff;
  box-shadow: 0 16px 34px rgba(11, 130, 241, 0.34);
}

.labeling-save-button:focus,
.labeling-action-buttons .btn:focus {
  box-shadow: 0 0 0 0.2rem rgba(30, 200, 255, 0.2), 0 12px 28px rgba(0, 0, 0, 0.18);
}

.login-btn {
  box-shadow: 0 16px 34px rgba(11, 130, 241, 0.34);
  transition: transform 0.18s ease, box-shadow 0.18s ease, filter 0.18s ease;
}

.login-btn:hover {
  transform: translateY(-1px);
  box-shadow: 0 18px 38px rgba(11, 130, 241, 0.4);
  filter: brightness(1.03);
}

.login-btn:focus {
  box-shadow: 0 0 0 0.2rem rgba(30, 200, 255, 0.2), 0 16px 34px rgba(11, 130, 241, 0.34);
}

.labeling-tire-layout-panel {
  width: 100%;
  max-width: 100%;
  overflow: hidden;
}

.labeling-axle-row {
  width: 100%;
  max-width: 100%;
  flex-wrap: nowrap;
  gap: 12px;
}

.labeling-axle-side {
  display: flex;
  flex: 1 1 0;
  min-width: 0;
  justify-content: center;
  gap: 0;
}

.labeling-axle-spacer {
  flex: 0 0 clamp(28px, 7vw, 65px);
  width: clamp(28px, 7vw, 65px) !important;
  margin: 0 clamp(6px, 2vw, 22px) !important;
}

.labeling-tire-cell {
  margin: 7px clamp(2px, 0.75vw, 7px) !important;
}

.labeling-tire-button {
  width: 90px;
  height: 126px;
  border-radius: 9px;
  font-size: 16px;
  line-height: 1.15;
  text-align: center;
  padding: 6px 4px;
}

@media (max-width: 1199.98px) {
  .labeling-image-card,
  .labeling-tools-card {
    height: auto;
  }

  .labeling-tools-card {
    margin-top: 4px;
  }
}

@media (max-width: 991.98px) {
  .dash-datepicker,
  .ts-dash-dropdown {
    width: 100% !important;
    max-width: 100% !important;
  }

  .portal-shell {
    flex-direction: column;
  }

  .portal-sidebar-col,
  .portal-content-col {
    width: 100%;
    max-width: 100%;
    flex: 0 0 100%;
  }

  .sidebar {
    position: static;
    width: 100%;
    height: auto;
    min-height: 0;
    border-right: none;
    border-bottom: 1px solid #2c323b;
    padding: 16px 0 12px;
  }

  .sidebar-nav {
    display: flex;
    flex-wrap: nowrap;
    overflow-x: auto;
    overflow-y: hidden;
    padding: 0 12px 8px;
    gap: 8px;
    scrollbar-width: thin;
  }

  .sidebar-link {
    margin: 0;
    white-space: nowrap;
    flex: 0 0 auto;
  }

  .logout-link {
    margin-left: auto;
  }

  .main-content {
    margin-left: 0;
    padding: 24px 20px 96px;
  }

  .portal-page-content-slot {
    min-height: 48vh;
  }

  .labeling-inspection-nav {
    max-width: 100% !important;
    gap: 8px;
  }

  .labeling-axle-row {
    gap: 8px;
  }

  .labeling-axle-spacer {
    flex-basis: clamp(20px, 5vw, 40px);
    width: clamp(20px, 5vw, 40px) !important;
    margin: 0 clamp(4px, 1.5vw, 12px) !important;
  }

  .labeling-tire-button {
    width: clamp(50px, 8.2vw, 72px) !important;
    height: clamp(74px, 12.5vw, 100px) !important;
    font-size: clamp(11px, 1.8vw, 15px) !important;
  }
}

@media (max-width: 767.98px) {
  .main-content {
    padding: 18px 14px 72px;
  }

  .login-content {
    min-height: auto;
  }

  .labeling-toolbar {
    justify-content: stretch !important;
  }

  .labeling-toolbar .btn-group {
    width: 100%;
  }

  .labeling-toolbar .btn {
    flex: 1 1 auto;
  }

  .labeling-tools-card .card-body {
    padding: 1.15rem 1rem 1.25rem;
  }

  .labeling-tool-selectors {
    row-gap: 10px;
    margin-bottom: 14px !important;
  }

  .labeling-tire-layout-panel {
    padding: 18px 10px;
  }

  .labeling-inspection-nav {
    flex-wrap: wrap;
  }

  .labeling-axle-row {
    gap: 4px;
  }

  .labeling-axle-side {
    flex: 1 1 auto;
  }

  .labeling-axle-spacer {
    flex-basis: 18px;
    width: 18px !important;
    margin: 0 2px !important;
  }

  .labeling-tire-cell {
    margin: 4px 1px !important;
  }

  .labeling-tire-cell > div:first-child {
    font-size: 11px !important;
  }

  .labeling-tire-button {
    width: clamp(42px, 12vw, 56px) !important;
    height: clamp(64px, 18vw, 82px) !important;
    font-size: clamp(9px, 2.6vw, 12px) !important;
    border-width: 2px !important;
    padding: 4px 2px !important;
  }

  .labeling-action-buttons {
    gap: 10px;
    margin-bottom: 20px;
  }

  .labeling-action-buttons .btn,
  .labeling-save-button {
    min-height: 52px;
  }
}

@media (max-width: 991.98px) and (orientation: landscape) {
  .labeling-tire-layout-panel {
    padding: 22px 18px;
  }

  .labeling-axle-row {
    gap: 10px;
  }

  .labeling-axle-spacer {
    flex-basis: clamp(24px, 4vw, 46px);
    width: clamp(24px, 4vw, 46px) !important;
    margin: 0 clamp(6px, 1.4vw, 14px) !important;
  }

  .labeling-tire-cell {
    margin: 6px 3px !important;
  }

  .labeling-tire-cell > div:first-child {
    font-size: 12px !important;
  }

  .labeling-tire-button {
    width: clamp(58px, 7vw, 80px) !important;
    height: clamp(84px, 10vw, 110px) !important;
    font-size: clamp(11px, 1.5vw, 15px) !important;
    padding: 6px 4px !important;
  }
}
