/* FixLinks AI — Admin Styles */
:root {
  --fl-primary: #4F46E5;
  --fl-primary-dk: #3730A3;
  --fl-primary-lt: #EEF2FF;
  --fl-success: #059669;
  --fl-success-lt: #D1FAE5;
  --fl-danger: #DC2626;
  --fl-danger-lt: #FEE2E2;
  --fl-warning: #D97706;
  --fl-warning-lt: #FEF3C7;
  --fl-info: #2563EB;
  --fl-info-lt: #DBEAFE;
  --fl-text: #111827;
  --fl-muted: #6B7280;
  --fl-border: #E5E7EB;
  --fl-bg: #F9FAFB;
  --fl-white: #ffffff;
  --fl-radius: 8px;
  --fl-radius-sm: 5px;
  --fl-shadow: 0 1px 3px rgba(0,0,0,.08), 0 1px 2px rgba(0,0,0,.04);
  --fl-shadow-md: 0 4px 12px rgba(0,0,0,.08), 0 2px 4px rgba(0,0,0,.04);
}

/* ── Wrapper ─────────────────────────────────────────────────────────────── */
.fixlinks-wrap { max-width: 1280px; font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif; }
.fixlinks-wrap * { box-sizing: border-box; }

/* ── Header ──────────────────────────────────────────────────────────────── */
.fixlinks-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 12px;
  padding: 20px 0 16px;
  border-bottom: 1px solid var(--fl-border);
  margin-bottom: 24px;
}
.fixlinks-header-title {
  display: flex;
  align-items: center;
  gap: 12px;
}
.fixlinks-logo-icon { font-size: 28px; line-height: 1; }
.fixlinks-header-title h1 {
  font-size: 22px !important;
  font-weight: 700 !important;
  margin: 0 !important;
  padding: 0 !important;
  line-height: 1.2 !important;
  color: var(--fl-text) !important;
}
.fixlinks-version {
  font-size: 11px;
  color: var(--fl-muted);
  background: var(--fl-bg);
  border: 1px solid var(--fl-border);
  border-radius: 20px;
  padding: 1px 8px;
  display: inline-block;
  margin-top: 2px;
}
.fixlinks-header-actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  align-items: center;
}

/* ── Buttons ─────────────────────────────────────────────────────────────── */
.fixlinks-btn {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 7px 14px;
  border-radius: var(--fl-radius-sm);
  font-size: 13px;
  font-weight: 600;
  line-height: 1.4;
  cursor: pointer;
  border: 1px solid transparent;
  text-decoration: none !important;
  transition: all .15s ease;
  white-space: nowrap;
}
.fixlinks-btn:focus { outline: 2px solid var(--fl-primary); outline-offset: 2px; }
.fixlinks-btn-icon { font-size: 13px; line-height: 1; }

