/* ============================================================
   xooa.net — Main Stylesheet
   3-column layout: 15% | 70% | 15%
   ============================================================ */

/* --- Reset & Base ----------------------------------------- */
*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

:root {
  --brand-primary:   #1a73e8;
  --brand-dark:      #0d47a1;
  --brand-light:     #e8f0fe;
  --accent:          #34a853;
  --warn:            #fbbc04;
  --danger:          #ea4335;
  --bg-page:         #f4f6f9;
  --bg-card:         #ffffff;
  --bg-sidebar:      #f0f2f5;
  --text-primary:    #202124;
  --text-secondary:  #5f6368;
  --text-muted:      #9aa0a6;
  --border:          #dadce0;
  --radius:          10px;
  --shadow:          0 2px 10px rgba(0,0,0,0.08);
  --shadow-hover:    0 6px 20px rgba(0,0,0,0.14);
  --font:            'Segoe UI', system-ui, -apple-system, sans-serif;
  --sidebar-w:       15%;
  --content-w:       70%;
}

html { scroll-behavior: smooth; }

body {
  font-family: var(--font);
  background: var(--bg-page);
  color: var(--text-primary);
  font-size: 15px;
  line-height: 1.6;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

a { color: var(--brand-primary); text-decoration: none; }
a:hover { text-decoration: underline; }

/* --- Header ----------------------------------------------- */
.site-header {
  background: linear-gradient(135deg, var(--brand-dark) 0%, var(--brand-primary) 100%);
  color: #fff;
  padding: 0 20px;
  box-shadow: 0 2px 8px rgba(0,0,0,0.2);
  position: sticky;
  top: 0;
  z-index: 100;
}

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

.site-logo {
  font-size: 1.6rem;
  font-weight: 800;
  letter-spacing: -0.5px;
  color: #fff;
  text-decoration: none;
}

.site-logo span {
  color: var(--warn);
}

.site-nav {
  display: flex;
  gap: 6px;
  align-items: center;
}

.site-nav a {
  color: rgba(255,255,255,0.88);
  font-size: 0.88rem;
  font-weight: 500;
  padding: 6px 14px;
  border-radius: 20px;
  transition: background 0.2s, color 0.2s;
  text-decoration: none;
}

.site-nav a:hover,
.site-nav a.active {
  background: rgba(255,255,255,0.18);
  color: #fff;
}

/* --- 3-Column Wrapper ------------------------------------- */
.page-wrapper {
  flex: 1;
  display: flex;
  max-width: 1400px;
  margin: 0 auto;
  width: 100%;
  padding: 24px 12px;
  gap: 16px;
  align-items: flex-start;
}

/* Sidebars */
.sidebar {
  width: var(--sidebar-w);
  flex-shrink: 0;
  display: flex;
  flex-direction: column;
  gap: 16px;
  position: sticky;
  top: 76px;
}

.ad-slot {
  background: var(--bg-sidebar);
  border: 1px dashed var(--border);
  border-radius: var(--radius);
  min-height: 250px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  color: var(--text-muted);
  font-size: 0.78rem;
  text-align: center;
  padding: 12px;
  gap: 6px;
}

.ad-slot .ad-label {
  font-size: 0.7rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-muted);
  margin-bottom: 4px;
}

.ad-slot-tall {
  min-height: 600px;
}

/* Main content column */
.main-content {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 20px;
}

/* --- Cards ------------------------------------------------ */
.card {
  background: var(--bg-card);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 28px 32px;
  border: 1px solid var(--border);
}

.card-title {
  font-size: 1.1rem;
  font-weight: 700;
  color: var(--text-primary);
  margin-bottom: 16px;
  display: flex;
  align-items: center;
  gap: 8px;
}

.card-title .icon {
  font-size: 1.2rem;
}

/* --- Hero Card -------------------------------------------- */
.hero-card {
  background: linear-gradient(135deg, var(--brand-dark) 0%, var(--brand-primary) 100%);
  color: #fff;
  text-align: center;
  padding: 40px 32px 36px;
}

