/**
 * YouTube PubSubHubbub Dashboard & Video Feed Stylesheet
 * Modern Dark Aesthetic, Glassmorphism, Micro-Animations
 */

@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700&family=Outfit:wght@500;600;700;800&family=JetBrains+Mono:wght@400;500&display=swap');

:root {
  --bg-main: #0a0e17;
  --bg-card: rgba(18, 24, 38, 0.75);
  --bg-card-hover: rgba(26, 34, 52, 0.85);
  --bg-input: #0f1523;
  --border-subtle: rgba(255, 255, 255, 0.08);
  --border-focus: #6366f1;
  --text-main: #f8fafc;
  --text-muted: #94a3b8;
  --text-dim: #64748b;
  
  --primary: #6366f1;
  --primary-glow: rgba(99, 102, 241, 0.25);
  --yt-red: #ff0033;
  --yt-glow: rgba(255, 0, 51, 0.25);
  
  --status-active: #10b981;
  --status-active-bg: rgba(16, 185, 129, 0.15);
  --status-pending: #f59e0b;
  --status-pending-bg: rgba(245, 158, 11, 0.15);
  --status-unsubscribed: #64748b;
  --status-unsubscribed-bg: rgba(100, 116, 139, 0.15);
  --status-error: #ef4444;
  --status-error-bg: rgba(239, 68, 68, 0.15);
  
  --radius-sm: 8px;
  --radius-md: 14px;
  --radius-lg: 20px;
  --radius-full: 9999px;
  
  --shadow-sm: 0 4px 6px -1px rgba(0, 0, 0, 0.3);
  --shadow-md: 0 10px 25px -5px rgba(0, 0, 0, 0.4);
  --shadow-glow: 0 0 30px rgba(99, 102, 241, 0.15);
  
  --transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
}

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

body {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
  background-color: var(--bg-main);
  background-image: 
    radial-gradient(circle at 15% 10%, rgba(99, 102, 241, 0.12) 0%, transparent 40%),
    radial-gradient(circle at 85% 90%, rgba(255, 0, 51, 0.08) 0%, transparent 40%);
  background-attachment: fixed;
  color: var(--text-main);
  line-height: 1.5;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  -webkit-font-smoothing: antialiased;
}

/* Container */
.container {
  max-width: 1240px;
  margin: 0 auto;
  padding: 0 24px;
  width: 100%;
}

/* Top Navigation Bar */
.navbar {
  position: sticky;
  top: 0;
  z-index: 50;
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  background: rgba(10, 14, 23, 0.8);
  border-bottom: 1px solid var(--border-subtle);
  padding: 16px 0;
}

.navbar .nav-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
  text-decoration: none;
  color: var(--text-main);
  font-family: 'Outfit', sans-serif;
  font-weight: 700;
  font-size: 1.25rem;
  letter-spacing: -0.02em;
}

.brand-icon {
  width: 38px;
  height: 38px;
  background: linear-gradient(135deg, var(--yt-red), #b91c1c);
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  box-shadow: 0 0 15px var(--yt-glow);
}

.brand span.badge-pill {
  font-size: 0.7rem;
  padding: 2px 8px;
  background: rgba(99, 102, 241, 0.2);
  border: 1px solid rgba(99, 102, 241, 0.4);
  color: #a5b4fc;
  border-radius: var(--radius-full);
  margin-left: 6px;
  font-family: 'JetBrains Mono', monospace;
  font-weight: 500;
}

.nav-links {
  display: flex;
  align-items: center;
  gap: 8px;
}

.nav-link {
  color: var(--text-muted);
  text-decoration: none;
  font-size: 0.9rem;
  font-weight: 500;
  padding: 8px 14px;
  border-radius: var(--radius-sm);
  transition: var(--transition);
  display: flex;
  align-items: center;
  gap: 6px;
}

.nav-link:hover, .nav-link.active {
  color: var(--text-main);
  background: rgba(255, 255, 255, 0.05);
}

.nav-link.active {
  color: #818cf8;
  background: rgba(99, 102, 241, 0.1);
  border: 1px solid rgba(99, 102, 241, 0.25);
}

/* Hero Section */
.hero {
  padding: 48px 0 32px;
  text-align: center;
}

.hero-tag {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 6px 14px;
  background: rgba(99, 102, 241, 0.12);
  border: 1px solid rgba(99, 102, 241, 0.3);
  border-radius: var(--radius-full);
  color: #c7d2fe;
  font-size: 0.8rem;
  font-weight: 500;
  margin-bottom: 18px;
  font-family: 'JetBrains Mono', monospace;
}

.hero-tag span.pulse-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background-color: var(--status-active);
  box-shadow: 0 0 8px var(--status-active);
  display: inline-block;
  animation: pulse 2s infinite;
}

