/* ========================================
   GPad Tester — Homepage Styles
   ======================================== */

/* ---- Hero Section ---- */
.hero {
  position: relative;
  padding: calc(var(--header-height) + 60px) 0 40px;
  text-align: center;
  overflow: hidden;
}

.hero::before {
  content: "";
  position: absolute;
  inset: 0;
  background:
    radial-gradient(
      ellipse at 20% 50%,
      rgba(6, 182, 212, 0.08) 0%,
      transparent 60%
    ),
    radial-gradient(
      ellipse at 80% 20%,
      rgba(139, 92, 246, 0.06) 0%,
      transparent 60%
    ),
    radial-gradient(
      ellipse at 50% 80%,
      rgba(236, 72, 153, 0.04) 0%,
      transparent 60%
    );
  pointer-events: none;
}

.hero__badge {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 6px 16px;
  background: rgba(6, 182, 212, 0.1);
  border: 1px solid rgba(6, 182, 212, 0.25);
  border-radius: var(--radius-full);
  font-size: var(--fs-xs);
  font-weight: 600;
  color: var(--accent-cyan);
  margin-bottom: var(--space-lg);
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.hero__badge-dot {
  width: 6px;
  height: 6px;
  background: var(--accent-cyan);
  border-radius: 50%;
  animation: pulse-green 2s ease-in-out infinite;
}

.hero__title {
  font-size: clamp(2rem, 5vw, var(--fs-5xl));
  font-weight: 900;
  line-height: 1.1;
  margin-bottom: var(--space-lg);
  letter-spacing: -1px;
}

.hero__title-gradient {
  background: linear-gradient(
    135deg,
    var(--accent-cyan),
    var(--accent-purple),
    var(--accent-magenta)
  );
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  background-size: 200% 200%;
  animation: gradientShift 4s ease-in-out infinite;
}

.hero__subtitle {
  font-size: var(--fs-lg);
  color: var(--text-secondary);
  max-width: 650px;
  margin: 0 auto var(--space-xl);
  line-height: 1.6;
}

.hero__actions {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-md);
  flex-wrap: wrap;
}

/* ---- Connection Panel ---- */
.connection-panel {
  max-width: 700px;
  margin: var(--space-2xl) auto 0;
}

.connection-panel__status {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-md);
  margin-bottom: var(--space-lg);
}

.connection-panel__methods {
  display: flex;
  justify-content: center;
  gap: var(--space-md);
}

.connection-method {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 20px;
  background: var(--bg-surface);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  color: var(--text-secondary);
  font-size: var(--fs-sm);
  font-weight: 500;
}

.connection-method__icon {
  font-size: 18px;
}

/* ---- Controller Tabs ---- */
.controller-tabs {
  display: flex;
  justify-content: center;
  gap: 10px;
  background: var(--bg-surface);
  padding: 8px;
  border-radius: var(--radius-lg);
  border: 2px solid var(--border-heavy);
  margin: var(--space-xl) auto;
  max-width: 800px;
  box-shadow:
    0 4px 20px rgba(0, 0, 0, 0.25),
    inset 0 1px 0 rgba(255, 255, 255, 0.04);
  position: relative;
  z-index: 10;
}

.controller-tab {
  flex: 1;
  padding: 14px 12px;
  background: transparent;
  color: var(--text-secondary);
  border-radius: var(--radius-md);
  transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
  text-align: center;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 4px;
  position: relative;
  overflow: hidden;
  letter-spacing: 0.2px;
}

.controller-tab::before {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: inherit;
  background: linear-gradient(
    135deg,
    rgba(6, 182, 212, 0.08),
    rgba(139, 92, 246, 0.06)
  );
  opacity: 0;
  transition: opacity 0.25s ease;
}

.controller-tab:hover {
  background: var(--bg-surface-light);
}

.controller-tab:hover::before {
  opacity: 1;
}

.controller-tab.active {
  background: linear-gradient(
    135deg,
    var(--accent-cyan),
    var(--accent-cyan-dark)
  );
  box-shadow:
    0 0 20px rgba(6, 182, 212, 0.35),
    0 4px 12px rgba(6, 182, 212, 0.25);
}

