/* ============================
   Fahrzeuge page base styling
   ============================ */

/* General page background */
body {
  background-color: #eef1f5;
}

.fm-page-container {
  max-width: 1400px;
  margin: 0 auto;
  width: 100%;
}

.fm-page-container--padded {
  padding-left: 1.5rem;
  padding-right: 1.5rem;
}

@media (min-width: 992px) {
  .fm-page-container--padded {
    padding-left: 3rem;
    padding-right: 3rem;
  }
}

.fm-page-padding {
  padding-left: 0.3rem;
  padding-right: 0.3rem;
}

.fm-vehicle-title {
  position: relative;
  top: 10px;
}

@media (min-width: 992px) {
  .fm-page-padding {
    padding-left: 0.6rem;
    padding-right: 0.6rem;
  }
}

/* ============================
   Filter + sort controls
   ============================ */

.fm-filter-menu {
  position: absolute;
  right: 0;
  top: calc(100% + 0.5rem);
  min-width: 320px;
  background: #ffffff;
  border: 1px solid #d7dee8;
  border-radius: 10px;
  box-shadow: 0 8px 20px rgba(15, 23, 42, 0.12);
  z-index: 50;
}

.fm-filter-menu.is-hidden {
  display: none;
}

/* ============================
   Sidebar
   ============================ */

.fm-sidebar {
  width: 16rem;            /* ~256px, similar to Tailwind w-64 */
  min-height: 100vh;
}

.fm-sidebar .nav-link {
  border-radius: 0;
  padding-left: 0;
}

.fm-sidebar .nav-link.active {
  border-left: 0.25rem solid #0d6efd; /* Blue left border */
  padding-left: 0.5rem;
  font-weight: 600;
}

/* ============================
   Topbar
   ============================ */

.fm-topbar {
  position: sticky;
  top: 0;
  z-index: 1020;
}

.fm-topbar__row {
  padding: 0.6rem 0;
}

.fm-topbar__row--compact {
  padding-top: 0.2rem;
  padding-bottom: 0.2rem;
}

.fm-topbar__row.border-bottom {
  border-color: #e5e7eb !important;
}

.fm-topbar__inner {
  row-gap: 0.75rem;
}

.fm-topbar__nav .nav-link {
  color: #495057;
  font-weight: 600;
  font-size: 0.9rem;
  padding: 0.3rem 0.6rem;
  border-bottom: 2px solid transparent;
}

.fm-nav-icon {
  height: 1.1em;
  width: auto;
  display: block;
}

.fm-nav-icon--truck {
  height: 1.2em;
}

.fm-topbar__nav .nav-link:hover {
  color: #0b5ed7;
  border-bottom-color: #9ec5fe;
}

.fm-topbar__nav .nav-link.active {
  color: #0d6efd;
  border-bottom-color: #0d6efd;
}

@media (max-width: 768px) {
  .fm-topbar__nav {
    width: 100%;
  }
}

/* ============================
   Kanban (Vorgaenge)
   ============================ */

.fm-kanban {
  min-height: 320px;
}

.fm-kanban-board {
  align-items: stretch;
}

.fm-kanban-column {
  background: #f8fafc;
  border: 1px solid #e2e8f0;
  border-radius: 12px;
  padding: 0.85rem;
  min-height: 320px;
  display: flex;
  flex-direction: column;
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.fm-kanban-column.is-over {
  border-color: #0d6efd;
  box-shadow: 0 0 0 2px rgba(13, 110, 253, 0.15);
}

.fm-kanban-column__head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-weight: 600;
  color: #1f2937;
  margin-bottom: 0.85rem;
}

.fm-kanban-count {
  background: #e2e8f0;
  color: #1f2937;
  font-size: 0.75rem;
  font-weight: 600;
  padding: 0.15rem 0.45rem;
  border-radius: 999px;
}

.fm-kanban-column__body {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  flex: 1;
  min-height: 240px;
}

