/* index.css - FIT to Text Converter Stylesheet (v8.6) */

@import url('https://fonts.googleapis.com/css2?family=Amaranth:ital,wght@0,400;0,700;1,400&display=swap');

@import url('./variables.css');

:root {
  /* Relative path override for the textured background image when loaded from this subfolder */
  --medium-paper-texture: url('../_images/blue_m.png');

  /* Sizing variables for UI controls */
  --btn-height-base: 2.5rem;
  --btn-height-large: 3.0rem;
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

body {
  min-height: 100vh;
  color: var(--panel-text);
  font-family: 'Amaranth', 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
  font-size: clamp(16px, 0.3vw + 15px, 18px);
  line-height: 1.6;
  padding: 0 0 32px;
  position: relative;
}

body::before {
  content: '';
  position: fixed;
  inset: 0;
  z-index: -1;
  background: linear-gradient(-45deg,
      var(--cycler-gradient-start),
      var(--cycler-gradient-mid-a),
      var(--cycler-gradient-mid-b),
      var(--cycler-gradient-end));
  background-size: 320% 320%;
  background-color: #313131;
  animation: cycler-gradient 40s ease-in-out infinite;
}

@keyframes cycler-gradient {
  0% {
    background-position: 18% 50%;
  }

  50% {
    background-position: 82% 50%;
  }

  100% {
    background-position: 18% 50%;
  }
}

header {
  width: 95%;
  max-width: 1180px;
  margin: 0.2em auto 0.6em;
  padding: 0.5em 0.7em 0.65em;
  text-align: center;
  background: var(--cycler-glass-bg);
  border: 1px solid var(--cycler-glass-border);
  border-radius: 20px;
  box-shadow: var(--cycler-header-shadow);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
}

header h1 {
  color: var(--heading-text);
  font-size: clamp(1.6rem, 4vw, 2.8rem);
  font-variant: small-caps;
  font-weight: 700;
  line-height: 1.12;
}

header p {
  max-width: 75ch;
  margin: 0.35em auto 0;
  color: var(--heading-copy);
  font-size: clamp(1rem, 1vw + 0.75rem, 1.25rem);
  line-height: 1.35;
}

.container {
  width: 95%;
  max-width: 1180px;
  margin: 0 auto;
  display: flex;
  flex-direction: column;
  gap: 1em;
}

.intro-copy,
.seo-details,
.options,
.athlete-context,
.drop-zone,
.status,
.output-box,
.card {
  background-color: var(--cycler-grid-bg-color);
  background-image: var(--panel-bg-image);
  border: 1px solid var(--cycler-border);
  border-radius: 20px;
  box-shadow: 1px 1px 4px 0 var(--cycler-shadow);
}

.intro-copy,
.seo-details,
.options,
.athlete-context {
  padding: 0.9em;
}

.intro-copy h2,
.seo-details h2 {
  margin-bottom: 0.35em;
  color: var(--strong-text);
  font-size: clamp(1.2rem, 1.5vw + 0.8rem, 1.7rem);
  font-variant: small-caps;
}

.intro-copy p {
  color: var(--panel-muted);
  font-size: 1rem;
  line-height: 1.45;
  max-width: 70ch;
}

.seo-details p,
.seo-details li {
  color: var(--panel-muted);
  font-size: 1rem;
  line-height: 1.45;
  max-width: 100%;
}

.faq-list {
  display: grid;
  gap: 0.65em;
}

.faq-list details {
  border: 1px solid var(--cycler-border);
  border-radius: 10px;
  background: var(--panel-soft);
  padding: 0.65em 0.8em;
}

.faq-list summary {
  color: var(--strong-text);
  cursor: pointer;
  font-size: 1.05rem;
  line-height: 1.25;
}

.faq-list summary:hover,
.faq-list details[open] summary {
  color: var(--accent-text);
}

.faq-list details[open] summary {
  margin-bottom: 0.45em;
}

.faq-list p {
  padding-left: 1.2em;
}

.options {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: center;
  gap: 0.75em 1em;
}

.format-field {
  display: flex;
  flex-direction: column;
  flex: 0 1 260px;
  margin: 0;
}

.format-field label {
  color: var(--panel-muted);
  font-size: 0.9rem;
  font-weight: 700;
  text-transform: uppercase;
  margin-bottom: 0.4em;
}

.format-field select {
  font-family: inherit;
  font-size: 1rem;
  padding: 0.6em 0.8em;
  border-radius: 8px;
  border: 1px solid var(--cycler-border, #555);
  background-color: var(--field-bg, rgba(255, 255, 255, 0.58));
  color: var(--field-text, #111);
  outline: none;
  cursor: pointer;
  transition: border-color 0.15s, box-shadow 0.15s;
}

.format-field select:focus {
  border-color: var(--cycler-hover, #c72a93);
  box-shadow: 0 0 0 3px rgba(199, 42, 147, 0.25);
}

.format-help-row {
  flex: 1 1 100%;
  padding-top: 0;
  margin-top: -0.25em;
  width: 100%;
}

.field-help-inline {
  font-size: 0.88rem;
  line-height: 1.45;
  color: var(--panel-muted);
  text-align: left;
  margin: 0;
  width: 100%;
}

.include-options {
  display: flex;
  flex: 1 1 auto;
  flex-wrap: wrap;
  align-items: center;
  justify-content: center;
  gap: 0.75em 1em;
  min-inline-size: 0;
  border: 0;
  padding: 0;
  margin: 0;
}

.include-options legend {
  flex: 0 0 auto;
  margin: 0;
  padding: 0;
}

.include-options legend,
.options label,
.athlete-context label,
.output-header label,
.card-label {
  color: var(--panel-muted);
  font-size: 0.9rem;
  font-weight: 700;
}

.include-options legend,
.output-header label,
.card-label {
  text-transform: uppercase;
}

.options label {
  display: flex;
  align-items: center;
  gap: 0.4em;
  cursor: pointer;
}

.options input[type="checkbox"] {
  width: 18px;
  height: 18px;
  accent-color: var(--cycler-hover);
  cursor: pointer;
  opacity: 1;
  position: relative;
}

.athlete-context input,
.athlete-context select,
.athlete-context textarea,
dialog#groupset-modal input,
dialog#groupset-modal select {
  width: 100%;
  color: var(--field-text);
  background: var(--field-bg);
  border: 1px solid var(--cycler-border);
  border-radius: 6px;
  font: inherit;
  padding: 0.45em 0.55em;
}

.athlete-context input,
.athlete-context select,
dialog#groupset-modal input,
dialog#groupset-modal select {
  height: 3rem;
  line-height: 1.2;
}

/* Fix iOS Safari date input height collapse */
.athlete-context input[type="date"],
dialog#groupset-modal input[type="date"] {
  min-width: 0;
  overflow: hidden;
  /* Force the input box itself to honour the 3rem height */
  -webkit-appearance: none;
  appearance: none;
  display: flex;
  align-items: center;
}

.athlete-context input[type="date"]::-webkit-date-and-time-value,
dialog#groupset-modal input[type="date"]::-webkit-date-and-time-value {
  min-height: 1.5em;
  /* was 1.2em — needs to be taller to fill 3rem */
  height: 1.5em;
  margin: 0;
  padding: 0;
  text-align: left;
}