.hero-card h1 {
  font-size: 1.9rem;
  font-weight: 800;
  margin-bottom: 8px;
  line-height: 1.2;
}

.hero-card p {
  font-size: 1rem;
  color: rgba(255,255,255,0.85);
  margin-bottom: 28px;
  max-width: 520px;
  margin-left: auto;
  margin-right: auto;
}

/* --- URL Input Form --------------------------------------- */
.url-form {
  display: flex;
  gap: 10px;
  max-width: 620px;
  margin: 0 auto;
}

.url-input {
  flex: 1;
  padding: 13px 18px;
  border-radius: 30px;
  border: none;
  font-size: 0.95rem;
  outline: none;
  box-shadow: 0 2px 8px rgba(0,0,0,0.15);
  color: var(--text-primary);
}

.url-input:focus {
  box-shadow: 0 0 0 3px rgba(255,255,255,0.4);
}

.btn-analyze {
  padding: 13px 28px;
  border-radius: 30px;
  border: none;
  background: var(--warn);
  color: #202124;
  font-size: 0.95rem;
  font-weight: 700;
  cursor: pointer;
  transition: background 0.2s, transform 0.1s;
  white-space: nowrap;
}

.btn-analyze:hover { background: #f9a825; }
.btn-analyze:active { transform: scale(0.97); }
.btn-analyze:disabled { opacity: 0.6; cursor: not-allowed; }

.url-hint {
  font-size: 0.78rem;
  color: rgba(255,255,255,0.65);
  margin-top: 10px;
  text-align: center;
}

/* --- API Key Config Banner -------------------------------- */
.config-banner {
  background: #fff8e1;
  border: 1px solid #ffe082;
  border-radius: var(--radius);
  padding: 14px 20px;
  font-size: 0.85rem;
  color: #5d4037;
  display: flex;
  align-items: flex-start;
  gap: 10px;
}

.config-banner .icon { font-size: 1.1rem; flex-shrink: 0; margin-top: 1px; }

.config-banner a { color: var(--brand-primary); font-weight: 600; }

/* --- Results Section -------------------------------------- */
#results-section { display: none; }

.results-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
}

.results-grid .card-full {
  grid-column: 1 / -1;
}

/* --- Progress / Loading ----------------------------------- */
.loader-wrap {
  text-align: center;
  padding: 40px 20px;
}

.spinner {
  width: 44px;
  height: 44px;
  border: 4px solid var(--border);
  border-top-color: var(--brand-primary);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
  margin: 0 auto 16px;
}

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

.loader-wrap p {
  color: var(--text-secondary);
  font-size: 0.9rem;
}

/* --- Site Overview ---------------------------------------- */
.site-overview {
  display: flex;
  gap: 16px;
  flex-wrap: wrap;
}

.overview-item {
  flex: 1;
  min-width: 120px;
  background: var(--bg-page);
  border-radius: 8px;
  padding: 14px 16px;
  text-align: center;
}

.overview-item .ov-value {
  font-size: 1.4rem;
  font-weight: 800;
  color: var(--brand-primary);
  line-height: 1.1;
}

.overview-item .ov-label {
  font-size: 0.75rem;
  color: var(--text-secondary);
  margin-top: 4px;
}

/* --- Keywords -------------------------------------------- */
.keywords-wrap {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 4px;
}

.kw-tag {
  background: var(--brand-light);
  color: var(--brand-dark);
  border-radius: 20px;
  padding: 4px 14px;
  font-size: 0.82rem;
  font-weight: 600;
  cursor: default;
  transition: background 0.15s;
}

.kw-tag:hover { background: #c5d8fb; }

.kw-tag .kw-count {
  font-size: 0.72rem;
  color: var(--brand-primary);
  margin-left: 4px;
  opacity: 0.8;
}

/* --- Rankings Table --------------------------------------- */
.rankings-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.88rem;
}

