/* ============================================================
   PitchMaster Tools — Reusable UI Components
   ============================================================ */

/* ============================================================
   Navigation Bar
   ============================================================ */
.nav-bar {
  position: sticky;
  top: 0;
  z-index: var(--z-sticky);
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: var(--nav-height);
  padding-inline: var(--space-4);
  background: rgba(10, 10, 26, 0.85);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border-bottom: 1px solid var(--color-border);
}

.nav-brand {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  text-decoration: none;
  color: var(--color-text);
  font-family: var(--font-heading);
  font-weight: var(--weight-bold);
  font-size: var(--text-lg);
}

.nav-brand svg,
.nav-brand img {
  width: 28px;
  height: 28px;
}

.nav-brand .brand-icon {
  font-size: 1.4em;
}

.nav-links {
  display: flex;
  align-items: center;
  gap: var(--space-1);
  list-style: none;
  padding: 0;
  margin: 0;
}

.nav-link {
  display: flex;
  align-items: center;
  gap: var(--space-1);
  padding: var(--space-2) var(--space-3);
  border-radius: var(--radius-md);
  color: var(--color-text-muted);
  font-size: var(--text-sm);
  font-weight: var(--weight-medium);
  text-decoration: none;
  transition: all var(--duration-fast) var(--ease-default);
  white-space: nowrap;
}

.nav-link:hover {
  color: var(--color-text);
  background: var(--color-surface);
  text-decoration: none;
}

.nav-link.active {
  color: var(--color-accent);
  background: rgba(var(--color-accent-rgb), 0.1);
}

.nav-link .nav-icon {
  font-size: 1.1em;
}

/* Mobile nav toggle */
.nav-toggle {
  display: none;
  background: none;
  border: none;
  color: var(--color-text);
  font-size: 1.5rem;
  cursor: pointer;
  padding: var(--space-2);
}

@media (max-width: 767px) {
  .nav-links {
    display: none;
    position: absolute;
    top: var(--nav-height);
    left: 0;
    right: 0;
    flex-direction: column;
    background: rgba(10, 10, 26, 0.95);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    border-bottom: 1px solid var(--color-border);
    padding: var(--space-2);
  }

  .nav-links.open {
    display: flex;
  }

  .nav-toggle {
    display: block;
  }

  .nav-link {
    width: 100%;
    padding: var(--space-3) var(--space-4);
  }
}

/* Tool Header in Nav Bar */
.nav-tool-header {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  margin: 0 var(--space-2);
}

.nav-tool-title {
  font-family: var(--font-heading);
  font-size: var(--text-base);
  font-weight: var(--weight-bold);
  line-height: 1.2;
  margin: 0;
  color: var(--color-text);
  white-space: nowrap;
}

.nav-tool-subtitle {
  font-family: var(--font-body);
  font-size: 10px;
  color: var(--color-text-muted);
  line-height: 1.2;
  margin: 0;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 100%;
}

@media (max-width: 767px) {
  .nav-brand .brand-text {
    display: none;
  }
  .nav-tool-header {
    margin: 0 var(--space-1);
    min-width: 0; /* allows text overflow ellipsis to work */
  }
}


/* ============================================================
   Glassmorphic Card
   ============================================================ */
.tool-card {
  background: rgba(26, 26, 46, 0.6);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-xl);
  padding: var(--space-6);
  transition: all var(--duration-normal) var(--ease-default);
}

.tool-card:hover {
  border-color: var(--color-border-hover);
  box-shadow: var(--shadow-glow);
  transform: translateY(-2px);
}

.tool-card--flat {
  backdrop-filter: none;
  -webkit-backdrop-filter: none;
  background: var(--color-surface);
}

.tool-card--compact {
  padding: var(--space-4);
}

.tool-card__header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: var(--space-4);
}

.tool-card__title {
  font-family: var(--font-heading);
  font-size: var(--text-lg);
  font-weight: var(--weight-semibold);
  color: var(--color-text);
}

.tool-card__icon {
  width: 48px;
  height: 48px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: var(--radius-lg);
  background: var(--gradient-primary);
  font-size: 1.4rem;
  color: white;
  flex-shrink: 0;
}


/* ============================================================
   Chip / Pill Selector
   ============================================================ */
.chip-group {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-2);
}

.chip {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: var(--space-2) var(--space-3);
  border-radius: var(--radius-full);
  border: 1px solid var(--color-border);
  background: transparent;
  color: var(--color-text-muted);
  font-family: var(--font-body);
  font-size: var(--text-sm);
  font-weight: var(--weight-medium);
  cursor: pointer;
  transition: all var(--duration-fast) var(--ease-default);
  user-select: none;
  min-width: 48px;
  text-align: center;
}

.chip:hover {
  border-color: var(--color-border-hover);
  color: var(--color-text);
  background: var(--color-surface-hover);
}

