/* 7SEO Monitor — Styles */

:root {
  --green: #0F6E56;
  --green-light: #e6f4f0;
  --orange: #854F0B;
  --orange-light: #fef3e2;
  --red: #791F1F;
  --red-light: #fde8e8;
  --blue: #1a56db;
  --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-900: #111827;
  --font: -apple-system, BlinkMacSystemFont, 'Inter', 'Segoe UI', sans-serif;
  --radius: 8px;
  --shadow: 0 1px 3px rgba(0,0,0,.1), 0 1px 2px rgba(0,0,0,.06);
  --shadow-md: 0 4px 6px rgba(0,0,0,.07), 0 2px 4px rgba(0,0,0,.06);
}

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

body {
  font-family: var(--font);
  font-size: 14px;
  color: var(--gray-700);
  background: var(--gray-50);
  line-height: 1.5;
}

/* --- Login --- */
.login-page {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--gray-100);
}

.login-container {
  width: 100%;
  max-width: 400px;
  padding: 16px;
}

.login-logo {
  text-align: center;
  margin-bottom: 32px;
}

.logo-text {
  font-size: 36px;
  font-weight: 800;
  color: var(--green);
  letter-spacing: -1px;
}

.logo-sub {
  font-size: 14px;
  color: var(--gray-400);
  margin-left: 4px;
  font-weight: 500;
}

.login-form {
  background: white;
  border-radius: var(--radius);
  padding: 32px;
  box-shadow: var(--shadow-md);
}

.login-form h1 {
  font-size: 20px;
  font-weight: 700;
  color: var(--gray-900);
  margin-bottom: 24px;
}

.form-hint {
  color: var(--gray-500);
  font-size: 13px;
  margin-bottom: 20px;
  margin-top: -16px;
}

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

.form-group label {
  display: block;
  font-size: 13px;
  font-weight: 500;
  color: var(--gray-600);
  margin-bottom: 6px;
}

.form-group label small {
  font-weight: 400;
  color: var(--gray-400);
}

.form-group input {
  width: 100%;
  padding: 9px 12px;
  border: 1px solid var(--gray-300);
  border-radius: var(--radius);
  font-size: 14px;
  font-family: var(--font);
  color: var(--gray-900);
  outline: none;
  transition: border-color .15s;
}

.form-group input:focus {
  border-color: var(--green);
  box-shadow: 0 0 0 3px rgba(15,110,86,.1);
}

/* --- Header --- */
.header {
  background: white;
  border-bottom: 1px solid var(--gray-200);
  position: sticky;
  top: 0;
  z-index: 100;
}

.header-inner {
  max-width: 1400px;
  margin: 0 auto;
  padding: 0 24px;
  height: 56px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.logo {
  text-decoration: none;
  display: flex;
  align-items: baseline;
  gap: 4px;
}

.logo .logo-text {
  font-size: 22px;
  font-weight: 800;
  color: var(--green);
  letter-spacing: -0.5px;
}

.logo .logo-sub {
  font-size: 12px;
  color: var(--gray-400);
}

.header-nav {
  display: flex;
  align-items: center;
  gap: 12px;
}

.header-date {
  font-size: 13px;
  color: var(--gray-400);
}

/* --- Main --- */
.main {
  max-width: 1400px;
  margin: 0 auto;
  padding: 24px;
}

/* --- Buttons --- */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 16px;
  border-radius: var(--radius);
  font-size: 14px;
  font-weight: 500;
  font-family: var(--font);
  cursor: pointer;
  border: none;
  text-decoration: none;
  transition: background .15s, opacity .15s;
}

.btn-primary {
  background: var(--green);
  color: white;
}

