/**
 * modal_settings.css - Fluid Responsive Settings Modal
 * Dynamically scales using container query units (cqw/cqh) bound to #game-wrapper.
 */

/* ==========================================================================
   SECTION 1: OVERLAY & BACKDROP
   ========================================================================== */

/* Main modal overlay container */
.modal-overlay {
  display: flex;
  position: absolute;
  inset: 0;
  z-index: 1000;
  justify-content: center;
  align-items: center;
  padding: 3.5cqw;
}

/* Hidden state for modal overlay via class or attribute */
.modal-overlay.hidden,
.modal-overlay[hidden] {
  display: none !important;
  visibility: hidden;
  opacity: 0;
  pointer-events: none;
}

/* Dimmed backdrop background with blur effect */
.modal-backdrop {
  position: absolute;
  inset: 0;
  background-color: rgba(5, 3, 2, 0.85);
  backdrop-filter: blur(4px);
}

/* ==========================================================================
   SECTION 2: INERT STATE & ACCESSIBILITY RESETS
   ========================================================================== */

/* Visual feedback and interaction disable for game wrapper when marked inert */
#game-wrapper[inert] {
  filter: blur(1px);
  pointer-events: none !important;
  user-select: none !important;
  transition: filter 0.2s ease-in-out;
}

/* Universal pointer and selection disable for all inert subtrees */
[inert],
[inert] * {
  pointer-events: none !important;
  user-select: none !important;
}

/* ==========================================================================
   SECTION 3: MAIN CARD CONTAINER & FOCUS INDICATORS
   ========================================================================== */

/* Modal Card Window - Scaled relative to game wrapper container */
.settings-card {
  display: flex;
  position: relative;
  z-index: 101;
  flex-direction: column;
  justify-content: space-between;
  overflow: hidden;
  width: 90.5cqw;
  max-width: 92cqw;
  min-height: 65cqh;
  max-height: 88cqh;
  border-radius: 1.5cqw;
  box-shadow: 0 1cqw 3cqw rgba(0, 0, 0, 0.7);
}

