/* ========================================
   SECTION STYLING - CARD-BASED LAYOUT
   ======================================== */

/* === APP CONTAINER === */
#app {
  margin: 0;
  padding: 0;
  background: white;
}

/* === MAIN LAYOUT === */
.control-panel {
  display: flex;
  flex-direction: column;
  gap: 0; /* NO GAPS - seamless flow */
  background: linear-gradient(180deg, #0f0f0f 0%, #1a1a1a 100%);
  min-height: 100vh;
  border: 3px solid var(--rt-primary);
  border-radius: 0;
  overflow-y: auto;
  overflow-x: hidden;
}

/* === HEADER (STICKY) === */
.status-bar {
  background: linear-gradient(180deg, #1a1a1a 0%, #222 100%);
  color: white;
  box-shadow: inset 0 -1px 0 rgba(212, 175, 55, 0.3);
  border-bottom: 1px solid rgba(212, 175, 55, 0.3);
  flex-shrink: 0;
  padding: 12px 16px !important;
  gap: 12px !important;
}

.status-center {
  font-size: 18px !important;
  letter-spacing: 1px;
  color: var(--rt-primary) !important;
  text-shadow: 0 2px 4px rgba(0, 0, 0, 0.3);
}

/* === INPUT MODE SELECTOR === */
.input-mode {
  display: flex;
  gap: 8px;
  padding: 16px 20px !important;
  background: white;
  border-bottom: 1px solid rgba(212, 175, 55, 0.2);
  flex-wrap: wrap;
  align-items: center;
  margin: 0;
  flex-shrink: 0;
}

.mode-btn {
  flex: 1;
  min-width: 100px;
  padding: 10px 16px;
  border: 2px solid #e0e0e0;
  background: white;
  border-radius: 8px;
  cursor: pointer;
  font-weight: 600;
  color: #666;
  transition: all 0.2s ease;
  font-size: 14px;
}

.mode-btn:hover {
  border-color: var(--rt-primary);
  background: rgba(212, 175, 55, 0.05);
}

.mode-btn.mode-btn-active {
  border-color: var(--rt-primary);
  background: var(--rt-primary);
  color: #1a1a1a;
  box-shadow: 0 2px 8px rgba(212, 175, 55, 0.2);
}

/* === CARD SECTIONS === */
section[data-section] {
  background: linear-gradient(135deg, rgba(26, 26, 26, 0.8) 0%, rgba(40, 40, 40, 0.9) 100%);
  border: none; /* NO BORDERS - seamless within container */
  border-bottom: 2px solid var(--rt-primary);
  border-left: 4px solid var(--rt-secondary);
  padding: 24px 20px;
  margin: 0; /* NO MARGINS - seamless */
  flex-shrink: 0;
  display: block;
}

section[data-section]:last-of-type {
  border-bottom: none; /* Last section has no bottom border */
}

section[data-section] h2 {
  margin: 0 0 20px 0;
  color: #d4af37 !important;
  font-size: 20px;
  font-weight: 700;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 12px 0;
  border-bottom: 3px solid #d4af37;
  text-shadow: 0 2px 8px rgba(212, 175, 55, 0.3);
}

/* === SUBSECTION SPACING === */
section[data-section] > div:not(h2) {
  margin-bottom: 16px;
}

section[data-section] > div:last-child {
  margin-bottom: 0;
}

/* === BPM SECTION === */
.bpm-section {
  background: rgba(212, 175, 55, 0.12);
  padding: 16px;
  border-radius: 8px;
  border-left: 4px solid var(--rt-primary);
  border: 1px solid rgba(212, 175, 55, 0.2);
}

.bpm-label {
  display: block;
  font-weight: 600;
  color: var(--rt-primary);
  margin-bottom: 12px;
  font-size: 14px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.bpm-controls {
  display: flex;
  align-items: center;
  gap: 12px;
}

.bpm-slider {
  flex: 1;
  height: 6px;
  border-radius: 3px;
  background: linear-gradient(90deg, var(--rt-primary), var(--rt-secondary));
  outline: none;
  -webkit-appearance: none;
  appearance: none;
}

.bpm-slider::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: var(--rt-primary);
  cursor: pointer;
  box-shadow: 0 2px 6px rgba(212, 175, 55, 0.3);
  transition: all 0.2s ease;
}

.bpm-slider::-webkit-slider-thumb:hover {
  transform: scale(1.1);
  box-shadow: 0 4px 12px rgba(212, 175, 55, 0.4);
}

.bpm-slider::-moz-range-thumb {
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: var(--rt-primary);
  cursor: pointer;
  border: none;
  box-shadow: 0 2px 6px rgba(212, 175, 55, 0.3);
  transition: all 0.2s ease;
}

.bpm-value {
  font-size: 24px;
  font-weight: 700;
  color: var(--rt-primary);
  text-align: center;
}

.bpm-unit {
  font-size: 12px;
  color: #999;
  text-align: center;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.bpm-btn-side {
  width: 40px;
  height: 40px;
  border-radius: 8px;
  border: 2px solid var(--rt-primary);
  background: white;
  color: var(--rt-primary);
  font-weight: 700;
  font-size: 18px;
  cursor: pointer;
  transition: all 0.2s ease;
}

.bpm-btn-side:hover {
  background: var(--rt-primary);
  color: #1a1a1a;
  box-shadow: 0 2px 8px rgba(212, 175, 55, 0.2);
}

/* === TIME SIGNATURE SECTION === */
.time-sig-section {
  background: rgba(201, 125, 34, 0.12);
  padding: 16px;
  border-radius: 8px;
  border-left: 4px solid var(--rt-secondary);
  border: 1px solid rgba(201, 125, 34, 0.2);
}

.time-sig-label {
  display: block;
  font-weight: 600;
  color: var(--rt-secondary);
  margin-bottom: 12px;
  font-size: 14px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.time-sig-select {
  width: 100%;
  padding: 10px 12px;
  border: 2px solid var(--rt-secondary);
  border-radius: 6px;
  background: white;
  color: #333;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s ease;
}

.time-sig-select:hover,
.time-sig-select:focus {
  border-color: var(--rt-primary);
  box-shadow: 0 0 0 3px rgba(212, 175, 55, 0.1);
}

/* === BEAT CANVAS === */
#beatCanvas {
  border-radius: 8px !important;
  border: 2px solid rgba(212, 175, 55, 0.2) !important;
  background: linear-gradient(180deg, #0f0f0f 0%, #1a1a1a 100%) !important;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
  margin-bottom: 16px !important;
  display: block !important;
  width: 100% !important;
}

/* === PLAYBACK CONTROLS === */
.controls-section {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
}

.control-btn {
  flex: 1;
  min-width: 100px;
  padding: 12px 16px;
  border: none;
  border-radius: 8px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s ease;
  font-size: 14px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.1);
}

.btn-play {
  background: var(--rt-primary);
  color: #1a1a1a;
}

.btn-play:hover:not(:disabled) {
  background: #ffd700;
  box-shadow: 0 4px 12px rgba(212, 175, 55, 0.4);
  transform: translateY(-2px);
}

.btn-stop {
  background: var(--rt-secondary);
  color: white;
}

.btn-stop:hover:not(:disabled) {
  background: #a86820;
  box-shadow: 0 4px 12px rgba(201, 125, 34, 0.4);
  transform: translateY(-2px);
}

.btn-reset {
  background: var(--rt-primary);
  color: #1a1a1a;
}

.btn-reset:hover:not(:disabled) {
  background: #ffd700;
  box-shadow: 0 4px 12px rgba(212, 175, 55, 0.4);
  transform: translateY(-2px);
}

.control-btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

/* === TAP BUTTON === */
.tap-section {
  display: flex;
  justify-content: center;
  margin: 20px 0;
}

.tap-button {
  width: 160px;
  height: 160px;
  border-radius: 50%;
  border: none;
  background: linear-gradient(135deg, var(--rt-primary) 0%, var(--rt-secondary) 100%);
  color: #1a1a1a;
  font-weight: 700;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s ease;
  box-shadow: 0 8px 24px rgba(212, 175, 55, 0.3);
}

.tap-button:active {
  transform: scale(0.95);
  box-shadow: 0 4px 12px rgba(212, 175, 55, 0.2);
}

.tap-button:hover {
  transform: scale(1.05);
  box-shadow: 0 12px 32px rgba(212, 175, 55, 0.4);
}

.tap-button-text {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
}

#tapHereText {
  font-size: 14px;
  letter-spacing: 1px;
  text-transform: uppercase;
}

/* === STATS SECTION === */
.stats-section {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 12px;
}

.stat-badge {
  background: linear-gradient(135deg, rgba(212, 175, 55, 0.15) 0%, rgba(201, 125, 34, 0.1) 100%);
  padding: 16px;
  border-radius: 8px;
  border: 2px solid var(--rt-primary);
  text-align: center;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
}

.stat-value {
  font-size: 24px;
  font-weight: 700;
  color: var(--rt-primary);
}

.stat-label {
  font-size: 12px;
  color: #999;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  font-weight: 600;
}

/* === SESSION INFO === */
.session-info {
  background: rgba(148, 192, 95, 0.12);
  padding: 12px 16px;
  border-radius: 8px;
  text-align: center;
  font-size: 14px;
  color: #ccc;
  border-left: 4px solid var(--rt-accent);
  border: 1px solid rgba(148, 192, 95, 0.2);
}

#sessionDuration {
  color: var(--rt-accent);
  font-weight: 700;
  font-size: 16px;
}

/* === SCAN SECTION === */
.scan-section {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.scan-btn {
  width: 100%;
  padding: 16px;
  border: 2px dashed var(--rt-primary);
  background: rgba(212, 175, 55, 0.15);
  color: var(--rt-primary);
  font-weight: 600;
  border-radius: 8px;
  cursor: pointer;
  transition: all 0.2s ease;
  font-size: 16px;
}

.scan-btn:hover {
  background: rgba(212, 175, 55, 0.25);
  border-style: solid;
  box-shadow: 0 4px 12px rgba(212, 175, 55, 0.3);
  transform: translateY(-2px);
}

/* === SESSION LIBRARY === */
.session-library-section {
  background: rgba(212, 175, 55, 0.05);
  padding: 16px;
  border-radius: 8px;
  border-left: 3px solid var(--rt-primary);
}

#sessionLibraryBtn {
  width: 100% !important;
  padding: 14px 16px !important;
  background: white !important;
  border: 2px solid var(--rt-primary) !important;
  border-radius: 8px !important;
  color: var(--rt-primary) !important;
  font-weight: 600 !important;
  cursor: pointer;
  transition: all 0.2s ease;
}

#sessionLibraryBtn:hover {
  background: var(--rt-primary) !important;
  color: #1a1a1a !important;
  box-shadow: 0 4px 12px rgba(212, 175, 55, 0.2);
}

