/* Operational views polish
 * Loaded last on purpose: these rules harmonise the legacy operational screens
 * with the dashboard and simulation form without disturbing their layouts.
 */

#fleet-view,
#drivers-view,
#contacts-view,
#clients-view,
#car-templates-view,
#calculations-view,
#settings-view {
  min-height: 100%;
}

#fleet-view > .page-container,
#drivers-view > .page-container,
#contacts-view > .page-container,
#clients-view > .page-container,
#calculations-view > .page-container,
#settings-view > .page-container {
  width: min(100%, 1480px);
  max-width: 1480px;
  margin: 0 auto;
  padding: 28px 32px 48px !important;
  border: 0;
  border-radius: 0;
  background: transparent;
  box-shadow: none;
  backdrop-filter: none;
}

#car-templates-view {
  width: min(100%, 1480px);
  margin: 0 auto;
  padding: 28px 32px 48px;
}

.formula-inline {
  display: inline;
  padding: 2px 6px;
  color: #bfdbfe;
  border: 1px solid rgba(96, 165, 250, 0.16);
  border-radius: 6px;
  background: rgba(59, 130, 246, 0.09);
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 0.9em;
}

.fleet-scopes, .fleet-pagination {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 20px;
}
.fleet-scopes [aria-pressed="true"] {
  background: #2563eb;
  color: white;
  border-color: #60a5fa;
}
.fleet-pagination { justify-content: center; }
.fleet-pagination span { color: #cbd5e1; }

.operational-header,
#clients-view .clients-header,
#calculations-view .view-header,
#settings-view .view-header,
#car-templates-view .templates-header {
  position: relative;
  overflow: hidden;
  padding: 24px;
  border: 1px solid rgba(96, 165, 250, 0.16);
  border-radius: 20px;
  background:
    radial-gradient(circle at 92% -30%, rgba(59, 130, 246, 0.22), transparent 46%),
    linear-gradient(145deg, rgba(15, 29, 51, 0.98), rgba(11, 22, 41, 0.96));
  box-shadow: 0 18px 50px rgba(2, 8, 23, 0.2);
}

.operational-header::after {
  content: "";
  position: absolute;
  inset: auto 0 0;
  height: 1px;
  background: linear-gradient(90deg, transparent, rgba(96, 165, 250, 0.5), transparent);
}

.operational-eyebrow {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  margin-bottom: 8px;
  color: #60a5fa;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.operational-eyebrow .material-symbols-rounded {
  font-size: 16px;
}

.operational-header h1,
#clients-view .clients-header h1 {
  font-family: "Urbanist", "Inter", sans-serif;
  font-size: clamp(26px, 2.2vw, 34px);
  font-weight: 750;
  letter-spacing: -0.025em;
}

.operational-header p,
#clients-view .clients-header p {
  max-width: 650px;
  color: #94a3b8;
  line-height: 1.55;
}

.operational-stats,
.fleet-stats {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 12px;
  width: 100%;
  margin: 20px 0;
}

.stat-card,
.operational-stat {
  position: relative;
  display: grid;
  grid-template-columns: 42px 1fr;
  align-items: center;
  min-width: 0;
  padding: 14px 16px;
  text-align: left;
  border: 1px solid rgba(148, 163, 184, 0.14);
  border-radius: 14px;
  background: rgba(8, 18, 35, 0.62);
}

.stat-card .stat-icon,
.operational-stat__icon {
  display: grid;
  width: 36px;
  height: 36px;
  place-items: center;
  color: #60a5fa;
  border-radius: 11px;
  background: rgba(59, 130, 246, 0.12);
}

.stat-card .stat-value,
.operational-stat__value {
  grid-column: 2;
  grid-row: 1;
  font-size: 23px;
  line-height: 1;
}

.stat-card .stat-label,
.operational-stat__label {
  grid-column: 2;
  grid-row: 2;
  margin-top: 4px;
  color: #94a3b8;
  font-size: 10px;
  font-weight: 650;
  letter-spacing: 0.075em;
  text-transform: uppercase;
}

.fleet-toolbar,
.drivers-toolbar,
.clients-header .clients-toolbar {
  align-items: center;
  padding-top: 18px;
  border-top: 1px solid rgba(148, 163, 184, 0.12);
}

.fleet-toolbar .search-box,
.drivers-toolbar .search-box,
.clients-header .search-box {
  min-width: min(100%, 320px);
  flex: 1 1 360px;
}

