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

:root {
  --bg-dark: #0f0f13;
  --bg-card: rgba(22, 22, 28, 0.7);
  --bg-card-hover: rgba(30, 30, 38, 0.9);
  --glass-border: rgba(255, 255, 255, 0.08);
  --primary: #00d4ff;
  --primary-hover: #00bfff;
  --success: #00ff88;
  --success-hover: #00cc6a;
  --danger: #ff4444;
  --warning: #ffd700;
  --gold: #ffd700;
  --text-main: #e8e8f0;
  --text-muted: #8888a0;
  --font-family: 'Inter', system-ui, sans-serif;
  --radius-md: 12px;
  --radius-lg: 16px;
  --shadow-glow: 0 0 20px rgba(0, 212, 255, 0.15);
}

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

body {
  font-family: var(--font-family);
  background: var(--bg-dark);
  color: var(--text-main);
  min-height: 100vh;
  overflow-x: hidden;
  position: relative;
}

/* Background Effects */
.bg-fx {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  z-index: -1;
  pointer-events: none;
  overflow: hidden;
}

.glow-orb {
  position: absolute;
  border-radius: 50%;
  filter: blur(80px);
  opacity: 0.15;
}

.orb-1 {
  width: 400px;
  height: 400px;
  background: var(--primary);
  top: -100px;
  left: -100px;
}

.orb-2 {
  width: 300px;
  height: 300px;
  background: var(--gold);
  bottom: 10%;
  right: -50px;
}

.orb-3 {
  width: 250px;
  height: 250px;
  background: var(--success);
  top: 50%;
  left: 30%;
}

/* Utility Classes */
.hidden {
  display: none !important;
}

.gradient-text {
  background: linear-gradient(135deg, var(--primary), var(--gold));
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
}

.text-green {
  color: var(--success);
}

.text-red,
.text-danger {
  color: var(--danger);
}

.text-cyan {
  color: var(--primary);
}

.text-gold {
  color: var(--gold);
}

.text-secondary {
  color: var(--text-muted);
}

.text-sm {
  font-size: 0.875rem;
}

.text-xs {
  font-size: 0.75rem;
}

.font-bold {
  font-weight: 700;
}

.mt-2 {
  margin-top: 0.5rem;
}

.mt-3 {
  margin-top: 1rem;
}

.mt-4 {
  margin-top: 1.5rem;
}

.mb-1 {
  margin-bottom: 0.25rem;
}

.mb-2 {
  margin-bottom: 0.5rem;
}

.mb-4 {
  margin-bottom: 1.5rem;
}

.ml-2 {
  margin-left: 0.5rem;
}

.p-2 {
  padding: 0.5rem;
}

.w-100 {
  width: 100%;
}

.block {
  display: block;
}

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

.flex-end {
  display: flex;
  justify-content: flex-end;
  align-items: center;
}

.gap-2 {
  gap: 0.5rem;
}

.strike {
  text-decoration: line-through;
  opacity: 0.7;
}

.bg-glass {
  background: rgba(0, 0, 0, 0.2);
  border: 1px solid var(--glass-border);
}

.border-radius {
  border-radius: var(--radius-md);
}

.border-top {
  border-top: 1px solid var(--glass-border);
}

/* Buttons */
.btn {
  font-family: var(--font-family);
  font-weight: 600;
  border: none;
  border-radius: 8px;
  padding: 10px 16px;
  cursor: pointer;
  transition: all 0.2s;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
}

.btn-primary {
  background: var(--primary);
  color: #000;
  box-shadow: var(--shadow-glow);
}

.btn-primary:hover {
  background: var(--primary-hover);
  transform: translateY(-1px);
}

.btn-green {
  background: var(--success);
  color: #000;
}

.btn-green:hover {
  background: var(--success-hover);
  transform: translateY(-1px);
}

.btn-outline {
  background: transparent;
  color: var(--text-main);
  border: 1px solid var(--glass-border);
}

.btn-outline:hover {
  background: rgba(255, 255, 255, 0.05);
}

.btn-sm {
  padding: 6px 12px;
  font-size: 0.875rem;
}