@keyframes pulse {
  0% { transform: scale(0.95); opacity: 0.8; }
  50% { transform: scale(1.3); opacity: 1; }
  100% { transform: scale(0.95); opacity: 0.8; }
}

.hero h1 {
  font-family: 'Outfit', sans-serif;
  font-size: 2.75rem;
  font-weight: 800;
  line-height: 1.15;
  letter-spacing: -0.03em;
  margin-bottom: 14px;
  background: linear-gradient(135deg, #ffffff 30%, #cbd5e1 70%, #94a3b8 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}

.hero p {
  color: var(--text-muted);
  font-size: 1.1rem;
  max-width: 620px;
  margin: 0 auto 32px;
}

/* Glass Card */
.glass-card {
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  box-shadow: var(--shadow-md);
  padding: 24px;
  transition: var(--transition);
}

.glass-card:hover {
  border-color: rgba(255, 255, 255, 0.14);
}

/* Subscription Form Card */
.subscribe-card {
  max-width: 780px;
  margin: 0 auto 48px;
  position: relative;
  overflow: hidden;
  border: 1px solid rgba(99, 102, 241, 0.25);
  box-shadow: 0 0 40px rgba(99, 102, 241, 0.1);
}

.subscribe-card::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 2px;
  background: linear-gradient(90deg, #6366f1, #ec4899, #ff0033);
}

.form-group {
  margin-bottom: 18px;
}

.form-label {
  display: block;
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--text-muted);
  margin-bottom: 8px;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.input-wrapper {
  position: relative;
  display: flex;
  gap: 10px;
}

.search-input {
  flex: 1;
  background: var(--bg-input);
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: var(--radius-sm);
  padding: 14px 18px;
  color: #fff;
  font-size: 1rem;
  font-family: inherit;
  outline: none;
  transition: var(--transition);
}

.search-input:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px var(--primary-glow);
}

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

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 13px 24px;
  border-radius: var(--radius-sm);
  font-size: 0.95rem;
  font-weight: 600;
  font-family: inherit;
  cursor: pointer;
  border: none;
  transition: var(--transition);
  text-decoration: none;
  white-space: nowrap;
}

.btn-primary {
  background: linear-gradient(135deg, #6366f1, #4f46e5);
  color: #fff;
  box-shadow: 0 4px 14px rgba(79, 70, 229, 0.35);
}

.btn-primary:hover {
  background: linear-gradient(135deg, #4f46e5, #4338ca);
  transform: translateY(-1px);
  box-shadow: 0 6px 20px rgba(79, 70, 229, 0.45);
}

.btn-danger {
  background: rgba(239, 68, 68, 0.15);
  color: #f87171;
  border: 1px solid rgba(239, 68, 68, 0.3);
}

.btn-danger:hover {
  background: #ef4444;
  color: #fff;
}

.btn-secondary {
  background: rgba(255, 255, 255, 0.06);
  color: var(--text-main);
  border: 1px solid var(--border-subtle);
}

.btn-secondary:hover {
  background: rgba(255, 255, 255, 0.12);
}

.btn-sm {
  padding: 6px 12px;
  font-size: 0.8rem;
  border-radius: 6px;
}

.btn:disabled {
  opacity: 0.6;
  cursor: not-allowed;
  transform: none !important;
}

/* Channel Resolution Preview */
.channel-preview {
  margin-top: 18px;
  padding: 16px;
  background: rgba(15, 21, 35, 0.8);
  border: 1px solid rgba(99, 102, 241, 0.3);
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  animation: fadeIn 0.3s ease;
}

.preview-left {
  display: flex;
  align-items: center;
  gap: 14px;
}

.channel-avatar {
  width: 52px;
  height: 52px;
  border-radius: 50%;
  object-fit: cover;
  border: 2px solid rgba(255, 255, 255, 0.15);
  background: #1e293b;
}

.channel-avatar-lg {
  width: 72px;
  height: 72px;
}

.preview-info h4 {
  font-size: 1.05rem;
  font-weight: 700;
  color: #fff;
  display: flex;
  align-items: center;
  gap: 8px;
}

.preview-info p {
  font-size: 0.85rem;
  color: var(--text-muted);
  font-family: 'JetBrains Mono', monospace;
  margin-top: 2px;
}

.preview-topic {
  font-size: 0.75rem;
  color: var(--text-dim);
  margin-top: 4px;
  word-break: break-all;
}

/* Metric Stats Row */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 18px;
  margin-bottom: 40px;
}

.stat-card {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 20px;
}

.stat-icon {
  width: 48px;
  height: 48px;
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.25rem;
}

.stat-icon.indigo {
  background: rgba(99, 102, 241, 0.15);
  color: #818cf8;
}

.stat-icon.red {
  background: rgba(255, 0, 51, 0.15);
  color: #ff4d6d;
}

.stat-icon.green {
  background: rgba(16, 185, 129, 0.15);
  color: #34d399;
}

.stat-icon.amber {
  background: rgba(245, 158, 11, 0.15);
  color: #fbbf24;
}

.stat-value {
  font-family: 'Outfit', sans-serif;
  font-size: 1.8rem;
  font-weight: 700;
  color: #fff;
  line-height: 1.1;
}

.stat-label {
  font-size: 0.8rem;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin-top: 4px;
}

/* Section Header */
.section-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 20px;
  flex-wrap: wrap;
  gap: 12px;
}