.athlete-context input:focus,
.athlete-context select:focus,
.athlete-context textarea:focus,
textarea:focus,
dialog#groupset-modal input:focus,
dialog#groupset-modal select:focus {
  outline: none;
  border-color: var(--cycler-hover);
  box-shadow: 0 0 0 3px rgba(199, 42, 147, 0.22);
}

.athlete-context {
  display: flex;
  flex-wrap: wrap;
  gap: 0.7em;
}

.required-note {
  width: 100%;
  margin: 0 0 0.15em;
  color: var(--panel-muted);
  font-size: 0.82rem;
  line-height: 1.3;
}

.required-note span,
.required-marker {
  color: var(--required-color);
  font-weight: 700;
}

.field {
  position: relative;
  display: flex;
  flex-direction: column;
  flex: 1 1 140px;
  gap: 0.25em;
  min-width: 0;
}

.field-label-row {
  display: flex;
  align-items: center;
  justify-content: flex-start;
  gap: 0.3em;
  min-height: 1.45rem;
}

.field-label-row label {
  min-width: 0;
  line-height: 1.2;
  white-space: normal;
}

.required-marker {
  font-size: 1.1em;
  line-height: 1;
  margin-left: 0.15em;
}

.optional-field .required-marker {
  display: none;
}

.field-help-text {
  display: none;
  position: absolute;
  z-index: 20;
  top: 1.8rem;
  left: var(--help-popover-left, 0);
  width: max-content;
  max-width: min(18rem, 80vw);
  padding: 0.55em 0.65em;
  color: var(--help-popover-text);
  background: var(--help-popover-bg);
  border: 1px solid var(--help-popover-border);
  border-radius: 6px;
  box-shadow: 0 6px 14px rgba(0, 0, 0, 0.18);
  font-size: 0.78rem;
  line-height: 1.3;
  pointer-events: none;
  transform: translateX(-0.05rem);
}