.btn-block {
  width: 100%;
}

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

/* Forms */
.form-group {
  margin-bottom: 1rem;
}

.form-group label {
  display: block;
  margin-bottom: 8px;
  font-weight: 500;
  font-size: 0.9rem;
}

input,
textarea {
  width: 100%;
  background: rgba(0, 0, 0, 0.3);
  border: 1px solid var(--glass-border);
  color: var(--text-main);
  padding: 10px 12px;
  border-radius: 8px;
  font-family: var(--font-family);
  outline: none;
  transition: border-color 0.2s;
}

input:focus,
textarea:focus {
  border-color: var(--primary);
}

/* Layouts */
.view {
  display: none;
}

.view.active {
  display: block;
}

.inner-view {
  display: none;
}

.inner-view.active {
  display: block;
}

/* Login */
.login-container {
  height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
}

.login-card {
  width: 100%;
  max-width: 400px;
  padding: 40px;
}

.login-header {
  text-align: center;
  margin-bottom: 30px;
}

.error-msg {
  color: var(--danger);
  font-size: 0.875rem;
  margin-top: 10px;
  text-align: center;
  background: rgba(255, 0, 0, 0.1);
  padding: 8px;
  border-radius: 6px;
}

/* Main App Layout */
.layout {
  display: flex;
  height: 100vh;
  overflow: hidden;
}

/* Sidebar */
.sidebar {
  width: 260px;
  background: rgba(15, 15, 19, 0.8);
  border-right: 1px solid var(--glass-border);
  display: flex;
  flex-direction: column;
  backdrop-filter: blur(20px);
}

.sidebar-logo {
  padding: 24px;
  font-size: 1.5rem;
  font-weight: 800;
  border-bottom: 1px solid var(--glass-border);
}

.sidebar-nav {
  padding: 20px 12px;
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.nav-btn {
  background: transparent;
  border: none;
  color: var(--text-muted);
  width: 100%;
  text-align: left;
  padding: 12px 16px;
  border-radius: 8px;
  font-weight: 500;
  font-size: 0.95rem;
  cursor: pointer;
  transition: all 0.2s;
  display: flex;
  align-items: center;
  gap: 12px;
}

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

.nav-btn.active {
  background: rgba(0, 212, 255, 0.1);
  color: var(--primary);
}

.nav-divider {
  height: 1px;
  background: var(--glass-border);
  margin: 8px 0;
}

.spacer {
  flex: 1;
}

/* Topbar */
.content {
  flex: 1;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.topbar {
  height: 70px;
  padding: 0 32px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  border-bottom: 1px solid var(--glass-border);
  background: rgba(15, 15, 19, 0.6);
  backdrop-filter: blur(10px);
}

.header-right {
  display: flex;
  align-items: center;
  gap: 20px;
}

.status-pill {
  display: flex;
  align-items: center;
  gap: 8px;
  background: rgba(0, 255, 136, 0.1);
  padding: 6px 12px;
  border-radius: 20px;
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--success);
}

.dot {
  width: 8px;
  height: 8px;
  background: var(--success);
  border-radius: 50%;
}

.pulse {
  animation: pulse 2s infinite;
}

@keyframes pulse {
  0% {
    opacity: 1;
  }

  50% {
    opacity: 0.4;
  }

  100% {
    opacity: 1;
  }
}

.avatar {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--primary), var(--gold));
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: bold;
  color: #000;
  font-size: 0.85rem;
}

/* Views Container */
.views-container {
  flex: 1;
  overflow-y: auto;
  padding: 32px;
}

.section-header {
  margin-bottom: 24px;
}

.section-header h2 {
  font-size: 1.8rem;
  font-weight: 700;
}

/* Cards */
.card {
  background: var(--bg-card);
  border: 1px solid var(--glass-border);
  border-radius: var(--radius-lg);
  backdrop-filter: blur(10px);
  padding: 24px;
}

.card h3 {
  font-size: 1.1rem;
  margin-bottom: 16px;
  font-weight: 600;
}

