/* =========================
   SETTINGS PAGE
   Basis = Landscape-Layout (Spiel wird nur im Landscape gespielt)
   Nur Portrait-Anpassungen in Media Query
   ========================= */

/* =========================
   SETTINGS LAYOUT - LANDSCAPE (DEFAULT)
   ========================= */

#settingsRoot {
  width: 100%;
  height: 100vh;
  height: calc(var(--vh, 1vh) * 100);
  display: flex;
  flex-direction: column;
  min-height: 0;
}

#settingsContent.settings-grid-layout {
  display: flex;
  flex-direction: row;
  gap: 0.8rem;
  padding: 0.3rem;
  overflow: hidden;
  justify-content: center;
  align-items: stretch;
  flex: 1 1 auto;
  min-height: 0;
  width: 100%;
}

.settings_core {
  align-self: stretch;
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 0.3rem;
  min-height: 0;
  justify-content: space-evenly;
}

.settings_factors {
  align-self: stretch;
  flex: 1.4;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 0.3rem;
  min-height: 0;
  justify-content: space-evenly;
}

/* Settings rows */
.settings-row {
  width: 100%;
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
  justify-content: center;
}

/* =========================
    SETTINGS COMPONENTS
    ========================= */

.settings-full-width {
  grid-column: 1 / -1;
}

.action-buttons-row{
  display: flex;
  justify-content: space-evenly;
}


/* =========================
   SHORTNAMES MODAL
   ========================= */

#shortnamesModal .shortnames-modal-content {
  display: flex;
  flex-direction: column;
  width: min(96vw, 85vh);
  height: clamp(85vh, calc(600px + 10vh), 95%);
  max-width: 96vw;
  max-height: 96vh;
  padding: clamp(0.6rem, 2vmin, 1.2rem);
}

.shortnames-modal-content h3 {
  text-align: center;
  margin: 0 0 clamp(0.3rem, 1.5vmin, 0.6rem) 0;
  font-size: inherit;
  color: var(--color-text-primary);
  flex-shrink: 0;
}

.shortnames-modal-body {
  display: flex;
  flex: 1;
  min-height: 0;
  gap: clamp(0.5rem, 1.5vmin, 0.8rem);
  overflow: hidden;
  align-items: center;
}

.shortnames-scroll-container {
  flex: 1;
  display: flex;
  flex-direction: column;
  min-width: 0;
  /* max-height: min(75vh, calc(min(96vh, 650px) - clamp(1.2rem, 4vmin, 1.8rem))); */
  overflow-y: auto;
  width:100%;
  height:100%;
}

.shortname-entry {
  display: flex;
  flex-direction: column;
  width: 100%;
  cursor: pointer;
  user-select: none;
  transition: background-color 0.15s ease;
}

.shortname-entry:hover {
  filter: brightness(1.08);
}

.shortname-full {
  width: 100%;
  padding: clamp(0.3rem, 1vmin, 0.5rem) clamp(0.5rem, 1.2vmin, 0.8rem);
  font-size: inherit;
  text-align: center;
  color: var(--color-text-secondary);
  background-color: var(--color-bg-secondary);
  border-bottom: 1px solid var(--color-border);
}

.shortname-short {
  width: 100%;
  padding: clamp(0.3rem, 1vmin, 0.5rem) clamp(0.5rem, 1.2vmin, 0.8rem);
  font-size: inherit;
  text-align: center;
  color: var(--color-text-tertiary);
  background-color: var(--color-bg-tertiary);
  border-bottom: 1px solid var(--color-border);
}

.shortnames-modal-buttons {
  display: flex;
  flex-direction: column;
  gap: clamp(0.6rem, 1.5vmin, 1rem);
  justify-content: center;
  align-items: center;
  flex-shrink: 0;
  height: fit-content;
}

/* =========================
   DATA BACKUP MODAL
   ========================= */

#dataBackupModal .backup-modal-content {
  display: flex;
  flex-direction: column;
  width: clamp(45vw, calc(300px + 30vw), 95%);
  height: clamp(50vh, calc(300px + 10vh), 95%);
  max-width: 96vw;
  max-height: 96vh;
  padding: clamp(0.6rem, 2vmin, 1.2rem);
}

.backup-modal-content h3 {
  text-align: center;
  margin: 0 0 clamp(0.3rem, 1.5vmin, 0.6rem) 0;
  font-size: inherit;
  color: var(--color-text-primary);
  flex-shrink: 0;
}

.backup-modal-body {
  display: flex;
  flex-direction: column;
  flex: 1;
  min-height: 0;
  gap: clamp(1rem, 3vmin, 1.8rem);
  overflow-y: auto;
  padding: clamp(0.3rem, 1vmin, 0.5rem) 0;
  justify-content: center;
  align-items: center;
}

.backup-section {
  display: flex;
  flex-direction: column;
  gap: clamp(0.4rem, 1vmin, 0.6rem);
  align-self: center;
  width: 100%;
  align-items: center;
}

.backup-upload-row {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: clamp(0.4rem, 1vmin, 0.6rem);
}

.backup-upload-row input[type="file"] {
  font-size: inherit;
  color: var(--color-text-primary);
  max-width: none;
}

.backup-modal-buttons {
  display: flex;
  justify-content: center;
  padding-top: clamp(0.4rem, 1vmin, 0.6rem);
  border-top: 1px solid var(--color-border);
}

/* =========================
   PORTRAIT-ONLY ADJUSTMENTS
   ========================= */

@media (orientation: portrait) {
  /* Settings gestapelt */
  #settingsContent.settings-grid-layout {
    flex-direction: column;
    padding: 0.3rem;
    gap: 0.5rem;
    overflow-y: auto;
  }
  
  #settingsContent.settings_core,
  #settingsContent.settings_factors {
    max-width: 100%;
    width: 100%;
    flex: 1;
    min-height: 0;
  }
  
  /* Core first */
  #settingsContent.settings_core {
    order: 1;
  }
  
  /* Factors below */
  #settingsContent.settings_factors {
    order: 2;
  }
  
  .toggle-switch--pill {
    width: 36px;
    height: 20px;
    border-radius: 10px;
  }
  
  .toggle-switch--pill::after {
    width: 14px;
    height: 14px;
    top: 3px;
    left: 3px;
  }
  
  .toggle-switch--pill.active::after {
    transform: translateX(16px);
  }
  
  .backup-modal-content {
   height: clamp(50vh, calc(300px + 10vh), 95%);
  }
  
  /* Shortnames Modal Layout */
  .shortnames-modal-content {
    height: clamp(85vh, calc(600px + 10vh), 95%);
    /* height: min(96vh, 85vmin); */
  }
  
  .shortnames-modal-body {
    flex-direction: column;
  }
  
  /* Reset shortcuts buttons to row for portrait */
  .shortnames-modal-buttons {
    flex-direction: row;
    width: 100%;
  }
}

/* =========================
   THEME SELECTOR DROPDOWN
   ========================= */

#themeSelector {
  width: 100%;
  padding: 6px 8px;
  font-size: clamp(16px, 2.8vmin, 3rem);
  border-radius: 4px;
  border: none;
  cursor: pointer;
  outline: none;
  /* Verwendet jetzt die .button und .highlight-btn Klassen */
}