.fm-kanban-card {
  background: #ffffff;
  border: 1px solid #dfe4ec;
  border-radius: 12px;
  padding: 0.85rem;
  box-shadow: 0 4px 12px rgba(15, 23, 42, 0.08);
  cursor: grab;
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.fm-kanban-card:active {
  cursor: grabbing;
}

.fm-kanban-card.is-dragging {
  opacity: 0.7;
  transform: rotate(1deg);
  box-shadow: 0 8px 16px rgba(15, 23, 42, 0.15);
}

.fm-kanban-meta {
  color: #6b7280;
  font-size: 0.8rem;
}

.fm-kanban-progress {
  display: flex;
  align-items: center;
  gap: 0.3rem;
}

.fm-kanban-progress span {
  height: 6px;
  flex: 1;
  border-radius: 999px;
  background: #cfe0ff;
}

.fm-kanban-progress span.is-active {
  background: #2563eb;
}

.fm-kanban-status {
  font-size: 0.75rem;
  font-weight: 600;
  color: #6b7280;
}

/* ============================
   Termine
   ============================ */

.fm-termine-filter-menu {
  position: absolute;
  right: 0;
  margin-top: 0.5rem;
  min-width: 340px;
  background: #ffffff;
  border: 1px solid #e2e8f0;
  border-radius: 12px;
  box-shadow: 0 16px 32px rgba(15, 23, 42, 0.12);
  padding: 1rem;
  z-index: 20;
}

.fm-termine-filter-columns {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 1.5rem;
}

.fm-termine-filter-title {
  font-size: 0.7rem;
  font-weight: 700;
  text-transform: uppercase;
  color: #1f2937;
  letter-spacing: 0.05em;
  margin-bottom: 0.75rem;
}

.fm-termine-filter-list {
  display: grid;
  gap: 0.35rem;
  max-height: 240px;
  overflow-y: auto;
}

.fm-termine-item {
  background: #ffffff;
  border-radius: 12px;
  border: 1px solid #e2e8f0;
  padding: 0.85rem;
}

.fm-termine-item + .fm-termine-item {
  margin-top: 0.65rem;
}

.fm-termine-meta {
  color: #6b7280;
  font-size: 0.8rem;
}

.fm-termine-badge {
  font-size: 0.7rem;
  font-weight: 600;
  padding: 0.2rem 0.6rem;
  border-radius: 999px;
  background: #e2e8f0;
  color: #1f2937;
}

.fm-termine-badge.is-warning {
  background: #fde68a;
  color: #92400e;
}

.fm-termine-badge.is-danger {
  background: #fecaca;
  color: #b91c1c;
}

.fm-termine-badge.is-success {
  background: #bbf7d0;
  color: #166534;
}

.fm-termine-empty {
  border: 1px dashed #cbd5f5;
  border-radius: 12px;
  padding: 1.5rem;
  text-align: center;
  color: #6b7280;
  background: #f8fafc;
}

/* ============================
   Main vehicle table
   ============================ */

/* Sticky header only for main vehicle table */
#vehicle-table-container thead th {
  position: sticky;
  top: 0;
  z-index: 20;
}

/* Container sizing for main table */
#vehicle-table-container {
  height: 360px;
  max-height: 60vh;
  overflow-y: auto;
  overflow-x: auto;
}

/* Shared header height for main + summary tables */
#vehicle-table-container thead th,
#vehicle-summary-table thead th {
  height: 40px;              /* fixed height for both headers */
  vertical-align: middle;    /* center text vertically */
  padding-top: 0.25rem;      /* slight padding tuning if needed */
  padding-bottom: 0.25rem;
}

/* Internal vertical dividers (column lines) for main table */
#vehicle-table-container table.table th,
#vehicle-table-container table.table td {
  border-right: 1px solid var(--bs-border-color, #dee2e6);
  text-align: center;
  vertical-align: middle;
  table-layout: auto; 
}

