/* ═══════════════════════════════════════════════════════
   AUDITLENS — Complete Stylesheet
   Professional SEO Audit Portal
═══════════════════════════════════════════════════════ */

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

:root {
  --green:      #1D9E75;
  --green-dk:   #0F6E56;
  --green-lt:   #E1F5EE;
  --green-mid:  #9FE1CB;
  --amber:      #EF9F27;
  --amber-lt:   #FAEEDA;
  --amber-dk:   #854F0B;
  --red:        #E24B4A;
  --red-lt:     #FCEBEB;
  --red-dk:     #A32D2D;
  --blue:       #378ADD;
  --blue-lt:    #E6F1FB;
  --blue-dk:    #185FA5;
  --gray-50:    #F8F7F5;
  --gray-100:   #F0EEE9;
  --gray-200:   #E2DED7;
  --gray-300:   #C8C4BC;
  --gray-400:   #9E9A93;
  --gray-600:   #5F5E5A;
  --gray-800:   #2C2C2A;
  --gray-900:   #1A1A18;
  --white:      #FFFFFF;
  --shadow-sm:  0 1px 3px rgba(0,0,0,0.06);
  --shadow-md:  0 4px 16px rgba(0,0,0,0.08);
  --shadow-lg:  0 8px 32px rgba(0,0,0,0.12);
  --radius-sm:  6px;
  --radius-md:  10px;
  --radius-lg:  16px;
  --radius-xl:  22px;
  --font:       'DM Sans', system-ui, sans-serif;
  --mono:       'DM Mono', monospace;
}

html { font-size: 16px; -webkit-font-smoothing: antialiased; }
body { font-family: var(--font); background: var(--gray-50); color: var(--gray-800); line-height: 1.6; }

/* ─── SCREENS ─── */
.screen { display: none; min-height: 100vh; flex-direction: column; }
.screen.active { display: flex; }

/* ─── TYPOGRAPHY ─── */
h1 { font-size: 2.25rem; font-weight: 600; line-height: 1.2; color: var(--gray-900); }
h2 { font-size: 1.5rem; font-weight: 600; color: var(--gray-900); }
h3 { font-size: 1rem; font-weight: 500; color: var(--gray-800); }
p  { color: var(--gray-600); }

/* ─── BRAND ─── */
.brand-mark { display: flex; align-items: center; gap: 8px; text-decoration: none; }
.brand-dot  { width: 10px; height: 10px; border-radius: 50%; background: var(--green); flex-shrink: 0; }
.brand-name { font-size: 17px; font-weight: 600; color: var(--gray-900); letter-spacing: -0.01em; }
.brand-mark--sm .brand-name { font-size: 15px; }
.brand-mark--sm .brand-dot  { width: 8px; height: 8px; }

/* ─── BUTTONS ─── */
.btn-primary {
  display: inline-flex; align-items: center; justify-content: center;
  padding: 11px 20px; font-size: 14px; font-weight: 500; font-family: var(--font);
  background: var(--green-dk); color: var(--white);
  border: none; border-radius: var(--radius-md);
  cursor: pointer; transition: opacity .15s, transform .1s;
  text-decoration: none;
}
.btn-primary:hover  { opacity: .88; }
.btn-primary:active { transform: scale(0.98); }

.btn-secondary {
  display: inline-flex; align-items: center; justify-content: center;
  padding: 10px 18px; font-size: 14px; font-weight: 500; font-family: var(--font);
  background: var(--white); color: var(--gray-800);
  border: 1px solid var(--gray-200); border-radius: var(--radius-md);
  cursor: pointer; transition: background .15s, border-color .15s;
}
.btn-secondary:hover { background: var(--gray-50); border-color: var(--gray-300); }

.btn-full { width: 100%; }

