/* ========================================
   LSEO Overlay CSS - Consolidated & Clean
   ======================================== */

/* === Full-Page Overlay === */
#lseo-overlay {
  position: fixed;
  inset: 0;
  background: linear-gradient(180deg, #f9fafb 0%, #eef2f7 100%);
  display: none;
  z-index: 999999;
  align-items: center;
  justify-content: center;
  flex-direction: column;
  text-align: center;
  padding: 40px;
}

#lseo-overlay.show {
  display: flex;
}

.lseo-overlay-box {
  width: min(92vw, 680px);
  padding: 24px 32px;
  text-align: center;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Arial, "Noto Sans", "Liberation Sans", "Helvetica Neue", sans-serif;
  color: #111827;
}

/* Overlay Header */
.lseo-title-main {
  font-size: 1.3em;
  font-weight: 700;
  line-height: 1.2;
  margin-bottom: 4px;
  color: #111827;
}

.lseo-title-sub {
  font-size: 1.0em;
  font-weight: 500;
  line-height: 1.2;
  margin-bottom: 12px;
  color: #111827;
}

/* Domain Display */
.lseo-domain {
  font-size: 1.4em !important;
  font-weight: 500;
  color: #1c77d3 !important;
  margin-top: 18px;
  margin-bottom: 24px;
  text-align: center;
  word-break: break-word;
}

/* Progress Bar */
.lseo-progress {
  position: relative;
  margin: 0 auto;
  width: 100%;
  max-width: 500px;
  height: 14px;
  border-radius: 999px;
  background: #e5e7eb;
  overflow: hidden;
  box-shadow: inset 0 1px 3px rgba(0,0,0,0.1);
}

