/* ============================================================
   LinkedIn Profile Enhancer — mobile-first stylesheet
   Base styles target 360px viewport. Breakpoints scale up.
   ============================================================ */

:root {
  --bg: #f4f6fa;
  --bg-elevated: #ffffff;
  --ink: #0a1f3a;
  --ink-soft: #44546a;
  --muted: #7a8aa3;
  --line: #e3e8f0;
  --line-strong: #cdd6e3;
  --brand: #0a66c2;
  --brand-dark: #084d92;
  --brand-soft: #e8f1fb;
  --brand-softer: #f3f8fd;
  --accent: #057642;
  --accent-soft: #e3f3ea;
  --warn: #b86e00;
  --warn-soft: #fff0dc;
  --yellow: #b88800;
  --yellow-soft: #fff8d1;
  --bad: #c8392b;
  --bad-soft: #fbeaea;
  --shadow-sm: 0 1px 2px rgba(10, 31, 58, 0.04);
  --shadow: 0 1px 2px rgba(10, 31, 58, 0.06), 0 8px 24px rgba(10, 31, 58, 0.06);
  --shadow-lg: 0 4px 12px rgba(10, 31, 58, 0.08), 0 20px 40px rgba(10, 31, 58, 0.08);
  --radius: 14px;
  --radius-sm: 10px;
  --radius-lg: 20px;
  --touch: 44px;
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
html { -webkit-text-size-adjust: 100%; }
body {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  background: var(--bg);
  color: var(--ink);
  -webkit-font-smoothing: antialiased;
  font-size: 16px;
  line-height: 1.55;
  min-height: 100vh;
  min-height: 100dvh;
}

/* ----- Header / footer ----- */
.site-header {
  background: #fff;
  border-bottom: 1px solid var(--line);
  padding: 12px 16px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  position: sticky;
  top: 0;
  z-index: 50;
}
.brand { display: flex; align-items: center; gap: 10px; text-decoration: none; color: inherit; }
.brand-mark {
  width: 36px; height: 36px;
  background: var(--brand);
  color: #fff;
  border-radius: 9px;
  display: grid; place-items: center;
  font-weight: 800; font-size: 15px;
  letter-spacing: -0.5px;
  flex-shrink: 0;
}
.brand-name { font-weight: 700; font-size: 15px; line-height: 1.2; }
.brand-sub  { color: var(--muted); font-size: 11.5px; line-height: 1.2; }
.header-link {
  color: var(--brand);
  text-decoration: none;
  font-weight: 600;
  font-size: 13.5px;
  display: none;  /* hidden on mobile */
}
.header-link:hover { text-decoration: underline; }

.site-footer {
  margin-top: 48px;
  padding: 24px 16px calc(24px + env(safe-area-inset-bottom));
  text-align: center;
  color: var(--muted);
  font-size: 13px;
}

main {
  max-width: 1040px;
  margin: 0 auto;
  padding: 20px 16px 0;
}

/* ----- Views ----- */
.view { display: none; }
.view.active { display: block; animation: fadeIn .22s ease; }
@keyframes fadeIn { from { opacity: 0; transform: translateY(4px); } to { opacity: 1; transform: none; } }

/* ----- Hero (input) ----- */
.hero { text-align: center; margin: 16px 0 24px; }
.hero-eyebrow {
  display: inline-block;
  font-size: 12px; font-weight: 600;
  color: var(--brand);
  background: var(--brand-soft);
  padding: 5px 12px;
  border-radius: 999px;
  margin-bottom: 14px;
  letter-spacing: 0.2px;
}
.hero h1 {
  font-size: clamp(26px, 7vw, 42px);
  font-weight: 800;
  letter-spacing: -0.6px;
  line-height: 1.15;
  margin: 0 0 10px;
  background: linear-gradient(135deg, #0a1f3a 0%, var(--brand) 100%);
  -webkit-background-clip: text; background-clip: text; color: transparent;
}
.hero-sub { color: var(--ink-soft); max-width: 640px; margin: 0 auto; font-size: 15.5px; line-height: 1.55; }

/* ----- Card ----- */
.card {
  background: var(--bg-elevated);
  border-radius: var(--radius);
  border: 1px solid var(--line);
  box-shadow: var(--shadow-sm);
  padding: 20px;
}

/* ----- Form ----- */
.form-card { margin-bottom: 28px; padding: 18px; }
.field { margin-bottom: 14px; display: block; }
.field label {
  display: block;
  font-weight: 600;
  font-size: 13.5px;
  margin-bottom: 6px;
  color: var(--ink);
}
.field .muted { color: var(--muted); font-weight: 500; }
.muted { color: var(--muted); }

/* 16px font size on inputs prevents iOS Safari auto-zoom on focus. */
input[type=text], input[type=url], textarea {
  width: 100%;
  padding: 12px 14px;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  font: inherit;
  font-size: 16px;
  color: var(--ink);
  background: #fafbfd;
  transition: border-color .15s, box-shadow .15s, background .15s;
  resize: vertical;
  min-height: var(--touch);
}
input:focus, textarea:focus {
  outline: none;
  border-color: var(--brand);
  background: #fff;
  box-shadow: 0 0 0 3px rgba(10, 102, 194, 0.15);
}
.grid-2 { display: grid; grid-template-columns: 1fr; gap: 14px; }

/* ----- Tabs ----- */
.tabs {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 4px;
  background: #eef2f7;
  padding: 4px;
  border-radius: 12px;
  margin: 16px 0 16px;
}
.tab {
  border: 0; background: transparent;
  padding: 11px 12px;
  border-radius: 9px;
  font: inherit; font-weight: 600; font-size: 14px;
  color: var(--ink-soft); cursor: pointer;
  display: flex; align-items: center; justify-content: center; gap: 6px;
  min-height: 40px;
  transition: background .15s, color .15s, box-shadow .15s;
}
.tab.active { background: #fff; color: var(--brand); box-shadow: 0 1px 3px rgba(0,0,0,0.08); }
.tab-icon { font-size: 16px; line-height: 1; }
.tab-panel { display: none; }
.tab-panel.active { display: block; animation: fadeIn .18s ease; }

/* ----- Dropzone ----- */
.upload-help {
  background: var(--brand-soft);
  border-radius: var(--radius-sm);
  padding: 12px 14px;
  font-size: 13.5px;
  margin-bottom: 14px;
  color: var(--ink);
}
.upload-help strong { display: block; margin-bottom: 6px; }
.upload-help ol { margin: 6px 0 0 20px; padding: 0; }
.upload-help li { margin-bottom: 3px; }

.dropzone {
  display: block;
  border: 2px dashed var(--line-strong);
  border-radius: 12px;
  padding: 18px;
  text-align: center;
  cursor: pointer;
  background: #fafbfd;
  transition: border-color .15s, background .15s;
  min-height: 96px;
}
.dropzone:hover, .dropzone:focus-within { border-color: var(--brand); background: var(--brand-softer); }
.dropzone.dragover { border-color: var(--brand); background: var(--brand-soft); }
.dropzone-inner { display: flex; align-items: center; gap: 14px; justify-content: flex-start; }
.dropzone-icon {
  background: var(--brand); color: #fff;
  width: 48px; height: 48px;
  border-radius: 10px;
  display: grid; place-items: center;
  font-weight: 800; font-size: 13px;
  flex-shrink: 0;
}
.dropzone-copy { text-align: left; flex: 1; }
.dropzone-title { font-weight: 600; font-size: 14.5px; margin-bottom: 2px; }

.pdf-status {
  margin: 12px 0;
  padding: 10px 14px;
  border-radius: var(--radius-sm);
  font-size: 13.5px;
}
.pdf-status.ok  { background: var(--accent-soft); color: var(--accent); }
.pdf-status.err { background: var(--bad-soft); color: var(--bad); }
.hidden { display: none !important; }

/* ----- Buttons ----- */
.cta-row {
  display: flex; flex-direction: column; gap: 8px;
  margin-top: 10px;
}
.btn-primary, .btn-secondary, .btn-ghost {
  border: 0; cursor: pointer; font: inherit; font-weight: 600;
  font-size: 15px;
  padding: 12px 20px;
  border-radius: 999px;
  min-height: var(--touch);
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  transition: background .15s, color .15s, box-shadow .15s, transform .05s;
  text-decoration: none;
}
.btn-block { width: 100%; }
.btn-primary {
  background: var(--brand); color: #fff;
  box-shadow: 0 4px 14px rgba(10, 102, 194, .3);
}
.btn-primary:hover { background: var(--brand-dark); }
.btn-primary:active { transform: translateY(1px); }
.btn-primary:disabled { background: #9fb6cf; cursor: wait; box-shadow: none; }
.btn-arrow { transition: transform .15s; }
.btn-primary:hover .btn-arrow { transform: translateX(3px); }

.btn-secondary {
  background: var(--brand-soft); color: var(--brand);
}
.btn-secondary:hover { background: #dde9f7; }

.btn-ghost {
  background: transparent; color: var(--ink-soft);
}
.btn-ghost:hover { background: #eef2f7; color: var(--ink); }

.form-error {
  margin-top: 12px;
  padding: 11px 14px;
  border-radius: var(--radius-sm);
  background: var(--bad-soft); color: var(--bad);
  font-size: 14px;
}

/* ----- "How it works" cards ----- */
.how { margin: 24px 0 64px; }
.how h2 { font-size: 20px; font-weight: 700; margin: 0 0 14px; letter-spacing: -0.2px; }
.how-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 10px;
}
.how-grid > div {
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 14px 16px;
}
.how-grid strong { display: block; margin-bottom: 4px; font-size: 14.5px; }
.how-grid span { color: var(--ink-soft); font-size: 13.5px; }

/* ----- Loader ----- */
.loader-wrap { text-align: center; padding: 64px 20px; }
.loader {
  width: 56px; height: 56px;
  border: 5px solid #d8e3f1;
  border-top-color: var(--brand);
  border-radius: 50%;
  animation: spin 0.9s linear infinite;
  margin: 0 auto 20px;
}
@keyframes spin { to { transform: rotate(360deg); } }
.loader-wrap h2 { font-size: 19px; margin: 0 0 6px; }

/* ============================================================
   RESULTS PAGE
   ============================================================ */

.results-section { margin: 28px 0; }
.section-head { margin-bottom: 14px; }
.section-head h2 {
  font-size: 19px;
  font-weight: 700;
  letter-spacing: -0.2px;
  margin: 0 0 4px;
}
.section-sub {
  color: var(--ink-soft);
  font-size: 14px;
  margin: 0;
  line-height: 1.5;
}

/* ----- Hero (results) ----- */
.results-hero {
  margin-top: 8px;
  padding: 22px 18px;
  display: flex; flex-direction: column;
  align-items: center;
  text-align: center;
  gap: 18px;
  background: linear-gradient(135deg, #ffffff 0%, var(--brand-softer) 100%);
  border-color: var(--line);
}
.score-circle-wrap {
  position: relative;
  width: 130px; height: 130px;
}
.score-circle { transform: rotate(-90deg); width: 130px; height: 130px; }
.score-track { fill: none; stroke: var(--line); stroke-width: 11; }
.score-bar {
  fill: none; stroke: var(--brand); stroke-width: 11;
  stroke-linecap: round;
  stroke-dasharray: 326.7;
  stroke-dashoffset: 326.7;
  transition: stroke-dashoffset 1.2s cubic-bezier(.2,.7,.2,1), stroke .4s;
}
.score-num {
  position: absolute; inset: 0;
  display: grid; place-items: center;
  font-size: 36px; font-weight: 800;
  letter-spacing: -1.5px;
}
.score-denom { font-size: 14px; color: var(--muted); font-weight: 600; letter-spacing: 0; }

.hero-text-block { width: 100%; }
.rating-chip {
  display: inline-block;
  background: var(--brand-soft);
  color: var(--brand);
  font-weight: 700;
  font-size: 11.5px;
  padding: 4px 11px;
  border-radius: 999px;
  margin-bottom: 8px;
  text-transform: uppercase;
  letter-spacing: 0.7px;
}
.hero-headline {
  font-size: clamp(20px, 5.5vw, 26px);
  font-weight: 800;
  letter-spacing: -0.4px;
  margin: 4px 0 8px;
  line-height: 1.2;
}
.hero-summary {
  color: var(--ink-soft);
  font-size: 14.5px;
  margin: 0 0 16px;
  line-height: 1.55;
}
.hero-actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  justify-content: center;
}
.hero-actions .btn-secondary, .hero-actions .btn-ghost {
  font-size: 14px;
  padding: 10px 16px;
}

/* ----- Verdict stats ----- */
.verdict-stats {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
  margin: 16px 0;
}
.stat-card {
  background: var(--bg-elevated);
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 14px 10px;
  text-align: center;
  position: relative;
  overflow: hidden;
}
.stat-card::before {
  content: ""; position: absolute; top: 0; left: 0; right: 0; height: 3px;
}
.stat-card.stat-green::before  { background: var(--accent); }
.stat-card.stat-yellow::before { background: var(--yellow); }
.stat-card.stat-red::before    { background: var(--bad); }
.stat-num {
  display: block;
  font-size: 28px; font-weight: 800;
  letter-spacing: -1px;
  line-height: 1;
  margin-bottom: 4px;
}
.stat-card.stat-green .stat-num  { color: var(--accent); }
.stat-card.stat-yellow .stat-num { color: var(--yellow); }
.stat-card.stat-red .stat-num    { color: var(--bad); }
.stat-label {
  display: block;
  font-size: 11.5px;
  color: var(--ink-soft);
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.4px;
  line-height: 1.3;
}

/* ----- Priority list ----- */
.priority-list {
  list-style: none;
  counter-reset: prio;
  padding: 6px 16px;
  margin: 0;
  background: var(--bg-elevated);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
}
.priority-list li {
  counter-increment: prio;
  padding: 14px 0 14px 44px;
  border-bottom: 1px solid var(--line);
  position: relative;
  font-size: 14.5px;
  line-height: 1.5;
}
.priority-list li:last-child { border-bottom: 0; }
.priority-list li::before {
  content: counter(prio);
  position: absolute; left: 0; top: 14px;
  width: 30px; height: 30px;
  background: var(--brand); color: #fff;
  border-radius: 50%;
  display: grid; place-items: center;
  font-weight: 700; font-size: 13.5px;
}

/* ----- Dual panel: strengths / focus areas ----- */
.dual-panel {
  display: grid;
  grid-template-columns: 1fr;
  gap: 12px;
}
.panel {
  border-radius: var(--radius);
  border: 1px solid var(--line);
  padding: 16px 18px;
  background: var(--bg-elevated);
  box-shadow: var(--shadow-sm);
}
.panel-strengths { background: linear-gradient(180deg, var(--accent-soft) 0%, var(--bg-elevated) 100%); border-color: #c8e6d3; }
.panel-focus     { background: linear-gradient(180deg, var(--warn-soft) 0%, var(--bg-elevated) 100%); border-color: #f3deb1; }
.panel-head { display: flex; align-items: center; gap: 8px; margin-bottom: 10px; }
.panel-icon {
  width: 26px; height: 26px;
  border-radius: 50%;
  display: grid; place-items: center;
  font-weight: 700; font-size: 14px;
}
.panel-strengths .panel-icon { background: var(--accent); color: #fff; }
.panel-focus .panel-icon     { background: var(--warn); color: #fff; }
.panel h3 { margin: 0; font-size: 15.5px; font-weight: 700; }
.panel-list { list-style: none; margin: 0; padding: 0; }
.panel-list li {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 10px;
  padding: 8px 0;
  border-bottom: 1px dashed rgba(0,0,0,0.08);
  font-size: 14px;
}
.panel-list li:last-child { border-bottom: 0; }
.panel-list .metric-name-cell { font-weight: 600; }
.panel-list .metric-mini-score {
  font-weight: 700;
  font-size: 13px;
  padding: 2px 8px;
  border-radius: 999px;
  flex-shrink: 0;
}

/* ----- Rewrites ----- */
.rewrites-grid {
  display: grid;
  gap: 12px;
  grid-template-columns: 1fr;
}
.rewrite-card { padding: 16px 18px; }
.rewrite-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 10px;
  gap: 10px;
}
.rewrite-label {
  font-size: 11.5px; font-weight: 700;
  color: var(--brand);
  text-transform: uppercase;
  letter-spacing: 0.7px;
}
.rewrite-body {
  font-size: 15px; line-height: 1.55;
  color: var(--ink);
  white-space: pre-wrap;
}
.copy-btn {
  border: 1px solid var(--line-strong);
  background: #fff;
  border-radius: 8px;
  padding: 6px 12px;
  font: inherit; font-weight: 600; font-size: 12.5px;
  color: var(--ink-soft); cursor: pointer;
  transition: all .12s;
  flex-shrink: 0;
  min-height: 32px;
}
.copy-btn:hover { color: var(--brand); border-color: var(--brand); }
.copy-btn.copied { background: var(--accent); color: #fff; border-color: var(--accent); }

/* ----- Keywords ----- */
.keywords-row {
  display: flex; flex-wrap: wrap; gap: 8px;
  padding: 16px 18px;
}
.keyword-chip {
  background: var(--yellow-soft);
  color: var(--yellow);
  font-weight: 600;
  font-size: 13.5px;
  padding: 6px 13px;
  border-radius: 999px;
  border: 1px solid #f3deb1;
}

/* ----- Metric cards (full breakdown) ----- */
.metrics-grid {
  display: grid;
  gap: 12px;
  grid-template-columns: 1fr;
}
.metric-card { padding: 18px; }
.metric-head {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  margin-bottom: 8px;
  gap: 10px;
}
.metric-name { font-weight: 700; font-size: 15px; line-height: 1.3; }
.metric-rating {
  font-size: 11px; font-weight: 700;
  text-transform: uppercase; letter-spacing: 0.5px;
  padding: 3px 9px; border-radius: 999px;
  white-space: nowrap;
  flex-shrink: 0;
}
.metric-score-bar {
  height: 6px; background: var(--line); border-radius: 4px; overflow: hidden;
  margin: 10px 0 14px;
}
.metric-score-fill {
  height: 100%; border-radius: 4px;
  transition: width .8s cubic-bezier(.2,.7,.2,1);
}
.metric-section { margin-top: 10px; }
.metric-section-label {
  font-size: 11px; font-weight: 700; text-transform: uppercase;
  letter-spacing: 0.6px; color: var(--muted);
  margin-bottom: 4px;
}
.metric-list { margin: 0; padding-left: 18px; }
.metric-list li { margin-bottom: 4px; font-size: 14px; color: var(--ink-soft); line-height: 1.5; }
.metric-list.suggestions li { color: var(--ink); }

/* color states */
.tone-red    { background: var(--bad-soft); color: var(--bad); }
.tone-orange { background: var(--warn-soft); color: var(--warn); }
.tone-yellow { background: var(--yellow-soft); color: var(--yellow); }
.tone-green  { background: var(--accent-soft); color: var(--accent); }
.tone-blue   { background: var(--brand-soft); color: var(--brand); }

.fill-red    { background: var(--bad); }
.fill-orange { background: var(--warn); }
.fill-yellow { background: var(--yellow); }
.fill-green  { background: var(--accent); }
.fill-blue   { background: var(--brand); }

/* ----- Mobile sticky action bar (results only) ----- */
.mobile-action-bar {
  position: sticky;
  bottom: 0;
  left: 0; right: 0;
  margin: 24px -16px 0;
  padding: 10px 16px calc(10px + env(safe-area-inset-bottom));
  background: rgba(255, 255, 255, 0.96);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  border-top: 1px solid var(--line);
  display: grid;
  grid-template-columns: 1fr 2fr;
  gap: 10px;
  z-index: 40;
}
.mobile-action-bar .btn-primary,
.mobile-action-bar .btn-secondary {
  font-size: 14.5px;
  padding: 10px 14px;
}

/* ============================================================
   BREAKPOINTS
   ============================================================ */

/* Tablet+ (>=640px) */
@media (min-width: 640px) {
  main { padding: 32px 24px 0; }
  .site-header { padding: 14px 24px; }
  .header-link { display: inline-block; min-height: var(--touch); display: inline-flex; align-items: center; }
  .form-card { padding: 24px; }
  .grid-2 { grid-template-columns: 1fr 1fr; gap: 16px; }
  .cta-row { flex-direction: row; align-items: center; }
  .btn-block { width: auto; }
  .how-grid { grid-template-columns: repeat(2, 1fr); gap: 12px; }
  .verdict-stats { gap: 12px; }
  .stat-card { padding: 18px 14px; }
  .stat-num { font-size: 32px; }
  .results-hero {
    flex-direction: row;
    align-items: center;
    text-align: left;
    gap: 28px;
    padding: 26px 26px;
  }
  .hero-actions { justify-content: flex-start; }
  .dual-panel { grid-template-columns: 1fr 1fr; gap: 14px; }
  .mobile-action-bar { display: none; }
}

/* Desktop (>=960px) */
@media (min-width: 960px) {
  .how-grid { grid-template-columns: repeat(4, 1fr); }
  .rewrites-grid { grid-template-columns: repeat(3, 1fr); }
  .metrics-grid { grid-template-columns: repeat(2, 1fr); gap: 14px; }
  .section-head h2 { font-size: 22px; }
  .hero h1 { letter-spacing: -0.8px; }
}

/* ----- Print friendliness ----- */
@media print {
  .site-header, .site-footer, .hero-actions, .copy-btn, .mobile-action-bar { display: none !important; }
  body { background: #fff; }
  .card, .panel, .priority-list { box-shadow: none; border-color: #ddd; break-inside: avoid; }
  main { max-width: 100%; padding: 0; }
  .results-hero { background: #fff !important; }
  .dual-panel { grid-template-columns: 1fr 1fr !important; }
  .rewrites-grid { grid-template-columns: 1fr 1fr 1fr !important; }
  .metrics-grid { grid-template-columns: 1fr 1fr !important; }
}

/* ----- Reduced motion ----- */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    transition-duration: 0.01ms !important;
  }
}
