/**
 * Firefox (Mozilla) pārlūka pielāgojumi – tiek lietoti tikai Firefox.
 * Galvenā problēma: body ir display:flex un bērni bez width:100%
 * Firefox nesaņem pilnu platumu (Chrome to dara automātiski).
 */
@supports (-moz-appearance: none) {
  /* Novērš horizontālo ritenu no .skewed-bg transform */
  html {
    overflow-x: hidden;
  }
  body {
    overflow-x: hidden;
    -moz-osx-font-smoothing: grayscale;
  }

  /*
   * GALVENAIS LABOJUMS: body ir display:flex; flex-direction:column (style2.css).
   * Firefox neauto-izstiepj flex bērnus uz pilnu platumu kā Chrome.
   * Nepieciešams width:100% vai align-self:stretch visiem tiešajiem bērniem.
   */
  body > * {
    width: 100%;
    box-sizing: border-box;
  }
  .main-content-wrapper {
    width: 100%;
    box-sizing: border-box;
  }
  .controls-container {
    width: 100%;
    box-sizing: border-box;
    background-color: var(--panel);
    border: 1px solid var(--border);
    border-radius: var(--r);
  }
  .shell {
    width: 100%;
    box-sizing: border-box;
    align-items: stretch;
  }
  .navbar {
    width: 100%;
    box-sizing: border-box;
  }
  footer {
    width: 100%;
    box-sizing: border-box;
  }

  /* Lapām ar tumšo motīvu (index3, prem.calc): vienots tumšs fons */
  body[data-theme="dark"] {
    background-color: #0a0e16;
    background-image: none;
  }
  body[data-theme="light"] {
    background-color: #f4f7ff;
    background-image: none;
  }

  /* Ritentiņi */
  :root {
    scrollbar-width: thin;
    scrollbar-color: rgba(255, 255, 255, 0.25) transparent;
  }
  [data-theme="light"] {
    scrollbar-color: rgba(0, 0, 0, 0.2) transparent;
  }

  /* Grid/Flex bērniem: min-width un min-height 0, lai neizlauztos */
  .main-content-wrapper,
  .shell,
  .panel,
  .panelHead,
  .panelBody,
  .calculator-wrapper,
  .controls-container,
  .seg,
  .group,
  .item,
  .itemTop,
  .panelHead__top,
  .panelHead__body,
  .panel-head-row,
  .calculator-with-results,
  .results-wrapper,
  #results1,
  .breakdown,
  .legend {
    min-width: 0;
  }
  .main-content-wrapper,
  .shell,
  .calculator-with-results,
  .panelBody,
  .group {
    min-height: 0;
  }

  /* .row3 grid bērniem min-width 0 */
  .row3,
  .aggCard .row3 {
    min-width: 0;
    width: 100%;
    box-sizing: border-box;
  }
  .row3 > *,
  .aggCard .row3 > * {
    min-width: 0;
  }

  /* Paneļi: pilns platums iekš grid */
  .calculator-wrapper,
  .calculator-with-results {
    width: 100%;
    display: flex;
    flex-direction: column;
    min-height: 0;
  }
  .panel {
    width: 100%;
    overflow: hidden;
    box-sizing: border-box;
  }

  /* Select/input – vienots izskats */
  select,
  input,
  select.form-control,
  select.form-select,
  .panel-head-select,
  input.form-control,
  input[type="number"],
  input[type="text"],
  input[type="email"],
  input[type="password"] {
    -moz-appearance: none;
    appearance: none;
    box-sizing: border-box;
  }

  /* Pogu fokuss */
  button:focus-visible,
  .btn:focus-visible,
  a:focus-visible {
    outline: 2px solid var(--primary-color, #FF4400);
    outline-offset: 2px;
  }
  .panel button:focus-visible,
  .seg button:focus-visible {
    outline: 2px solid rgba(255, 59, 59, 0.6);
    outline-offset: 2px;
  }
  button::-moz-focus-inner,
  .btn::-moz-focus-inner,
  input[type="submit"]::-moz-focus-inner,
  input[type="button"]::-moz-focus-inner {
    border: 0;
    padding: 0;
  }

  /* Skewed fons */
  .skewed-bg {
    -moz-transform: skewY(-5deg);
    transform: skewY(-5deg);
    transform-origin: top left;
    will-change: transform;
  }
}