#vehicle-table-container table.table th:last-child,
#vehicle-table-container table.table td:last-child {
  border-right: none;
}

#vehicle-table tbody tr {
  cursor: pointer;
}

/* Persist highlight for the last selected row */
#vehicle-table tr.vehicle-row-selected td {
  background-color: #e6f0ff;
}

.availability-gantt {
  --gantt-timeline-width: 780px;
  background-color: #fff;
}

.availability-gantt-scroll {
  overflow-x: auto;
  padding-bottom: 0.5rem;
}

.availability-gantt-axis,
.availability-gantt-track {
  min-width: var(--gantt-timeline-width);
}

.availability-gantt-axis {
  display: flex;
  font-size: 0.75rem;
  color: #495057;
  padding: 0.25rem 0 0.5rem;
  border-bottom: 1px solid #e9ecef;
  gap: 0;
}

.availability-gantt-axis span {
  flex: 1 0 auto;
  text-align: center;
  border-right: 1px solid #e9ecef;
  padding: 0 0.25rem;
}

.availability-gantt-axis span:last-child {
  border-right: none;
}

.availability-gantt-rows {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  padding-top: 0.75rem;
}

.availability-gantt-row {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.availability-gantt-label {
  flex-shrink: 0;
  width: 72px;
  font-weight: 600;
}

.availability-gantt-track {
  position: relative;
  height: 40px;
  padding: 6px 0;
  border-radius: 12px;
  background-color: #f8f9fa;
  overflow: hidden;
}

.availability-gantt-bar {
  position: absolute;
  top: 8px;
  height: 24px;
  border-radius: 8px;
  line-height: 24px;
  color: #fff;
  font-size: 0.75rem;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0 0.4rem;
  white-space: nowrap;
}

.availability-gantt-bar.bg-warning {
  color: #212529;
}

.availability-gantt-legend-item {
  display: flex;
  align-items: center;
  gap: 0.35rem;
  font-size: 0.85rem;
}

.availability-gantt-legend-dot {
  width: 12px;
  height: 12px;
  border-radius: 50%;
  display: inline-block;
  border: 2px solid #fff;
  box-shadow: 0 0 0 1px rgba(0, 0, 0, 0.15);
}

/* Hide vertical scrollbar until hover for main table container */
.scroll-vertical {
  scrollbar-width: none;      /* Firefox: hide */
  padding-bottom: 700px;      /* Extra space at bottom so last row isn't cut off */
}

/* Chrome / Edge / Safari: hide by default */
.scroll-vertical::-webkit-scrollbar {
  width: 0;
}

/* Show scrollbar on hover */
.scroll-vertical:hover {
  scrollbar-width: thin;
  scrollbar-color: #a0aec0 transparent;
}

/* Chrome / Edge / Safari: thin bar on hover */
.scroll-vertical:hover::-webkit-scrollbar {
  width: 6px;
}

/* Rounded thumb */
.scroll-vertical:hover::-webkit-scrollbar-thumb {
  background: #a0aec0;
  border-radius: 12px;
}

/* Transparent track */
.scroll-vertical:hover::-webkit-scrollbar-track {
  background: transparent;
}

/* ============================
   Summary table (popup header)
   ============================ */

/* Let Bootstrap .table/.table-light handle most styling; we only
   control layout and the rounded top corners. */
#vehicle-summary-table {
  table-layout: auto;
  width: 100%;      /* fill the modal width */
}

/* Internal vertical dividers (column lines) for summary table */
#vehicle-summary-table th,
#vehicle-summary-table td {
  border-right: 1px solid var(--bs-border-color, #dee2e6);
  text-align: center;
  vertical-align: middle;
}

#vehicle-summary-table th:last-child,
#vehicle-summary-table td:last-child {
  border-right: none;
}

/* Wrapper that holds the summary table at the top of the modal */
.vehicle-summary-wrapper {
  margin: 0;
  padding: 0;
  border-bottom: 1px solid #d1d5db;
}

