/* ============================================
   calc.css - Rechner-spezifisches Styling
   Für: pages/calc/, pages/calc_presets/
   
   Basierend auf main.css Theme-Variablen
   Responsive: 667x375px bis 4K
   ============================================ */

/* ============================================
   RECHNER HAUPTCONTAINER
   ============================================ */

#mainFrame {
  display: flex;
  flex-direction: column;
  justify-content: space-evenly;
  gap: clamp(.2rem, 1.5vmin, 1rem);
  width: 95%;
  align-self: center;
}

#upperMenu {
  display: flex;
  flex-direction: column;
  gap: .2rem;
  text-wrap: nowrap;
  margin-top: clamp(0.1rem, 0.2vmin, 0.3rem)
}

#GB_Menu {
  display: flex;
  flex-direction: row;
}

#GB_Selection {
  display: flex;
  flex-direction: row;
}

/* FP-Anzeige */
#divFpInfo {
  flex: 1 0 auto;
}

#divTotalFp, #divOwnFp {
  width: 50%;
}

#divFavSelection {
  flex: 1 0 auto;
  justify-content: center;
}

/* totalFp: padding, border-radius, highlight-btn bei state-error */
#totalFp {
  padding: 0 0.3rem;
  border-radius: var(--radius-md);
}

#totalFp.state-error {
  box-shadow: inset -2px 2px 7px var(--color-highlight-strong), inset 2px -2px 7px var(--color-shadow);
}

/* ownFp Reset-Button */
#ownFpReset {
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: bold;
  cursor: pointer;
  padding: 0 clamp(0.4rem, 2.5vmin, 1.5rem);
  height: auto;
  align-self: center;
}

#ownFpReset:hover {
  filter: brightness(1.2);
}

#GbLevel {
  width: 6ch;
}

#ownFp {
  width: 50%
}

/* Favoriten-Container */
#divFavFp {
  display: flex;
  flex-direction: row;
  align-content: space-around;
}

#favListWorlds, #favListGbs {
  display: flex;
  flex-direction: column;
  min-height: 5rem;
  max-height: 50vh;
  gap: .2rem;

  overflow-y: auto;
}

/* ============================================
   CALCULATOR SECTION LAYOUT
   ============================================ */

#calcSection {
  display: flex;
  flex-direction: row;
  gap: 1rem;
  justify-content: space-around;
}

#mainTable {
  display: grid;
  grid-template-rows: 1fr 1fr 1fr 1fr 1fr 1fr;
  grid-template-columns: 7fr 5fr 7fr 8fr 8fr 8fr;
  flex: 5;
}

#externalTable {
  display: grid;
  grid-template-rows: 1fr 1fr 1fr 1fr 1fr 1fr;
  flex: 1;
}

/* Copy-Funktion Inputs */
#calcCopyText {
  width: 50%;
}

#calcCopyStyle {
  width: 30%;
}

/* ============================================
   COPY LIST SECTION
   ============================================ */

#copyListSection {
  align-items: flex-start;
}

.copy-list-buttons {
  display: flex;
  flex-direction: column;
  gap: .2rem;
}

.copy-list-btn {
  min-width: 5.5ch;
  text-align: center;
}

#calcCopyListContainer {
  flex: 1;
  max-height: 5em;
  overflow-y: auto;
}

.copy-list-row {
  display: flex;
  align-items: center;
  padding: .1rem .4rem;
  border-bottom: 1px solid var(--color-border);
  cursor: pointer;
}

.copy-list-row:last-child {
  border-bottom: none;
}

.copy-list-row:hover {
  background: var(--color-highlight-soft);
}

.copy-list-text {
  flex: 1;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.copy-list-del {
  margin-left: .4rem;
  font-weight: bold;
  cursor: pointer;
  flex-shrink: 0;
}

.copy-list-empty {
  padding: .2rem .4rem;
  font-size: .8em;
  opacity: .5;
  text-align: center;
}

/* ============================================
   RESPONSIVE - KLEINE DISPLAYS (460px)
   ============================================ */

@media (max-width: 460px) {

  #calcSection {
    flex-direction: column;
  }

  #externalTable {
    grid-template-rows: 1fr 1fr;
    grid-template-columns: 1fr 1fr 1fr 1fr 1fr;
    row-gap: 1vmin;
  }

  #calcExternalButton {
    grid-column: 1/6;
  }

  #divFavFp {
    flex-direction: column;
  }

  #favTables {
    flex-direction: column;
  }

  /* FP-Info auf 2 Zeilen verteilen */
  #divFpInfo {
    flex-direction: column;
    align-items: center;
  }

  #divTotalFp, #divOwnFp {
    width: auto;
    flex: 1;
    justify-content: center;
  }

  /* ownFp Input im Portrait größer machen */
  #ownFp {
    width: 6ch;
  }
}

/* ============================================
   CALC_PRESETS - Favoriten Verwaltung
   (generische .presets-* Klassen liegen in main.css)
   ============================================ */

/* calc_presets: Root/Tabellen-Container nutzen .flex-1 aus dem HTML.
   Kein overflow:hidden/height hier → bei kleinem Viewport wächst der
   Content über #content hinaus und dort scrollt (wie snipe/calc).
   Lange Listen wachsen frei, Seiten-Scroll in #content übernimmt. */

/* Nebeneinander (Default): Padding für Seitenabstand,
   größerer Gap zwischen den Tabellen. */
#favTables {
  padding-inline: clamp(1rem, 5vw, 4rem);
  gap: clamp(1rem, 4vw, 3rem);
}

#favTables .presets-table {
  width: 100%;
}

/* Responsive für calc_presets: gestapelt → zentriert (nur Portrait) */
@media (max-width: 900px) and (orientation: portrait) {
  #favTables {
    flex-direction: column;
    align-items: center;
    padding-inline: clamp(1rem, 5vw, 3rem);
    gap: 1.5rem;
  }

  #favTables .presets-table {
    width: 90%;
  }
}

