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

:root {
  --bg: #1a1a2e;
  --card: #16213e;
  --accent: #0f3460;
  --highlight: #e94560;
  --text: #eee;
  --text-dim: #aaa;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
  overflow-x: hidden;
}

#app {
  max-width: 600px;
  margin: 0 auto;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

header {
  background: var(--card);
  padding: 1rem;
  text-align: center;
  position: sticky;
  top: 0;
  z-index: 10;
}

header h1 {
  font-size: 1.4rem;
  color: var(--highlight);
}

#bottom-nav {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  background: var(--card);
  display: flex;
  justify-content: space-around;
  padding: 0.5rem 0;
  border-top: 1px solid var(--accent);
  z-index: 100;
  max-width: 600px;
  margin: 0 auto;
}

.nav-btn {
  background: none;
  border: none;
  color: var(--text-dim);
  cursor: pointer;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.2rem;
  padding: 0.3rem 0.5rem;
  transition: all 0.2s;
}

.nav-btn.active {
  color: var(--highlight);
}

.nav-icon {
  font-size: 1.4rem;
}

.nav-label {
  font-size: 0.7rem;
}

.nav-btn:hover {
  opacity: 0.9;
}

main {
  flex: 1;
  padding: 1rem;
  padding-bottom: 80px;
  position: relative;
}

.view {
  display: none;
}

.view.active {
  display: block;
}

#now-playing {
  text-align: center;
  margin: 2rem 0;
}

#cover-art {
  font-size: 5rem;
  margin-bottom: 1rem;
}

#episode-title {
  font-size: 1.1rem;
  margin-bottom: 0.3rem;
  line-height: 1.3;
}

#podcast-name {
  color: var(--text-dim);
  font-size: 0.9rem;
}

#progress-bar {
  position: relative;
  margin: 1.5rem 0;
  height: 4px;
  background: var(--accent);
  border-radius: 2px;
}

#progress-fill {
  position: absolute;
  height: 100%;
  background: var(--highlight);
  border-radius: 2px;
  width: 0%;
  pointer-events: none;
}

#seek-slider {
  position: absolute;
  width: 100%;
  top: -8px;
  height: 20px;
  opacity: 0;
  cursor: pointer;
}

#time-display {
  display: flex;
  justify-content: space-between;
  font-size: 0.8rem;
  color: var(--text-dim);
  margin-bottom: 1.5rem;
}

#controls {
  display: flex;
  justify-content: center;
  gap: 1.5rem;
  align-items: center;
  margin-bottom: 1.5rem;
}

#controls button {
  background: none;
  border: none;
  color: var(--text);
  font-size: 1.8rem;
  cursor: pointer;
  padding: 0.5rem;
}

#play-btn {
  font-size: 2.5rem;
  background: var(--highlight);
  border-radius: 50%;
  width: 60px;
  height: 60px;
  display: flex;
  align-items: center;
  justify-content: center;
}

#playback-speed {
  display: flex;
  justify-content: center;
  gap: 0.5rem;
}

.speed-btn {
  background: var(--accent);
  border: none;
  color: var(--text);
  padding: 0.3rem 0.8rem;
  border-radius: 15px;
  cursor: pointer;
  font-size: 0.8rem;
}

.speed-btn.active {
  background: var(--highlight);
}

.setting-group {
  background: var(--card);
  padding: 1rem;
  border-radius: 8px;
  margin-bottom: 1rem;
}

.setting-group label {
  display: block;
  margin-bottom: 0.5rem;
  font-size: 0.9rem;
}

.setting-group input[type="url"],
.setting-group input[type="range"] {
  width: 100%;
  margin-bottom: 0.5rem;
  padding: 0.5rem;
  border: 1px solid var(--accent);
  background: var(--bg);
  color: var(--text);
  border-radius: 4px;
}

.setting-group input[type="range"] {
  padding: 0 0;
}

#episodes-count {
  color: var(--highlight);
  font-weight: bold;
}

button {
  background: var(--highlight);
  border: none;
  color: white;
  padding: 0.6rem 1.2rem;
  border-radius: 4px;
  cursor: pointer;
  font-size: 0.9rem;
}

button:hover {
  opacity: 0.9;
}

button.danger {
  background: #c0392b;
  width: 100%;
  margin-top: 1rem;
}

#podcast-list {
  margin-top: 1rem;
}