/* KPI Grid */
.kpi-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 24px;
}

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

.kpi-icon {
  width: 48px;
  height: 48px;
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.5rem;
  background: rgba(255, 255, 255, 0.05);
}

.kpi-card.cyan .kpi-icon {
  background: rgba(0, 212, 255, 0.1);
  color: var(--primary);
}

.kpi-card.green .kpi-icon {
  background: rgba(0, 255, 136, 0.1);
  color: var(--success);
}

.kpi-card.gold .kpi-icon {
  background: rgba(255, 215, 0, 0.1);
  color: var(--gold);
}

.kpi-card.purple .kpi-icon {
  background: rgba(155, 89, 182, 0.1);
  color: #9b59b6;
}

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

.kpi-label {
  font-size: 0.85rem;
  color: var(--text-muted);
  font-weight: 500;
}

.kpi-value {
  font-size: 1.5rem;
  font-weight: 700;
}

/* Tables */
.table-responsive {
  overflow-x: auto;
}

.table {
  width: 100%;
  border-collapse: collapse;
}

.table th,
.table td {
  padding: 12px 16px;
  text-align: left;
  border-bottom: 1px solid rgba(255, 255, 255, 0.05);
}

.table th {
  font-weight: 600;
  color: var(--text-muted);
  font-size: 0.85rem;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.table tbody tr:hover {
  background: rgba(255, 255, 255, 0.02);
}

.thumb-xs {
  width: 60px;
  height: auto;
  border-radius: 4px;
  border: 1px solid var(--glass-border);
}

.titles-col {
  max-width: 300px;
}

.title-old {
  font-size: 0.8rem;
  margin-bottom: 4px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.title-new {
  font-size: 0.9rem;
  font-weight: 500;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.badge {
  padding: 4px 8px;
  border-radius: 4px;
  font-size: 0.75rem;
  font-weight: 600;
  background: rgba(255, 255, 255, 0.1);
  color: #fff;
}

/* Score Bar */
.score-bar {
  width: 100px;
  height: 6px;
  background: rgba(255, 255, 255, 0.1);
  border-radius: 3px;
  overflow: hidden;
}

.score-fill {
  height: 100%;
  background: var(--primary);
  transition: width 0.5s ease;
}

.bg-gold {
  background: var(--gold) !important;
}

/* Channel Tabs */
.channel-tabs {
  display: flex;
  gap: 12px;
  border-bottom: 1px solid var(--glass-border);
  padding-bottom: 16px;
  overflow-x: auto;
}

.channel-tab {
  padding: 8px 16px;
  border-radius: 20px;
  background: rgba(255, 255, 255, 0.05);
  color: var(--text-muted);
  border: 1px solid transparent;
  cursor: pointer;
  transition: all 0.2s;
  white-space: nowrap;
  font-weight: 500;
}

.channel-tab:hover {
  background: rgba(255, 255, 255, 0.1);
}

.channel-tab.active {
  background: rgba(0, 212, 255, 0.1);
  border-color: rgba(0, 212, 255, 0.3);
  color: var(--primary);
}

/* Channel Overview */
.channel-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  border-bottom: 1px solid var(--glass-border);
  padding-bottom: 16px;
}

.channel-stats {
  display: flex;
  gap: 32px;
}

.stat-item {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.stat-item .label {
  font-size: 0.8rem;
  color: var(--text-muted);
  text-transform: uppercase;
}

.stat-item .value {
  font-size: 1.25rem;
  font-weight: 700;
}

/* Progress */
.progress-container {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.progress-bar-bg {
  width: 100%;
  height: 8px;
  background: rgba(255, 255, 255, 0.1);
  border-radius: 4px;
  overflow: hidden;
}

.progress-bar-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--primary), var(--success));
  transition: width 0.5s ease;
}

.progress-text {
  font-size: 0.8rem;
  color: var(--text-muted);
  text-align: right;
}

/* Review Card (VidIQ Style) */
.review-card {
  padding: 20px;
  border: 1px solid rgba(0, 212, 255, 0.3);
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.5);
}

.review-layout {
  display: flex;
  gap: 24px;
}