.section-title {
  font-family: 'Outfit', sans-serif;
  font-size: 1.4rem;
  font-weight: 700;
  letter-spacing: -0.01em;
}

/* Channel Cards Grid */
.channels-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(340px, 1fr));
  gap: 20px;
  margin-bottom: 48px;
}

.channel-card {
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  padding: 22px;
  border-radius: var(--radius-md);
  position: relative;
}

.channel-card-top {
  display: flex;
  align-items: flex-start;
  gap: 14px;
  margin-bottom: 16px;
}

.channel-details {
  flex: 1;
  min-width: 0;
}

.channel-name {
  font-size: 1.1rem;
  font-weight: 700;
  color: #fff;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  text-decoration: none;
  display: block;
}

.channel-name:hover {
  color: #818cf8;
}

.channel-meta-tag {
  font-size: 0.8rem;
  color: var(--text-muted);
  font-family: 'JetBrains Mono', monospace;
  margin-top: 2px;
}

.status-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 10px;
  border-radius: var(--radius-full);
  font-size: 0.75rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.badge-active {
  background: var(--status-active-bg);
  color: var(--status-active);
  border: 1px solid rgba(16, 185, 129, 0.3);
}

.badge-pending {
  background: var(--status-pending-bg);
  color: var(--status-pending);
  border: 1px solid rgba(245, 158, 11, 0.3);
}

.badge-unsubscribed {
  background: var(--status-unsubscribed-bg);
  color: var(--status-unsubscribed);
  border: 1px solid rgba(100, 116, 139, 0.3);
}

.badge-error, .badge-denied {
  background: var(--status-error-bg);
  color: var(--status-error);
  border: 1px solid rgba(239, 68, 68, 0.3);
}

.channel-meta-list {
  background: rgba(0, 0, 0, 0.25);
  border-radius: var(--radius-sm);
  padding: 12px;
  margin-bottom: 18px;
  font-size: 0.82rem;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.meta-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.meta-item span:first-child {
  color: var(--text-dim);
}

.meta-item span:last-child {
  color: var(--text-main);
  font-family: 'JetBrains Mono', monospace;
}

.channel-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  border-top: 1px solid var(--border-subtle);
  padding-top: 16px;
}

/* Video Grid Layout */
.videos-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  gap: 24px;
  margin-bottom: 48px;
}

.video-card {
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  overflow: hidden;
  transition: var(--transition);
  display: flex;
  flex-direction: column;
}

.video-card:hover {
  transform: translateY(-4px);
  border-color: rgba(99, 102, 241, 0.4);
  box-shadow: 0 12px 28px rgba(0, 0, 0, 0.45), 0 0 20px rgba(99, 102, 241, 0.15);
}

.video-thumb-wrap {
  position: relative;
  width: 100%;
  aspect-ratio: 16 / 9;
  background: #000;
  overflow: hidden;
  cursor: pointer;
}

.video-thumb {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 0.4s ease;
}

.video-card:hover .video-thumb {
  transform: scale(1.05);
}

.play-overlay {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.4);
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  transition: var(--transition);
}

