/* =========================
   Global
   ========================= */

body {
  margin: 0;
  background-color: var(--bs-body-bg);
  font-family: "Inter", system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  font-size: 0.875rem;
  line-height: 1.35;
}

/* =========================
   Calculator Container
   ========================= */

.calculator-wrapper {
  max-width: 68.75rem;      /* ~1100px */
  margin: 1.25rem auto;     /* ~20px */
  padding: 1rem 1.25rem;    /* ~16px 20px */
  border-radius: 0.875rem;  /* ~14px */
  box-shadow: 0 0.5rem 1.5rem rgba(0, 0, 0, 0.35);
}

/* Camera select width (replaces inline style) */
.camera-select {
  max-width: 26rem;
  /*transition: box-shadow 0.15s ease;*/
}

/*
.camera-select:focus {
  box-shadow: 0 0 0 0.15rem rgba(13, 110, 253, 0.25);
}
*/

/* ===== Camera custom dropdown ===== */

.camera-dropdown {
  position: relative;
  max-width: 26rem; /* same as your previous camera-select max width */
}

/* Combobox button styled like an input */
.camera-combobox {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  cursor: pointer;
  text-align: left;
  position: relative;
}

.camera-combobox-text {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  position: absolute;
  left: 50%;
  transform: translateX(-50%);
  text-align: center;
  width: calc(100% - 2.5rem); /* leaves space for caret */
  pointer-events: none;       /* click goes to button */
}

.camera-combobox-caret {
  opacity: 0.8;
  margin-left: auto;
}

/* Popup listbox */
.camera-listbox {
  position: absolute;
  z-index: 1050;
  width: 100%;
  margin-top: 0.35rem;
  background: var(--bs-body-bg);
  border: 1px solid var(--bs-border-color);
  border-radius: 0.75rem;
  box-shadow: 0 0.75rem 1.75rem rgba(0, 0, 0, 0.45);
  max-height: 18rem;
  overflow: auto;
  padding: 0.25rem;
}

/* Groups */
.camera-group {
  border-radius: 0.6rem;
  overflow: hidden;
}

/* Group header */
.camera-group-header {
  padding: 0.5rem 0.6rem;
  font-weight: 600;
  opacity: 0.9;
  user-select: none;
  border-radius: 0.55rem;
}

/* Options container */
.camera-group-options {
  max-height: 0;              /* collapsed by default */
  overflow: hidden;
  transition: max-height 160ms ease;
}

/* Expand on hover (your requested behavior) */
.camera-group:hover .camera-group-options,
.camera-group:focus-within .camera-group-options {
  max-height: 30rem;          /* “big enough” to show options */
}

/* Option rows */
.camera-option {
  padding: 0.45rem 0.6rem;
  border-radius: 0.55rem;
  cursor: pointer;
}

.camera-option:hover,
.camera-option[aria-selected="true"],
.camera-option.is-active {
  background: rgba(255, 255, 255, 0.08);
}

/* Improve keyboard focus visibility inside listbox */
.camera-option:focus {
  outline: none;
}

/* =========================
   Headings
   ========================= */

h1 {
  font-size: 1.6rem;
  margin-bottom: 1rem;
}

.section-title {
  text-align: center;
  font-weight: 600;
  font-size: 1.05rem;
  margin: 1.125rem 0 0.75rem;
}

/* =========================
   Dividers
   ========================= */

.divider {
  border-top: 1px solid var(--bs-border-color);
  margin: 1.125rem 0;
}

/* =========================
   Labels & Inputs
   ========================= */

.form-label {
  margin-bottom: 0.125rem;
  font-weight: 500;
  font-size: 0.85em;
}

.form-control,
.form-select,
.input-group-text,
.btn {
  border-radius: 0.625rem;   /* ~10px */
  font-size: 0.9em;
}

.form-control,
.form-select {
  text-align: center;
  padding: 0.375rem 0.625rem;
}

.input-group-text {
  padding: 0.375rem 0.625rem;
  font-size: 0.85em;
}

/* Make unit spans match unit dropdown width */
.unit-span {
  width: 4.5rem;
  justify-content: center;
  text-align: center;
}

/* Narrow unit dropdowns in input groups */
.unit-select {
  max-width: 4.5rem;
  text-align: left;
}

/* =========================
   Dark Mode Toggle Button
   ========================= */

#themeToggle {
  border-radius: 50%;
  width: 2.125rem;   /* ~34px */
  height: 2.125rem;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.9em;
}

/* =========================
   Bootstrap Grid Tightening
   ========================= */

.row.g-3 {
  --bs-gutter-y: 0.75rem;
}

/* =========================
   Mobile Adjustments
   ========================= */

@media (max-width: 36rem) {
  body { font-size: 0.84rem; }
  h1 { font-size: 1.4rem; }
  .calculator-wrapper { padding: 0.875rem 1rem; }
}

/* Center unit text */
select.unit-select {
    text-align: center;
    text-align-last: center;
}