/* Tube Link Fixer Extension Styles - Enhanced UI */
:root {
  --primary: #2563eb;
  --primary-dark: #1d4ed8;
  --primary-light: #3b82f6;
  --success: #10b981;
  --success-light: #34d399;
  --danger: #ef4444;
  --danger-light: #f87171;
  --warning: #f59e0b;
  --gray-50: #f9fafb;
  --gray-100: #f3f4f6;
  --gray-200: #e5e7eb;
  --gray-300: #d1d5db;
  --gray-400: #9ca3af;
  --gray-500: #6b7280;
  --gray-600: #4b5563;
  --gray-700: #374151;
  --gray-800: #1f2937;
  --gray-900: #111827;
  --radius: 12px;
  --radius-sm: 8px;
  --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.05);
  --shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1);
  --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1);
}

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

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  font-size: 14px;
  color: var(--gray-800);
  background: linear-gradient(135deg, #f8fafc 0%, #e2e8f0 100%);
  width: 380px;
  min-height: 450px;
}

.container {
  padding: 16px;
}

/* Header */
.header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 16px;
  padding-bottom: 12px;
  border-bottom: 1px solid var(--gray-200);
}

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

.logo-icon {
  width: 28px;
  height: 28px;
  color: var(--primary);
}

.logo-text {
  font-weight: 700;
  font-size: 18px;
  background: linear-gradient(135deg, var(--primary), var(--primary-light));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.status-badge {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 6px 12px;
  background: var(--gray-100);
  border-radius: 20px;
  font-size: 12px;
  font-weight: 500;
  color: var(--gray-500);
}

.status-badge.connected {
  background: linear-gradient(135deg, #dcfce7, #bbf7d0);
  color: #166534;
}

.status-badge.connected .status-dot {
  background: var(--success);
  box-shadow: 0 0 0 3px rgba(16, 185, 129, 0.2);
}

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

/* Warning Card */
.warning-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  padding: 32px 24px;
  background: linear-gradient(135deg, #fef3c7, #fde68a);
  border-radius: var(--radius);
  color: #92400e;
  margin-bottom: 16px;
}

.warning-icon {
  width: 40px;
  height: 40px;
  margin-bottom: 16px;
  color: var(--warning);
}

.warning-card p {
  margin-bottom: 16px;
  line-height: 1.5;
}

/* Sections */
.section {
  margin-bottom: 16px;
}

/* Login Card */
.login-card {
  background: white;
  border: 1px solid var(--gray-200);
  border-radius: var(--radius);
  padding: 32px 24px;
  text-align: center;
  box-shadow: var(--shadow);
}

.login-icon {
  width: 64px;
  height: 64px;
  margin: 0 auto 20px;
  background: linear-gradient(135deg, var(--primary), var(--primary-light));
  border-radius: 20px;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 8px 16px rgba(37, 99, 235, 0.25);
}

.login-icon svg {
  width: 32px;
  height: 32px;
  color: white;
}

.login-card h3 {
  font-size: 18px;
  font-weight: 600;
  margin-bottom: 8px;
  color: var(--gray-900);
}

.section-desc {
  font-size: 13px;
  color: var(--gray-500);
  margin-bottom: 20px;
  line-height: 1.5;
}

.help-text {
  margin-top: 16px;
  font-size: 12px;
  color: var(--gray-500);
}

.help-text a {
  color: var(--primary);
  text-decoration: none;
  font-weight: 500;
}

/* User Card (Logged In State) */
.user-card {
  background: white;
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  overflow: hidden;
}

.user-card-header {
  display: flex;
  align-items: center;
  padding: 16px;
  background: linear-gradient(135deg, var(--primary), var(--primary-light));
}

.avatar-wrapper {
  position: relative;
  margin-right: 12px;
}

.avatar {
  width: 48px;
  height: 48px;
  border-radius: 50%;
  background: white;
  color: var(--primary);
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 18px;
  border: 3px solid rgba(255, 255, 255, 0.3);
}

.online-indicator {
  position: absolute;
  bottom: 2px;
  right: 2px;
  width: 12px;
  height: 12px;
  background: var(--success);
  border-radius: 50%;
  border: 2px solid var(--primary);
}

.user-info {
  flex: 1;
  text-align: left;
}

.user-name {
  font-weight: 600;
  font-size: 15px;
  color: white;
  margin-bottom: 2px;
}

.user-email {
  font-size: 12px;
  color: rgba(255, 255, 255, 0.8);
}

.btn-icon-only {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  border: none;
  background: rgba(255, 255, 255, 0.15);
  color: white;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s;
}

.btn-icon-only:hover {
  background: rgba(255, 255, 255, 0.25);
}

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

.user-card-footer {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 12px 16px;
  background: var(--gray-50);
  border-top: 1px solid var(--gray-100);
}

/* Credits Bar */
.credits-bar {
  padding: 12px 16px;
  background: white;
  border-top: 1px solid rgba(255, 255, 255, 0.1);
}

.credits-info {
  display: flex;
  justify-content: space-between;
  margin-bottom: 6px;
}

.credits-label {
  font-size: 11px;
  color: var(--gray-500);
  font-weight: 500;
}

.credits-value {
  font-size: 11px;
  color: var(--gray-700);
  font-weight: 600;
}

.credits-progress {
  height: 6px;
  background: var(--gray-100);
  border-radius: 3px;
  overflow: hidden;
}

.credits-progress-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--success), var(--success-light));
  border-radius: 3px;
  transition: width 0.5s ease;
}