.chip.selected {
  background: rgba(var(--color-primary-rgb), 0.2);
  border-color: var(--color-primary);
  color: var(--color-primary-light);
  box-shadow: 0 0 8px rgba(var(--color-primary-rgb), 0.15);
}

.chip--accent.selected {
  background: rgba(var(--color-accent-rgb), 0.15);
  border-color: var(--color-accent);
  color: var(--color-accent);
}

.chip--small {
  padding: var(--space-1) var(--space-2);
  font-size: var(--text-xs);
  min-width: 36px;
}


/* ============================================================
   Toggle / Segmented Control
   ============================================================ */
.toggle-bar {
  display: inline-flex;
  background: var(--color-surface);
  border-radius: var(--radius-full);
  border: 1px solid var(--color-border);
  padding: 3px;
  position: relative;
}

.toggle-option {
  position: relative;
  z-index: 1;
  padding: var(--space-2) var(--space-4);
  border-radius: var(--radius-full);
  border: none;
  background: transparent;
  color: var(--color-text-muted);
  font-family: var(--font-body);
  font-size: var(--text-sm);
  font-weight: var(--weight-medium);
  cursor: pointer;
  transition: color var(--duration-fast) var(--ease-default);
  user-select: none;
}

.toggle-option:hover {
  color: var(--color-text);
}

.toggle-option.selected {
  color: var(--color-bg);
  background: var(--gradient-primary);
  font-weight: var(--weight-semibold);
}


/* ============================================================
   Range Slider
   ============================================================ */
.slider-control {
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
  width: 100%;
}

.slider-control__header {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.slider-control__label {
  font-size: var(--text-sm);
  font-weight: var(--weight-medium);
  color: var(--color-text-muted);
}

.slider-control__value {
  font-size: var(--text-sm);
  font-weight: var(--weight-semibold);
  color: var(--color-accent);
  font-family: var(--font-mono);
}

.slider-control input[type="range"] {
  -webkit-appearance: none;
  appearance: none;
  width: 100%;
  height: 6px;
  border-radius: var(--radius-full);
  background: var(--color-surface-alt);
  outline: none;
  cursor: pointer;
}

.slider-control input[type="range"]::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: var(--gradient-primary);
  cursor: pointer;
  border: 2px solid var(--color-bg);
  box-shadow: var(--shadow-glow);
  transition: transform var(--duration-fast) var(--ease-spring);
}

.slider-control input[type="range"]::-webkit-slider-thumb:hover {
  transform: scale(1.15);
}

.slider-control input[type="range"]::-webkit-slider-thumb:active {
  transform: scale(1.25);
}

.slider-control input[type="range"]::-moz-range-thumb {
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: var(--gradient-primary);
  cursor: pointer;
  border: 2px solid var(--color-bg);
  box-shadow: var(--shadow-glow);
}


/* ============================================================
   Spinner Control (±)
   ============================================================ */
.spinner-control {
  display: flex;
  align-items: center;
  gap: var(--space-2);
}

.spinner-control__label {
  font-size: var(--text-sm);
  color: var(--color-text-muted);
  margin-right: var(--space-2);
  white-space: nowrap;
}

.spinner-control__btn {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  border-radius: var(--radius-md);
  border: 1px solid var(--color-border);
  background: var(--color-surface);
  color: var(--color-text-muted);
  font-size: var(--text-lg);
  cursor: pointer;
  transition: all var(--duration-fast) var(--ease-default);
  user-select: none;
}

.spinner-control__btn:hover {
  border-color: var(--color-primary);
  color: var(--color-primary);
  background: rgba(var(--color-primary-rgb), 0.1);
}

.spinner-control__btn:active {
  transform: scale(0.92);
}

.spinner-control__value {
  min-width: 32px;
  text-align: center;
  font-size: var(--text-lg);
  font-weight: var(--weight-semibold);
  font-family: var(--font-mono);
  color: var(--color-text);
}


/* ============================================================
   Buttons
   ============================================================ */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-2);
  padding: var(--space-3) var(--space-6);
  border-radius: var(--radius-full);
  border: none;
  font-family: var(--font-heading);
  font-size: var(--text-base);
  font-weight: var(--weight-semibold);
  cursor: pointer;
  transition: all var(--duration-fast) var(--ease-default);
  user-select: none;
  text-decoration: none;
  white-space: nowrap;
}

.btn:active {
  transform: scale(0.96);
}

.btn-primary {
  background: var(--gradient-primary);
  color: white;
  box-shadow: var(--shadow-glow);
}

.btn-primary:hover {
  box-shadow: 0 0 32px rgba(var(--color-primary-rgb), 0.5);
  filter: brightness(1.1);
}