/* RHS popups should expand leftward to prevent going off screen */
.grid-2-col>.field:nth-child(2) .field-help-text {
  left: auto;
  right: 0;
  transform: none;
}

.field-help-text:focus {
  outline: 3px solid var(--cycler-hover);
  outline-offset: 1px;
  box-shadow: 0 6px 14px rgba(0, 0, 0, 0.25), 0 0 0 4px rgba(199, 42, 147, 0.45);
}

.field.help-open .field-help-text {
  display: block;
}

.ride-notes-field .field-help-text {
  max-width: min(18rem, 72vw);
}

.athlete-context textarea {
  min-height: 4.1rem;
  resize: vertical;
  line-height: 1.4;
}

.ride-notes-field {
  flex: 1 1 100%;
}

.activity-context-field {
  flex: 2 1 280px;
}


.convert-actions {
  display: flex;
  width: 100%;
  justify-content: center;
}

.drop-zone {
  position: relative;
  overflow: hidden;
  padding: 0.75em 1.2em;
  text-align: center;
  cursor: pointer;
  transition: box-shadow 0.15s ease-out, transform 0.15s ease-out, border-color 0.15s ease-out;
}

.drop-zone::before {
  content: '';
  position: absolute;
  inset: 0;
  background: rgba(255, 255, 255, 0.16);
  opacity: 0;
  transition: opacity 0.15s ease-out;
}

.drop-zone:hover,
.drop-zone.dragover,
.drop-zone:focus-within {
  transform: translateY(2px);
  border-color: var(--cycler-hover);
  box-shadow:
    inset 2px 2px 6px rgba(0, 0, 0, 0.2),
    inset -1px -1px 4px rgba(255, 255, 255, 0.1),
    0 0 15px var(--cycler-button-glow);
}

.drop-zone:hover::before,
.drop-zone.dragover::before,
.drop-zone:focus-within::before {
  opacity: 1;
}

.drop-zone>* {
  position: relative;
  z-index: 1;
}

.drop-icon {
  display: block;
  margin: 0 auto 0.4em auto;
  width: 2.2rem;
  height: 2.2rem;
  color: var(--accent-text);
}

.drop-zone h2 {
  margin-bottom: 0.1em;
  color: var(--strong-text);
  font-size: clamp(1.2rem, 1.5vw + 0.75rem, 1.7rem);
}

.drop-zone p {
  color: var(--panel-muted);
  font-size: 1rem;
}

.choose-file-action {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  margin-top: 0.5em;
  min-height: var(--btn-height-base);
  padding: 0.35em 0.8em;
  color: var(--cycler-button-text);
  background-color: var(--cycler-button-bg);
  background-image: linear-gradient(to bottom,
      rgba(255, 255, 255, 0.4) 0%,
      rgba(255, 255, 255, 0.05) 50%,
      rgba(0, 0, 0, 0.05) 51%,
      rgba(0, 0, 0, 0.1) 100%);
  border: 1px solid var(--cycler-border);
  border-radius: 6px;
  box-shadow:
    inset 1px 1px 0 rgba(255, 255, 255, 0.6),
    inset -1px -1px 0 rgba(0, 0, 0, 0.1),
    0 1px 2px rgba(0, 0, 0, 0.2),
    0 0 12px var(--cycler-button-glow);
  cursor: pointer;
  font: inherit;
  font-size: 1rem;
  font-weight: 700;
  line-height: 1.15;
  text-align: center;
  text-shadow: 1px 1px 0 rgba(255, 255, 255, 0.3);
  transition: background-color 0.15s ease-out, box-shadow 0.15s ease-out, transform 0.15s ease-out;
  user-select: none;
}

