/* Dashboard CSS - Dark theme tablet-optimized bike dashboard */

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

html, body {
  height: 100%;
  overflow: hidden;
}

body {
  font-family: 'Segoe UI', -apple-system, BlinkMacSystemFont, sans-serif;
  background: linear-gradient(180deg, #0a0a14 0%, #12121f 50%, #0d0d1a 100%);
  color: #e0e0e0;
  -webkit-user-select: none;
  user-select: none;
  -webkit-touch-callout: none;
}

/* Screen States */
.screen {
  width: 100vw;
  height: 100vh;
  display: flex;
  flex-direction: column;
}

.screen.hidden {
  display: none;
}

/* ============================================
   CONNECTION SCREEN
   ============================================ */

#connectScreen {
  justify-content: center;
  align-items: center;
}

.connect-content {
  text-align: center;
  padding: 2rem;
}

.connect-content h1 {
  font-size: 2.5rem;
  font-weight: 300;
  margin-bottom: 1rem;
  background: linear-gradient(90deg, #00d4ff, #7b2cbf);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.support-message {
  font-size: 1rem;
  margin-bottom: 2rem;
  min-height: 1.5rem;
}

.support-message.error {
  color: #ff4757;
}

.support-message.success {
  color: #00d4ff;
}

.connect-button {
  background: linear-gradient(135deg, #00d4ff 0%, #7b2cbf 100%);
  border: none;
  border-radius: 50px;
  padding: 1.5rem 4rem;
  font-size: 1.5rem;
  font-weight: 500;
  color: white;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 1rem;
  margin: 0 auto;
  transition: all 0.3s ease;
  box-shadow: 0 10px 40px rgba(0, 212, 255, 0.3);
}

.connect-button:hover {
  transform: scale(1.05);
  box-shadow: 0 15px 50px rgba(0, 212, 255, 0.4);
}

.connect-button:active {
  transform: scale(0.98);
}

.connect-button:disabled {
  background: #333;
  cursor: not-allowed;
  box-shadow: none;
}

.connect-button:disabled:hover {
  transform: none;
}

.connect-icon {
  font-size: 2rem;
}

.connection-status {
  margin-top: 2rem;
  font-size: 1rem;
  color: #888;
  min-height: 1.5rem;
}

.connection-status.connecting {
  color: #ffdd00;
}

/* ============================================
   DASHBOARD SCREEN
   ============================================ */

#dashboardScreen {
  padding: 1vh 2vw;
  justify-content: space-between;
  align-items: center;
  gap: 0;
  overflow: hidden;
}

/* Gauges Row */
.gauges-row {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: clamp(1rem, 4vw, 6rem);
  flex: 1;
  width: 100%;
  min-height: 0;
}

.gauge-container {
  display: flex;
  flex-direction: column;
  align-items: center;
  width: clamp(120px, 35vw, 350px);
  flex-shrink: 1;
}

.gauge {
  width: 100%;
  height: auto;
}

.gauge-bg {
  fill: none;
  stroke: rgba(255, 255, 255, 0.08);
  stroke-width: 14;
  stroke-linecap: round;
}

.gauge-value {
  fill: none;
  stroke-width: 14;
  stroke-linecap: round;
  stroke-dasharray: 251.2;
  stroke-dashoffset: 251.2;
  transition: stroke-dashoffset 0.3s ease-out;
}

.rpm-arc {
  stroke: url(#rpmGradient);
  transition: stroke 0.3s ease;
}

/* Cadence zone colors */
.rpm-arc.zone-red { stroke: #ff4757; }
.rpm-arc.zone-orange { stroke: #ff9f43; }
.rpm-arc.zone-yellow { stroke: #feca57; }
.rpm-arc.zone-green { stroke: #26de81; }

.speed-arc {
  stroke: url(#speedGradient);
}

.gauge-reading {
  margin-top: -1vh;
  text-align: center;
  display: flex;
  align-items: baseline;
  justify-content: center;
}

.gauge-number {
  font-size: clamp(1.5rem, 8vw, 5rem);
  font-weight: 200;
  letter-spacing: -1px;
  line-height: 1;
  min-width: 2ch;
  text-align: right;
}

.gauge-unit {
  font-size: clamp(0.7rem, 2vw, 1.3rem);
  color: #888;
  margin-left: 0.3rem;
  font-weight: 400;
}

.gauge-label {
  font-size: clamp(0.5rem, 1.5vw, 0.9rem);
  color: #666;
  letter-spacing: 2px;
  margin-top: 0.3vh;
}

/* Metrics Row (Distance + Watts) */
.metrics-row {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: clamp(1rem, 4vw, 3rem);
  padding: 0.5vh 0;
  flex-shrink: 0;
  width: 100%;
}

.metric-content {
  display: flex;
  align-items: baseline;
  justify-content: center;
  gap: 0.3rem;
}

.metric-divider {
  width: 1px;
  height: clamp(1.5rem, 5vw, 3rem);
  background: rgba(255, 255, 255, 0.15);
}

.metric-number {
  font-size: clamp(1.5rem, 8vw, 5rem);
  font-weight: 200;
  letter-spacing: -1px;
  color: #e0e0e0;
}

.metric-unit {
  font-size: clamp(0.7rem, 2vw, 1.3rem);
  color: #888;
  font-weight: 400;
}

.metric-label {
  font-size: clamp(0.5rem, 1.5vw, 0.9rem);
  color: #555;
  letter-spacing: 2px;
  margin-left: 0.75rem;
}

/* Stats Row */
.stats-row {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  align-items: stretch;
  gap: clamp(0.5rem, 2vw, 1.5rem);
  padding: 0.5vh 0 1vh 0;
  flex-shrink: 1;
  width: 100%;
}

.stat-card {
  flex: 1 1 auto;
  min-width: 60px;
  max-width: 180px;
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: clamp(8px, 2vw, 16px);
  padding: clamp(0.5rem, 1.5vh, 1.5rem) clamp(0.5rem, 2vw, 1.5rem);
  text-align: center;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
}

.stat-icon {
  font-size: clamp(0.8rem, 3vw, 1.8rem);
  margin-bottom: 0.2rem;
  opacity: 0.8;
}

.stat-value {
  font-size: clamp(1rem, 5vw, 3rem);
  font-weight: 300;
  line-height: 1.1;
}

.stat-label {
  font-size: clamp(0.45rem, 1.2vw, 0.8rem);
  color: #666;
  letter-spacing: 1px;
  margin-top: 0.2rem;
}

/* Heart Rate special styling */
.stat-card:first-child .stat-value {
  color: #ff4757;
}

/* Resistance special styling */
.stat-card:nth-child(2) .stat-value {
  color: #00d4ff;
}

/* Calories special styling */
.stat-card:nth-child(3) .stat-value {
  color: #ff6b35;
}

/* Time special styling */
.stat-card:nth-child(4) .stat-value {
  color: #ffdd00;
}

/* Disconnect Button */
.disconnect-button {
  position: absolute;
  top: 1rem;
  right: 1.5rem;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 8px;
  padding: 0.6rem 1.2rem;
  font-size: 0.85rem;
  color: #888;
  cursor: pointer;
  transition: all 0.2s ease;
}

.disconnect-button:hover {
  background: rgba(255, 71, 87, 0.15);
  border-color: rgba(255, 71, 87, 0.4);
  color: #ff4757;
}

/* ============================================
   RESPONSIVE ADJUSTMENTS
   ============================================ */

/* Narrow screens (split screen, small tablets) - 2x2 grid for stats */
@media (max-width: 600px) {
  .stat-card {
    flex: 1 1 40%;
    min-width: 40%;
    max-width: 48%;
  }
}

/* Very narrow screens (phones portrait) - stack gauges */
@media (max-width: 350px) {
  .gauges-row {
    flex-direction: column;
    gap: 0.5rem;
  }

  .gauge-container {
    width: 80vw;
  }
}