.btn-primary:hover { background: #0a5a45; }

.btn-ghost {
  background: transparent;
  color: var(--gray-600);
  border: 1px solid var(--gray-200);
}

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

.btn-sm { padding: 5px 10px; font-size: 13px; }
.btn-full { width: 100%; justify-content: center; }

/* --- Alerts --- */
.alert {
  padding: 12px 16px;
  border-radius: var(--radius);
  margin-bottom: 16px;
  font-size: 13px;
}

.alert-error { background: var(--red-light); color: var(--red); }
.alert-success { background: var(--green-light); color: var(--green); }
.alert-warning { background: var(--orange-light); color: var(--orange); }

.alerts-banner {
  background: var(--red-light);
  border: 1px solid #fca5a5;
  border-radius: var(--radius);
  padding: 12px 16px;
  margin-bottom: 20px;
}

.alert-item {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 8px 0;
  border-bottom: 1px solid rgba(0,0,0,.06);
}

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

.alert-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  flex-shrink: 0;
  margin-top: 4px;
}

.alert-dot--critical { background: var(--red); }
.alert-dot--warning { background: #f59e0b; }

.alert-text { flex: 1; }
.alert-domain { font-weight: 600; font-size: 13px; color: var(--gray-900); }
.alert-msg { font-size: 12px; color: var(--gray-500); }
.alert-time { font-size: 11px; color: var(--gray-400); }

/* --- KPI Grid --- */
.kpi-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 16px;
  margin-bottom: 24px;
}

.kpi-grid--small { grid-template-columns: repeat(4, 1fr); }

@media (max-width: 900px) {
  .kpi-grid, .kpi-grid--small { grid-template-columns: repeat(2, 1fr); }
}

@media (max-width: 500px) {
  .kpi-grid, .kpi-grid--small { grid-template-columns: 1fr; }
}

.kpi-card {
  background: white;
  border-radius: var(--radius);
  padding: 20px;
  box-shadow: var(--shadow);
  border: 1px solid var(--gray-200);
}

.kpi-card--alert { border-left: 3px solid var(--red); }
.kpi-card--alert.has-alerts .kpi-value { color: var(--red); }

.kpi-value {
  font-size: 32px;
  font-weight: 700;
  color: var(--gray-900);
  line-height: 1;
  margin-bottom: 6px;
}

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

.kpi-sub {
  font-size: 12px;
  color: var(--gray-400);
  margin-top: 2px;
}

/* --- Sections --- */
.section {
  background: white;
  border-radius: var(--radius);
  padding: 20px;
  box-shadow: var(--shadow);
  border: 1px solid var(--gray-200);
  margin-bottom: 20px;
}

.section-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 16px;
}

.section-header h2 {
  font-size: 16px;
  font-weight: 600;
  color: var(--gray-900);
}

.section h2 {
  font-size: 16px;
  font-weight: 600;
  color: var(--gray-900);
  margin-bottom: 16px;
}

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

/* --- Table --- */
.table-wrapper {
  overflow-x: auto;
}

.table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}

.table thead th {
  text-align: left;
  padding: 10px 12px;
  color: var(--gray-500);
  font-weight: 600;
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: .4px;
  border-bottom: 1px solid var(--gray-200);
  white-space: nowrap;
}

.table thead th[data-sort] { cursor: pointer; user-select: none; }
.table thead th[data-sort]:hover { color: var(--gray-900); }

.table tbody tr {
  border-bottom: 1px solid var(--gray-100);
  transition: background .1s;
}

.table tbody tr:last-child { border-bottom: none; }
.table tbody tr:hover { background: var(--gray-50); }

.table tbody td {
  padding: 10px 12px;
  color: var(--gray-700);
}

.table-loading {
  text-align: center;
  padding: 40px !important;
  color: var(--gray-400);
}

.table-sm td, .table-sm th { padding: 6px 10px; }

/* --- Status indicators --- */
.status-dot {
  display: inline-block;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  margin-right: 6px;
}

.status-dot--up { background: #10b981; }
.status-dot--down { background: var(--red); }
.status-dot--unknown { background: var(--gray-300); }

.status-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 10px;
  border-radius: 20px;
  font-size: 13px;
  font-weight: 600;
}