.credits-progress-fill.warning {
  background: linear-gradient(90deg, var(--warning), #fbbf24);
}

.credits-progress-fill.danger {
  background: linear-gradient(90deg, var(--danger), var(--danger-light));
}

.btn-icon-only+.btn-icon-only {
  margin-left: 6px;
}

.btn-icon-only.refreshing svg {
  animation: spin 1s linear infinite;
}

.plan-badge {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  font-weight: 600;
  color: var(--primary);
  background: rgba(37, 99, 235, 0.1);
  padding: 6px 10px;
  border-radius: 20px;
}

.plan-badge svg {
  width: 14px;
  height: 14px;
}

.account-link {
  font-size: 12px;
  color: var(--gray-500);
  text-decoration: none;
}

.account-link:hover {
  color: var(--primary);
}

/* Quick Stats */
.quick-stats {
  display: flex;
  gap: 8px;
  margin-top: 12px;
}

.stat-item {
  flex: 1;
  text-align: center;
  padding: 12px 8px;
  background: white;
  border-radius: var(--radius-sm);
  box-shadow: var(--shadow-sm);
}

.stat-value {
  display: block;
  font-size: 20px;
  font-weight: 700;
  color: var(--gray-800);
}

.stat-value.broken {
  color: var(--danger);
}

.stat-label {
  font-size: 10px;
  color: var(--gray-500);
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

/* Video Card */
.video-card {
  background: white;
  border-radius: var(--radius);
  overflow: hidden;
  box-shadow: var(--shadow-sm);
  margin-bottom: 12px;
}

.video-card-header {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 14px;
  background: #ff0000;
  color: white;
  font-size: 12px;
  font-weight: 600;
}

.youtube-icon {
  width: 18px;
  height: 18px;
}

.video-content {
  display: flex;
  gap: 12px;
  padding: 12px;
}

.video-thumbnail {
  width: 100px;
  height: 56px;
  background: var(--gray-200);
  border-radius: var(--radius-sm);
  background-size: cover;
  background-position: center;
  flex-shrink: 0;
}

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

.video-title {
  font-weight: 500;
  font-size: 13px;
  line-height: 1.3;
  color: var(--gray-800);
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  margin-bottom: 4px;
}

.video-channel {
  font-size: 11px;
  color: var(--gray-500);
}

/* Scan Button */
.btn-scan {
  display: flex;
  align-items: center;
  width: 100%;
  padding: 14px 16px;
  background: linear-gradient(135deg, var(--primary), var(--primary-light));
  border: none;
  border-radius: var(--radius);
  color: white;
  cursor: pointer;
  transition: all 0.3s;
  box-shadow: 0 4px 12px rgba(37, 99, 235, 0.3);
}

.btn-scan:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 16px rgba(37, 99, 235, 0.4);
}

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

.scan-icon-wrapper {
  width: 40px;
  height: 40px;
  background: rgba(255, 255, 255, 0.2);
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  margin-right: 12px;
}

.scan-icon {
  width: 20px;
  height: 20px;
}

.scan-text {
  flex: 1;
  text-align: left;
}

.scan-title {
  display: block;
  font-size: 14px;
  font-weight: 600;
}

.scan-subtitle {
  display: block;
  font-size: 11px;
  opacity: 0.8;
}

.scan-arrow {
  width: 20px;
  height: 20px;
  opacity: 0.6;
}

/* Progress Section */
.progress-section {
  background: white;
  border-radius: var(--radius);
  padding: 16px;
  margin-top: 12px;
  box-shadow: var(--shadow-sm);
}

.progress-header {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 12px;
}

.progress-spinner {
  width: 24px;
  height: 24px;
  border: 3px solid var(--gray-200);
  border-top-color: var(--primary);
  border-radius: 50%;
  animation: spin 1s linear infinite;
}

@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

.progress-title {
  font-weight: 600;
  color: var(--gray-800);
}

.progress-bar {
  height: 8px;
  background: var(--gray-100);
  border-radius: 4px;
  overflow: hidden;
}

.progress-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--primary), var(--primary-light));
  border-radius: 4px;
  transition: width 0.3s ease;
  width: 0%;
}