.review-video-info {
  width: 320px;
  flex-shrink: 0;
}

.video-embed-container {
  position: relative;
  width: 100%;
  padding-top: 56.25%;
  /* 16:9 Aspect Ratio */
  background: #000;
  border-radius: var(--radius-md);
  overflow: hidden;
  border: 1px solid var(--glass-border);
}

.review-iframe {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
}

.review-content-edit {
  flex: 1;
}

.review-original-title {
  font-size: 0.9rem;
  line-height: 1.4;
  color: #a0a0a0;
}

.review-suggested-title {
  font-size: 1.1rem;
  padding: 12px;
  background: rgba(0, 255, 136, 0.05);
  border-color: rgba(0, 255, 136, 0.2);
}

.review-suggested-desc {
  font-size: 0.9rem;
  font-family: monospace;
  resize: vertical;
  min-height: 80px;
}

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

.toast {
  background: rgba(30, 30, 38, 0.95);
  border-left: 4px solid var(--primary);
  padding: 16px 20px;
  border-radius: 8px;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.5);
  backdrop-filter: blur(10px);
  color: #fff;
  font-weight: 500;
  display: flex;
  align-items: center;
  gap: 12px;
  animation: slideInRight 0.3s ease forwards;
  max-width: 350px;
}

.toast.success {
  border-color: var(--success);
}

.toast.error {
  border-color: var(--danger);
}

.toast.info {
  border-color: var(--primary);
}

@keyframes slideInRight {
  from {
    transform: translateX(100%);
    opacity: 0;
  }

  to {
    transform: translateX(0);
    opacity: 1;
  }
}

@keyframes fadeOut {
  to {
    opacity: 0;
  }
}

/* Diamonds Grid */
.diamonds-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 24px;
}

.diamond-card {
  padding: 16px;
  cursor: pointer;
  transition: transform 0.2s;
  border: 1px solid rgba(255, 215, 0, 0.2);
  background: linear-gradient(180deg, rgba(255, 215, 0, 0.02) 0%, rgba(22, 22, 28, 0.8) 50%);
}

.diamond-card:hover {
  transform: translateY(-4px);
  box-shadow: 0 10px 20px rgba(255, 215, 0, 0.1);
}

.thumb-container {
  position: relative;
  border-radius: 8px;
  overflow: hidden;
  margin-bottom: 12px;
  aspect-ratio: 16/9;
  background: #000;
}

.thumb-container img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  opacity: 0.9;
}

.diamond-badges {
  position: absolute;
  top: 8px;
  right: 8px;
  background: rgba(0, 0, 0, 0.7);
  padding: 4px 8px;
  border-radius: 4px;
  font-size: 0.8rem;
  backdrop-filter: blur(4px);
}