.drop-zone:hover .choose-file-action,
.choose-file-action:hover {
  background-color: var(--cycler-button-bg-hover);
  background-image: linear-gradient(to bottom,
      rgba(255, 255, 255, 0.5) 0%,
      rgba(255, 255, 255, 0.1) 100%);
  transform: translateY(2px);
  box-shadow:
    inset 2px 2px 6px rgba(0, 0, 0, 0.2),
    inset -1px -1px 4px rgba(255, 255, 255, 0.1),
    0 0 15px var(--cycler-button-glow);
}

input[type="file"] {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  opacity: 0;
  cursor: pointer;
}

input[type="file"]:focus-visible {
  outline: none;
}

input[type="file"]:focus-visible~.choose-file-action {
  outline: 3px solid var(--cycler-hover);
  outline-offset: 2px;
}

.status {
  display: flex;
  align-items: center;
  gap: 0.6em;
  max-height: 0;
  overflow: hidden;
  padding: 0 0.9em;
  color: var(--success-text);
  font-weight: 700;
  opacity: 0;
  transition: max-height 0.15s ease-out, opacity 0.15s ease-out, padding 0.15s ease-out;
}

.status.visible {
  max-height: 5rem;
  padding: 0.75em 0.9em;
  opacity: 1;
}

.status.error {
  color: var(--danger);
  border-color: var(--danger);
}

.spinner {
  width: 18px;
  height: 18px;
  border: 2px solid rgba(255, 255, 255, 0.5);
  border-top-color: var(--cycler-hover);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
  flex-shrink: 0;
}

@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

.output-section {
  display: none;
  flex-direction: column;
  gap: 0.8em;
}

.output-section.visible {
  display: flex;
}

.summary-cards {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(130px, 1fr));
  gap: 0.6em;
}

.card {
  min-width: 0;
  padding: 0.65em;
  transition: border-color 0.15s ease-out, box-shadow 0.15s ease-out;
}

.card:hover {
  border-color: var(--cycler-hover);
  box-shadow: 0 0 15px var(--cycler-button-glow);
}

.card-label {
  margin-bottom: 0.25em;
  white-space: nowrap;
}

.card-value {
  color: var(--strong-text);
  font-size: clamp(1rem, 1vw + 0.75rem, 1.35rem);
  font-weight: 700;
  line-height: 1.1;
  white-space: nowrap;
}

.card-unit {
  margin-left: 0.15em;
  color: var(--panel-muted);
  font-size: 0.8rem;
  font-weight: 400;
}

.output-box {
  overflow: hidden;
}

.output-header {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 0.8em;
  padding: 0.7em 0.85em;
  border-bottom: 1px solid var(--cycler-border);
  background: var(--panel-softer);
}

.btn-group {
  display: flex;
  flex-wrap: wrap;
  gap: 0.45em;
}

.btn-group button {
  min-height: var(--btn-height-base);
  padding: 0.35em 0.8em;
  font-size: 1rem;
}

@layer base {
  button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: var(--btn-height-base);
    padding: 0.35em 0.8em;
    color: var(--cycler-button-text);
    background-color: var(--cycler-button-bg);
    background-image: linear-gradient(to bottom,
        rgba(255, 255, 255, 0.4) 0%,
        rgba(255, 255, 255, 0.05) 50%,
        rgba(0, 0, 0, 0.05) 51%,
        rgba(0, 0, 0, 0.1) 100%);
    border: 1px solid var(--cycler-border);
    border-radius: 6px;
    box-shadow:
      inset 1px 1px 0 rgba(255, 255, 255, 0.6),
      inset -1px -1px 0 rgba(0, 0, 0, 0.1),
      0 1px 2px rgba(0, 0, 0, 0.2),
      0 0 12px var(--cycler-button-glow);
    cursor: pointer;
    font: inherit;
    font-size: 1rem;
    line-height: 1.15;
    text-align: center;
    text-shadow: 1px 1px 0 rgba(255, 255, 255, 0.3);
    transition: background-color 0.15s ease-out, box-shadow 0.15s ease-out, transform 0.15s ease-out;
  }

  button:hover,
  button.primary:hover {
    background-color: var(--cycler-button-bg-hover);
    background-image: linear-gradient(to bottom,
        rgba(255, 255, 255, 0.5) 0%,
        rgba(255, 255, 255, 0.1) 100%);
    transform: translateY(2px);
    box-shadow:
      inset 2px 2px 6px rgba(0, 0, 0, 0.2),
      inset -1px -1px 4px rgba(255, 255, 255, 0.1),
      0 0 15px var(--cycler-button-glow);
  }

  button:disabled {
    cursor: not-allowed;
    opacity: 0.5;
    transform: none;
    box-shadow:
      inset 1px 1px 0 rgba(255, 255, 255, 0.35),
      inset -1px -1px 0 rgba(0, 0, 0, 0.08);
  }

  button:disabled:hover {
    background-color: var(--cycler-button-bg);
    background-image: linear-gradient(to bottom,
        rgba(255, 255, 255, 0.4) 0%,
        rgba(255, 255, 255, 0.05) 50%,
        rgba(0, 0, 0, 0.05) 51%,
        rgba(0, 0, 0, 0.1) 100%);
    transform: none;
  }

  button:focus-visible {
    outline: 3px solid var(--cycler-hover);
    outline-offset: 2px;
  }
}