.progress-text {
  font-size: 12px;
  color: var(--gray-500);
  text-align: center;
  margin-top: 8px;
}

/* Results Section */
.results-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 12px;
}

.results-header h3 {
  font-size: 16px;
  font-weight: 600;
  color: var(--gray-800);
}

/* Results Summary Cards */
.results-summary {
  display: flex;
  gap: 8px;
  margin-bottom: 12px;
}

.summary-card {
  flex: 1;
  text-align: center;
  padding: 14px 8px;
  background: white;
  border-radius: var(--radius-sm);
  box-shadow: var(--shadow-sm);
}

.summary-icon {
  width: 32px;
  height: 32px;
  margin: 0 auto 8px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
}

.summary-icon svg {
  width: 16px;
  height: 16px;
}

.summary-total .summary-icon {
  background: var(--gray-100);
  color: var(--gray-600);
}

.summary-valid .summary-icon {
  background: #dcfce7;
  color: var(--success);
}

.summary-broken .summary-icon {
  background: #fee2e2;
  color: var(--danger);
}

.summary-count {
  display: block;
  font-size: 22px;
  font-weight: 700;
  margin-bottom: 2px;
}

.summary-total .summary-count {
  color: var(--gray-700);
}

.summary-valid .summary-count {
  color: var(--success);
}

.summary-broken .summary-count {
  color: var(--danger);
}

.summary-label {
  font-size: 10px;
  color: var(--gray-500);
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

/* Results List */
.results-list-container {
  background: white;
  border-radius: var(--radius);
  overflow: hidden;
  box-shadow: var(--shadow-sm);
}

.results-list-header {
  padding: 10px 14px;
  background: var(--gray-50);
  border-bottom: 1px solid var(--gray-100);
  font-size: 12px;
  font-weight: 600;
  color: var(--gray-600);
}

.results-list {
  max-height: 180px;
  overflow-y: auto;
}

.result-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 14px;
  border-bottom: 1px solid var(--gray-100);
  transition: background 0.2s;
}

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

.result-item:hover {
  background: var(--gray-50);
}

.result-icon {
  width: 24px;
  height: 24px;
  flex-shrink: 0;
  padding: 4px;
  border-radius: 50%;
}

.result-icon.valid {
  color: var(--success);
  background: #dcfce7;
}

.result-icon.broken {
  color: var(--danger);
  background: #fee2e2;
}

.result-icon.redirect {
  color: var(--warning);
  background: #fef3c7;
}

.result-url {
  flex: 1;
  font-size: 12px;
  word-break: break-all;
  color: var(--gray-600);
}

.result-status {
  font-size: 10px;
  padding: 4px 8px;
  border-radius: 12px;
  font-weight: 600;
  text-transform: uppercase;
}

.result-status.valid {
  background: #dcfce7;
  color: #166534;
}

.result-status.broken {
  background: #fee2e2;
  color: #991b1b;
}

.result-status.redirect {
  background: #fef3c7;
  color: #92400e;
}

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

.btn-primary {
  background: linear-gradient(135deg, var(--primary), var(--primary-light));
  color: white;
  box-shadow: 0 4px 12px rgba(37, 99, 235, 0.3);
}

.btn-primary:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 16px rgba(37, 99, 235, 0.4);
}

.btn-secondary {
  background: white;
  color: var(--gray-700);
  border: 1px solid var(--gray-300);
}

.btn-secondary:hover {
  background: var(--gray-50);
}

.btn-ghost {
  background: transparent;
  color: var(--gray-600);
  padding: 8px 12px;
}

.btn-ghost:hover {
  background: var(--gray-100);
}

.btn-sm {
  padding: 8px 12px;
  font-size: 12px;
}

.btn-full {
  width: 100%;
}

.btn-icon {
  width: 18px;
  height: 18px;
}

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

/* Footer */
.footer {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 8px;
  padding-top: 12px;
  border-top: 1px solid var(--gray-200);
  font-size: 11px;
  color: var(--gray-400);
}

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

.footer a:hover {
  color: var(--primary);
}

.version {
  color: var(--gray-300);
}

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

::-webkit-scrollbar-track {
  background: var(--gray-100);
}

::-webkit-scrollbar-thumb {
  background: var(--gray-300);
  border-radius: 3px;
}

::-webkit-scrollbar-thumb:hover {
  background: var(--gray-400);
}

/* Animations */
.animate-spin {
  animation: spin 1s linear infinite;
}