/* Accessible keyboard focus ring indicators inside settings card */
.settings-card button:focus-visible,
.settings-card input:focus-visible,
.settings-card [tabindex]:focus-visible {
  outline: 0.4cqw solid var(--border-gold-light, #f3d078);
  outline-offset: 0.4cqw;
}

/* ==========================================================================
   SECTION 4: HEADER & CLOSE CONTROL
   ========================================================================== */

/* Header container for settings modal */
.settings-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 2.2cqh 4cqw;
  background-color: var(--bg-wood-dark, #1a0f0a);
  border-bottom: 0.2cqw solid var(--border-gold, #c89d38);
}

/* Title text inside settings header */
.settings-title {
  color: var(--text-gold, #e2b755);
  font-family: 'Cinzel', serif;
  font-size: 4.2cqw;
  font-weight: 700;
  letter-spacing: 0.05em;
  text-transform: uppercase;
}

/* Red circular close icon button control with gold border */
.btn-close-icon {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 6.5cqw;
  height: 6.5cqw;
  background: radial-gradient(circle at 30% 30%, #e84444 0%, #c42b2b 70%, #9e1b1b 100%);
  color: #ffffff;
  font-family: Arial, sans-serif;
  font-size: 3.6cqw;
  font-weight: 800;
  line-height: 1;
  border: 0.35cqw solid var(--border-gold-light, #f3d078);
  border-radius: 50%;
  box-shadow: 0 0.3cqw 0.8cqw rgba(0, 0, 0, 0.6), inset 0 0.2cqw 0.3cqw rgba(255, 255, 255, 0.35);
  cursor: pointer;
  transition: transform 0.15s ease, filter 0.15s ease, box-shadow 0.15s ease;
}

/* Hover state feedback for close icon button */
.btn-close-icon:hover {
  filter: brightness(1.15);
  transform: scale(1.1);
  box-shadow: 0 0 1.2cqw rgba(243, 208, 120, 0.7), inset 0 0.2cqw 0.3cqw rgba(255, 255, 255, 0.5);
}

/* Active pressed state for close icon button */
.btn-close-icon:active {
  transform: scale(0.95);
  box-shadow: 0 0.2cqw 0.4cqw rgba(0, 0, 0, 0.8);
}

/* ==========================================================================
   SECTION 5: BODY CONTENT & FORM CONTROLS
   ========================================================================== */

/* Main scrollable body container for modal content */
.settings-body {
  display: flex;
  flex: 1;
  flex-direction: column;
  justify-content: center;
  overflow-y: auto;
  padding: 2.8cqh 4cqw;
}

/* Fieldset grouping container for related setting controls */
.settings-group {
  padding: 1.8cqh 3cqw 2.2cqh 3cqw;
  background: rgba(10, 6, 4, 0.3);
  border: 0.2cqw solid rgba(200, 157, 56, 0.3);
  border-radius: 1.2cqw;
}

/* Fieldset legend title heading */
.settings-group-title {
  padding: 0 1cqw;
  color: var(--text-gold, #e2b755);
  font-family: 'Cinzel', serif;
  font-size: 3.4cqw;
}

/* Individual row layout container for setting label and control */
.setting-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 3cqw;
  margin-top: 1.8cqh;
}

/* Descriptive text label for individual setting */
.setting-label {
  flex: 1;
  color: #d1c2a5;
  font-size: 3.1cqw;
}

/* Interactive control wrapper holding input control and value display */
.setting-control {
  display: flex;
  align-items: center;
  gap: 1.5cqw;
  min-width: 36cqw;
}

/* Text display for numerical slider or setting value */
.setting-value {
  width: 8cqw;
  color: var(--text-gold, #e2b755);
  font-size: 2.8cqw;
  text-align: right;
  font-variant-numeric: tabular-nums;
}

/* Custom styled range input slider control */
.range-slider {
  flex: 1;
  height: 1.5cqh;
  accent-color: var(--border-gold, #c89d38);
  cursor: pointer;
}

/* Custom styled checkbox toggle switch element */
.toggle-checkbox {
  width: 4cqw;
  height: 4cqw;
  accent-color: var(--border-gold, #c89d38);
  cursor: pointer;
}

/* ==========================================================================
   SECTION 6: FOOTER & ACTION BUTTONS
   ========================================================================== */

/* Footer container for modal action buttons */
.settings-footer {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 2.5cqw;
  padding: 2.2cqh 4cqw;
  background-color: var(--bg-wood-dark, #1a0f0a);
  border-top: 0.2cqw solid var(--border-gold, #c89d38);
}

/* Shared base styling for footer action buttons */
.btn-primary,
.btn-secondary {
  padding: 1.4cqh 3cqw;
  font-family: 'Cinzel', serif;
  font-size: 3cqw;
  font-weight: 600;
  border-radius: 0.8cqw;
  cursor: pointer;
  transition: all 0.15s ease;
}

/* Primary call-to-action button variant */
.btn-primary {
  flex: 1;
  background: linear-gradient(180deg, #c89d38 0%, #8c6a28 100%);
  color: #0d0804;
  border: 0.2cqw solid var(--border-gold-light, #f3d078);
}

/* Hover state feedback for primary button */
.btn-primary:hover {
  box-shadow: 0 0 2cqw rgba(243, 208, 120, 0.4);
  filter: brightness(1.15);
}

/* Secondary action button variant */
.btn-secondary {
  background: transparent;
  color: #b0a088;
  border: 0.2cqw solid rgba(176, 160, 136, 0.4);
}

/* Hover state feedback for secondary button */
.btn-secondary:hover {
  color: var(--text-gold, #e2b755);
  border-color: var(--border-gold, #c89d38);
}

/* Forfeit match action button style */
.btn-forfeit {
  position: relative;
  width: 70%;
  margin: 0.8cqh auto 1.5cqh auto;
  padding: 1.4cqh 2cqw;
  background: linear-gradient(180deg, #8b1d1d 0%, #631010 100%);
  color: #ffffff;
  font-family: 'Cinzel', serif;
  font-size: 3cqw;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  text-shadow: 0 0.2cqh 0.4cqh rgba(0, 0, 0, 0.9);
  border: 0.2cqw solid #a82828;
  border-radius: 1.2cqw;
  box-shadow: 0 0.8cqh 2cqw rgba(0, 0, 0, 0.6), inset 0 0.2cqh 0 rgba(255, 255, 255, 0.2);
  cursor: pointer;
  transition: background 0.15s ease, transform 0.10s ease, box-shadow 0.15s ease;
}

/* Hover state feedback for forfeit match button */
.btn-forfeit:hover {
  background: linear-gradient(180deg, #a82828 0%, #7c1515 100%);
  box-shadow: 0 0.8cqh 2.8cqw rgba(168, 40, 40, 0.4), inset 0 0.2cqh 0 rgba(255, 255, 255, 0.3);
}

/* Active pressed state for forfeit match button */
.btn-forfeit:active {
  box-shadow: 0 0.4cqh 1cqw rgba(0, 0, 0, 0.8);
  transform: translateY(0.2cqh);
}

/* Hidden state for forfeit match button via class or attribute */
.btn-forfeit.hidden,
.btn-forfeit[hidden] {
  display: none !important;
}