.fleet-toolbar .search-input,
.drivers-toolbar .search-input,
.clients-header .search-input,
.fleet-toolbar .filter-select,
.drivers-toolbar .filter-select,
.clients-header .filter-select {
  min-height: 44px;
  border-color: rgba(148, 163, 184, 0.18);
  background: rgba(7, 16, 31, 0.72);
}

.fleet-container,
.drivers-container,
#contacts-view .clients-container,
#clients-view .clients-container {
  margin-top: 18px;
}

.fleet-container > .empty-state,
.drivers-container > .empty-state,
.clients-table-wrapper > .empty-state,
.templates-empty {
  min-height: 330px;
  border: 1px dashed rgba(96, 165, 250, 0.26);
  border-radius: 20px;
  background:
    radial-gradient(circle at 50% 18%, rgba(59, 130, 246, 0.11), transparent 44%),
    rgba(12, 25, 47, 0.58);
}

.empty-state .empty-icon,
.templates-empty > .material-symbols-rounded {
  display: grid;
  width: 64px;
  height: 64px;
  margin: 0 auto 16px;
  place-items: center;
  color: #60a5fa;
  border: 1px solid rgba(96, 165, 250, 0.24);
  border-radius: 20px;
  background: rgba(59, 130, 246, 0.1);
  font-size: 30px;
}

.vehicle-card,
.drivers-table-container,
.clients-table-wrapper,
.template-card {
  border-color: rgba(148, 163, 184, 0.14);
  background: rgba(12, 24, 45, 0.78);
  box-shadow: 0 16px 36px rgba(2, 8, 23, 0.14);
}

.vehicle-card:hover,
.template-card:hover {
  border-color: rgba(96, 165, 250, 0.55);
  box-shadow: 0 18px 42px rgba(37, 99, 235, 0.13);
}

/* Fleet/driver modals use a wrapper plus a sibling overlay. The global share
 * modal animation made that overlay transparent, leaving forms inaccessible. */
.modal.modal-active {
  position: fixed;
  inset: 0;
  z-index: 1200;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
}

.modal.modal-active > .modal-overlay {
  position: absolute;
  inset: 0;
  z-index: 0;
  display: block;
  padding: 0;
  opacity: 1;
  pointer-events: auto;
  background: rgba(2, 8, 23, 0.76);
  backdrop-filter: blur(10px);
}

.modal.modal-active > .modal-content {
  position: relative;
  z-index: 1;
  max-height: min(88vh, 820px);
  border-color: rgba(96, 165, 250, 0.2);
  background: #101d33;
  box-shadow: 0 30px 80px rgba(0, 0, 0, 0.48);
}

.modal.modal-active .modal-header h3 {
  margin: 0;
  color: #f8fafc;
  font-family: "Urbanist", "Inter", sans-serif;
  font-size: 21px;
}

.modal.modal-active .form-group label {
  color: #cbd5e1;
}

.modal.modal-active input,
.modal.modal-active select,
.modal.modal-active textarea {
  width: 100%;
  border: 1px solid rgba(148, 163, 184, 0.22);
  border-radius: 10px;
  background: #0b172a;
  color: #f8fafc;
}

.modal.modal-active input:focus,
.modal.modal-active select:focus,
.modal.modal-active textarea:focus {
  border-color: #60a5fa;
  outline: 3px solid rgba(59, 130, 246, 0.14);
}

@media (max-width: 980px) {
  .operational-stats,
  .fleet-stats {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 768px) {
  #fleet-view > .page-container,
  #drivers-view > .page-container,
  #contacts-view > .page-container,
  #clients-view > .page-container,
  #calculations-view > .page-container,
  #settings-view > .page-container {
    padding: 18px 16px 36px !important;
  }

  #car-templates-view {
    padding: 18px 16px 36px;
  }

  .operational-header {
    padding: 20px;
  }

  .operational-stats,
  .fleet-stats {
    grid-template-columns: 1fr;
  }

  .modal.modal-active {
    align-items: flex-end;
    padding: 12px;
  }

  .modal.modal-active > .modal-content {
    max-height: 92vh;
    border-radius: 18px;
  }
}

@media (prefers-reduced-motion: reduce) {
  .vehicle-card,
  .template-card,
  .modal-overlay {
    transition: none !important;
  }
}
