/* ==============================================
   BANDWIDTH - Gauges, Metrics, Cup, Pulse
   + Full Panel Styles
   ============================================== */

/* ============================================
   OVERVIEW COMPONENTS (small cards)
   ============================================ */

/* Bandwidth Donut (small) */
.bandwidth-donut-container {
  display: flex;
  align-items: center;
  gap: 12px;
}

.bandwidth-donut {
  position: relative;
  width: 28px;
  height: 28px;
}

.bandwidth-donut svg {
  transform: rotate(-90deg);
  width: 28px;
  height: 28px;
}

.bandwidth-donut .donut-bg {
  fill: none;
  stroke: var(--border-color);
  stroke-width: 6;
}

.bandwidth-donut .donut-fill {
  fill: none;
  stroke-width: 6;
  stroke-linecap: round;
  transition: stroke-dasharray 0.5s ease;
}

.bandwidth-donut .donut-fill.low { stroke: var(--accent-sage); }
.bandwidth-donut .donut-fill.medium { stroke: var(--accent-gold); }
.bandwidth-donut .donut-fill.high { stroke: var(--accent-coral); }

.bandwidth-donut .donut-tick-yellow {
  stroke: var(--accent-gold);
  stroke-width: 1.5;
}

.bandwidth-donut .donut-tick-red {
  stroke: var(--accent-coral);
  stroke-width: 1.5;
}

/* Cup Graphic */
.cup-container {
  display: flex;
  align-items: flex-end;
  gap: 12px;
}

.cup-graphic {
  position: relative;
  width: 22px;
  height: 28px;
  background: var(--bg-tertiary);
  border: none;
  border-radius: 0 0 5px 5px;
  overflow: hidden;
}

.cup-graphic::before {
  content: '';
  position: absolute;
  top: 0;
  left: -2px;
  right: -2px;
  height: 2px;
  background: var(--bg-tertiary);
  border-radius: 1px;
}

.cup-fill {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  background: linear-gradient(to top, var(--accent-teal), var(--accent-sage));
  transition: height 0.5s ease;
  border-radius: 0 0 5px 5px;
}