button.field-help {
  min-width: 1.5rem;
  min-height: 1.5rem;
  width: 1.5rem;
  height: 1.5rem;
  padding: 0;
  flex: 0 0 auto;
  color: var(--panel-muted);
  background: var(--panel-soft);
  background-image: none;
  border-color: var(--cycler-glass-border);
  border-radius: 50%;
  box-shadow: inset 1px 1px 0 rgba(255, 255, 255, 0.25);
  font-size: 0.9rem;
  font-weight: 700;
  line-height: 1.1;
  text-shadow: none;
  transform: none;
}

button.field-help:hover,
button.field-help:focus {
  color: var(--cycler-button-text);
  background: var(--cycler-button-bg);
  background-image: none;
  box-shadow: 0 0 8px var(--cycler-button-glow);
  transform: none;
}

.convert-button {
  min-width: min(100%, 18rem);
  min-height: var(--btn-height-large);
  padding: 0.55em 1.25em;
  font-size: clamp(1.05rem, 1vw + 0.8rem, 1.35rem);
  font-weight: 700;
}

textarea {
  width: 100%;
  min-height: 320px;
  padding: 1em;
  color: var(--field-text);
  background: var(--field-bg);
  border: none;
  font: 0.82rem/1.65 ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  resize: vertical;
}

#outputText {
  font-size: 0.70rem;
  line-height: 1.45;
}

.athlete-context .ride-notes-field textarea {
  min-height: 4.1rem;
  padding: 0.65em 0.7em;
  font: inherit;
  line-height: 1.35;
}

/* ============================================================================
   THEME SWITCHER
   ============================================================================ */
.theme-toggle {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.25em;
  width: fit-content;
  max-width: 95%;
  margin: 0;
  padding: 0.22em;
  color: var(--cycler-theme-text);
  background: var(--cycler-theme-bg);
  border: 1px solid var(--cycler-glass-border);
  border-radius: 999px;
  box-shadow: 0 8px 16px rgba(45, 4, 82, 0.2);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
}

.theme-toggle button {
  appearance: none;
  -webkit-appearance: none;
  min-height: 1.9rem;
  padding: 0.25em 0.58em;
  color: var(--cycler-theme-text);
  background: transparent;
  border: 1px solid transparent;
  border-radius: 999px;
  cursor: pointer;
  font: inherit;
  font-size: clamp(13px, 0.45vw + 0.65rem, 16px);
  line-height: 1;
  transition: background-color 0.15s ease-out,
    border-color 0.15s ease-out,
    box-shadow 0.15s ease-out,
    transform 0.15s ease-out;
}

.theme-toggle button:hover,
.theme-toggle button:focus {
  background: var(--cycler-theme-active-bg);
  border-color: var(--cycler-glass-border);
  outline: none;
}

.theme-toggle button[aria-pressed="true"] {
  color: var(--cycler-button-text);
  background-color: var(--cycler-button-bg);
  border-color: var(--cycler-border);
  box-shadow:
    inset 1px 1px 0 rgba(255, 255, 255, 0.35),
    0 0 10px var(--cycler-button-glow);
}

.theme-toggle button:focus-visible {
  outline: 3px solid var(--cycler-hover);
  outline-offset: 2px;
}

/* ============================================================================
   FOOTER
   ============================================================================ */
