/* podcast-styles.css - Daily Puck NHL Podcast Directory Styles */

/* CSS Variables (hockey theme - red/black) */
:root {
  --podcast-accent: #cc0000;
  --podcast-accent-hover: #ff4444;
  --bg-primary: #0d1117;
  --bg-secondary: #161b22;
  --bg-tertiary: #21262d;
  --bg-hover: #30363d;
  --text-primary: #e6edf3;
  --text-secondary: #8b949e;
  --text-dim: #6e7681;
  --border: #30363d;
  --success: #3fb950;
}

/* Keep nav links blue (don't inherit red podcast theme) */
.nav a {
  color: #58a6ff;
}
.nav a:hover {
  color: #79b8ff;
}

/* Hero Section */
.podcast-hero {
  background: linear-gradient(135deg, var(--bg-secondary) 0%, rgba(204, 0, 0, 0.1) 100%);
  border-radius: 0.75rem;
  padding: 2rem;
  margin-bottom: 2rem;
  border: 1px solid var(--border);
  text-align: center;
}

.podcast-hero h1 {
  font-size: 2rem;
  font-weight: 700;
  margin-bottom: 1rem;
  color: var(--text-primary);
}

.podcast-hero p {
  color: var(--text-secondary);
  font-size: 1.1rem;
  line-height: 1.6;
  margin-bottom: 1.5rem;
  max-width: 800px;
  margin-left: auto;
  margin-right: auto;
}

/* Quick Actions */
.quick-actions {
  display: flex;
  gap: 1rem;
  flex-wrap: wrap;
  justify-content: center;
}

.action-btn {
  padding: 0.75rem 1.5rem;
  border-radius: 0.5rem;
  font-size: 0.95rem;
  font-weight: 600;
  border: 1px solid var(--border);
  background: var(--bg-secondary);
  color: var(--text-primary);
  cursor: pointer;
  transition: all 0.2s;
  text-decoration: none;
}

.action-btn:hover {
  background: var(--bg-hover);
  border-color: var(--podcast-accent);
  transform: translateY(-2px);
}

.action-btn.primary {
  background: var(--podcast-accent);
  color: white;
  border-color: var(--podcast-accent);
}

.action-btn.primary:hover {
  background: var(--podcast-accent-hover);
  border-color: var(--podcast-accent-hover);
}

/* Controls Section */
.podcast-controls {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 1rem;
  margin-bottom: 2rem;
  flex-wrap: wrap;
}

.search-box {
  flex: 1;
  max-width: 400px;
}

.search-box input {
  width: 100%;
  padding: 0.625rem 1rem;
  background: var(--bg-secondary);
  border: 1px solid var(--border);
  border-radius: 0.5rem;
  color: var(--text-primary);
  font-size: 0.9rem;
  transition: all 0.2s;
}

.search-box input:focus {
  outline: none;
  border-color: var(--podcast-accent);
  background: var(--bg-tertiary);
}

.search-box input::placeholder {
  color: var(--text-dim);
}

/* Tree View Styles */
.podcast-directory.tree-view {
  display: block;
  margin-bottom: 2rem;
  min-height: 400px;
}

.tree-controls {
  display: flex;
  gap: 0.5rem;
  margin-bottom: 1.5rem;
  padding-bottom: 1rem;
  border-bottom: 1px solid var(--border);
  justify-content: center;
}

.tree-btn {
  padding: 0.5rem 1rem;
  background: var(--bg-secondary);
  border: 1px solid var(--border);
  border-radius: 0.375rem;
  color: var(--text-secondary);
  font-size: 0.85rem;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s;
}

.tree-btn:hover {
  background: var(--bg-tertiary);
  border-color: var(--podcast-accent);
  color: var(--text-primary);
}

/* Tree Divider */
.tree-divider {
  text-align: center;
  margin: 1.5rem 0;
  position: relative;
}

.tree-divider::before {
  content: '';
  position: absolute;
  top: 50%;
  left: 0;
  right: 0;
  height: 1px;
  background: var(--border);
}

.tree-divider span {
  background: var(--bg-secondary);
  padding: 0 1rem;
  position: relative;
  color: var(--text-secondary);
  font-size: 0.85rem;
  text-transform: uppercase;
  letter-spacing: 1px;
}

/* Tree Container */
.tree-container {
  background: var(--bg-secondary);
  border: 1px solid var(--border);
  border-radius: 0.75rem;
  padding: 1rem;
}