/* ─── FORMS ─── */
.form-group   { margin-bottom: 1rem; }
.form-row     { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.form-label   { display: block; font-size: 12px; font-weight: 500; color: var(--gray-600); margin-bottom: 6px; letter-spacing: .03em; text-transform: uppercase; }
.form-input   {
  width: 100%; padding: 11px 14px; font-size: 14px; font-family: var(--font);
  background: var(--gray-50); border: 1px solid var(--gray-200);
  border-radius: var(--radius-md); color: var(--gray-900); outline: none;
  transition: border-color .15s, box-shadow .15s;
}
.form-input:focus { border-color: var(--green); box-shadow: 0 0 0 3px rgba(29,158,117,.1); }
.form-error { font-size: 13px; color: var(--red-dk); background: var(--red-lt); border: 1px solid #f09595; border-radius: var(--radius-sm); padding: 10px 12px; margin-bottom: 1rem; }
.hidden { display: none !important; }
.forgot-link { font-size: 12px; color: var(--green-dk); text-align: right; margin-top: 6px; cursor: pointer; }
.link { color: var(--green-dk); cursor: pointer; font-weight: 500; }
.link:hover { text-decoration: underline; }

/* ══════════════════════════════════════════
   SCREEN 1 & 2: LOGIN / REGISTER
══════════════════════════════════════════ */
.login-bg {
  position: fixed; inset: 0; pointer-events: none; overflow: hidden;
  background: linear-gradient(135deg, #f0faf6 0%, #f8f7f5 50%, #fef9f2 100%);
}
.login-bg-grid {
  position: absolute; inset: 0;
  background-image:
    linear-gradient(var(--gray-200) 1px, transparent 1px),
    linear-gradient(90deg, var(--gray-200) 1px, transparent 1px);
  background-size: 48px 48px;
  opacity: .35;
}

.login-wrap {
  position: relative; z-index: 1;
  display: flex; align-items: stretch;
  min-height: 100vh; max-width: 1100px;
  margin: 0 auto; padding: 2rem;
  gap: 4rem;
}
.login-wrap--center {
  align-items: center; justify-content: center;
  gap: 0;
}

.login-left {
  flex: 1; display: flex; flex-direction: column;
  justify-content: center; padding: 2rem 0;
}
.login-headline {
  font-size: 3rem; font-weight: 600; line-height: 1.15;
  color: var(--gray-900); margin: 1.5rem 0 1rem;
  letter-spacing: -0.02em;
}
.login-tagline { font-size: 16px; color: var(--gray-600); max-width: 380px; margin-bottom: 2rem; line-height: 1.6; }
.login-features { display: flex; flex-direction: column; gap: 10px; }
.lf-item { font-size: 14px; color: var(--gray-600); display: flex; align-items: center; gap: 10px; }
.lf-icon { color: var(--green); font-size: 16px; }

.login-right { flex: 0 0 400px; display: flex; align-items: center; }

.login-card {
  background: var(--white); border: 1px solid var(--gray-200);
  border-radius: var(--radius-xl); padding: 2rem 2.25rem;
  width: 100%; box-shadow: var(--shadow-lg);
}
.login-card-header { margin-bottom: 1.75rem; }
.login-card-header h2 { font-size: 1.25rem; margin: 1rem 0 .25rem; }
.login-card-header p  { font-size: 14px; color: var(--gray-400); }

.login-divider {
  text-align: center; position: relative; margin: 1.25rem 0;
  font-size: 12px; color: var(--gray-400);
}
.login-divider::before {
  content: ''; position: absolute; top: 50%; left: 0; right: 0;
  height: 1px; background: var(--gray-200);
}
.login-divider span { background: var(--white); position: relative; padding: 0 12px; }
.login-footer { font-size: 13px; color: var(--gray-400); text-align: center; margin-top: 1.25rem; }

/* ══════════════════════════════════════════
   TOP NAV (shared)
══════════════════════════════════════════ */
.topnav {
  background: var(--white); border-bottom: 1px solid var(--gray-200);
  padding: 0 24px; height: 58px;
  display: flex; align-items: center; justify-content: space-between;
  position: sticky; top: 0; z-index: 100; flex-shrink: 0;
}
.topnav-left  { display: flex; align-items: center; gap: 32px; }
.topnav-right { display: flex; align-items: center; gap: 12px; }

.nav-links { display: flex; gap: 4px; }
.nav-link  { font-size: 14px; font-weight: 500; color: var(--gray-600); padding: 6px 12px; border-radius: var(--radius-sm); text-decoration: none; transition: color .15s, background .15s; }
.nav-link:hover  { color: var(--gray-900); background: var(--gray-100); }
.nav-link.active { color: var(--green-dk); }

.audit-count-badge { font-size: 12px; color: var(--green-dk); background: var(--green-lt); padding: 5px 10px; border-radius: 20px; font-weight: 500; }
.audit-count-badge .aud-num { font-weight: 600; }

.user-menu  { display: flex; align-items: center; gap: 10px; }
.avatar     { width: 32px; height: 32px; border-radius: 50%; background: var(--green-lt); color: var(--green-dk); font-size: 12px; font-weight: 600; display: flex; align-items: center; justify-content: center; }
.user-email { font-size: 13px; color: var(--gray-600); }
.btn-logout { font-size: 12px; color: var(--gray-400); background: none; border: 1px solid var(--gray-200); border-radius: var(--radius-sm); padding: 5px 10px; cursor: pointer; font-family: var(--font); transition: color .15s; }
.btn-logout:hover { color: var(--red); border-color: var(--red); }

/* ══════════════════════════════════════════
   SCREEN 3: DASHBOARD
══════════════════════════════════════════ */
.dash-hero {
  background: var(--white);
  border-bottom: 1px solid var(--gray-200);
  padding: 4rem 2rem;
}
.dash-hero-inner { max-width: 640px; margin: 0 auto; text-align: center; }

.hero-badge {
  display: inline-flex; align-items: center; gap: 7px;
  font-size: 11px; font-weight: 500; letter-spacing: .07em; text-transform: uppercase;
  color: var(--green-dk); background: var(--green-lt); padding: 5px 12px;
  border-radius: 20px; margin-bottom: 1.25rem;
}
.hero-badge-dot { width: 6px; height: 6px; border-radius: 50%; background: var(--green); animation: pulse 2s ease-in-out infinite; }
@keyframes pulse { 0%,100% { opacity:1; } 50% { opacity:.3; } }

.hero-title { font-size: 2.5rem; font-weight: 600; letter-spacing: -.02em; margin-bottom: .75rem; }
.hero-sub   { font-size: 16px; color: var(--gray-400); margin-bottom: 2.5rem; }

.url-card {
  background: var(--gray-50); border: 1px solid var(--gray-200);
  border-radius: var(--radius-xl); padding: 1.5rem; text-align: left;
  box-shadow: var(--shadow-sm);
}
.url-input-group { display: flex; border: 1px solid var(--gray-300); border-radius: var(--radius-md); overflow: hidden; background: var(--white); }
.url-prefix { display: flex; align-items: center; padding: 0 14px; font-size: 14px; font-family: var(--mono); color: var(--gray-400); background: var(--gray-100); border-right: 1px solid var(--gray-200); flex-shrink: 0; }
.url-input  { flex: 1; padding: 13px 14px; font-size: 15px; font-family: var(--mono); background: transparent; border: none; outline: none; color: var(--gray-900); min-width: 0; }
.btn-analyze { padding: 0 24px; font-size: 14px; font-weight: 600; font-family: var(--font); background: var(--green-dk); color: var(--white); border: none; cursor: pointer; white-space: nowrap; transition: background .15s; flex-shrink: 0; }
.btn-analyze:hover    { background: var(--green); }
.btn-analyze:disabled { opacity: .5; cursor: wait; }

.checks-strip { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 1rem; }
.check-tag { font-size: 12px; color: var(--gray-600); background: var(--white); border: 1px solid var(--gray-200); padding: 5px 10px; border-radius: 20px; display: flex; align-items: center; gap: 5px; }
.check-tag span { color: var(--green); }

.dash-recent       { padding: 2rem; flex: 1; }
.dash-recent-inner { max-width: 1000px; margin: 0 auto; }
.section-head      { display: flex; align-items: center; justify-content: space-between; margin-bottom: 1rem; }
.section-head h3   { font-size: 15px; font-weight: 600; }
.view-all          { font-size: 13px; color: var(--green-dk); cursor: pointer; }
.recent-empty      { font-size: 14px; color: var(--gray-400); text-align: center; padding: 3rem; background: var(--white); border: 1px dashed var(--gray-300); border-radius: var(--radius-lg); }
.recent-grid       { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 12px; }

.recent-card {
  background: var(--white); border: 1px solid var(--gray-200);
  border-radius: var(--radius-lg); padding: 1.125rem 1.25rem;
  cursor: pointer; transition: border-color .15s, box-shadow .15s;
}
.recent-card:hover { border-color: var(--green-mid); box-shadow: var(--shadow-sm); }
.rc-top   { display: flex; align-items: flex-start; justify-content: space-between; margin-bottom: .75rem; }
.rc-url   { font-size: 14px; font-weight: 500; color: var(--gray-900); font-family: var(--mono); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 180px; }
.rc-score { font-size: 20px; font-weight: 700; }
.rc-date  { font-size: 12px; color: var(--gray-400); margin-bottom: .5rem; }
.rc-bar   { height: 4px; background: var(--gray-100); border-radius: 2px; overflow: hidden; }
.rc-bar-fill { height: 100%; border-radius: 2px; transition: width .4s; }

/* ══════════════════════════════════════════
   SCREEN 4: LOADING
══════════════════════════════════════════ */
.loading-body {
  flex: 1; display: flex; align-items: center; justify-content: center;
  padding: 2rem; background: var(--gray-50);
}
.loading-card {
  background: var(--white); border: 1px solid var(--gray-200);
  border-radius: var(--radius-xl); padding: 3rem 2.5rem;
  text-align: center; max-width: 440px; width: 100%;
  box-shadow: var(--shadow-md);
}

/* Scan animation */
.scan-animation { position: relative; width: 80px; height: 80px; margin: 0 auto 2rem; }
.scan-ring {
  position: absolute; border-radius: 50%;
  border: 1.5px solid var(--green); opacity: 0;
  animation: scanPulse 2.4s ease-out infinite;
}
.scan-ring-1 { inset: 0; animation-delay: 0s; }
.scan-ring-2 { inset: -14px; animation-delay: .8s; }
.scan-ring-3 { inset: -28px; animation-delay: 1.6s; }
@keyframes scanPulse { 0% { opacity:.7; transform:scale(.7); } 100% { opacity:0; transform:scale(1.1); } }
.scan-core {
  position: absolute; inset: 22px;
  background: var(--green-lt); border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
}
.scan-dot { width: 12px; height: 12px; border-radius: 50%; background: var(--green); }

.loading-title { font-size: 1.25rem; font-weight: 600; color: var(--gray-900); margin-bottom: .5rem; }
.loading-url   { font-size: 13px; color: var(--gray-400); font-family: var(--mono); margin-bottom: 1.5rem; }

.progress-bar-wrap {
  height: 4px; background: var(--gray-100); border-radius: 2px;
  overflow: hidden; margin-bottom: 2rem;
}
.progress-bar {
  height: 100%; background: var(--green); border-radius: 2px;
  width: 0%; transition: width .6s ease;
}

.loading-steps   { text-align: left; display: flex; flex-direction: column; gap: 10px; }
.lstep           { display: flex; align-items: center; gap: 12px; font-size: 13px; color: var(--gray-400); }
.lstep-dot       { width: 8px; height: 8px; border-radius: 50%; background: var(--gray-200); flex-shrink: 0; transition: background .3s; }
.lstep.active    { color: var(--gray-800); }
.lstep.active    .lstep-dot { background: var(--green); animation: pulse 1s ease-in-out infinite; }
.lstep.done      { color: var(--gray-600); }
.lstep.done      .lstep-dot { background: var(--green-dk); animation: none; }

/* ══════════════════════════════════════════
   SCREEN 5: REPORT
══════════════════════════════════════════ */
.report-wrap { flex: 1; overflow-y: auto; }

/* Report Header */
.report-header       { background: var(--white); border-bottom: 1px solid var(--gray-200); padding: 2rem; }
.report-header-inner { max-width: 1000px; margin: 0 auto; display: flex; flex-wrap: wrap; gap: 2rem; align-items: flex-start; }

.report-score-section { display: flex; align-items: center; gap: 1.5rem; flex: 0 0 auto; }

.score-donut   { position: relative; width: 120px; height: 120px; flex-shrink: 0; }
.donut-svg     { width: 100%; height: 100%; transform: rotate(-90deg); }
.donut-bg      { fill: none; stroke: var(--gray-100); stroke-width: 10; }
.donut-fill    { fill: none; stroke: var(--green); stroke-width: 10; stroke-linecap: round; stroke-dasharray: 327; stroke-dashoffset: 327; transition: stroke-dashoffset 1.2s ease, stroke .4s; }
.score-center  { position: absolute; inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; }
.score-num     { font-size: 2rem; font-weight: 700; color: var(--gray-900); line-height: 1; }
.score-label   { font-size: 11px; color: var(--gray-400); }

.score-meta    { flex: 1; }
.score-verdict { font-size: 1.25rem; font-weight: 600; color: var(--gray-900); margin-bottom: .25rem; }
.score-url     { font-size: 13px; font-family: var(--mono); color: var(--blue); margin-bottom: .25rem; }
.score-date    { font-size: 12px; color: var(--gray-400); margin-bottom: .75rem; }
.score-pills   { display: flex; gap: 8px; flex-wrap: wrap; }
.pill {
  font-size: 11px; font-weight: 600; padding: 4px 10px; border-radius: 20px;
}
.pill-red    { background: var(--red-lt);   color: var(--red-dk); }
.pill-amber  { background: var(--amber-lt); color: var(--amber-dk); }
.pill-green  { background: var(--green-lt); color: var(--green-dk); }
.pill-blue   { background: var(--blue-lt);  color: var(--blue-dk); }

.report-kpis { flex: 1; display: grid; grid-template-columns: repeat(4,1fr); gap: 12px; min-width: 0; }
.kpi-card    { background: var(--gray-50); border: 1px solid var(--gray-200); border-radius: var(--radius-md); padding: 1rem; }
.kpi-label   { font-size: 11px; color: var(--gray-400); text-transform: uppercase; letter-spacing: .07em; margin-bottom: .5rem; }
.kpi-val     { font-size: 1.5rem; font-weight: 700; line-height: 1; margin-bottom: .25rem; }
.kpi-note    { font-size: 11px; color: var(--gray-400); }

/* Report Body */
.report-body    { max-width: 1000px; margin: 0 auto; padding: 2rem; }
.report-section { margin-bottom: 2.5rem; }
.rsection-head  { display: flex; align-items: center; gap: 12px; margin-bottom: 1rem; padding-bottom: .75rem; border-bottom: 1px solid var(--gray-200); }
.rsection-head h3    { font-size: 15px; font-weight: 600; flex: 1; }
.rsection-count { font-size: 12px; background: var(--gray-100); color: var(--gray-600); padding: 3px 9px; border-radius: 20px; font-weight: 500; }
.ai-badge       { font-size: 11px; background: var(--green-lt); color: var(--green-dk); padding: 3px 10px; border-radius: 20px; font-weight: 500; }

/* Issues */
.issues-list     { display: flex; flex-direction: column; gap: 10px; }
.issue-card      {
  background: var(--white); border: 1px solid var(--gray-200);
  border-radius: var(--radius-md); padding: 1.125rem 1.25rem;
  display: flex; gap: 14px; align-items: flex-start;
}
.issue-left  { display: flex; flex-direction: column; align-items: center; gap: 6px; flex-shrink: 0; padding-top: 2px; }
.issue-sev   { width: 8px; height: 8px; border-radius: 50%; flex-shrink: 0; }
.sev-critical { background: var(--red); }
.sev-warning  { background: var(--amber); }
.sev-info     { background: var(--blue); }

.issue-body  { flex: 1; min-width: 0; }
.issue-title { font-size: 14px; font-weight: 500; color: var(--gray-900); margin-bottom: .25rem; }
.issue-desc  { font-size: 13px; color: var(--gray-600); line-height: 1.55; margin-bottom: .75rem; }
.issue-fix   { font-size: 12px; font-family: var(--mono); background: var(--gray-50); color: var(--gray-700); border: 1px solid var(--gray-200); padding: 8px 12px; border-radius: var(--radius-sm); display: block; line-height: 1.5; }
.issue-fix-label { font-size: 11px; color: var(--gray-400); margin-bottom: 4px; text-transform: uppercase; letter-spacing: .05em; }

.issue-tag {
  font-size: 10px; font-weight: 600; padding: 3px 9px;
  border-radius: 20px; flex-shrink: 0; text-transform: uppercase; letter-spacing: .05em; margin-top: 2px;
}
.tag-critical { background: var(--red-lt);   color: var(--red-dk); }
.tag-warning  { background: var(--amber-lt); color: var(--amber-dk); }
.tag-info     { background: var(--blue-lt);  color: var(--blue-dk); }

/* Category grid */
.category-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); gap: 12px; }
.cat-card      {
  background: var(--white); border: 1px solid var(--gray-200);
  border-radius: var(--radius-md); padding: 1rem 1.125rem;
}
.cat-name    { font-size: 12px; font-weight: 500; color: var(--gray-600); margin-bottom: .5rem; text-transform: uppercase; letter-spacing: .05em; }
.cat-score   { font-size: 1.625rem; font-weight: 700; line-height: 1; margin-bottom: .625rem; }
.cat-bar     { height: 4px; background: var(--gray-100); border-radius: 2px; overflow: hidden; }
.cat-fill    { height: 100%; border-radius: 2px; }
.cat-status  { font-size: 11px; color: var(--gray-400); margin-top: .5rem; }

/* Recommendations */
.recs-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 12px; }
.rec-card  {
  background: var(--white); border: 1px solid var(--gray-200);
  border-radius: var(--radius-md); padding: 1.25rem; position: relative;
}
.rec-top    { display: flex; align-items: flex-start; justify-content: space-between; gap: 10px; margin-bottom: .625rem; }
.rec-title  { font-size: 14px; font-weight: 500; color: var(--gray-900); line-height: 1.4; }
.rec-icon   { font-size: 20px; flex-shrink: 0; }
.rec-desc   { font-size: 13px; color: var(--gray-600); line-height: 1.55; margin-bottom: .75rem; }
.impact-badge { font-size: 11px; font-weight: 600; padding: 3px 9px; border-radius: 20px; }
.impact-high  { background: var(--green-lt); color: var(--green-dk); }
.impact-med   { background: var(--amber-lt); color: var(--amber-dk); }
.impact-low   { background: var(--gray-100); color: var(--gray-600); }