/* Rounded upper corners + no extra spacing */
.vehicle-summary-wrapper .table-responsive {
  margin: 0;
  border-radius: 0.75rem 0.75rem 0 0; /* round upper corners */
  overflow: hidden;                    /* clip inner borders to radius */
}

/* =======================================
   Horizontal scroll for summary table
   ======================================= */
#vehicle-summary-scroll {
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none; /* Firefox: hide by default */
}

/* Chrome / Edge / Safari: hide scrollbar by default */
#vehicle-summary-scroll::-webkit-scrollbar {
  height: 0;
}

/* Show scrollbar only when hovering */
#vehicle-summary-scroll:hover {
  scrollbar-width: thin;
  scrollbar-color: #a0aec0 transparent;
}

/* Chrome / Edge / Safari: thin visible scrollbar on hover */
#vehicle-summary-scroll:hover::-webkit-scrollbar {
  height: 6px;
}

#vehicle-summary-scroll:hover::-webkit-scrollbar-thumb {
  background: #a0aec0;
  border-radius: 12px;
}

#vehicle-summary-scroll:hover::-webkit-scrollbar-track {
  background: transparent;
}

/* Prevent table from shrinking too narrow */
#vehicle-summary-table {
  min-width: 1200px; /* same width threshold as main table */
}


/* Ensures table doesn't shrink too narrow */
#vehicle-summary-table {
  min-width: 1200px; /* matches main table width threshold */
}


/* ============================
   Stammdaten table (left side)
   ============================ */

#vehicle-details-table {
  table-layout: auto;
  width: 100%;
}

#vehicle-details-table td:first-child {
  width: 40%;
  max-width: 40%;
}

#vehicle-details-table td:last-child {
  width: 60%;
  max-width: 60%;
}

#vehicle-details-table td {
  white-space: normal;
  overflow-wrap: break-word;
  word-wrap: break-word;
  word-break: break-word;
  padding: 0.35rem 0;
}

/* ============================
   Inventar table
   ============================ */

/* Ensure body cells are white (header uses table-light) */
.inventar-table tbody td {
  background-color: #ffffff;
}

/* ============================
   Vehicle modal info tables
   ============================ */

.fm-info-block {
  background: #ffffff;
  border: 1px solid #d9dee6;
  border-radius: 8px;
  padding: 0.75rem 0.85rem 0.9rem;
  box-shadow: 0 1px 2px rgba(15, 23, 42, 0.04);
}

.fm-info-row {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 1rem;
}

.fm-info-row .fm-info-block {
  height: 100%;
}

.fm-info-block__header {
  font-weight: 600;
  color: #0f172a;
  padding: 0.09rem 0.09rem 0.39rem;
  margin-bottom: 0.36rem;
}

.fm-info-block__body {
  padding: 0 0.09rem;
}

.fm-info-table {
  border-collapse: separate;
  border-spacing: 0;
  border: 1px solid #e0e5ec;
  border-radius: 6px;
  overflow: hidden;
  background-color: #ffffff;
  box-shadow: none;
}

.fm-info-table thead th {
  background: #f7f8fb !important;
  color: #0f172a;
  font-weight: 600;
  padding: 0.6rem 0.9rem;
  border-bottom: 1px solid #e0e5ec;
}

.fm-info-table td {
  padding: 0.65rem 0.9rem;
  color: #4b5563;
  font-size: 0.9rem;
  vertical-align: middle;
  border-top: 1px solid #eef2f7;
  background: #ffffff;
}

.fm-info-table tbody td {
  border-radius: 4px;
  background-clip: padding-box;
}

.fm-info-table td.fm-info-label {
  font-weight: 500;
  color: #000000;
  background: #ffffff;
  white-space: nowrap;
  width: auto;
}

.fm-info-table thead th + th,
.fm-info-table td + td {
  border-left: 1px solid #eef2f7;
}