/* Tree Node Structure */
.tree-node {
  margin-bottom: 0.125rem;
  animation: fadeIn 0.3s ease;
}

@keyframes fadeIn {
  from {
    opacity: 0;
    transform: translateX(-10px);
  }
  to {
    opacity: 1;
    transform: translateX(0);
  }
}

.tree-node-content {
  display: flex;
  align-items: center;
  padding: 0.625rem 0.75rem;
  background: var(--bg-primary);
  border: 1px solid var(--border);
  border-radius: 0.5rem;
  cursor: default;
  transition: all 0.2s;
  position: relative;
}

.tree-node-content:hover {
  background: var(--bg-tertiary);
  border-color: var(--podcast-accent);
  transform: translateX(2px);
}

/* Expand/Collapse Arrow */
.expand-arrow {
  width: 20px;
  height: 20px;
  margin-right: 0.5rem;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: transform 0.2s;
  flex-shrink: 0;
}

.expand-arrow svg {
  width: 12px;
  height: 12px;
  fill: var(--text-secondary);
}

.expand-arrow:hover svg {
  fill: var(--podcast-accent);
}

.tree-node.expanded > .tree-node-content .expand-arrow {
  transform: rotate(90deg);
}

.expand-spacer {
  width: 20px;
  margin-right: 0.5rem;
  flex-shrink: 0;
}

/* Node Info */
.node-info {
  flex: 1;
  display: flex;
  align-items: center;
  gap: 0.75rem;
  min-width: 0;
}