.controller-tab.active::before {
  display: none;
}

.controller-tab__title {
  font-size: var(--fs-base);
  font-weight: 700;
  color: var(--text-secondary);
  transition: color 0.25s ease;
  white-space: nowrap;
}

.controller-tab:hover .controller-tab__title {
  color: var(--text-primary);
}

.controller-tab.active .controller-tab__title {
  color: var(--text-inverse);
}

.controller-tab__status {
  font-size: var(--fs-sm);
  font-weight: 600;
  color: var(--danger);
  transition: color 0.25s ease;
  white-space: nowrap;
}

.controller-tab.active .controller-tab__status {
  color: #ff3333; /* Bright visible red for active tab */
}

.controller-tab.connected .controller-tab__status {
  color: var(--success);
}

.controller-tab.active.connected .controller-tab__status {
  color: var(--text-inverse);
  opacity: 0.9;
}

/* ---- Main Tester Panel ---- */
.tester-panel {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: var(--space-xl);
  margin-top: var(--space-xl);
}

/* ---- SVG Controller ---- */
.controller-display {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 320px;
}

.controller-visual {
  width: 100%;
  max-width: 520px;
  position: relative;
}

.controller-visual__svg {
  width: 100%;
  height: auto;
}

/* ---- Button Grid ---- */
.button-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 12px;
}

.btn-indicator {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 16px 8px;
  background: transparent;
  border: 2px solid var(--border-heavy);
  border-radius: var(--radius-lg);
  transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
  min-height: 70px;
  position: relative;
  overflow: hidden;
  cursor: default;
}

.btn-indicator__label {
  font-family: var(--font-primary);
  font-size: var(--fs-sm);
  font-weight: 700;
  color: var(--text-primary);
  margin-bottom: 6px;
  text-transform: uppercase;
  letter-spacing: 1px;
  z-index: 1;
  transition: color 0.2s ease;
}

.btn-indicator__value {
  font-family: var(--font-mono);
  font-size: 11px;
  font-weight: 600;
  color: var(--text-muted);
  z-index: 1;
  transition: color 0.2s ease;
}

.btn-indicator:hover {
  background: var(--bg-surface);
  border-color: var(--border-color-light);
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
}

[data-theme="light"] .btn-indicator:hover {
  background: #ffffff;
}

.btn-indicator.pressed {
  background: rgba(6, 182, 212, 0.15);
  border-color: var(--accent-cyan);
  transform: scale(0.96);
  box-shadow: 
    0 0 20px rgba(6, 182, 212, 0.2) inset,
    0 0 15px rgba(6, 182, 212, 0.4);
}

.btn-indicator.pressed .btn-indicator__label {
  color: var(--accent-cyan-light);
  text-shadow: 0 0 10px rgba(34, 211, 238, 0.5);
}

.btn-indicator.pressed .btn-indicator__value {
  color: var(--accent-cyan);
}

/* ---- Axes Display ---- */
.axes-panel {
  margin-top: var(--space-lg);
}

.axes-panel__title {
  font-size: var(--fs-sm);
  font-weight: 700;
  color: var(--text-secondary);
  margin-bottom: var(--space-sm);
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.stick-display {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: var(--space-lg);
}

.stick-canvas-wrap {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: var(--space-sm);
}

.stick-canvas-wrap__label {
  font-size: var(--fs-xs);
  font-weight: 700;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 1px;
}

.stick-canvas {
  width: 140px;
  height: 140px;
  border-radius: 50%;
  border: 2px solid var(--border-heavy);
  background: var(--bg-surface);
}

.stick-values {
  display: flex;
  gap: var(--space-md);
  font-family: var(--font-mono);
  font-size: var(--fs-xs);
  color: var(--text-muted);
}

/* ---- Trigger Bars ---- */
.trigger-display {
  display: flex;
  gap: var(--space-xl);
  justify-content: center;
  margin-top: var(--space-md);
}

.trigger-bar-wrap {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: var(--space-sm);
}

.trigger-bar-wrap__label {
  font-size: var(--fs-xs);
  font-weight: 700;
  color: var(--text-muted);
  text-transform: uppercase;
}

.trigger-bar {
  width: 40px;
  height: 120px;
  background: var(--bg-surface);
  border: 2px solid var(--border-heavy);
  border-radius: var(--radius-sm);
  position: relative;
  overflow: hidden;
}

.trigger-bar__fill {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  background: linear-gradient(to top, var(--accent-cyan), var(--accent-purple));
  transition: height 50ms ease;
  border-radius: 0 0 var(--radius-sm) var(--radius-sm);
}

.trigger-bar__value {
  font-family: var(--font-mono);
  font-size: var(--fs-xs);
  color: var(--text-muted);
}

/* ---- Raw Data Panel ---- */
.raw-data-toggle {
  margin-top: var(--space-lg);
  text-align: center;
}

.raw-data {
  margin-top: var(--space-md);
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--text-muted);
  background: var(--bg-surface);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: var(--space-md);
  max-height: 200px;
  overflow-y: auto;
  line-height: 1.8;
}