.fm-info-table tbody tr {
  background: #ffffff;
}

.fm-info-table tbody tr:nth-child(even) {
  background: #ffffff;
}

/* ============================
   Zustand state card
   ============================ */

.fm-state-card {
  --state-accent: #f5a524;
  --state-bg: #fff8e6;
  --state-border: #f3d59b;
  --state-text: #7a4b00;
  background: var(--state-bg);
  border: 1px solid var(--state-border);
  border-left: 4px solid var(--state-accent);
  border-radius: 8px;
  padding: 0.75rem 0.95rem;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  box-shadow: 0 1px 3px rgba(15, 23, 42, 0.06);
}

.fm-state-card.is-success {
  --state-accent: #2e9b57;
  --state-bg: #ecf8f1;
  --state-border: #bfe7d0;
  --state-text: #1f6b3b;
}

.fm-state-card.is-warning {
  --state-accent: #f5a524;
  --state-bg: #fff8e6;
  --state-border: #f3d59b;
  --state-text: #7a4b00;
}

.fm-state-card.is-danger {
  --state-accent: #d64545;
  --state-bg: #fff1f1;
  --state-border: #f3c2c2;
  --state-text: #9b2c2c;
}

.fm-state-card.is-neutral {
  --state-accent: #94a3b8;
  --state-bg: #f8fafc;
  --state-border: #e2e8f0;
  --state-text: #475569;
}

.fm-state-row {
  display: flex;
  align-items: center;
  gap: 0.65rem;
}

.fm-state-icon {
  width: 28px;
  height: 24px;
  background: var(--state-accent);
  color: #ffffff;
  font-weight: 700;
  font-size: 0.75rem;
  display: flex;
  align-items: flex-end;
  justify-content: center;
  padding-bottom: 3px;
  clip-path: polygon(50% 0%, 0% 100%, 100% 100%);
}

.fm-state-badge {
  background: rgba(245, 165, 36, 0.2);
  color: var(--state-text);
  padding: 0.25rem 0.7rem;
  border-radius: 999px;
  font-weight: 600;
  font-size: 0.85rem;
}

.fm-state-card.is-success .fm-state-badge,
.fm-state-card.is-danger .fm-state-badge,
.fm-state-card.is-neutral .fm-state-badge {
  background: rgba(15, 23, 42, 0.08);
}

.fm-state-line {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  color: #4b5563;
  font-size: 0.9rem;
}

.fm-state-label {
  font-weight: 500;
  color: #475569;
  font-size: 0.9rem;
}

.fm-state-value {
  color: #0f172a;
  font-weight: 600;
  font-size: 0.9rem;
}

.fm-state-divider {
  height: 1px;
  background: rgba(15, 23, 42, 0.08);
}

/* ============================
   Dokumente: status dot
   ============================ */

.doc-status-dot {
  width: 8px;
  height: 8px;
  display: inline-block;
}

/* ============================
   Vehicle modal sizing
   ============================ */

/*
  The .fm-vehicle-dialog is the modal-dialog that we position
  and size via JS to match the main table container.
  Here we just ensure Bootstrap doesn't constrain it.
*/
.fm-vehicle-dialog {
  max-width: none; /* Allow full custom width */
}

/* Make modal content fill the custom dialog height */
.fm-vehicle-dialog .modal-content {
  height: 100%;
}

/* ============================
   Kosten totals (monthly / yearly) - slightly larger & bold
   ============================ */
#total-monthly-cost,
#total-yearly-cost,
#reparatur-total-cost {
  /* make totals more prominent inside the small alert */
  font-size: 1.15rem; /* slightly larger */
  font-weight: 700;   /* enforce bold */
  line-height: 1.1;
}

/* Add a small tweak so the reparatur alert has consistent spacing when placed inside the tab */
#panel-reparatur .alert {
  margin-top: 0.5rem;
}