.node-name {
  font-size: 0.95rem;
  font-weight: 500;
  color: var(--text-primary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.node-stats {
  display: flex;
  gap: 1rem;
  font-size: 0.8rem;
  color: var(--text-dim);
  margin-left: auto;
}

.stat-item {
  white-space: nowrap;
}

/* Node Feed Actions */
.node-feeds {
  display: flex;
  gap: 0.5rem;
  margin-left: 1rem;
  flex-shrink: 0;
}

.feed-button-group {
  display: flex;
  align-items: center;
  gap: 0.25rem;
  padding: 0.25rem 0.5rem;
  background: var(--bg-secondary);
  border: 1px solid var(--border);
  border-radius: 0.375rem;
  transition: all 0.2s;
}

.feed-button-group:hover {
  background: var(--bg-tertiary);
  border-color: var(--podcast-accent);
}

.feed-label {
  font-size: 0.75rem;
  color: var(--text-secondary);
  margin-right: 0.25rem;
  white-space: nowrap;
}

.feed-actions {
  display: flex;
  gap: 0.25rem;
}

.btn-icon {
  width: 24px;
  height: 24px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: transparent;
  border: none;
  border-radius: 0.25rem;
  color: var(--text-secondary);
  cursor: pointer;
  transition: all 0.2s;
  text-decoration: none;
}

.btn-icon:hover {
  background: var(--podcast-accent);
  color: white;
}

.btn-icon.copied {
  background: var(--success);
  color: white;
}

.btn-icon svg {
  width: 14px;
  height: 14px;
}

/* Tree Children Container */
.tree-children {
  margin-left: 1.5rem;
  margin-top: 0.25rem;
  padding-left: 1rem;
  border-left: 2px solid var(--border);
  position: relative;
}

/* Depth-based Styling */
.tree-node[data-depth="0"] > .tree-node-content {
  background: linear-gradient(135deg, var(--bg-secondary) 0%, rgba(204, 0, 0, 0.1) 100%);
  border-width: 1.5px;
}

.tree-node[data-depth="0"] > .tree-node-content .node-name {
  font-size: 1.05rem;
  font-weight: 600;
  color: var(--podcast-accent);
}

.tree-node[data-depth="1"] > .tree-node-content {
  background: var(--bg-primary);
}

.tree-node[data-depth="2"] > .tree-node-content {
  background: rgba(255, 255, 255, 0.02);
}

/* Search Highlighting */
.tree-node.search-match > .tree-node-content {
  background: rgba(204, 0, 0, 0.15) !important;
  border-color: var(--podcast-accent);
}

.tree-node.search-match > .tree-node-content .node-name {
  color: var(--podcast-accent);
}

.tree-node.search-hidden {
  display: none !important;
}

/* Modal Styles */
.modal {
  display: none;
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.8);
  z-index: 1000;
  padding: 2rem;
  overflow-y: auto;
}

.modal.active {
  display: flex;
  align-items: center;
  justify-content: center;
  animation: fadeIn 0.2s ease;
}

.modal-content {
  background: var(--bg-secondary);
  border-radius: 1rem;
  padding: 2rem;
  max-width: 700px;
  width: 100%;
  position: relative;
  max-height: 90vh;
  overflow-y: auto;
  border: 1px solid var(--border);
}

.modal-content.all-feeds {
  max-width: 900px;
}

.modal-close {
  position: absolute;
  top: 1rem;
  right: 1rem;
  background: transparent;
  border: none;
  color: var(--text-secondary);
  font-size: 1.5rem;
  cursor: pointer;
  width: 32px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 0.25rem;
  transition: all 0.2s;
}

.modal-close:hover {
  background: var(--bg-hover);
  color: var(--text-primary);
}

.modal h3 {
  font-size: 1.5rem;
  margin-bottom: 1.5rem;
  color: var(--text-primary);
}

/* Instructions */
.instructions {
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
}

.instruction-step {
  padding: 1rem;
  background: var(--bg-primary);
  border-radius: 0.5rem;
  border: 1px solid var(--border);
}

.instruction-step h4 {
  color: var(--podcast-accent);
  margin-bottom: 0.75rem;
  font-size: 1rem;
}

.instruction-step p {
  color: var(--text-secondary);
  line-height: 1.6;
}

.instruction-step ol {
  margin-left: 1.5rem;
  color: var(--text-secondary);
  line-height: 1.8;
}

/* App Instructions */
.app-instructions {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  margin-top: 0.75rem;
}

.app-instructions details {
  background: var(--bg-secondary);
  border: 1px solid var(--border);
  border-radius: 0.375rem;
  padding: 0.75rem;
}

.app-instructions summary {
  cursor: pointer;
  color: var(--text-primary);
  font-weight: 500;
  user-select: none;
}

.app-instructions details[open] summary {
  margin-bottom: 0.5rem;
  color: var(--podcast-accent);
}

.app-instructions details ol,
.app-instructions details p {
  margin-top: 0.5rem;
  color: var(--text-secondary);
  font-size: 0.9rem;
}

/* All Feeds List */
.feeds-list {
  display: flex;
  flex-direction: column;
  gap: 1rem;
  max-height: 60vh;
  overflow-y: auto;
}

.feed-item {
  padding: 1rem;
  background: var(--bg-primary);
  border-radius: 0.5rem;
  border: 1px solid var(--border);
}

.feed-item strong {
  display: block;
  color: var(--text-primary);
  margin-bottom: 0.5rem;
}

.feed-url {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin: 0.5rem 0;
  font-size: 0.85rem;
}

.feed-url span {
  color: var(--text-dim);
  min-width: 70px;
}

.feed-url code {
  flex: 1;
  background: var(--bg-secondary);
  padding: 0.25rem 0.5rem;
  border-radius: 0.25rem;
  color: var(--text-secondary);
  font-family: monospace;
  font-size: 0.8rem;
  overflow-x: auto;
}

.btn-copy-inline {
  padding: 0.25rem 0.75rem;
  background: var(--podcast-accent);
  color: white;
  border: none;
  border-radius: 0.25rem;
  font-size: 0.75rem;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s;
  white-space: nowrap;
}

.btn-copy-inline:hover {
  background: var(--podcast-accent-hover);
}

.btn-copy-inline.copied {
  background: var(--success);
}

/* Loading Skeleton */
.podcast-card.skeleton,
.tree-node.skeleton {
  pointer-events: none;
}

.skeleton-title {
  height: 1.5rem;
  background: var(--bg-tertiary);
  border-radius: 0.25rem;
  margin-bottom: 0.5rem;
  animation: pulse 1.5s infinite;
}

.skeleton-text {
  height: 1rem;
  background: var(--bg-tertiary);
  border-radius: 0.25rem;
  margin-bottom: 1rem;
  width: 60%;
  animation: pulse 1.5s infinite;
}

.skeleton-buttons {
  height: 2rem;
  background: var(--bg-tertiary);
  border-radius: 0.25rem;
  animation: pulse 1.5s infinite;
}

@keyframes pulse {
  0%, 100% { opacity: 0.3; }
  50% { opacity: 0.6; }
}

/* Error States */
.no-podcasts,
.error-message {
  text-align: center;
  padding: 3rem;
  background: var(--bg-secondary);
  border-radius: 0.75rem;
  border: 1px solid var(--border);
}

.no-podcasts h3,
.error-message h3 {
  color: var(--text-primary);
  margin-bottom: 1rem;
}

.no-podcasts p,
.error-message p {
  color: var(--text-secondary);
}

.retry-button {
  margin-top: 1rem;
  padding: 0.5rem 1.5rem;
  background: var(--podcast-accent);
  color: white;
  border: none;
  border-radius: 0.375rem;
  font-size: 0.9rem;
  cursor: pointer;
  transition: all 0.2s;
}

.retry-button:hover {
  background: var(--podcast-accent-hover);
  transform: scale(1.05);
}

/* Mobile Modal */
.mobile-modal {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 1000;
  display: flex;
  align-items: flex-end;
  justify-content: center;
}

.mobile-modal-backdrop {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.7);
}