/* ---- Advanced Testing Suite ---- */
.tools-section {
  padding: var(--space-lg) 0;
}

.tools-section__header {
  text-align: center;
  margin-bottom: var(--space-2xl);
}

.tools-section__title {
  font-size: var(--fs-xl);
  font-weight: 800;
  margin-bottom: var(--space-sm);
}

.tools-section__subtitle {
  font-size: var(--fs-md);
  color: var(--text-secondary);
  max-width: 600px;
  margin: 0 auto;
}

.tools-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: var(--space-lg);
}

/* ---- How To Use Section ---- */
.howto-section {
  padding: var(--space-lg) 0;
}

.howto-steps {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: var(--space-xl);
  margin-top: var(--space-2xl);
}

.howto-step {
  text-align: center;
  position: relative;
}

.howto-step__number {
  width: 56px;
  height: 56px;
  border-radius: 50%;
  background: linear-gradient(
    135deg,
    rgba(6, 182, 212, 0.15),
    rgba(139, 92, 246, 0.15)
  );
  border: 2px solid rgba(6, 182, 212, 0.3);
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: var(--font-mono);
  font-size: var(--fs-xl);
  font-weight: 800;
  color: var(--accent-cyan);
  margin: 0 auto var(--space-md);
}

.howto-step__title {
  font-size: var(--fs-base);
  font-weight: 700;
  margin-bottom: var(--space-xs);
}

.howto-step__desc {
  font-size: var(--fs-sm);
  color: var(--text-secondary);
  line-height: 1.5;
}

/* ---- Supported Controllers ---- */
.controllers-section {
  padding: var(--space-lg) 0;
}

.controllers-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: var(--space-lg);
  margin-top: var(--space-2xl);
}

.controller-brand {
  text-align: center;
}

.controller-brand__icon {
  font-size: 48px;
  margin-bottom: var(--space-md);
}

.controller-brand__name {
  font-size: var(--fs-base);
  font-weight: 700;
  margin-bottom: var(--space-sm);
}

.controller-brand__list {
  font-size: var(--fs-sm);
  color: var(--text-secondary);
  line-height: 1.8;
}

/* ---- FAQ Grid ---- */
.faq-section {
  padding: var(--space-lg) 0;
}

.faq-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
  gap: var(--space-lg);
  margin-top: var(--space-2xl);
}

.faq-grid .glass-panel {
  padding: var(--space-xl);
  height: 100%;
  display: flex;
  flex-direction: column;
}

/* ---- No Controller / Placeholder State ---- */
.no-controller {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: var(--space-2xl) var(--space-xl);
  color: var(--text-muted);
  position: relative;
  transition: all 0.4s ease;
}

.no-controller__icon {
  position: relative;
  width: 100px;
  height: 100px;
  background: rgba(16, 185, 129, 0.1); /* Subtle green background */
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 40px;
  color: var(--success);
  margin-bottom: var(--space-xl);
  z-index: 1;
}

/* Vibration Rings / Water Drop Effect */
.vibration-rings {
  position: absolute;
  inset: 0;
  border-radius: 50%;
  z-index: -1;
}