footer {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  gap: 1em;
  width: 95%;
  max-width: 1180px;
  margin: 2em auto 1.5em auto;
  padding: 1.2em 1em;
  color: var(--panel-text);
  font-size: 0.9em;
  border: 1px solid var(--cycler-border);
  background-color: var(--cycler-grid-bg-color);
  background-image: var(--panel-bg-image);
  border-radius: 20px;
  box-shadow: 1px 1px 4px 0 var(--cycler-shadow);
  box-sizing: border-box;
}

footer p {
  margin: 0;
}

#btn-groupset-details {
  height: var(--btn-height-large);
  width: 100%;
}

/* Groupset Modal */
/* Modals styling (Groupset, HR Sanity Alerts, & Warning) */
dialog#groupset-modal,
dialog#hr-sanity-modal,
dialog#warning-modal {
  border: 1px solid var(--cycler-glass-border);
  border-radius: 20px;
  background-color: var(--cycler-grid-bg-color);
  background-image: var(--panel-bg-image);
  color: var(--panel-text);
  padding: 1.5em;
  width: 90%;
  box-shadow: 0 12px 30px rgba(0, 0, 0, 0.4);
  position: fixed;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  margin: 0;
  z-index: 1000;
}

dialog#hr-sanity-modal,
dialog#warning-modal {
  max-width: 420px;
}

dialog#groupset-modal {
  max-width: 520px;
}

dialog#groupset-modal::backdrop,
dialog#hr-sanity-modal::backdrop,
dialog#warning-modal::backdrop {
  background: rgba(0, 0, 0, 0.6);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
}

.modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 1em;
  border-bottom: 1px solid var(--cycler-border);
  padding-bottom: 0.5em;
}

.modal-header h2 {
  font-size: 1.4rem;
  color: var(--strong-text);
  margin: 0;
}

.close-modal-btn {
  background: transparent;
  border: none;
  font-size: 2.1rem;
  line-height: 1;
  color: var(--panel-muted);
  cursor: pointer;
  box-shadow: none;
  min-height: auto;
  padding: 0;
  transform: none;
  text-shadow: none;
}

.close-modal-btn:hover {
  color: var(--accent-text);
  background: transparent;
  box-shadow: none;
  transform: none;
}

.modal-fields {
  display: flex;
  flex-direction: column;
  gap: 0.8em;
  margin-bottom: 1.2em;
}

.grid-2-col {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.8em;
}

.modal-actions {
  display: flex;
  justify-content: flex-end;
}

.modal-actions button {
  width: 100%;
}

dialog#groupset-modal .field {
  flex: none;
}

.groupset-note {
  font-size: 0.82rem;
  line-height: 1.35;
  color: var(--panel-muted);
  margin: 0;
  margin-bottom: 0.8rem;
}

/* Spacing between vertical rows inside the modal tabs */
.tab-content>.grid-2-col,
.tab-content>.field {
  margin-bottom: 1.1rem;
}

.tab-content>.grid-2-col:last-child,
.tab-content>.field:last-child {
  margin-bottom: 0;
}

/* Advanced Settings Tabs */
.modal-tabs {
  display: flex;
  margin-bottom: 1.2rem;
  border-bottom: 1px solid var(--cycler-border);
  gap: 0.5rem;
}

.tab-btn {
  background: transparent !important;
  border: none !important;
  color: var(--panel-muted) !important;
  font-family: inherit;
  font-size: 0.95rem !important;
  font-weight: 700;
  padding: 0.5rem 1rem !important;
  cursor: pointer;
  box-shadow: none !important;
  min-height: auto !important;
  transform: none !important;
  position: relative;
  transition: color 0.2s ease;
}

.tab-btn:hover {
  color: var(--panel-text) !important;
  background: transparent !important;
  box-shadow: none !important;
  transform: none !important;
}

.tab-btn.active {
  color: var(--accent-text) !important;
  background: transparent !important;
}

.tab-btn.active::after {
  content: '';
  position: absolute;
  bottom: -1px;
  left: 0;
  right: 0;
  height: 2px;
  background-color: var(--accent-text);
  border-radius: 2px;
}

.tab-content {
  animation: fadeInTab 0.25s ease-in-out;
}

.tab-content[hidden] {
  display: none !important;
}

@keyframes fadeInTab {
  from {
    opacity: 0;
    transform: translateY(4px);
  }

  to {
    opacity: 1;
    transform: translateY(0);
  }
}