.btn-secondary {
  background: var(--color-surface);
  color: var(--color-text);
  border: 1px solid var(--color-border);
}

.btn-secondary:hover {
  border-color: var(--color-border-hover);
  background: var(--color-surface-hover);
}

.btn-accent {
  background: var(--gradient-accent);
  color: var(--color-bg);
  font-weight: var(--weight-bold);
}

.btn-accent:hover {
  box-shadow: 0 0 32px rgba(var(--color-accent-rgb), 0.4);
  filter: brightness(1.1);
}

.btn-danger {
  background: var(--color-error);
  color: white;
}

.btn-danger:hover {
  filter: brightness(1.15);
}

.btn-ghost {
  background: transparent;
  color: var(--color-text-muted);
}

.btn-ghost:hover {
  background: var(--color-surface);
  color: var(--color-text);
}

.btn-lg {
  padding: var(--space-4) var(--space-8);
  font-size: var(--text-lg);
}

.btn-sm {
  padding: var(--space-2) var(--space-4);
  font-size: var(--text-sm);
}

.btn-icon {
  padding: var(--space-3);
  border-radius: var(--radius-lg);
  width: 44px;
  height: 44px;
}

/* Play/Stop button special state */
.btn-play {
  width: 64px;
  height: 64px;
  border-radius: 50%;
  font-size: 1.5rem;
  padding: 0;
}

.btn-play.playing {
  background: var(--gradient-warm);
  animation: pulseGlow 1.5s var(--ease-default) infinite;
}


/* ============================================================
   Meter / Level Bar
   ============================================================ */
.meter-bar {
  display: flex;
  flex-direction: column;
  gap: var(--space-1);
  width: 100%;
}

.meter-bar__label {
  font-size: var(--text-xs);
  color: var(--color-text-muted);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  font-weight: var(--weight-medium);
}

.meter-bar__track {
  width: 100%;
  height: 6px;
  border-radius: var(--radius-full);
  background: var(--color-surface-alt);
  overflow: hidden;
}

.meter-bar__fill {
  height: 100%;
  border-radius: var(--radius-full);
  background: var(--gradient-accent);
  transition: width var(--duration-fast) var(--ease-out);
  min-width: 2px;
}

.meter-bar__fill--warning {
  background: var(--gradient-warm);
}

.meter-bar__fill--success {
  background: var(--color-success);
}


/* ============================================================
   Cents Bar (Tuning Error Display)
   ============================================================ */
.cents-bar {
  position: relative;
  width: 100%;
  height: 32px;
  margin: var(--space-4) 0;
}

.cents-bar__track {
  position: absolute;
  top: 50%;
  left: 0;
  right: 0;
  height: 4px;
  transform: translateY(-50%);
  background: var(--color-surface-alt);
  border-radius: var(--radius-full);
}

.cents-bar__center {
  position: absolute;
  top: 50%;
  left: 50%;
  width: 2px;
  height: 16px;
  background: var(--color-text-dim);
  transform: translate(-50%, -50%);
  border-radius: var(--radius-full);
}

.cents-bar__indicator {
  position: absolute;
  top: 50%;
  width: 12px;
  height: 12px;
  border-radius: 50%;
  background: var(--color-success);
  transform: translate(-50%, -50%);
  box-shadow: 0 0 12px currentColor;
  transition: left var(--duration-fast) var(--ease-out),
              background-color var(--duration-fast) var(--ease-default),
              box-shadow var(--duration-fast) var(--ease-default);
}

.cents-bar__labels {
  display: flex;
  justify-content: space-between;
  margin-top: var(--space-1);
  font-size: var(--text-xs);
  color: var(--color-text-dim);
  font-family: var(--font-mono);
}


/* ============================================================
   Frequency Display
   ============================================================ */
.freq-display {
  text-align: center;
  padding: var(--space-2);
}

.freq-display__hz {
  font-family: var(--font-mono);
  font-size: var(--text-xl);
  font-weight: var(--weight-semibold);
  color: var(--color-text);
}

.freq-display__hz span {
  font-size: var(--text-sm);
  color: var(--color-text-muted);
  font-weight: var(--weight-regular);
  margin-left: var(--space-1);
}

.freq-display__cents {
  font-family: var(--font-mono);
  font-size: var(--text-base);
  font-weight: var(--weight-medium);
  margin-top: var(--space-1);
}

.freq-display__cents.in-tune   { color: var(--color-success); }
.freq-display__cents.close     { color: var(--color-warning); }
.freq-display__cents.off       { color: var(--color-error); }


/* ============================================================
   Warning Banner
   ============================================================ */
.warning-banner {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  padding: var(--space-3) var(--space-4);
  border-radius: var(--radius-lg);
  background: rgba(var(--color-warning-rgb), 0.1);
  border: 1px solid rgba(var(--color-warning-rgb), 0.3);
  color: var(--color-warning);
  font-size: var(--text-sm);
  margin-bottom: var(--space-4);
}