.podcast-item {
  background: var(--card);
  padding: 0.8rem;
  border-radius: 8px;
  margin-bottom: 0.5rem;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.podcast-item h4 {
  font-size: 0.9rem;
}

.remove-podcast {
  background: #c0392b;
  padding: 0.3rem 0.6rem;
  font-size: 0.8rem;
}

#episodes-list {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.episode-item {
  background: var(--card);
  padding: 1rem;
  border-radius: 8px;
  cursor: pointer;
  transition: all 0.2s;
  border-left: 3px solid transparent;
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
}

.episode-item:hover {
  background: var(--accent);
}

.episode-item.playing {
  border-left-color: var(--highlight);
}

.episode-info {
  flex: 1;
}

.episode-status {
  margin-left: 0.5rem;
}

.downloaded-badge {
  background: #2ecc71;
  color: white;
  padding: 0.2rem 0.5rem;
  border-radius: 12px;
  font-size: 0.7rem;
  white-space: nowrap;
}

.episode-item h4 {
  font-size: 0.95rem;
  margin-bottom: 0.3rem;
}

.episode-item p {
  font-size: 0.8rem;
  color: var(--text-dim);
}

.episode-item .episode-date {
  font-size: 0.75rem;
  color: var(--text-dim);
  margin-top: 0.3rem;
}

.episode-meta {
  display: flex;
  gap: 1rem;
  font-size: 0.75rem;
  color: var(--text-dim);
  margin-top: 0.3rem;
}

.podcast-badge {
  display: inline-block;
  background: var(--highlight);
  color: white;
  padding: 0.15rem 0.5rem;
  border-radius: 10px;
  font-size: 0.7rem;
  margin-bottom: 0.3rem;
}

.episode-duration {
  color: var(--highlight);
}

.stats-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1rem;
  margin-bottom: 1.5rem;
}

.stat-card {
  background: var(--card);
  padding: 1rem;
  border-radius: 8px;
  text-align: center;
}

.stat-card h3 {
  font-size: 0.8rem;
  color: var(--text-dim);
  margin-bottom: 0.5rem;
}

.stat-card p {
  font-size: 1.2rem;
  color: var(--highlight);
  font-weight: bold;
}

#storage-breakdown {
  background: var(--card);
  padding: 1rem;
  border-radius: 8px;
}

.storage-item {
  display: flex;
  justify-content: space-between;
  padding: 0.5rem 0;
  border-bottom: 1px solid var(--accent);
  font-size: 0.9rem;
}

.storage-item:last-child {
  border-bottom: none;
}

.empty-state {
  text-align: center;
  padding: 3rem 1rem;
  color: var(--text-dim);
}

@media (max-width: 400px) {
  #bottom-nav {
    padding: 0.3rem 0;
  }
  .nav-icon {
    font-size: 1.2rem;
  }
  .nav-label {
    font-size: 0.6rem;
  }
}

#search-query {
  width: calc(100% - 80px);
  padding: 0.5rem;
  margin-right: 5px;
}

#search-btn {
  padding: 0.5rem 1rem;
}

#search-results {
  margin-top: 1rem;
}

.podcast-search-item {
  display: flex;
  align-items: center;
  padding: 0.8rem;
  border-bottom: 1px solid var(--accent);
  gap: 0.8rem;
}

.podcast-search-item img {
  width: 60px;
  height: 60px;
  border-radius: 8px;
  object-fit: cover;
}

.podcast-search-info {
  flex: 1;
}

.podcast-search-info h4 {
  margin: 0 0 0.3rem 0;
  font-size: 0.95rem;
}

.podcast-search-info p {
  margin: 0 0 0.2rem 0;
  font-size: 0.8rem;
  color: var(--text-dim);
}

.podcast-search-info small {
  font-size: 0.7rem;
  color: var(--text-dim);
  word-break: break-all;
}

.add-podcast-btn {
  padding: 0.4rem 0.8rem;
  font-size: 0.85rem;
}

.play-episode-btn {
  background: none;
  border: 2px solid var(--accent);
  border-radius: 50%;
  width: 36px;
  height: 36px;
  font-size: 0.9rem;
  cursor: pointer;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  margin-right: 0.5rem;
}

.play-episode-btn:hover {
  background: var(--accent);
}

.episode-item {
  display: flex;
  align-items: center;
  padding: 0.8rem;
  border-bottom: 1px solid var(--accent);
}

.episode-info {
  flex:1;
  cursor: pointer;
}

.delete-download-btn {
  background: none;
  border: none;
  font-size: 1.2rem;
  cursor: pointer;
  padding: 0.5rem;
  opacity: 0.7;
}

.delete-download-btn:hover {
  opacity: 1;
}
