/* Reset & Base */
*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  -webkit-tap-highlight-color: transparent;
}

html, body {
  width: 100%;
  height: 100%;
  background-color: var(--bg-app);
  color: var(--text-main);
  font-family: var(--font-family);
  overflow-x: hidden;
  user-select: none;
  -webkit-user-select: none;
}

body {
  display: flex;
  justify-content: center;
  align-items: stretch;
}

/* App Container (Centrado tipo iPhone en desktop, ocupando todo en móvil) */
#app-container {
  width: 100%;
  max-width: var(--max-width);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  background-color: var(--bg-app);
  position: relative;
  box-shadow: 0 0 50px rgba(0, 0, 0, 0.8);
  padding-top: var(--safe-top);
  padding-bottom: calc(var(--safe-bottom) + 16px);
}

/* Header */
.app-header {
  padding: 24px 20px 12px 20px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.brand {
  display: flex;
  align-items: center;
  gap: 10px;
}

.brand-icon {
  font-size: 1.6rem;
  filter: drop-shadow(0 0 8px var(--accent-moon-glow));
}

.brand-title {
  font-size: 1.1rem;
  font-weight: 600;
  letter-spacing: 2px;
  text-transform: uppercase;
  color: var(--text-muted);
}

.btn-icon {
  background: transparent;
  border: none;
  color: var(--text-muted);
  font-size: 1.2rem;
  padding: 8px;
  cursor: pointer;
  border-radius: var(--radius-pill);
  transition: background 0.2s ease, color 0.2s ease;
  display: flex;
  align-items: center;
  justify-content: center;
}

.btn-icon:active {
  background: var(--bg-card-hover);
  color: var(--text-main);
}

/* Views Container */
.views-container {
  flex: 1;
  position: relative;
  overflow: hidden;
}

.view {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  overflow-y: auto;
  padding: 12px 20px 40px 20px;
  display: none;
  opacity: 0;
  transform: translateY(8px);
  transition: opacity 0.25s ease, transform 0.25s ease;
  -webkit-overflow-scrolling: touch;
}

.view.active {
  display: block;
  opacity: 1;
  transform: translateY(0);
}

/* Common Section Headers */
.section-label {
  font-size: 0.85rem;
  text-transform: uppercase;
  letter-spacing: 1.5px;
  color: var(--text-dim);
  margin: 24px 0 12px 4px;
  font-weight: 600;
}

/* Featured Section (Para esta noche) */
.featured-card {
  background: linear-gradient(145deg, #172033 0%, #0f1624 100%);
  border: 1px solid rgba(251, 191, 36, 0.2);
  border-radius: var(--radius-lg);
  padding: 24px;
  position: relative;
  box-shadow: var(--shadow-card), var(--shadow-glow);
  margin-bottom: 24px;
  cursor: pointer;
  transition: transform 0.2s ease, border-color 0.2s ease;
}

.featured-card:active {
  transform: scale(0.98);
}

.featured-tag {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--accent-moon);
  text-transform: uppercase;
  letter-spacing: 1px;
  margin-bottom: 12px;
}

.featured-title {
  font-size: 1.35rem;
  font-weight: 700;
  color: var(--text-main);
  margin-bottom: 8px;
  line-height: 1.3;
}

.featured-desc {
  font-size: 0.95rem;
  color: var(--text-muted);
  margin-bottom: 20px;
  line-height: 1.4;
}

.btn-play-featured {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  background-color: var(--accent-moon);
  color: #070a12;
  font-size: 0.95rem;
  font-weight: 700;
  padding: 12px 24px;
  border-radius: var(--radius-pill);
  border: none;
  cursor: pointer;
  transition: background-color 0.2s ease, transform 0.2s ease;
}

.btn-play-featured:active {
  transform: scale(0.95);
  background-color: #f59e0b;
}

/* Resume Card (Último escuchado) */
.resume-card {
  background-color: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 16px 20px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 24px;
  cursor: pointer;
  transition: background-color 0.2s ease;
}

.resume-card:active {
  background-color: var(--bg-card-hover);
}

.resume-info {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.resume-title {
  font-size: 1rem;
  font-weight: 600;
  color: var(--text-main);
}

.resume-time {
  font-size: 0.85rem;
  color: var(--accent-moon);
  font-variant-numeric: tabular-nums;
}

/* Category Cards */
.categories-list {
  display: flex;
  flex-direction: column;
  gap: 14px;
  margin-bottom: 24px;
}

.category-card {
  background-color: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 20px;
  display: flex;
  align-items: center;
  gap: 16px;
  cursor: pointer;
  touch-action: manipulation;
  -webkit-touch-callout: none;
  transition: background-color 0.2s ease, transform 0.2s ease;
}

.category-card:active {
  background-color: var(--bg-card-hover);
  transform: scale(0.99);
}

.category-icon {
  font-size: 2rem;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 52px;
  height: 52px;
  background-color: rgba(255, 255, 255, 0.04);
  border-radius: var(--radius-sm);
}

.category-details {
  flex: 1;
}

.category-title {
  font-size: 1.1rem;
  font-weight: 700;
  color: var(--text-main);
  margin-bottom: 4px;
}

.category-subtitle {
  font-size: 0.85rem;
  color: var(--text-muted);
}

.arrow-icon {
  color: var(--text-dim);
  font-size: 1.2rem;
}

/* Back Nav Header for Sub-views */
.view-nav-header {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 20px;
  padding-bottom: 12px;
  border-bottom: 1px solid var(--border-color);
}

.btn-back {
  background: transparent;
  border: none;
  color: var(--accent-moon);
  font-size: 1.3rem;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 6px;
  font-weight: 600;
}

.view-nav-title {
  font-size: 1.2rem;
  font-weight: 700;
}

.view-nav-subtitle {
  font-size: 0.85rem;
  color: var(--text-muted);
  margin-top: 2px;
}

/* Content List Items */
.content-list {
  display: flex;
  flex-direction: column;
  gap: 12px;
  margin-bottom: 20px;
}

.content-item {
  background-color: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 16px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  cursor: pointer;
  touch-action: manipulation;
  -webkit-touch-callout: none;
  transition: background-color 0.2s ease;
}

.content-item:active {
  background-color: var(--bg-card-hover);
}

.content-item-info {
  display: flex;
  flex-direction: column;
  gap: 4px;
  flex: 1;
  padding-right: 12px;
  cursor: pointer;
  touch-action: manipulation;
}

.content-item-title {
  font-size: 1rem;
  font-weight: 600;
  color: var(--text-main);
}

.content-item-meta {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 0.8rem;
  color: var(--text-muted);
}

.badge-offline {
  color: var(--badge-offline);
  font-weight: 600;
}

.badge-new {
  color: var(--badge-new);
  font-weight: 600;
}

.btn-surprise {
  width: 100%;
  background-color: var(--bg-surface);
  border: 1px dashed var(--accent-moon);
  color: var(--accent-moon);
  padding: 16px;
  border-radius: var(--radius-md);
  font-size: 1rem;
  font-weight: 600;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  cursor: pointer;
  margin-top: 16px;
  transition: background-color 0.2s ease;
}

.btn-surprise:active {
  background-color: var(--bg-card-hover);
}

/* Player View / Overlay */
.view.player-view {
  display: none;
}

.view.player-view.active {
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  align-items: center;
  text-align: center;
  padding: 20px 24px calc(var(--safe-bottom) + 30px) 24px;
  background: radial-gradient(circle at top, #141c2e 0%, #070a12 80%);
}

.player-header {
  width: 100%;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.player-art {
  width: 180px;
  height: 180px;
  border-radius: 50%;
  background: radial-gradient(circle, #253350 0%, #111827 100%);
  border: 2px solid rgba(251, 191, 36, 0.3);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 4rem;
  margin: 30px 0;
  box-shadow: 0 0 40px rgba(0,0,0,0.6), var(--shadow-glow);
}

.player-details {
  margin-bottom: 24px;
}

.player-category {
  font-size: 0.85rem;
  text-transform: uppercase;
  letter-spacing: 1.5px;
  color: var(--accent-moon);
  margin-bottom: 8px;
  font-weight: 600;
}

.player-title {
  font-size: 1.4rem;
  font-weight: 700;
  color: var(--text-main);
  margin-bottom: 6px;
}

.player-description {
  font-size: 0.9rem;
  color: var(--text-muted);
}

/* Player Controls & Progress */
.player-controls-container {
  width: 100%;
  display: flex;
  flex-direction: column;
  gap: 20px;
}

.progress-container {
  width: 100%;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.progress-bar-bg {
  width: 100%;
  height: 6px;
  background-color: rgba(255, 255, 255, 0.1);
  border-radius: var(--radius-pill);
  position: relative;
  cursor: pointer;
  touch-action: none;
}

.progress-bar-fill {
  height: 100%;
  background-color: var(--accent-moon);
  border-radius: var(--radius-pill);
  width: 35%;
  position: relative;
}

.progress-bar-handle {
  width: 16px;
  height: 16px;
  background-color: var(--text-main);
  border-radius: 50%;
  position: absolute;
  right: -8px;
  top: 50%;
  transform: translateY(-50%);
  box-shadow: 0 0 8px rgba(0, 0, 0, 0.5);
}

.time-stamps {
  display: flex;
  justify-content: space-between;
  font-size: 0.8rem;
  color: var(--text-dim);
  font-variant-numeric: tabular-nums;
}

.controls-row {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 14px;
}

.btn-skip {
  background: transparent;
  border: none;
  color: var(--text-main);
  font-size: 1.2rem;
  cursor: pointer;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  padding: 10px;
  border-radius: var(--radius-pill);
}

.btn-skip span {
  font-size: 0.7rem;
  color: var(--text-muted);
}

.btn-skip:disabled {
  opacity: 0.35;
  cursor: not-allowed;
}

.btn-play-main {
  width: 72px;
  height: 72px;
  border-radius: 50%;
  background-color: var(--accent-moon);
  color: #070a12;
  border: none;
  font-size: 1.8rem;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  box-shadow: 0 0 20px rgba(251, 191, 36, 0.4);
  transition: transform 0.15s ease, background-color 0.15s ease;
}

.btn-play-main:active {
  transform: scale(0.92);
}

.btn-timer {
  background-color: rgba(255, 255, 255, 0.06);
  border: 1px solid var(--border-color);
  color: var(--text-muted);
  padding: 10px 20px;
  border-radius: var(--radius-pill);
  font-size: 0.85rem;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  cursor: pointer;
  margin-top: 10px;
}

.btn-timer:active {
  background-color: var(--bg-card-hover);
  color: var(--text-main);
}

/* Modals */
.modal-backdrop {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background-color: rgba(0, 0, 0, 0.7);
  backdrop-filter: blur(4px);
  z-index: 100;
  display: none;
  align-items: flex-end;
  justify-content: center;
}

.modal-backdrop.active {
  display: flex;
}

.modal-sheet {
  width: 100%;
  background-color: var(--bg-modal);
  border-top-left-radius: var(--radius-lg);
  border-top-right-radius: var(--radius-lg);
  border-top: 1px solid var(--border-color);
  padding: 24px 20px calc(var(--safe-bottom) + 24px) 20px;
  display: flex;
  flex-direction: column;
  gap: 16px;
  box-shadow: 0 -10px 40px rgba(0, 0, 0, 0.8);
}

.modal-title {
  font-size: 1.1rem;
  font-weight: 700;
  text-align: center;
  color: var(--text-main);
  margin-bottom: 8px;
}

.timer-options {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.btn-option {
  width: 100%;
  background-color: var(--bg-card);
  border: 1px solid var(--border-color);
  color: var(--text-main);
  padding: 16px;
  border-radius: var(--radius-md);
  font-size: 1rem;
  font-weight: 600;
  cursor: pointer;
  text-align: center;
}

.btn-option:active {
  background-color: var(--accent-moon);
  color: #070a12;
}

.footer-heart {
  text-align: center;
  margin-top: 30px;
  color: var(--text-dim);
  font-size: 1.2rem;
}