.status-up { background: #d1fae5; color: #065f46; }
.status-down { background: var(--red-light); color: var(--red); }
.status-unknown { background: var(--gray-100); color: var(--gray-500); }

/* Badges priorité/type */
.badge {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 12px;
  font-size: 11px;
  font-weight: 600;
  background: var(--gray-100);
  color: var(--gray-600);
  margin-left: 6px;
}

.badge--high { background: #fde68a; color: #92400e; }
.badge--medium { background: #bfdbfe; color: #1e40af; }
.badge--low { background: var(--gray-100); color: var(--gray-500); }

/* Score uptime coloré */
.uptime-pct { font-weight: 600; }
.uptime-pct--good { color: #059669; }
.uptime-pct--warn { color: #d97706; }
.uptime-pct--bad { color: var(--red); }

/* PageSpeed score coloré */
.ps-score {
  display: inline-block;
  width: 40px;
  height: 40px;
  border-radius: 50%;
  font-weight: 700;
  font-size: 13px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.ps-score--good { background: #d1fae5; color: #065f46; }
.ps-score--medium { background: #fef3c7; color: #92400e; }
.ps-score--bad { background: var(--red-light); color: var(--red); }

/* --- Inputs --- */
.input-search, .input-select {
  padding: 6px 10px;
  border: 1px solid var(--gray-200);
  border-radius: var(--radius);
  font-size: 13px;
  font-family: var(--font);
  color: var(--gray-700);
  outline: none;
  background: white;
}

.input-search:focus, .input-select:focus {
  border-color: var(--green);
}

/* --- Site detail --- */
.site-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  margin-bottom: 24px;
}

.site-header-info h1 {
  font-size: 24px;
  font-weight: 700;
  color: var(--gray-900);
}

.site-domain {
  font-size: 14px;
  color: var(--gray-400);
  margin-right: 8px;
}

.site-header-status { text-align: right; }

.response-time {
  font-size: 12px;
  color: var(--gray-400);
  margin-top: 4px;
}

.detail-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 20px;
}

.detail-section--wide { grid-column: 1 / -1; }

@media (max-width: 768px) {
  .detail-grid { grid-template-columns: 1fr; }
  .detail-section--wide { grid-column: 1; }
}

/* --- Chart --- */
.chart-container {
  position: relative;
  height: 220px;
}

/* --- PageSpeed --- */
.ps-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
}

.ps-label {
  font-size: 12px;
  font-weight: 600;
  color: var(--gray-500);
  text-transform: uppercase;
  letter-spacing: .5px;
  margin-bottom: 10px;
}

.ps-scores {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.ps-score-item {
  text-align: center;
}

.ps-score-item .ps-score-val {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 14px;
  margin: 0 auto 4px;
}

.ps-score-item .ps-score-name {
  font-size: 10px;
  color: var(--gray-400);
  text-align: center;
}

.score-good { background: #d1fae5; color: #065f46; }
.score-medium { background: #fef3c7; color: #92400e; }
.score-bad { background: #fee2e2; color: #991b1b; }

/* --- Audit issues --- */
.audit-meta {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  margin-bottom: 16px;
  font-size: 13px;
}

.audit-field { color: var(--gray-500); }
.audit-value { color: var(--gray-900); font-weight: 500; }

.issue-list { list-style: none; }

.issue-item {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  padding: 7px 0;
  border-bottom: 1px solid var(--gray-100);
  font-size: 13px;
}

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

.issue-badge {
  flex-shrink: 0;
  padding: 1px 6px;
  border-radius: 10px;
  font-size: 11px;
  font-weight: 600;
}

.issue-critical { background: #fee2e2; color: #991b1b; }
.issue-warning { background: #fef3c7; color: #92400e; }
.issue-info { background: #dbeafe; color: #1e40af; }

/* --- Uptime bars --- */
.uptime-bars {
  display: flex;
  gap: 3px;
  align-items: flex-end;
  height: 32px;
  margin-bottom: 8px;
}

.uptime-bar {
  flex: 1;
  border-radius: 2px;
  min-height: 4px;
  cursor: pointer;
  transition: opacity .15s;
}

.uptime-bar:hover { opacity: .8; }
.uptime-bar--up { background: #10b981; height: 32px; }
.uptime-bar--down { background: var(--red); height: 32px; }
.uptime-bar--partial { background: #f59e0b; height: 32px; }

.uptime-legend {
  display: flex;
  gap: 16px;
  font-size: 12px;
  color: var(--gray-500);
}

.uptime-up::before { content: ''; display: inline-block; width: 8px; height: 8px; background: #10b981; border-radius: 2px; margin-right: 4px; }
.uptime-down::before { content: ''; display: inline-block; width: 8px; height: 8px; background: var(--red); border-radius: 2px; margin-right: 4px; }

/* --- No data --- */
.no-data-msg {
  color: var(--gray-400);
  font-size: 13px;
  text-align: center;
  padding: 20px 0;
}

/* --- Domain link in table --- */
.domain-link {
  text-decoration: none;
  color: var(--gray-900);
  font-weight: 600;
}

.domain-link:hover { color: var(--green); }

.domain-name-sub {
  font-size: 12px;
  color: var(--gray-400);
  font-weight: 400;
}

/* --- Alert count badge --- */
.alert-count {
  display: inline-block;
  background: var(--red);
  color: white;
  border-radius: 10px;
  padding: 1px 6px;
  font-size: 11px;
  font-weight: 700;
}

.alert-count--zero {
  background: var(--gray-200);
  color: var(--gray-400);
}

/* --- Recommandations SEO --- */

/* Score SEO cercle */
.seo-score-circle {
  width: 56px;
  height: 56px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 20px;
  font-weight: 800;
  flex-shrink: 0;
}

.seo-score-circle--large {
  width: 72px;
  height: 72px;
  font-size: 26px;
}

/* Section résumé sur site-detail */
.reco-summary-section {
  margin-bottom: 20px;
}

.reco-header-left {
  display: flex;
  align-items: center;
  gap: 16px;
}

.reco-counts {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  margin-top: 4px;
}

.reco-counts--large { margin-top: 8px; }

.reco-count {
  font-size: 12px;
  font-weight: 600;
  padding: 2px 8px;
  border-radius: 10px;
}

.reco-count--total { background: var(--gray-100); color: var(--gray-600); }
.reco-count--critical { background: #fee2e2; color: #991b1b; }
.reco-count--high { background: #ffedd5; color: #9a3412; }
.reco-count--medium { background: #fef3c7; color: #92400e; }
.reco-count--low { background: #dbeafe; color: #1e40af; }

/* Liste résumée (top 5) */
.reco-list {
  margin-top: 16px;
}

.reco-item {
  display: flex;
  flex-direction: column;
  gap: 4px;
  padding: 10px 0;
  border-bottom: 1px solid var(--gray-100);
}

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

.reco-item-header {
  display: flex;
  gap: 6px;
  align-items: center;
}

.reco-item-title {
  font-size: 14px;
  font-weight: 600;
  color: var(--gray-900);
}

.reco-item-action {
  font-size: 12px;
  color: var(--gray-500);
}

/* Badges priorité */
.reco-priority-badge {
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  padding: 2px 6px;
  border-radius: 4px;
  letter-spacing: .3px;
}

.reco-priority--critical { background: #fee2e2; color: #991b1b; }
.reco-priority--high { background: #ffedd5; color: #9a3412; }
.reco-priority--medium { background: #fef3c7; color: #92400e; }
.reco-priority--low { background: #dbeafe; color: #1e40af; }

/* Badges catégorie */
.reco-category-badge {
  font-size: 10px;
  font-weight: 600;
  padding: 2px 6px;
  border-radius: 4px;
  background: var(--gray-100);
  color: var(--gray-500);
  text-transform: uppercase;
  letter-spacing: .3px;
}

.reco-cat--gsc { background: #ede9fe; color: #5b21b6; }
.reco-cat--technique { background: #dbeafe; color: #1e40af; }
.reco-cat--performance { background: #fce7f3; color: #9d174d; }
.reco-cat--tendance { background: #d1fae5; color: #065f46; }

/* --- Page recommandations dédiée --- */

.reco-page-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 24px;
}

.reco-page-header-left {
  display: flex;
  align-items: center;
  gap: 20px;
}

.reco-page-header-left h1 {
  font-size: 24px;
  font-weight: 700;
  color: var(--gray-900);
}

/* Filtres */
.reco-filters {
  display: flex;
  gap: 24px;
  flex-wrap: wrap;
  margin-bottom: 20px;
  padding: 12px 16px;
  background: white;
  border-radius: var(--radius);
  border: 1px solid var(--gray-200);
}

.reco-filter-group {
  display: flex;
  align-items: center;
  gap: 6px;
}

.reco-filter-group label {
  font-size: 12px;
  color: var(--gray-500);
  font-weight: 600;
  margin-right: 4px;
}

.reco-filter-btn {
  font-size: 12px;
  padding: 4px 10px;
  border-radius: 20px;
  border: 1px solid var(--gray-200);
  background: white;
  color: var(--gray-600);
  cursor: pointer;
  font-family: var(--font);
  font-weight: 500;
  transition: all .15s;
}

.reco-filter-btn:hover {
  border-color: var(--green);
  color: var(--green);
}

.reco-filter-btn.active {
  background: var(--green);
  color: white;
  border-color: var(--green);
}

/* Cartes recommandations (page dédiée) */
.reco-full-list {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.reco-card {
  background: white;
  border-radius: var(--radius);
  padding: 16px 20px;
  border: 1px solid var(--gray-200);
  border-left: 4px solid var(--gray-300);
  box-shadow: var(--shadow);
}

.reco-card--critical { border-left-color: #ef4444; }
.reco-card--high { border-left-color: #f97316; }
.reco-card--medium { border-left-color: #eab308; }
.reco-card--low { border-left-color: #3b82f6; }

.reco-card-header {
  display: flex;
  gap: 6px;
  margin-bottom: 8px;
}

.reco-card-title {
  font-size: 15px;
  font-weight: 600;
  color: var(--gray-900);
  margin-bottom: 6px;
}

.reco-card-desc {
  font-size: 13px;
  color: var(--gray-600);
  line-height: 1.5;
  margin-bottom: 10px;
}

.reco-metrics {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  padding: 10px 12px;
  background: var(--gray-50);
  border-radius: 6px;
  margin-bottom: 10px;
}

.reco-metric-item {
  font-size: 12px;
  color: var(--gray-500);
}

.reco-metric-item strong {
  color: var(--gray-900);
}

.reco-metric-page {
  width: 100%;
  font-size: 11px;
  color: var(--gray-400);
  word-break: break-all;
}

.reco-card-action {
  font-size: 13px;
  color: var(--green);
  background: var(--green-light);
  padding: 10px 12px;
  border-radius: 6px;
  line-height: 1.5;
}

.reco-card-action strong {
  color: #065f46;
}

/* Bouton Claude Code */
.reco-card-footer {
  margin-top: 12px;
  padding-top: 10px;
  border-top: 1px solid var(--gray-100);
}

.btn-claude {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 12px;
  border-radius: 6px;
  border: 1px solid #d4a574;
  background: #fdf6ee;
  color: #8b5e34;
  font-size: 12px;
  font-weight: 600;
  font-family: var(--font);
  cursor: pointer;
  transition: all .15s;
}

.btn-claude:hover {
  background: #f9e8d4;
  border-color: #b8834a;
}

.btn-claude--copied {
  background: #d1fae5;
  border-color: #10b981;
  color: #065f46;
}

@media (max-width: 768px) {
  .reco-filters { flex-direction: column; gap: 12px; }
  .reco-page-header-left { flex-direction: column; align-items: flex-start; }
}