.video-card:hover .play-overlay {
  opacity: 1;
}

.play-btn {
  width: 52px;
  height: 52px;
  background: var(--yt-red);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  font-size: 1.25rem;
  box-shadow: 0 0 20px var(--yt-glow);
  transform: scale(0.9);
  transition: transform 0.2s ease;
}

.video-card:hover .play-btn {
  transform: scale(1);
}

.video-content {
  padding: 16px;
  display: flex;
  flex-direction: column;
  flex: 1;
}

.video-title {
  font-size: 0.98rem;
  font-weight: 600;
  line-height: 1.4;
  color: #fff;
  margin-bottom: 8px;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  text-decoration: none;
}

.video-title:hover {
  color: #818cf8;
}

.video-dates {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 0.78rem;
  color: var(--text-dim);
  margin-top: auto;
  padding-top: 12px;
  border-top: 1px solid rgba(255, 255, 255, 0.05);
}

/* Empty State */
.empty-state {
  text-align: center;
  padding: 64px 20px;
  max-width: 500px;
  margin: 0 auto;
}

.empty-icon {
  font-size: 3rem;
  color: var(--text-dim);
  margin-bottom: 16px;
}

.empty-state h3 {
  font-family: 'Outfit', sans-serif;
  font-size: 1.3rem;
  font-weight: 700;
  margin-bottom: 8px;
}

.empty-state p {
  color: var(--text-muted);
  font-size: 0.95rem;
  margin-bottom: 24px;
}

/* Modal Player */
.modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.85);
  backdrop-filter: blur(8px);
  z-index: 100;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 24px;
  animation: fadeIn 0.25s ease;
}

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

.modal-dialog {
  background: #0f172a;
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: var(--radius-md);
  width: 100%;
  max-width: 900px;
  overflow: hidden;
  box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.75);
}

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

.modal-title {
  font-size: 1.05rem;
  font-weight: 600;
  color: #fff;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  padding-right: 16px;
}

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

.modal-close:hover {
  color: #fff;
}

.modal-body {
  position: relative;
  width: 100%;
  aspect-ratio: 16 / 9;
  background: #000;
}

.modal-body iframe {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  border: none;
}

/* Logs Table */
.table-container {
  overflow-x: auto;
  border-radius: var(--radius-sm);
  background: rgba(0, 0, 0, 0.2);
}

.log-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.85rem;
  text-align: left;
}

.log-table th {
  background: rgba(255, 255, 255, 0.03);
  padding: 14px 18px;
  color: var(--text-dim);
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  border-bottom: 1px solid var(--border-subtle);
}

.log-table td {
  padding: 14px 18px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.04);
  vertical-align: top;
}

.log-table tr:hover td {
  background: rgba(255, 255, 255, 0.02);
}

.log-time {
  font-family: 'JetBrains Mono', monospace;
  color: var(--text-dim);
  white-space: nowrap;
}

/* Toast Notifications */
.toast-container {
  position: fixed;
  bottom: 24px;
  right: 24px;
  z-index: 120;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.toast {
  background: #1e293b;
  color: #fff;
  border-radius: var(--radius-sm);
  padding: 14px 18px;
  font-size: 0.9rem;
  display: flex;
  align-items: center;
  gap: 12px;
  box-shadow: var(--shadow-md);
  border-left: 4px solid var(--primary);
  min-width: 280px;
  max-width: 400px;
  animation: slideIn 0.3s ease;
}

.toast.toast-success { border-left-color: var(--status-active); }
.toast.toast-error { border-left-color: var(--status-error); }
.toast.toast-info { border-left-color: var(--primary); }

@keyframes slideIn {
  from { transform: translateX(100%); opacity: 0; }
  to { transform: translateX(0); opacity: 1; }
}

@keyframes fadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

/* Footer */
.footer {
  margin-top: auto;
  border-top: 1px solid var(--border-subtle);
  padding: 24px 0;
  text-align: center;
  color: var(--text-dim);
  font-size: 0.85rem;
}

.footer a {
  color: var(--text-muted);
  text-decoration: none;
}

.footer a:hover {
  color: #818cf8;
}

/* Responsive adjustments */
@media (max-width: 768px) {
  .hero h1 { font-size: 2.1rem; }
  .input-wrapper { flex-direction: column; }
  .channels-grid { grid-template-columns: 1fr; }
  .channel-preview { flex-direction: column; align-items: flex-start; }
}