.cup-fill.low { 
  background: linear-gradient(to top, var(--accent-coral), #d4a574);
  height: 25%;
}

.cup-fill.medium { 
  background: linear-gradient(to top, var(--accent-gold), var(--accent-sage));
  height: 55%;
}

.cup-fill.high { 
  background: linear-gradient(to top, var(--accent-teal), var(--accent-sage));
  height: 85%;
}

.cup-steam {
  position: absolute;
  top: -18px;
  left: 50%;
  transform: translateX(-50%);
  display: flex;
  gap: 3px;
}

.steam-line {
  width: 2px;
  height: 12px;
  background: var(--text-muted);
  border-radius: 2px;
  opacity: 0.5;
  animation: steam 2s ease-in-out infinite;
}

.steam-line:nth-child(2) { animation-delay: 0.3s; height: 10px; }
.steam-line:nth-child(3) { animation-delay: 0.6s; height: 8px; }

@keyframes steam {
  0%, 100% { transform: translateY(0); opacity: 0.5; }
  50% { transform: translateY(-4px); opacity: 0.2; }
}

/* Pulse Line */
.pulse-container {
  display: flex;
  align-items: center;
  justify-content: center;
}

.pulse-line {
  width: 50px;
  height: 24px;
}

.pulse-path {
  fill: none;
  stroke-width: 1.5;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.pulse-line.calm .pulse-path { stroke: var(--accent-sage); }
.pulse-line.stretched .pulse-path {
  stroke: var(--accent-gold);
  animation: pulse-glow 2s ease-in-out infinite;
}
.pulse-line.stressed .pulse-path {
  stroke: var(--accent-coral);
  animation: pulse-shake 0.5s ease-in-out infinite;
}

@keyframes pulse-glow {
  0%, 100% { opacity: 0.7; }
  50% { opacity: 1; }
}

@keyframes pulse-shake {
  0%, 100% { transform: translateX(0); }
  25% { transform: translateX(-1px); }
  75% { transform: translateX(1px); }
}

/* ============================================
   FULL BANDWIDTH PANEL STYLES
   ============================================ */

.bandwidth-dashboard {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.bandwidth-section-label {
  font-size: 10px;
  color: var(--accent-gold);
  letter-spacing: 2px;
  text-transform: uppercase;
  margin-bottom: 8px;
}

.bandwidth-section {
  background: var(--bg-secondary);
  border: 1px solid var(--border-color);
  border-radius: 8px;
  padding: 16px;
  overflow: hidden;
}

/* Day Circles Row */
.day-circles {
  display: flex;
  align-items: center;
  margin-bottom: 16px;
}

.days-row {
  display: flex;
  justify-content: space-between;
  flex: 1;
  max-width: 690px;
  margin-left: 34px;
}

.wk-wrapper {
  flex: 0 0 auto;
  display: flex;
  justify-content: center;
  margin-left: 16px;
}

.day-circle, .wk-circle {
  position: relative;
  width: 40px;
  height: 40px;
  min-width: 40px;
  min-height: 40px;
  max-width: 40px;
  max-height: 40px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.day-circle-bg, .wk-circle-bg {
  position: absolute;
  width: 100%;
  height: 100%;
  border-radius: 50%;
  background: var(--bg-tertiary);
}

.day-circle-progress {
  position: absolute;
  width: 100%;
  height: 100%;
  border-radius: 50%;
}

.day-circle-inner, .wk-circle-inner {
  position: absolute;
  width: 30px;
  height: 30px;
  border-radius: 50%;
  background: var(--bg-secondary);
}

.day-letter, .wk-letter {
  position: relative;
  z-index: 1;
  font-size: 13px;
  font-weight: 400;
  color: var(--text-muted);
}

.wk-letter {
  font-size: 12px;
  letter-spacing: -0.5px;
}

.day-circle.today .day-letter { color: var(--accent-teal); }

.wk-circle { cursor: pointer; }
.wk-circle:hover .wk-letter { color: var(--accent-teal); }

/* Sleep Content Grid */
.sleep-content {
  display: grid;
  grid-template-columns: 1fr 144px;
  gap: 24px;
  align-items: stretch;
}

.sleep-graph-wrapper {
  display: grid;
  grid-template-columns: 40px 1fr;
  grid-template-rows: 1fr auto;
  gap: 0;
  height: 100%;
}

.graph-y-labels {
  grid-column: 1;
  grid-row: 1;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  padding-right: 8px;
  padding-top: 10px;
  padding-bottom: 10px;
}

.y-label {
  font-size: 10px;
  color: var(--text-muted);
  text-align: right;
  line-height: 1;
}

.sleep-graph-container {
  grid-column: 2;
  grid-row: 1;
  background: var(--bg-tertiary);
  border-radius: 8px;
  overflow: hidden;
  height: 100%;
  min-height: 160px;
}

.sleep-graph {
  width: 100%;
  height: 100%;
}

.sleep-graph svg {
  width: 100%;
  height: 100%;
  display: block;
}

.graph-line {
  fill: none;
  stroke: var(--accent-teal);
  stroke-width: 2;
}

.graph-area {
  fill: var(--accent-teal);
  opacity: 0.15;
}

.graph-time-labels {
  grid-column: 2;
  grid-row: 2;
  display: flex;
  justify-content: space-between;
  font-size: 10px;
  color: var(--text-muted);
  padding: 4px 0 0;
}

/* Sleep Stats Sidebar */
.sleep-stats-wrapper {
  background: var(--bg-tertiary);
  border-radius: 8px;
  padding: 12px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.quality-circle {
  display: flex;
  flex-direction: column;
  align-items: center;
  padding-bottom: 8px;
}

.quality-gauge {
  position: relative;
  width: 56px;
  height: 56px;
  border-radius: 50%;
  background: conic-gradient(
    var(--accent-teal) 0deg,
    var(--accent-teal) 338deg,
    var(--bg-secondary) 338deg
  );
  display: flex;
  align-items: center;
  justify-content: center;
}

.quality-gauge::before {
  content: '';
  position: absolute;
  width: 44px;
  height: 44px;
  border-radius: 50%;
  background: var(--bg-tertiary);
}

.quality-value {
  position: relative;
  z-index: 1;
  font-size: 14px;
  font-weight: 400;
  color: var(--accent-teal);
}

.sleep-stat-card {
  background: var(--bg-secondary);
  border-radius: 6px;
  padding: 6px 8px;
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
}

.sleep-stat-card .stat-label {
  font-size: 9px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--text-muted);
  margin-bottom: 2px;
  text-align: center;
}

.sleep-stat-card .stat-value {
  font-size: 14px;
  font-weight: 400;
  text-align: center;
}

/* Sleep Stages Row */
.sleep-heart-row {
  margin-top: 16px;
}

/* Bandwidth Cards Grid */
.bandwidth-cards {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 12px;
}

.bandwidth-card {
  background: var(--bg-tertiary);
  border-radius: 8px;
  padding: 14px 12px;
  text-align: center;
}

.bandwidth-card .card-value {
  font-size: 14px;
  font-weight: 400;
  line-height: 1.2;
}

.card-unit {
  font-size: 10px;
  font-weight: 400;
  color: var(--text-muted);
}

.bandwidth-card .card-label {
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 1px;
  color: var(--text-muted);
  margin-top: 4px;
}

.heart-card .card-value { color: var(--accent-coral); }
.activity-card .card-value { color: var(--accent-sage); }
.sleep-stage-card .card-value { color: var(--text-primary); }

/* Readiness Section */
.readiness-display {
  display: flex;
  align-items: center;
  gap: 20px;
}

.readiness-gauge {
  position: relative;
  width: 64px;
  height: 64px;
  border-radius: 50%;
  background: conic-gradient(
    var(--accent-sage) 0deg,
    var(--accent-sage) 252deg,
    var(--bg-tertiary) 252deg
  );
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.readiness-gauge::before {
  content: '';
  position: absolute;
  width: 50px;
  height: 50px;
  border-radius: 50%;
  background: var(--bg-secondary);
}

.readiness-value {
  position: relative;
  z-index: 1;
  font-size: 14px;
  font-weight: 400;
  color: var(--accent-sage);
}

.readiness-factors {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.factor {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 1px;
  color: var(--text-muted);
}

.factor-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
}

.sleep-dot { background: var(--accent-teal); }
.hrv-dot { background: var(--accent-purple); }
.rhr-dot { background: var(--accent-coral); }

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

@media (max-width: 768px) {
  .sleep-content {
    grid-template-columns: 1fr;
  }
  
  .bandwidth-cards {
    grid-template-columns: repeat(2, 1fr);
  }
  
  .days-row {
    margin-left: 0;
  }
}