/* What's working */
.passes-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 10px; }
.pass-card   {
  background: var(--green-lt); border: 1px solid var(--green-mid);
  border-radius: var(--radius-md); padding: .875rem 1rem;
  display: flex; align-items: flex-start; gap: 10px;
}
.pass-check  { color: var(--green-dk); font-size: 16px; flex-shrink: 0; margin-top: 1px; }
.pass-text   { font-size: 13px; color: var(--green-dk); font-weight: 500; line-height: 1.4; }

/* ─── PRINT ─── */
@media print {
  .topnav, .btn-secondary, .btn-primary { display: none !important; }
  .screen { display: flex !important; }
  #screen-login, #screen-register, #screen-dashboard, #screen-loading { display: none !important; }
  #screen-report { display: flex !important; }
}

/* ─── RESPONSIVE ─── */
@media (max-width: 768px) {
  .login-wrap   { flex-direction: column; gap: 2rem; padding: 1.5rem; }
  .login-left   { display: none; }
  .login-right  { flex: none; width: 100%; }
  .hero-title   { font-size: 1.75rem; }
  .report-kpis  { grid-template-columns: repeat(2,1fr); }
  .topnav       { padding: 0 16px; }
  .nav-links    { display: none; }
  .user-email   { display: none; }
  .form-row     { grid-template-columns: 1fr; }
  .report-header-inner { flex-direction: column; }
  .report-kpis  { width: 100%; }
}

@media (max-width: 480px) {
  .url-prefix   { display: none; }
  .checks-strip { display: none; }
  .report-kpis  { grid-template-columns: 1fr 1fr; }
}