.warning-banner__icon {
  font-size: 1.2rem;
  flex-shrink: 0;
}


/* ============================================================
   Permission Prompt
   ============================================================ */
.permission-prompt {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: var(--space-4);
  padding: var(--space-10);
  text-align: center;
  min-height: 300px;
}

.permission-prompt__icon {
  font-size: 3rem;
  color: var(--color-primary);
  animation: pulse 2s var(--ease-default) infinite;
}

.permission-prompt__title {
  font-size: var(--text-xl);
  font-weight: var(--weight-semibold);
}

.permission-prompt__text {
  color: var(--color-text-muted);
  max-width: 400px;
}


/* ============================================================
   Ad Slot Containers
   ============================================================ */
.ad-slot {
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(26, 26, 46, 0.3);
  border: 1px dashed var(--color-border);
  border-radius: var(--radius-lg);
  min-height: 90px;
  overflow: hidden;
  margin: var(--space-6) 0;
}

.ad-slot--leaderboard {
  max-width: 728px;
  min-height: 90px;
  margin-inline: auto;
}

.ad-slot--sidebar {
  width: 300px;
  min-height: 250px;
}

.ad-slot--responsive {
  width: 100%;
  min-height: 100px;
}

.ad-slot__fallback {
  text-align: center;
  padding: var(--space-4);
  color: var(--color-text-dim);
  font-size: var(--text-sm);
}

/* Hide ad borders once loaded */
.ad-slot.loaded {
  border: none;
  background: transparent;
}


/* ============================================================
   CTA Banner (App Download)
   ============================================================ */
.cta-banner {
  display: flex;
  align-items: center;
  gap: var(--space-4);
  padding: var(--space-4) var(--space-6);
  border-radius: var(--radius-xl);
  background: var(--gradient-surface);
  border: 1px solid var(--color-border);
}

.cta-banner__text {
  flex: 1;
}

.cta-banner__title {
  font-size: var(--text-base);
  font-weight: var(--weight-semibold);
  margin-bottom: var(--space-1);
}

.cta-banner__desc {
  font-size: var(--text-sm);
  color: var(--color-text-muted);
  margin: 0;
}


/* ============================================================
   Footer
   ============================================================ */
.site-footer {
  padding: var(--space-10) var(--space-4) var(--space-6);
  margin-top: var(--space-16);
  border-top: 1px solid var(--color-border);
  text-align: center;
}

.site-footer__links {
  display: flex;
  justify-content: center;
  gap: var(--space-6);
  margin-bottom: var(--space-4);
  list-style: none;
  padding: 0;
}

.site-footer__links a {
  color: var(--color-text-muted);
  font-size: var(--text-sm);
}

.site-footer__links a:hover {
  color: var(--color-accent);
}

.site-footer__copy {
  color: var(--color-text-dim);
  font-size: var(--text-xs);
  margin: 0;
}


/* ============================================================
   Content Sections (Educational Content)
   ============================================================ */
.content-section {
  padding: var(--space-8) 0;
}

.content-section h2 {
  margin-bottom: var(--space-4);
  padding-bottom: var(--space-2);
  border-bottom: 1px solid var(--color-border);
}

.content-section h3 {
  margin-top: var(--space-6);
  margin-bottom: var(--space-3);
}

.content-section p {
  max-width: 72ch;
}

/* FAQ Accordion */
.faq-list {
  display: flex;
  flex-direction: column;
  gap: var(--space-3);
}

.faq-item {
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
  overflow: hidden;
  transition: border-color var(--duration-fast) var(--ease-default);
}

.faq-item:hover {
  border-color: var(--color-border-hover);
}

.faq-question {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 100%;
  padding: var(--space-4);
  background: var(--color-surface);
  border: none;
  color: var(--color-text);
  font-family: var(--font-body);
  font-size: var(--text-base);
  font-weight: var(--weight-medium);
  cursor: pointer;
  text-align: left;
}

.faq-question::after {
  content: '+';
  font-size: var(--text-xl);
  color: var(--color-primary);
  transition: transform var(--duration-fast) var(--ease-default);
  flex-shrink: 0;
  margin-left: var(--space-4);
}

.faq-item.open .faq-question::after {
  transform: rotate(45deg);
}

.faq-answer {
  padding: 0 var(--space-4);
  max-height: 0;
  overflow: hidden;
  transition: max-height var(--duration-normal) var(--ease-default),
              padding var(--duration-normal) var(--ease-default);
}

.faq-item.open .faq-answer {
  padding: var(--space-2) var(--space-4) var(--space-4);
  max-height: 500px;
}

.faq-answer p {
  margin-bottom: var(--space-2);
}