@media (min-width: 48rem) {

  header,
  .container,
  footer {
    width: 85%;
  }
}

@media (max-width: 48rem) {
  .btn-group {
    justify-content: flex-start;
  }
}

@media (prefers-reduced-motion: reduce) {

  body::before,
  .spinner {
    animation: none;
  }

  body::before {
    background-position: 50% 50%;
  }
}

/* ── DASHBOARD MODAL ────────────────────────────────────────────────────── */
dialog#dashboard-modal {
  border: 1px solid var(--cycler-glass-border);
  border-radius: 20px;
  background-color: var(--cycler-grid-bg-color);
  background-image: var(--panel-bg-image);
  color: var(--panel-text);
  padding: 0;
  width: 95%;
  max-width: 1400px;
  height: 90vh;
  max-height: 900px;
  box-shadow: 0 12px 40px rgba(0, 0, 0, 0.5);
  position: fixed;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  margin: 0;
  z-index: 1000;
  overflow: hidden;
  display: none;
  /* fallback */
}

dialog#dashboard-modal[open] {
  display: flex;
  flex-direction: column;
}

#dashboard-capture-area {
  display: flex;
  flex-direction: column;
  height: 100%;
  width: 100%;
  padding: 1.2em;
  box-sizing: border-box;
  background-color: var(--cycler-grid-bg-color);
  background-image: var(--panel-bg-image);
  color: var(--panel-text);
}

#btn-save-dashboard {
  margin-left: auto;
  margin-right: 1.5rem;
  font-size: 0.82rem;
  padding: 0.4em 0.8em;
  min-height: auto;
}

dialog#dashboard-modal::backdrop {
  background: rgba(0, 0, 0, 0.7);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
}

dialog#dashboard-modal .dashboard-content {
  display: flex;
  flex-direction: column;
  gap: 1.2em;
  flex: 1;
  overflow-y: auto;
  padding-right: 0.5em;
  margin-top: 0.5em;
}

/* Custom scrollbar for dashboard content */
dialog#dashboard-modal .dashboard-content::-webkit-scrollbar {
  width: 8px;
}

dialog#dashboard-modal .dashboard-content::-webkit-scrollbar-track {
  background: transparent;
}

dialog#dashboard-modal .dashboard-content::-webkit-scrollbar-thumb {
  background: var(--cycler-glass-border);
  border-radius: 4px;
}

/* KPI Grid */
dialog#dashboard-modal .kpi-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  gap: 0.8em;
}

dialog#dashboard-modal .kpi-card {
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid var(--cycler-glass-border);
  border-radius: 12px;
  padding: 0.4em 0.6em;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  box-shadow: 0 4px 10px rgba(0, 0, 0, 0.15);
}

dialog#dashboard-modal .kpi-label {
  font-size: 0.68rem;
  color: var(--panel-muted);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin-bottom: 0.2em;
}

dialog#dashboard-modal .kpi-value {
  font-size: 1.0rem;
  font-weight: 700;
  color: var(--panel-text);
  white-space: pre-line;
  line-height: 1.25;
}

/* Charts Grid */
dialog#dashboard-modal .charts-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(500px, 1fr));
  gap: 1.2em;
  margin-bottom: 0.5em;
}

@media (max-width: 600px) {
  dialog#dashboard-modal .charts-grid {
    grid-template-columns: 1fr;
  }
}

dialog#dashboard-modal .chart-container {
  background: var(--cycler-theme-bg);
  border: 1px solid var(--cycler-glass-border);
  border-radius: 16px;
  padding: 0.8em 1.0em;
  box-shadow: 0 6px 20px rgba(0, 0, 0, 0.15);
  display: flex;
  flex-direction: column;
  height: 330px;
}

dialog#dashboard-modal .chart-container h3 {
  font-size: 0.95rem;
  margin-top: 0;
  margin-bottom: 0.5em;
  font-weight: 600;
  color: var(--panel-text);
  border-left: 3px solid var(--cycler-hover);
  padding-left: 8px;
}

dialog#dashboard-modal .chart-wrapper {
  position: relative;
  flex: 1;
  min-height: 0;
  width: 100%;
}

dialog#dashboard-modal .chart-wrapper canvas {
  display: block;
  width: 100% !important;
  height: 100% !important;
}