.lseo-progress-bar {
  position: absolute;
  left: -40%;
  top: 0;
  height: 100%;
  width: 40%;
  background: linear-gradient(90deg, #1c77d3, #3298ff);
  border-radius: 999px;
  animation: lseo-indeterminate 2.4s ease-in-out infinite;
}

@keyframes lseo-indeterminate {
  0%   { left: -40%; width: 40%; }
  50%  { left: 20%;  width: 60%; }
  100% { left: 100%; width: 40%; }
}

.lseo-subtitle {
  margin-top: 14px;
  font-size: 14px;
  color: #222;
}

/* === Results Page === */
body {
  line-height: 1.2;
}

.lseo-results-title {
  text-align: center;
  margin: 16px 0 6px;
}

.lseo-results-domain {
  text-align: center;
  font-size: 1.25em;
  color: #1c77d3;
  margin-bottom: 20px;
  word-break: break-word;
}

/* === Sections === */
.lseo-section {
  background: #f9f9f9 !important;
  padding: 20px 25px;
  margin: 40px 0;
  border-radius: 6px;
  border: 1px solid #ddd !important;
  box-shadow: 0 1px 3px rgba(0,0,0,0.08), 0 1px 2px rgba(0,0,0,0.04) !important;
}

.lseo-section h2 {
  margin-top: 0;
  color: #1c77d3 !important;
}

/* === Status Colors === */
.lseo-pass { color: #059669; }
.lseo-warn { color: #f59e0b; }
.lseo-error { color: #dc2626; }

/* Status Badges */
.lseo-status-badge {
  display: inline-flex;
  align-items: center;
  padding: 2px 8px;
  border-radius: 12px;
  font-size: 0.85em;
  font-weight: 500;
  color: #fff;
  margin: 2px 0;
  box-shadow: 0 1px 2px rgba(0,0,0,0.05) !important;
}

.lseo-status-pass { background-color: #059669; }
.lseo-status-warning { background-color: #f59e0b; }
.lseo-status-error { background-color: #dc2626; }

.lseo-status-badge svg { 
  width: 14px; 
  height: 14px; 
  margin-right: 4px; 
  fill: #fff; 
}

/* === Charts === */
.lseo-summary-charts {
  display: flex;
  flex-wrap: wrap;
  gap: 20px;
  margin: 30px 0;
  align-items: stretch;
}

.lseo-chart {
  flex: 1;
  min-width: 300px;
  text-align: center;
  position: relative;
  background: #fff;
  border: 1px solid #e0e0e0;
  border-radius: 8px;
  padding: 15px;
  box-shadow: 0 2px 4px rgba(0,0,0,0.04);
  display: flex;
  flex-direction: column;
  justify-content: center; /* Center content vertically */
}

.lseo-chart canvas {
  max-width: 100%;
  height: auto;
}

.lseo-chart .center{position:absolute;top:43%;left:50%;transform:translate(-50%,-50%);font-size:4em;font-weight:800;color:#0e2530}


/* Chart Center Text */
.chart-center-text {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  font-size: 2.5em;
  font-weight: 700;
  text-align: center;
  pointer-events: none;
}

/* Doughnut Chart */
#seoScoreChart {
  width: 240px !important;
  height: 240px !important;
  margin: 0 auto;
}

#seoGradeText {
  font-size: 5em;
  font-weight: 600;
  display: block;
}

#seoPercentText {
  font-size: 1.5em !important;
  font-weight: 800;
  color: #000000;
}

#seoScoreLabel {
  font-size: 1.1em !important;
  font-weight: 400;
  color: #000000;
  margin-top: 5px;
}

/* Bar Chart */
#seoBreakdownChart {
  width: 100% !important;
  max-width: 700px;
  height: 350px !important;
  margin: 0 auto;
  display: block;
}

/* Hide x-axis labels */
#seoBreakdownChart + div,
#seoBreakdownChart ~ .chartjs-axis-x {
  display: none !important;
}

/* Bar Numbers */
.bar-nums {
  display: grid !important;
  grid-template-columns: repeat(3, 1fr);
  max-width: 700px;
  margin: 10px auto 0;
  text-align: center;
  gap: 0;
}

.bar-nums .bn {
  text-align: center;
  font-weight: 600;
}

.bar-nums .bn-num {
  font-weight: 800;
  font-size: 1.1em;
}

.bar-nums .bn-label {
  font-size: 0.9em;
  font-weight: normal;
  color: #444;
}

/* === Metric Cards === */
.lseo-metric-cards {
  display: flex;
  flex-wrap: wrap;
  gap: 15px;
  justify-content: space-between;
  margin-top: 10px;
}

.lseo-metric {
  flex: 1 1 30%;
  min-width: 200px;
  text-align: center;
  background: #fff;
  border-radius: 6px;
  padding: 15px;
  box-shadow: 0 1px 3px rgba(0,0,0,0.1);
}

.lseo-metric-label {
  font-weight: normal;
  margin-bottom: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  font-size: 1em;
}

.lseo-metric-text,
.lseo-metric-abbrev {
  font-size: 1.2em;
}

.lseo-metric-label .dashicons {
  font-size: 20px;
  width: 20px;
  height: 20px;
  line-height: 1;
}

.lseo-metric-label .lseo-status-badge {
  font-size: 0.85em;
}

.lseo-metric-value {
  margin-top: 6px;
  font-weight: 700;
  font-size: 15px;
}

.lseo-metric-guideline {
  font-size: 12px;
  color: #666;
  margin-top: 4px;
}

/* Hide break between value and badge */
.lseo-core-web-vitals p br:first-of-type { 
  display: none; 
}

.lseo-core-web-vitals p .lseo-status-badge { 
  margin-left: 6px; 
  vertical-align: baseline; 
}

/* === Forms === */
.lseo-audit-form {
  display: block;
  margin: 24px auto 40px;
  padding: 20px;
  text-align: left !important;
}

.lseo-audit-form label {
  font-size: 14px;
  color: #222;
  margin-right: 8px;
  font-family: inherit !important;
  font-weight: normal !important;
}

.lseo-audit-form input[type="text"],
.lseo-audit-form input[type="email"],
.lseo-audit-form input[type="url"] {
  border: 1px solid #d1d5db;
  padding: 10px 14px;
  font-size: 15px;
  width: 400px;
  max-width: 100%;
  box-shadow: inset 0 1px 2px rgba(0,0,0,0.05);
  transition: border-color 0.2s, box-shadow 0.2s;
}

.lseo-audit-form input[type="text"]:focus,
.lseo-audit-form input[type="email"]:focus,
.lseo-audit-form input[type="url"]:focus {
  border-color: #1c77d3;
  box-shadow: 0 0 0 3px rgba(28,119,211,0.2);
  outline: none;
}

/* === Non-WordPress Message === */
.lseo-non-wp {
  text-align: center;
  margin: 40px auto;
  background: #f9f9f9;
  border: 1px solid #ddd;
  padding: 40px;
  border-radius: 10px;
  max-width: 600px;
  box-shadow: 0 2px 6px rgba(0,0,0,0.1);
}

.lseo-non-wp h1 {
  font-size: 1.8em;
  font-weight: 600;
  color: #222;
  margin-bottom: 20px;
}

.lseo-non-wp p {
  margin: 15px 0;
  color: #444;
}

.lseo-non-wp .lseo-nonwp-line1 {
  font-size: 1.4em;
}

.lseo-non-wp .lseo-nonwp-line2 {
  font-size: 1.3em;
}

.lseo-non-wp .lseo-switch-btn {
  margin-top: 20px;
}

/* === Audit Log Table === */
.lseo-audit-log-wrapper { 
  max-width: 100%; 
  overflow-x: auto; 
}

.lseo-audit-log-wrapper th:first-child,
.lseo-audit-log-wrapper td:first-child { 
  min-width: 170px; 
}

.lseo-audit-log-wrapper td.url-col { 
  max-width: 420px; 
  overflow: hidden; 
  text-overflow: ellipsis; 
  white-space: nowrap; 
}

.lseo-audit-log-wrapper td.email-col { 
  max-width: 260px; 
  overflow: hidden; 
  text-overflow: ellipsis; 
  white-space: nowrap; 
}

/* === Utility Classes === */
.lseo-hint { 
  font-size: 0.9em; 
}

.lseo-w-400 { 
  width: 400px; 
}

.lseo-w-100 { 
  width: 100px; 
}

.lseo-mt-15 { 
  margin-top: 15px; 
}

.lseo-result-passed,
.lseo-result-warning,
.lseo-result-error {
  font-weight: normal !important;
}

/* === Print Styles === */

.print-only-header {
  display: none;
}

/* Top-level, not wrapped in @media */
@page {
  size: auto;
  margin: 20mm 15mm; /* top/bottom: 20mm, left/right: 15mm */
}


@media print {
 /* Let @page control margins */
	html, body {
		margin: 0 !important;
		padding: 0 !important;
	}

	/* Kill sticky/fixed bars that “eat” the top margin on each page */
	/* Tweak selectors to your markup as needed */
	#wpadminbar,
	header, .site-header, .lseo-header,
	[style*="position:fixed"], [style*="position: sticky"] {
		position: static !important;
		top: auto !important;
	}

	/* Transforms can create new containing blocks and upset pagination */
	[style*="transform"] { transform: none !important; }
	
	/* Replace .lseo-report/.report-wrapper with your actual container */
	.lseo-report, .report-wrapper { margin: 0 !important; padding: 0 !important; }

	/* Remove top margins that would be dropped at page starts anyway */
	.lseo-report > *:first-child,
	.report-wrapper > *:first-child,
	h1, h2, h3, p, section, article {
		margin-top: 0 !important;
	}

	/* If you manually insert page breaks between sections, ensure consistent top space */
	.page-break { break-before: page; }                /* add <div class="page-break"></div> between sections */
	.page-break + * { margin-top: 0 !important; }      /* no extra element top margin; @page provides it */
  
  /* Ensure Chrome prints background colors */
	* {
		-webkit-print-color-adjust: exact !important;
		print-color-adjust: exact !important;
		color-adjust: exact !important;
	}  
  
  /* Show custom header */
 .print-only-header {
    display: block !important;
    margin-bottom: 20px !important;
    margin-top: -20px !important; /* Pull header up to reduce top margin */
    padding-bottom: 15px;
    border-bottom: 2px solid #ccc;
  }
  
  /* Reduce top margin on first heading */
  .lseo-results-title {
    margin-top: -10px !important;
  }

   .lseo-mini-meter {
    max-width: 100% !important;
    height: auto !important;
  }

  .print-only-header .header-line {
    display: flex;
    justify-content: space-between;
    align-items: center;
  }

  .print-only-header .header-date {
    font-size: 14px;
    color: #555;
  }

  .print-only-header .header-title {
    font-weight: bold;
    font-size: 16px;
    color: #1c77d3;
    text-align: right;
  }

  .print-only-header .header-logo {
    text-align: center;
    flex-grow: 1;
  }

  /* Hide UI elements */
  header, nav, .site-header, .main-navigation, .menu-toggle, 
  .menu-icon, .site-branding, .page-header, .no-print, 
  form, button, .button, .flatsome-cookies, .footer, .footer-wrapper {
    display: none !important;
  }

  /* Keep sections together */
  .lseo-section {
    break-inside: avoid;
    page-break-inside: avoid;
    margin-top: 10px !important; /* Reduced from 20px */
    margin-bottom: 10px !important; /* Reduced from 20px */
    padding: 12px 16px !important; /* Reduced from 20px 25px */
  }

  .lseo-section *[class*="notice"],
  .lseo-section *[class*="alert"],
  .lseo-section *[class*="box"],
  .lseo-section *[class*="card"] {
    break-inside: avoid;
    page-break-inside: avoid;
  }

  /* Print typography */
  h1, h2 {
    color: #000;
    border-bottom: 1px solid #ccc;
    padding-bottom: 4px;
    margin-bottom: 10px;
  }

  ul {
    margin: 0 0 20px 20px;
    padding: 0;
  }

  li {
    margin-bottom: 5px;
  }

  .good { color: #006400 !important; }
  .warn { color: #b58900 !important; }
  .bad { color: #a30000 !important; }
  
  /* Scale charts to 80% for printing */
  .lseo-summary-charts {
    transform: scale(1);
    transform-origin: top center;
    display: flex !important;
    justify-content: center !important;
    margin-left: auto !important;
    margin-right: auto !important;
  }
}

/* === Responsive === */
@media (max-width: 768px) {
  .lseo-summary-charts {
    flex-direction: column;
    align-items: center;
  }

  .lseo-summary-charts .chart-column.doughnut-col,
  .lseo-summary-charts .chart-column.bar-col {
    flex: 0 0 100%;
    max-width: 100%;
  }
}


@media (max-width: 800px) {
  .lseo-summary-charts {
    flex-direction: column;
    align-items: center;
  }
}