.vibration-rings span {
  position: absolute;
  inset: 0;
  border-radius: 50%;
  border: 2px solid rgba(16, 185, 129, 0.3);
  animation: ripple-ring 2s linear infinite;
  opacity: 0; /* Starts hidden until animation takes over */
}

.vibration-rings span:nth-child(1) { animation-delay: 0s; }
.vibration-rings span:nth-child(2) { animation-delay: 0.5s; }
.vibration-rings span:nth-child(3) { animation-delay: 1s; }
.vibration-rings span:nth-child(4) { animation-delay: 1.5s; }

@keyframes ripple-ring {
  0% {
    transform: scale(0.9);
    opacity: 0.8;
  }
  100% {
    transform: scale(2.2);
    opacity: 0;
  }
}

.no-controller__title {
  font-size: var(--fs-lg);
  font-weight: 700;
  color: var(--text-secondary);
  margin-bottom: var(--space-xs);
  letter-spacing: -0.3px;
}

.no-controller__desc {
  font-size: var(--fs-sm);
  max-width: 360px;
  line-height: 1.6;
  margin-bottom: var(--space-md);
}

.no-controller__methods {
  display: flex;
  gap: var(--space-md);
  align-items: center;
}

.no-controller__method {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 6px 14px;
  background: var(--bg-surface);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-full);
  font-size: var(--fs-xs);
  font-weight: 500;
  color: var(--text-muted);
}

/* Re-highlight animation for tab switching */
.no-controller.re-highlight {
  animation: reHighlight 0.6s ease;
}

@keyframes reHighlight {
  0%   { opacity: 1; }
  30%  { opacity: 0.5; transform: scale(0.98); }
  100% { opacity: 1; transform: scale(1); }
}

/* ---- Responsive ---- */
@media (max-width: 1024px) {
  .tester-panel {
    grid-template-columns: 1fr;
  }

  .howto-steps {
    grid-template-columns: repeat(2, 1fr);
  }

  .controllers-grid {
    grid-template-columns: repeat(2, 1fr);
  }
}

@media (max-width: 768px) {
  .hero {
    padding: calc(var(--header-height) + 40px) 0 20px;
  }

  .tester-panel {
    grid-template-columns: 1fr;
  }

  .button-grid {
    grid-template-columns: repeat(3, 1fr);
  }

  .howto-steps {
    grid-template-columns: 1fr 1fr;
    gap: var(--space-lg);
  }

  .controllers-grid {
    grid-template-columns: 1fr 1fr;
  }

  .hero__actions {
    flex-direction: column;
  }

  .connection-panel__methods {
    flex-direction: column;
    align-items: center;
  }
}

@media (max-width: 480px) {
  .controller-tabs {
    flex-wrap: wrap;
    gap: 8px;
    padding: 8px;
  }

  .controller-tab {
    flex: 1 1 calc(50% - 8px);
    padding: 10px 4px;
  }

  .controller-tab__title {
    font-size: var(--fs-xs);
  }

  .controller-tab__status {
    font-size: 10px;
  }

  .button-grid {
    grid-template-columns: repeat(2, 1fr);
  }

  .howto-steps {
    grid-template-columns: 1fr;
  }

  .controllers-grid {
    grid-template-columns: 1fr;
  }

  .stick-display {
    grid-template-columns: 1fr;
  }
}


/* ---- Animated Connection Guide ---- */
.connect-guide {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-lg);
  margin-top: var(--space-lg);
  flex-wrap: wrap;
  opacity: 0;
  transform: translateY(10px);
  transition:
    opacity 0.35s ease,
    transform 0.35s ease;
}

.connect-guide.connect-guide--ready {
  opacity: 1;
  transform: translateY(0);
}

.connect-guide__step {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: var(--space-sm);
  padding: var(--space-md) var(--space-lg);
  background: var(--bg-surface);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  transition: all var(--transition-base);
  cursor: default;
  min-width: 120px;
  position: relative;
  overflow: hidden;
}

.connect-guide__step:hover {
  border-color: var(--accent-cyan);
  background: rgba(6, 182, 212, 0.05);
  transform: translateY(-2px);
  box-shadow: 0 4px 16px rgba(6, 182, 212, 0.15);
}