.mobile-modal-content {
  position: relative;
  width: 100%;
  max-width: 500px;
  background: var(--bg-secondary);
  border-radius: 1rem 1rem 0 0;
  padding: 1.5rem;
  transform: translateY(100%);
  transition: transform 0.3s ease;
}

.mobile-modal.show .mobile-modal-content {
  transform: translateY(0);
}

.mobile-modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 1rem;
  padding-bottom: 1rem;
  border-bottom: 1px solid var(--border);
}

.mobile-modal-header h3 {
  font-size: 1.1rem;
  margin: 0;
}

.mobile-modal-close {
  background: transparent;
  border: none;
  color: var(--text-secondary);
  font-size: 1.5rem;
  cursor: pointer;
  padding: 0;
  line-height: 1;
}

.modal-feed-option {
  display: block;
  width: 100%;
  padding: 1rem;
  margin-bottom: 0.5rem;
  background: var(--bg-tertiary);
  border: 1px solid var(--border);
  border-radius: 0.5rem;
  color: var(--text-primary);
  font-size: 1rem;
  text-align: center;
  text-decoration: none;
  cursor: pointer;
  transition: all 0.2s;
}

.modal-feed-option:hover {
  background: var(--podcast-accent);
  border-color: var(--podcast-accent);
  color: white;
}

.modal-feed-option:last-child {
  margin-bottom: 0;
}

/* Responsive Design */
@media (max-width: 1024px) {
  .node-stats {
    display: none;
  }

  .tree-node-content:hover .node-stats {
    display: flex;
    position: absolute;
    top: -1.5rem;
    right: 0;
    background: var(--bg-secondary);
    padding: 0.25rem 0.5rem;
    border-radius: 0.25rem;
    border: 1px solid var(--border);
    z-index: 10;
  }
}

@media (max-width: 768px) {
  .podcast-hero {
    padding: 1.5rem;
  }

  .podcast-hero h1 {
    font-size: 1.5rem;
  }

  .podcast-hero p {
    font-size: 1rem;
  }

  .quick-actions {
    flex-direction: column;
  }

  .action-btn {
    width: 100%;
    text-align: center;
  }

  .podcast-controls {
    flex-direction: column;
  }

  .search-box {
    max-width: 100%;
  }

  .tree-controls {
    flex-wrap: wrap;
  }

  .tree-btn {
    flex: 1;
    min-width: 80px;
  }

  .tree-children {
    margin-left: 1rem;
    padding-left: 0.5rem;
  }

  .node-feeds {
    display: none;
  }

  .tree-node-content:hover .node-feeds {
    display: flex;
    position: absolute;
    top: 100%;
    right: 0;
    background: var(--bg-secondary);
    padding: 0.5rem;
    border-radius: 0.375rem;
    border: 1px solid var(--border);
    z-index: 20;
    margin-top: 0.25rem;
  }

  .feed-button-group {
    flex-direction: column;
    align-items: flex-start;
  }

  .modal {
    padding: 1rem;
  }

  .modal-content {
    padding: 1.5rem;
  }
}

@media (max-width: 480px) {
  .tree-node-content {
    padding: 0.5rem;
  }

  .node-name {
    font-size: 0.85rem;
  }

  .feed-url {
    flex-direction: column;
    align-items: flex-start;
  }

  .feed-url code {
    width: 100%;
  }
}