.rankings-table th {
  background: var(--bg-page);
  color: var(--text-secondary);
  font-weight: 600;
  font-size: 0.78rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  padding: 10px 12px;
  text-align: left;
  border-bottom: 2px solid var(--border);
}

.rankings-table td {
  padding: 10px 12px;
  border-bottom: 1px solid var(--border);
  vertical-align: middle;
}

.rankings-table tr:last-child td { border-bottom: none; }
.rankings-table tr:hover td { background: var(--bg-page); }

.rank-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  font-weight: 800;
  font-size: 0.85rem;
}

.rank-1  { background: #ffd700; color: #5d4037; }
.rank-2  { background: #e0e0e0; color: #424242; }
.rank-3  { background: #cd7f32; color: #fff; }
.rank-top10 { background: var(--brand-light); color: var(--brand-dark); }
.rank-other { background: #f5f5f5; color: var(--text-secondary); }
.rank-na    { background: #fce4ec; color: #c62828; font-size: 0.7rem; }

.engine-logo {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-weight: 600;
}

.engine-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  flex-shrink: 0;
}

.dot-google { background: #4285f4; }
.dot-brave  { background: #fb542b; }
.dot-ddg    { background: #de5833; }

/* --- Traffic Chart ---------------------------------------- */
.traffic-info {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  gap: 12px;
  margin-bottom: 20px;
}

.traffic-stat {
  background: var(--bg-page);
  border-radius: 8px;
  padding: 14px;
  text-align: center;
}

.traffic-stat .ts-val {
  font-size: 1.3rem;
  font-weight: 800;
  color: var(--accent);
}

.traffic-stat .ts-label {
  font-size: 0.75rem;
  color: var(--text-secondary);
  margin-top: 3px;
}

#traffic-chart-canvas {
  width: 100% !important;
  max-height: 220px;
}

/* --- SEO Meta Info ---------------------------------------- */
.meta-table { width: 100%; border-collapse: collapse; font-size: 0.87rem; }
.meta-table td { padding: 8px 10px; border-bottom: 1px solid var(--border); vertical-align: top; }
.meta-table tr:last-child td { border-bottom: none; }
.meta-table td:first-child { font-weight: 600; color: var(--text-secondary); width: 130px; white-space: nowrap; }
.meta-table td:last-child { color: var(--text-primary); word-break: break-word; }

/* --- Status Pills ----------------------------------------- */
.pill {
  display: inline-block;
  padding: 2px 10px;
  border-radius: 12px;
  font-size: 0.75rem;
  font-weight: 600;
}
.pill-green  { background: #e6f4ea; color: #1e7e34; }
.pill-yellow { background: #fff8e1; color: #856404; }
.pill-red    { background: #fce8e6; color: #c62828; }
.pill-blue   { background: var(--brand-light); color: var(--brand-dark); }

/* --- Error / Notice --------------------------------------- */
.notice {
  padding: 14px 18px;
  border-radius: 8px;
  font-size: 0.88rem;
  display: flex;
  gap: 10px;
  align-items: flex-start;
}
.notice-warn { background: #fff8e1; border: 1px solid #ffe082; color: #5d4037; }
.notice-error { background: #fce8e6; border: 1px solid #f5c6cb; color: #721c24; }
.notice-info  { background: var(--brand-light); border: 1px solid #b3cef6; color: #1a3a6b; }

/* --- Footer ----------------------------------------------- */
.site-footer {
  background: #1c2331;
  color: rgba(255,255,255,0.7);
  text-align: center;
  padding: 20px;
  font-size: 0.82rem;
  margin-top: auto;
}

.site-footer a { color: rgba(255,255,255,0.85); }
.site-footer a:hover { color: #fff; }

.footer-links {
  display: flex;
  justify-content: center;
  gap: 20px;
  margin-bottom: 8px;
  flex-wrap: wrap;
}

/* --- Privacy / Contact pages ------------------------------ */
.prose h2 { font-size: 1.2rem; margin: 24px 0 10px; color: var(--brand-dark); }
.prose h3 { font-size: 1rem; margin: 18px 0 8px; color: var(--text-primary); }
.prose p  { margin-bottom: 12px; color: var(--text-secondary); line-height: 1.7; }
.prose ul { padding-left: 20px; margin-bottom: 12px; color: var(--text-secondary); }
.prose ul li { margin-bottom: 6px; }

/* --- Contact Form ----------------------------------------- */
.contact-form { display: flex; flex-direction: column; gap: 16px; }
.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.form-group { display: flex; flex-direction: column; gap: 6px; }
.form-group label { font-size: 0.85rem; font-weight: 600; color: var(--text-secondary); }
.form-group input,
.form-group textarea,
.form-group select {
  padding: 10px 14px;
  border: 1px solid var(--border);
  border-radius: 8px;
  font-size: 0.9rem;
  font-family: var(--font);
  color: var(--text-primary);
  background: var(--bg-card);
  transition: border-color 0.2s, box-shadow 0.2s;
  outline: none;
}
.form-group input:focus,
.form-group textarea:focus {
  border-color: var(--brand-primary);
  box-shadow: 0 0 0 3px rgba(26,115,232,0.12);
}
.form-group textarea { resize: vertical; min-height: 120px; }

.btn-submit {
  padding: 12px 32px;
  background: var(--brand-primary);
  color: #fff;
  border: none;
  border-radius: 8px;
  font-size: 0.95rem;
  font-weight: 700;
  cursor: pointer;
  transition: background 0.2s;
  align-self: flex-start;
}
.btn-submit:hover { background: var(--brand-dark); }

/* --- Responsive ------------------------------------------- */
@media (max-width: 1100px) {
  :root { --sidebar-w: 180px; }
}

@media (max-width: 860px) {
  .page-wrapper { flex-direction: column; }
  .sidebar { width: 100%; position: static; flex-direction: row; flex-wrap: wrap; }
  .ad-slot { min-height: 100px; flex: 1; min-width: 200px; }
  .ad-slot-tall { min-height: 100px; }
  .results-grid { grid-template-columns: 1fr; }
  .form-row { grid-template-columns: 1fr; }
  .url-form { flex-direction: column; }
  .btn-analyze { border-radius: 8px; }
}

@media (max-width: 560px) {
  .card { padding: 20px 16px; }
  .hero-card h1 { font-size: 1.4rem; }
  .site-nav a { padding: 5px 10px; font-size: 0.8rem; }
}

/* ============================================================
   v7 additions — Audit table, badges, scores, report download
   ============================================================ */

/* --- Colour tokens ---------------------------------------- */
:root {
  --green:  #34a853;
  --amber:  #fbbc04;
  --red:    #ea4335;
}

/* --- Pill additions --------------------------------------- */
.pill-amber { background: #fff3cd; color: #856404; }

/* --- Result header card ----------------------------------- */
.result-header-card { padding: 24px 28px; }

.result-header-inner {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 20px;
  flex-wrap: wrap;
}

/* --- Overall score circle --------------------------------- */
.overall-score-wrap {
  text-align: center;
  flex-shrink: 0;
}

.overall-score {
  font-size: 3rem;
  font-weight: 900;
  line-height: 1;
}

.overall-score-label {
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-muted);
  margin-top: 4px;
}

/* --- Download button -------------------------------------- */
.btn-download {
  margin-top: 10px;
  padding: 8px 18px;
  background: var(--accent);
  color: #fff;
  border: none;
  border-radius: 8px;
  font-size: 0.82rem;
  font-weight: 700;
  cursor: pointer;
  transition: background 0.2s;
  white-space: nowrap;
}
.btn-download:hover { background: #2d9248; }

/* --- Audit table ------------------------------------------ */
.audit-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.84rem;
  margin-top: 4px;
}

.audit-table th {
  background: var(--bg-page);
  color: var(--text-secondary);
  font-size: 0.76rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  padding: 9px 12px;
  text-align: left;
  border-bottom: 2px solid var(--border);
}

.audit-table td {
  padding: 10px 12px;
  border-bottom: 1px solid var(--border);
  vertical-align: top;
}

.audit-table tr:last-child td { border-bottom: none; }

.audit-row:hover td { background: #fafbff; }

.audit-pass td:first-child { border-left: 3px solid var(--green); }
.audit-fail td:first-child { border-left: 3px solid var(--red); }
.audit-warn td:first-child { border-left: 3px solid var(--amber); }
.audit-info td:first-child { border-left: 3px solid var(--brand-primary); }
.audit-na   td:first-child { border-left: 3px solid var(--border); }

/* --- Result badges ---------------------------------------- */
.result-badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 4px 10px;
  border-radius: 20px;
  font-size: 0.78rem;
  font-weight: 600;
  white-space: nowrap;
}

.badge-pass { background: #e6f4ea; color: #1e7e34; }
.badge-fail { background: #fce8e6; color: #c62828; }
.badge-warn { background: #fff8e1; color: #856404; }
.badge-info { background: var(--brand-light); color: var(--brand-dark); }
.badge-na   { background: #f1f3f4; color: var(--text-muted); }

/* --- Fix tip ---------------------------------------------- */
.fix-tip {
  display: block;
  background: #f0f7ff;
  border-left: 3px solid var(--brand-primary);
  padding: 6px 10px;
  border-radius: 0 6px 6px 0;
  font-size: 0.79rem;
  color: #1a3a6b;
  line-height: 1.5;
}

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

.ps-col { }

.ps-label {
  font-size: 0.78rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-muted);
  margin-bottom: 10px;
  font-weight: 700;
}

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

.ps-score {
  text-align: center;
  min-width: 60px;
}

.ps-score-label {
  font-size: 0.7rem;
  color: var(--text-muted);
  margin-top: 4px;
}

/* Score dot circles */
.score-dot {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 52px;
  height: 52px;
  border-radius: 50%;
  font-size: 1.1rem;
  font-weight: 800;
  color: #fff;
}

.dot-green { background: var(--green); }
.dot-amber { background: var(--amber); color: #333; }
.dot-red   { background: var(--red); }

/* --- Opportunity rows ------------------------------------- */
.opportunity-row {
  background: var(--bg-page);
  border-radius: 8px;
  padding: 10px 14px;
  margin-bottom: 8px;
  border-left: 3px solid var(--amber);
}

/* --- Responsive additions --------------------------------- */
@media (max-width: 860px) {
  .ps-grid { grid-template-columns: 1fr; }
  .result-header-inner { flex-direction: column; }
  .audit-table th:nth-child(2),
  .audit-table td:nth-child(2) { display: none; }
}

@media (max-width: 560px) {
  .audit-table th:nth-child(4),
  .audit-table td:nth-child(4) { display: none; }
  .score-dot { width: 42px; height: 42px; font-size: 0.9rem; }
}

/* ============================================================
   v8 additions — Site Intelligence card
   ============================================================ */

.intel-card {
  border-left: 4px solid var(--brand-primary);
}

.intel-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
  gap: 20px;
  margin-top: 4px;
}

.intel-block {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.intel-block-wide {
  grid-column: 1 / -1;
}

.intel-block-label {
  font-size: 0.72rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-muted);
}

.intel-topic {
  font-size: 0.95rem;
  color: var(--text-primary);
  line-height: 1.5;
  font-style: italic;
}

.intel-value {
  font-size: 0.95rem;
  color: var(--text-primary);
  font-weight: 600;
}

.intel-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.intel-tag {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  background: var(--bg-page);
  border: 1px solid var(--border);
  border-radius: 20px;
  padding: 4px 12px;
  font-size: 0.8rem;
  font-weight: 500;
  color: var(--text-primary);
  text-decoration: none;
  transition: background 0.15s;
}

.intel-tag:hover {
  background: #e8f0fe;
  text-decoration: none;
}

.intel-social {
  color: var(--brand-primary);
  border-color: var(--brand-primary);
}