.connect-guide__icon {
  font-size: 28px;
  line-height: 1;
}

.connect-guide__label {
  font-size: var(--fs-xs);
  font-weight: 600;
  color: var(--text-secondary);
  white-space: nowrap;
}

.connect-guide__divider {
  font-size: var(--fs-xs);
  color: var(--text-muted);
  font-weight: 500;
  padding: 0 var(--space-xs);
}

.connect-guide__then {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: var(--space-sm);
  padding: var(--space-md) var(--space-lg);
  background: rgba(6, 182, 212, 0.06);
  border: 1px solid rgba(6, 182, 212, 0.25);
  border-radius: var(--radius-lg);
  min-width: 140px;
  position: relative;
  overflow: hidden;
}

.connect-guide__then .connect-guide__label {
  color: var(--accent-cyan);
  font-weight: 700;
}

.connect-guide__step::after,
.connect-guide__then::after {
  content: "";
  position: absolute;
  inset: -30%;
  background: radial-gradient(circle, rgba(6, 182, 212, 0.18), transparent 60%);
  opacity: 0;
  transform: scale(0.8);
  transition:
    opacity 0.3s ease,
    transform 0.3s ease;
  pointer-events: none;
}

.connect-guide__step--active,
.connect-guide__then--active {
  border-color: rgba(6, 182, 212, 0.5);
  background: rgba(6, 182, 212, 0.08);
  box-shadow:
    0 12px 30px rgba(6, 182, 212, 0.14),
    0 0 0 1px rgba(6, 182, 212, 0.12) inset;
  transform: translateY(-3px);
}

.connect-guide__step--active::after,
.connect-guide__then--active::after {
  opacity: 1;
  transform: scale(1);
}

.connect-guide__step--active .connect-guide__label,
.connect-guide__then--active .connect-guide__label {
  color: var(--text-primary);
}

/* Pulse animation for the "press any button" icon */
.pulse-anim {
  animation: pulseGuide 1.5s ease-in-out infinite alternate;
}

@keyframes pulseGuide {
  from { transform: scale(1); opacity: 0.7; }
  to   { transform: scale(1.2); opacity: 1; }
}

/* ---- Quick Diagnosis Card ---- */
.diagnosis-card {
  max-width: 800px;
  margin: var(--space-xl) auto 0;
  animation: slideUp 0.4s ease forwards;
}

@keyframes slideUp {
  from { opacity: 0; transform: translateY(20px); }
  to   { opacity: 1; transform: translateY(0); }
}

.diagnosis-card__header {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-bottom: var(--space-md);
}

.diagnosis-card__title {
  font-size: var(--fs-base);
  font-weight: 700;
  color: var(--text-primary);
  margin-bottom: 0;
}

.diagnosis-card__summary {
  margin: 0;
  font-size: var(--fs-sm);
  color: var(--text-secondary);
  line-height: 1.6;
}

.diagnosis-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: var(--space-md);
}

.diag-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: var(--space-xs);
  padding: var(--space-md);
  background: var(--bg-surface);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  text-align: center;
  min-height: 104px;
  justify-content: center;
}

.diag-label {
  font-size: var(--fs-xs);
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.diag-val {
  font-family: var(--font-mono);
  font-size: var(--fs-lg);
  font-weight: 700;
  color: var(--accent-cyan);
}

.diag-val--success {
  color: var(--success);
}

.diag-val--warning {
  color: var(--warning);
}

.diag-val--danger {
  color: var(--danger);
}

/* Responsive connect-guide and diagnosis */
@media (max-width: 480px) {
  .connect-guide {
    gap: var(--space-sm);
  }

  .connect-guide__step,
  .connect-guide__then {
    min-width: 90px;
    padding: var(--space-sm) var(--space-md);
  }

  .connect-guide__icon {
    font-size: 22px;
  }

  .diagnosis-grid {
    grid-template-columns: repeat(2, 1fr);
  }

  .diagnosis-card__summary {
    font-size: var(--fs-xs);
  }
}