#sessionCountBadge {
  background: var(--rt-primary) !important;
  color: #1a1a1a !important;
  padding: 4px 8px;
  border-radius: 12px;
  font-size: 12px;
  font-weight: 700;
}

/* === FOOTER === */
footer {
  background: linear-gradient(135deg, rgba(212, 175, 55, 0.12) 0%, rgba(201, 125, 34, 0.08) 100%);
  padding: 20px;
  text-align: center;
  border-top: 2px solid var(--rt-primary);
  margin: 0;
  margin-top: auto;
  flex-shrink: 0;
  color: #aaa;
}

#footerPoliciesBtn {
  background: none;
  border: none;
  color: var(--rt-primary);
  cursor: pointer;
  font-weight: 600;
  transition: all 0.2s ease;
  font-size: 13px;
}

#footerPoliciesBtn:hover {
  color: var(--rt-secondary);
  text-decoration: underline;
}

/* === RESPONSIVE DESIGN === */
@media (max-width: 768px) {
  .stat-badge {
    padding: 12px;
    font-size: 12px;
  }

  .stat-value {
    font-size: 18px;
  }

  .tap-button {
    width: 140px;
    height: 140px;
  }

  .mode-btn {
    min-width: 80px;
    font-size: 13px;
  }

  section[data-section] {
    padding: 18px 16px;
  }

  section[data-section] h2 {
    font-size: 16px;
  }
}

@media (max-width: 480px) {
  .stats-section {
    grid-template-columns: repeat(2, 1fr);
    gap: 10px;
  }

  .stat-badge {
    padding: 10px;
  }

  .stat-value {
    font-size: 16px;
  }

  .tap-button {
    width: 120px;
    height: 120px;
    font-size: 12px;
  }

  .controls-section {
    gap: 8px;
  }

  .control-btn {
    font-size: 12px;
    padding: 10px 12px;
  }

  section[data-section] {
    padding: 16px 12px;
  }

  .bpm-controls {
    gap: 8px;
  }
}
