/*
 * Expeditions Calculator - Bootstrap 5 Styles
 * Migrated from jQuery UI to Bootstrap 5.3.8
 * Shared pieces (.main-header, .subheader, .lined tables, warning banner)
 * follow the same conventions as the moon / graviton calculators. The tooltip
 * skin is not restated here - it lives once in css/common_bs.css.
 */

#expeditions {
  width: max-content;
  max-width: 100%;
  margin: 0 auto;
  position: relative;
  overflow-x: auto;
}

/* The results table is the widest content on the page, so the settings panel
   must not inflate #expeditions' max-content width: width:0 removes its
   contribution and min-width stretches it back. The m-1 utility adds 0.25rem
   margin per side, so subtract 0.5rem to keep the outer box within the parent. */
#settings-panel,
#api-accordion {
  width: 0;
  min-width: calc(100% - 0.5rem);
  box-sizing: border-box;
}

/* Stack both parameter tabs in the same grid cell so the widest and tallest one
   sizes the panel once and for all. Bootstrap hides inactive panes with
   display:none, which would drop them out of that intrinsic sizing and make the
   whole (max-content, centred) calculator jump on every tab switch, so they are
   hidden with visibility instead. */
#paramTabContent {
  display: grid;
}

#paramTabContent > .tab-pane {
  display: block;
  grid-area: 1 / 1;
}

/* Collapsed to zero height so only the active pane drives the panel height,
   while the grid column still sizes to the widest pane. */
#paramTabContent > .tab-pane:not(.active) {
  visibility: hidden;
  height: 0;
  overflow: hidden;
}

.main-header {
  width: auto;
  font-size: 0.95rem;
  font-weight: 600;
  padding: 4px;
  margin: 2px;
}

.subheader {
  text-align: center;
  font-weight: 600;
  margin: 0 0 6px 0 !important;
  padding: 2px 6px;
}

#reset {
  cursor: pointer;
  z-index: 10;
  width: 30px;
  height: 30px;
  border: 1px solid #dc3545;
  border-radius: 8px;
  margin-right: 0.2rem;
}

/* Layout tables: tighten the default cell padding and align vertically. */
#expeditions table td {
  padding: 2px 4px;
  vertical-align: middle;
}

/* Table styling (shared with the queue / costs / production calculators) */
.lined {
  border-collapse: collapse;
}

.lined th {
  background-color: var(--bs-tertiary-bg);
  font-weight: 600;
  padding: 2px 8px;
  border: 1px solid var(--bs-border-color);
  text-align: center;
}

.lined td {
  border: 1px solid var(--bs-border-color);
  padding: 2px 8px;
  white-space: nowrap;
}

/* Bootstrap scopes --bs-table-striped-bg to .table, so it resolves to nothing
   here; mix the stripe off the body colour instead, which flips with the theme. */
.lined tr.odd {
  background-color: color-mix(in srgb, var(--bs-body-color) 7%, transparent);
}

.lined tr.even {
  background-color: transparent;
}

/* Compact controls placed inside .lined tables */
.lined .form-control-sm {
  height: 1.5rem;
  min-height: unset;
  padding-top: 0;
  padding-bottom: 0;
}

/* Inputs */
.level-input {
  width: 60px;
  text-align: center;
}

.count-input {
  width: 80px;
  text-align: center;
}

/* Bootstrap's input-group overrides width utilities that are not id-scoped, so
   the percentage fields inside one get their own rule. */
.input-group > .form-control.percent-input {
  flex: 0 0 auto;
  width: 60px;
  text-align: center;
}

/* Clearing the fleet sits in the "number" column header. */
.clear-fleet-btn {
  padding: 0 4px;
  line-height: 1;
  vertical-align: middle;
}

/* The API table carries prose, so let it wrap instead of stretching the page. */
#api-table td {
  white-space: normal;
}

/* Warning banner (shared look with the moon / graviton calculators) */
#warning {
  position: absolute;
  top: 20px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 9999;
  padding: 10px 20px;
  text-align: center;
  background-color: var(--bs-warning-bg-subtle);
  border: 1px solid var(--bs-warning-border-subtle);
  border-radius: var(--bs-border-radius);
  color: var(--bs-body-color);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
  min-width: 300px;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.4s ease-in-out;
}

#warning.visible {
  opacity: 1;
  pointer-events: auto;
  display: block;
}

/* Responsive */
@media (max-width: 992px) {
  #expeditions {
    max-width: 100%;
    padding: 0 10px;
  }
}