.fixlinks-btn-primary {
  background: var(--fl-primary);
  color: #fff !important;
  border-color: var(--fl-primary);
}
.fixlinks-btn-primary:hover { background: var(--fl-primary-dk); border-color: var(--fl-primary-dk); color: #fff !important; }

.fixlinks-btn-secondary {
  background: var(--fl-white);
  color: var(--fl-text) !important;
  border-color: var(--fl-border);
  box-shadow: var(--fl-shadow);
}
.fixlinks-btn-secondary:hover { background: var(--fl-bg); border-color: #C4C4C4; color: var(--fl-text) !important; }

.fixlinks-btn-outline {
  background: transparent;
  color: var(--fl-primary) !important;
  border-color: var(--fl-primary);
}
.fixlinks-btn-outline:hover { background: var(--fl-primary-lt); color: var(--fl-primary) !important; }

.fixlinks-btn-ghost {
  background: transparent;
  color: var(--fl-muted) !important;
  border-color: var(--fl-border);
  font-size: 12px;
  padding: 4px 10px;
}
.fixlinks-btn-ghost:hover { background: var(--fl-bg); color: var(--fl-danger) !important; border-color: var(--fl-danger); }

.fixlinks-btn-ai {
  background: linear-gradient(135deg, #7C3AED, #4F46E5);
  color: #fff !important;
  border-color: transparent;
  font-size: 12px;
  padding: 5px 10px;
}
.fixlinks-btn-ai:hover { background: linear-gradient(135deg, #6D28D9, #3730A3); color: #fff !important; }

.fixlinks-btn:disabled,
.fixlinks-btn[disabled] { opacity: .65; cursor: not-allowed; }

/* ── Stats Grid ──────────────────────────────────────────────────────────── */
.fixlinks-stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  gap: 16px;
  margin-bottom: 20px;
}
.fixlinks-stat-card {
  background: var(--fl-white);
  border: 1px solid var(--fl-border);
  border-radius: var(--fl-radius);
  padding: 16px 20px;
  display: flex;
  align-items: center;
  gap: 14px;
  box-shadow: var(--fl-shadow);
  transition: box-shadow .15s;
}
.fixlinks-stat-card:hover { box-shadow: var(--fl-shadow-md); }
.fixlinks-stat-icon { font-size: 28px; line-height: 1; flex-shrink: 0; }
.fixlinks-stat-value { font-size: 30px; font-weight: 800; line-height: 1; }
.fixlinks-stat-label { font-size: 11px; text-transform: uppercase; letter-spacing: .5px; color: var(--fl-muted); margin-top: 3px; font-weight: 500; }

.fixlinks-stat-card-danger { border-left: 3px solid var(--fl-danger); }
.fixlinks-stat-card-danger .fixlinks-stat-value { color: var(--fl-danger); }
.fixlinks-stat-card-success { border-left: 3px solid var(--fl-success); }
.fixlinks-stat-card-success .fixlinks-stat-value { color: var(--fl-success); }
.fixlinks-stat-card-info { border-left: 3px solid var(--fl-info); }
.fixlinks-stat-card-info .fixlinks-stat-value { color: var(--fl-info); }

/* ── Meta / Helpers ──────────────────────────────────────────────────────── */
.fixlinks-last-crawl { font-size: 12px; color: var(--fl-muted); margin: 0 0 16px; }

/* ── Progress Bar ────────────────────────────────────────────────────────── */
.fixlinks-progress-wrap {
  background: var(--fl-white);
  border: 1px solid var(--fl-border);
  border-radius: var(--fl-radius);
  padding: 16px 20px;
  margin-bottom: 20px;
  box-shadow: var(--fl-shadow);
}
.fixlinks-progress-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 10px; font-size: 13px; }
.fixlinks-progress-text { color: var(--fl-muted); font-size: 12px; }
.fixlinks-progress-track { background: var(--fl-border); border-radius: 99px; height: 8px; overflow: hidden; }
.fixlinks-progress-bar { background: linear-gradient(90deg, var(--fl-primary), #7C3AED); height: 8px; border-radius: 99px; transition: width .4s ease; }
.fixlinks-progress-pct { font-size: 11px; color: var(--fl-muted); margin-top: 6px; text-align: right; }

/* ── Notices ─────────────────────────────────────────────────────────────── */
.fixlinks-notice {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 12px 16px;
  border-radius: var(--fl-radius);
  margin-bottom: 20px;
  font-size: 13px;
  border: 1px solid;
}
.fixlinks-notice-warning { background: var(--fl-warning-lt); border-color: #FCD34D; color: #78350F; }
.fixlinks-notice-warning a { color: #92400E; font-weight: 600; }
.fixlinks-notice-icon { font-size: 16px; flex-shrink: 0; margin-top: 1px; }

/* ── Section Header ──────────────────────────────────────────────────────── */
.fixlinks-section-header {
  display: flex;
  align-items: center;
  gap: 10px;
  margin: 0 0 12px;
}
.fixlinks-section-header h2 {
  font-size: 16px !important;
  font-weight: 700 !important;
  margin: 0 !important;
  padding: 0 !important;
  color: var(--fl-text) !important;
}
.fixlinks-section-desc { font-size: 12px; color: var(--fl-muted); margin: -8px 0 12px; }

/* ── Badges ──────────────────────────────────────────────────────────────── */
.fixlinks-badge {
  display: inline-block;
  font-size: 11px;
  font-weight: 700;
  padding: 2px 8px;
  border-radius: 20px;
  text-transform: lowercase;
}
.fixlinks-badge-danger { background: var(--fl-danger-lt); color: var(--fl-danger); }
.fixlinks-badge-info   { background: var(--fl-info-lt); color: var(--fl-info); }
.fixlinks-badge-success{ background: var(--fl-success-lt); color: var(--fl-success); }

/* ── Table ───────────────────────────────────────────────────────────────── */
.fixlinks-table-wrap {
  border: 1px solid var(--fl-border);
  border-radius: var(--fl-radius);
  overflow: hidden;
  box-shadow: var(--fl-shadow);
  margin-bottom: 24px;
}
.fixlinks-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
  background: var(--fl-white);
}
.fixlinks-table thead th {
  background: var(--fl-bg);
  padding: 10px 14px;
  text-align: left;
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .4px;
  color: var(--fl-muted);
  border-bottom: 1px solid var(--fl-border);
}
.fixlinks-table tbody td {
  padding: 12px 14px;
  border-bottom: 1px solid var(--fl-border);
  vertical-align: middle;
  color: var(--fl-text);
}
.fixlinks-table tbody tr:last-child td { border-bottom: none; }
.fixlinks-table tbody tr:hover td { background: #FAFAFA; }
.fixlinks-row-applied td { background: #F0FDF4 !important; }
.fixlinks-col-narrow { width: 80px; }
.fixlinks-col-action { width: 130px; }

/* ── Table Cell Content ──────────────────────────────────────────────────── */
.fixlinks-cell-url { max-width: 260px; }
.fixlinks-broken-url {
  display: block;
  font-size: 12px;
  font-family: 'SFMono-Regular', Consolas, monospace;
  color: var(--fl-danger) !important;
  word-break: break-all;
  text-decoration: none !important;
}
.fixlinks-broken-url:hover { text-decoration: underline !important; }
.fixlinks-anchor-text { display: block; font-size: 11px; color: var(--fl-muted); margin-top: 2px; font-style: italic; }
.fixlinks-source-link { font-size: 12px; color: var(--fl-primary) !important; text-decoration: none !important; }
.fixlinks-source-link:hover { text-decoration: underline !important; }
.fixlinks-to-url { font-size: 12px; color: var(--fl-primary) !important; text-decoration: none !important; word-break: break-all; }
.fixlinks-to-url:hover { text-decoration: underline !important; }
.fixlinks-code { font-size: 11px; background: var(--fl-bg); padding: 2px 6px; border-radius: 4px; font-family: monospace; border: 1px solid var(--fl-border); word-break: break-all; }

/* ── Status Badges ───────────────────────────────────────────────────────── */
.fixlinks-status-badge {
  display: inline-block;
  padding: 3px 8px;
  border-radius: 20px;
  font-size: 11px;
  font-weight: 700;
}
.fixlinks-status-badge.error-404 { background: var(--fl-danger-lt); color: var(--fl-danger); }
.fixlinks-status-badge.error-5xx { background: var(--fl-warning-lt); color: var(--fl-warning); }
.fixlinks-status-badge.error-0   { background: #F1F5F9; color: #64748B; }

/* ── Confidence Badges ───────────────────────────────────────────────────── */
.fixlinks-confidence {
  display: inline-block;
  font-size: 10px;
  font-weight: 700;
  padding: 2px 7px;
  border-radius: 4px;
  text-transform: uppercase;
  letter-spacing: .3px;
  margin-top: 4px;
}
.fixlinks-confidence.high   { color: #065F46; background: var(--fl-success-lt); }
.fixlinks-confidence.medium { color: #92400E; background: var(--fl-warning-lt); }
.fixlinks-confidence.low    { color: #7F1D1D; background: var(--fl-danger-lt); }

/* ── Suggestion Input ────────────────────────────────────────────────────── */
.fixlinks-suggestion-wrap { display: flex; flex-direction: column; gap: 4px; }
.fixlinks-redirect-input {
  width: 100%;
  font-size: 12px;
  padding: 5px 8px;
  border: 1px solid var(--fl-border);
  border-radius: var(--fl-radius-sm);
  background: var(--fl-white);
  color: var(--fl-text);
  font-family: monospace;
}
.fixlinks-redirect-input:focus { outline: none; border-color: var(--fl-primary); box-shadow: 0 0 0 2px var(--fl-primary-lt); }

/* ── Action Column ───────────────────────────────────────────────────────── */
.fixlinks-action-wrap { display: flex; flex-direction: column; gap: 5px; align-items: flex-start; }
.fixlinks-applied-badge { font-size: 12px; font-weight: 700; color: var(--fl-success); }
.fixlinks-upgrade-hint { font-size: 12px; color: #C4B5FD; font-style: italic; }
.fixlinks-no-action { color: #D1D5DB; font-size: 13px; }
.fixlinks-hit-badge {
  display: inline-block;
  background: var(--fl-info-lt);
  color: var(--fl-info);
  font-size: 11px;
  font-weight: 700;
  padding: 2px 8px;
  border-radius: 20px;
}
.fixlinks-date { font-size: 11px; color: var(--fl-muted); }

/* ── Empty State ─────────────────────────────────────────────────────────── */
.fixlinks-empty-state {
  text-align: center;
  padding: 48px 24px;
  background: var(--fl-white);
  border: 1px solid var(--fl-border);
  border-radius: var(--fl-radius);
  box-shadow: var(--fl-shadow);
  margin-bottom: 24px;
}
.fixlinks-empty-icon { font-size: 48px; margin-bottom: 12px; }
.fixlinks-empty-state h3 { font-size: 18px; font-weight: 700; color: var(--fl-text); margin: 0 0 8px; }
.fixlinks-empty-state p  { font-size: 13px; color: var(--fl-muted); margin: 0; }

/* ── Upgrade Banner ──────────────────────────────────────────────────────── */
.fixlinks-upgrade-banner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 16px 20px;
  background: linear-gradient(135deg, #EEF2FF, #F5F3FF);
  border: 1px solid #C7D2FE;
  border-radius: var(--fl-radius);
  margin-bottom: 24px;
  font-size: 13px;
  flex-wrap: wrap;
}

/* ── Spinner ─────────────────────────────────────────────────────────────── */
.fixlinks-spinner {
  display: inline-block;
  width: 12px;
  height: 12px;
  border: 2px solid rgba(255,255,255,.4);
  border-top-color: currentColor;
  border-radius: 50%;
  animation: fl-spin .6s linear infinite;
  vertical-align: middle;
  margin-right: 4px;
}
.fixlinks-btn-secondary .fixlinks-spinner,
.fixlinks-btn-outline .fixlinks-spinner,
.fixlinks-btn-ghost .fixlinks-spinner {
  border-color: rgba(0,0,0,.15);
  border-top-color: var(--fl-primary);
}
@keyframes fl-spin { to { transform: rotate(360deg); } }

/* ── Settings Page ───────────────────────────────────────────────────────── */
.fixlinks-settings-wrap { max-width: 680px; }
.fixlinks-settings-card {
  background: var(--fl-white);
  border: 1px solid var(--fl-border);
  border-radius: var(--fl-radius);
  padding: 24px 28px;
  box-shadow: var(--fl-shadow);
  margin-bottom: 20px;
}
.fixlinks-settings-card h2 { font-size: 15px; font-weight: 700; margin: 0 0 20px; padding-bottom: 12px; border-bottom: 1px solid var(--fl-border); }
.fixlinks-field { margin-bottom: 18px; }
.fixlinks-field label { display: block; font-size: 13px; font-weight: 600; color: var(--fl-text); margin-bottom: 6px; }
.fixlinks-field input[type="text"],
.fixlinks-field select {
  width: 100%;
  max-width: 420px;
  padding: 8px 12px;
  border: 1px solid var(--fl-border);
  border-radius: var(--fl-radius-sm);
  font-size: 13px;
  color: var(--fl-text);
  background: var(--fl-white);
  transition: border-color .15s;
}
.fixlinks-field input[type="text"]:focus,
.fixlinks-field select:focus { outline: none; border-color: var(--fl-primary); box-shadow: 0 0 0 2px var(--fl-primary-lt); }
.fixlinks-field .fixlinks-field-hint { font-size: 12px; color: var(--fl-muted); margin-top: 5px; }
.fixlinks-plan-badge {
  display: inline-block;
  padding: 3px 12px;
  border-radius: 20px;
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .4px;
}
.fixlinks-plan-badge.free   { background: #F1F5F9; color: #64748B; }
.fixlinks-plan-badge.pro    { background: var(--fl-info-lt); color: var(--fl-info); }
.fixlinks-plan-badge.agency { background: #EDE9FE; color: #6D28D9; }
.fixlinks-license-active { font-size: 13px; font-weight: 600; color: var(--fl-success); margin-top: 12px; }

/* ── Responsive ──────────────────────────────────────────────────────────── */
@media (max-width: 782px) {
  .fixlinks-header { flex-direction: column; align-items: flex-start; }
  .fixlinks-stats-grid { grid-template-columns: repeat(2, 1fr); }
  .fixlinks-table thead { display: none; }
  .fixlinks-table tbody td { display: block; padding: 6px 12px; border-bottom: none; }
  .fixlinks-table tbody td::before { content: attr(data-label); font-weight: 700; font-size: 10px; text-transform: uppercase; color: var(--fl-muted); display: block; margin-bottom: 2px; }
  .fixlinks-table tbody tr { border-bottom: 1px solid var(--fl-border); display: block; padding: 8px 0; }
  .fixlinks-col-narrow, .fixlinks-col-action { width: auto; }
  .fixlinks-upgrade-banner { flex-direction: column; align-items: flex-start; }
}