.diamond-title {
  font-size: 1rem;
  font-weight: 600;
  line-height: 1.4;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

/* Switch for auto-run */
.switch {
  position: relative;
  display: inline-block;
  width: 44px;
  height: 24px;
}

.switch input {
  opacity: 0;
  width: 0;
  height: 0;
}

.slider {
  position: absolute;
  cursor: pointer;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background-color: rgba(255, 255, 255, 0.1);
  transition: .4s;
}

.slider:before {
  position: absolute;
  content: "";
  height: 18px;
  width: 18px;
  left: 3px;
  bottom: 3px;
  background-color: white;
  transition: .4s;
}

input:checked+.slider {
  background-color: var(--success);
}

input:checked+.slider:before {
  transform: translateX(20px);
}

.slider.round {
  border-radius: 24px;
}

.slider.round:before {
  border-radius: 50%;
}

/* Spinners */
.spinner {
  border: 3px solid rgba(255, 255, 255, 0.1);
  width: 20px;
  height: 20px;
  border-radius: 50%;
  border-left-color: var(--primary);
  animation: spin 1s linear infinite;
  display: inline-block;
  vertical-align: middle;
  margin-right: 8px;
}

@keyframes spin {
  0% {
    transform: rotate(0deg);
  }

  100% {
    transform: rotate(360deg);
  }
}

/* Missing Utility Classes */
.text-primary {
  color: var(--text-main);
}

.text-xl {
  font-size: 1.25rem;
}

.text-center {
  text-align: center;
}

.text-dark {
  color: #000;
  font-weight: 700;
}

.p-4 {
  padding: 1.5rem;
}

.pt-3 {
  padding-top: 1rem;
}

.align-center {
  align-items: center;
}

/* Login Header */
.login-header h1 {
  font-size: 2.5rem;
  font-weight: 800;
  letter-spacing: -1px;
  margin-bottom: 8px;
}

.login-header p {
  color: var(--text-muted);
  font-size: 1rem;
}

/* Diamond Info (missing from rewrite) */
.diamond-info {
  padding: 16px 0 0;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.diamond-views {
  font-size: 0.85rem;
}

.score-container {
  margin-top: 8px;
}

/* Channel Actions (missing from rewrite) */
.channel-actions {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
}

/* Config Grid (missing from rewrite) */
.cp-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
  gap: 24px;
}

/* Review List */
.review-list {
  display: flex;
  flex-direction: column;
  gap: 24px;
}

/* Pagination */
.pagination {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 16px;
}

/* Scrollbar */
::-webkit-scrollbar {
  width: 6px;
  height: 6px;
}

::-webkit-scrollbar-track {
  background: transparent;
}

::-webkit-scrollbar-thumb {
  background: rgba(255, 255, 255, 0.1);
  border-radius: 3px;
}

::-webkit-scrollbar-thumb:hover {
  background: rgba(255, 255, 255, 0.2);
}

/* Range Input */
input[type="range"] {
  -webkit-appearance: none;
  appearance: none;
  height: 6px;
  background: rgba(255, 255, 255, 0.1);
  border-radius: 3px;
  border: none;
  padding: 0;
}

input[type="range"]::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: var(--primary);
  cursor: pointer;
  box-shadow: 0 0 8px rgba(0, 212, 255, 0.4);
}

/* Mobile Responsive */
@media (max-width: 768px) {
  .sidebar {
    position: fixed;
    left: 0;
    top: 0;
    height: 100vh;
    z-index: 100;
    transform: translateX(-100%);
    transition: transform 0.3s ease;
  }

  .sidebar.open {
    transform: translateX(0);
  }

  .sidebar-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.5);
    z-index: 99;
  }

  .sidebar-overlay.active {
    display: block;
  }

  .hamburger {
    display: flex;
  }

  .views-container {
    padding: 16px;
  }

  .topbar {
    padding: 0 16px;
  }

  .kpi-grid {
    grid-template-columns: repeat(2, 1fr);
    gap: 12px;
  }

  .review-layout {
    flex-direction: column;
  }

  .review-video-info {
    width: 100%;
  }

  .channel-header {
    flex-direction: column;
    gap: 12px;
    align-items: flex-start;
  }

  .channel-stats {
    flex-wrap: wrap;
    gap: 16px;
  }

  .cp-grid {
    grid-template-columns: 1fr;
  }
}

/* Hamburger Button */
.hamburger {
  display: none;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
  background: transparent;
  border: 1px solid var(--glass-border);
  border-radius: 8px;
  color: var(--text-main);
  cursor: pointer;
  font-size: 1.2rem;
}

/* Focus States for Accessibility */
.btn:focus-visible,
.nav-btn:focus-visible,
.channel-tab:focus-visible,
input:focus-visible,
textarea:focus-visible {
  outline: 2px solid var(--primary);
  outline-offset: 2px;
}

/* Skeleton Loading */
.skeleton {
  background: linear-gradient(90deg,
      rgba(255, 255, 255, 0.02) 25%,
      rgba(255, 255, 255, 0.06) 50%,
      rgba(255, 255, 255, 0.02) 75%);
  background-size: 200% 100%;
  animation: skeletonPulse 1.5s ease infinite;
  border-radius: 8px;
}

@keyframes skeletonPulse {
  0% {
    background-position: 200% 0;
  }

  100% {
    background-position: -200% 0;
  }
}