:root {
  --c1: #06a9c4;
  --c2: #0a4d59;
  --grad: linear-gradient(135deg, var(--c1), var(--c2));
  --bg: #f2f8fa;
  --surface: #ffffff;
  --border: #d4edf3;
  --text: #1a2e35;
  --muted: #6b8a94;
  --panel: #ffffff;
  --input-bg: #f7fbfc;
  --input-border: #d0e8ef;
}
html.dark {
  --bg: #081a20;
  --surface: #0d2630;
  --border: #1a3d4a;
  --text: #e2edf0;
  --muted: #7aa5b0;
  --panel: #0d2630;
  --input-bg: #0a1f28;
  --input-border: #1e4557;
}

/* ── BASE ──────────────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; }
html { transition: background-color .3s, color .3s; }
body {
  font-family: 'Play', sans-serif;
  background: var(--bg);
  color: var(--text);
  margin: 0;
  transition: background-color .3s, color .3s;
}

/* ── SCROLLBAR ─────────────────────────────────────────────────── */
::-webkit-scrollbar { width: 4px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--c1); border-radius: 2px; opacity: .5; }

/* ── NAVBAR (Landing page style) ───────────────────────────────── */
.glass-light {
  background: rgba(255,255,255,0.72);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  border: 1px solid rgba(255,255,255,0.22);
}
html.dark .glass-light {
  background: rgba(0,0,0,0.28);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  border: 1px solid rgba(255,255,255,0.10);
}

/* Hamburger lines */
.ham-line {
  display: block;
  width: 20px; height: 2px;
  border-radius: 2px;
  background: #334155;
  transition: transform 0.3s ease, opacity 0.3s ease;
}
html.dark .ham-line { background: #fff; }
.ham-open .ham-top { transform: translateY(6px) rotate(45deg); }
.ham-open .ham-mid { opacity: 0; }
.ham-open .ham-bot { transform: translateY(-6px) rotate(-45deg); }

/* Mobile dropdown menu */
.mobile-nav-menu {
  opacity: 0;
  transform: translateY(-10px);
  pointer-events: none;
  transition: opacity 0.25s ease, transform 0.25s ease;
}
.mobile-nav-menu.open {
  opacity: 1;
  transform: translateY(0);
  pointer-events: auto;
}
.mobile-nav-overlay {
  opacity: 0; pointer-events: none;
  transition: opacity 0.25s ease;
}
.mobile-nav-overlay.open { opacity: 1; pointer-events: auto; }

/* Navbar scroll shadow */
#main-navbar { transition: box-shadow 0.3s; }

/* ── BRAND GRADIENT ────────────────────────────────────────────── */
.grad-bg { background: var(--grad); }
.grad-text,
.brand-gradient-text {
  background: var(--grad);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}
.btn-gradient {
  background: var(--grad);
  color: #fff;
  border: none;
  cursor: pointer;
  transition: opacity .2s, transform .2s, box-shadow .2s;
}
.btn-gradient:hover {
  opacity: .88;
  transform: translateY(-1px);
  box-shadow: 0 8px 28px rgba(6,169,196,.30);
}

/* ── BUTTONS ───────────────────────────────────────────────────── */
.btn-primary {
  background: var(--grad);
  color: #fff;
  border: none;
  cursor: pointer;
  transition: opacity .2s, transform .2s, box-shadow .2s;
}
.btn-primary:hover {
  opacity: .88;
  transform: translateY(-1px);
  box-shadow: 0 8px 28px rgba(6,169,196,.30);
}
.btn-secondary {
  background: transparent;
  border: 1px solid var(--c1);
  color: var(--c1);
  cursor: pointer;
  transition: background .2s, color .2s;
}
.btn-secondary:hover { background: var(--c1); color: #fff; }
.btn-ghost {
  background: transparent;
  border: 1px solid var(--border);
  color: var(--muted);
  cursor: pointer;
  font-family: 'Play', sans-serif;
  font-size: 12px;
  transition: border-color .2s, color .2s;
}
.btn-ghost:hover { border-color: var(--c1); color: var(--c1); }

/* ── FORM INPUTS ───────────────────────────────────────────────── */
.field {
  background: var(--input-bg);
  border: 1px solid var(--input-border);
  color: var(--text);
  font-family: 'Play', sans-serif;
  font-size: 13px;
  border-radius: 8px;
  padding: 8px 11px;
  width: 100%;
  transition: border-color .2s, box-shadow .2s;
  outline: none;
}
.field:focus {
  border-color: var(--c1);
  box-shadow: 0 0 0 3px rgba(6,169,196,.12);
}
.field::placeholder { color: var(--muted); opacity: .7; }
textarea.field { resize: vertical; min-height: 80px; }
label { font-size: 11px; font-weight: 600; color: var(--muted); letter-spacing: .06em; text-transform: uppercase; }

/* ── SECTION TOGGLE ────────────────────────────────────────────── */
.section-toggle-btn {
  display: flex; align-items: center; justify-content: space-between;
  width: 100%; padding: 12px 16px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 10px;
  cursor: pointer;
  font-family: 'Play', sans-serif; font-size: 13px; font-weight: 600;
  color: var(--text);
  transition: background .2s, border-color .2s;
  user-select: none;
}
.section-toggle-btn:hover { border-color: var(--c1); }
.section-toggle-btn .chevron {
  width: 14px; height: 14px;
  border-right: 2px solid var(--muted);
  border-bottom: 2px solid var(--muted);
  transform: rotate(45deg);
  transition: transform .25s;
}
.section-toggle-btn.open .chevron { transform: rotate(225deg); }
.section-body {
  max-height: 0;
  overflow: hidden;
  transition: max-height .35s ease;
}
.section-body.open { max-height: 3000px; }

/* ── ENTRY CARD ─────────────────────────────────────────────────── */
.entry-card {
  background: var(--input-bg);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 14px;
  position: relative;
  transition: border-color .2s;
}
.entry-card:hover { border-color: var(--c1); }
.entry-card .remove-btn {
  position: absolute; top: 10px; right: 10px;
  width: 22px; height: 22px;
  border-radius: 50%; background: rgba(255,80,80,.12);
  border: none; cursor: pointer; color: #f05;
  font-size: 14px; line-height: 22px; text-align: center;
  transition: background .2s;
}
.entry-card .remove-btn:hover { background: rgba(255,0,80,.22); }

/* ── TOGGLE SWITCH (landing page style) ───────────────────────── */
.toggle-track {
  width: 44px; height: 24px;
  border-radius: 999px;
  position: relative;
  cursor: pointer;
  transition: background 0.3s;
  background: #cbd5e1; /* slate-300 */
  border: none;
  display: inline-block;
  flex-shrink: 0;
}
html.dark .toggle-track { background: #06a9c4; }
.toggle-thumb {
  position: absolute;
  top: 3px; left: 3px;
  width: 18px; height: 18px;
  border-radius: 50%;
  background: white;
  transition: transform 0.3s;
  box-shadow: 0 1px 4px rgba(0,0,0,0.18);
}
html.dark .toggle-thumb { transform: translateX(20px); }

/* ── BUILDER LAYOUT ────────────────────────────────────────────── */
#builder-section {
  height: calc(100vh - 80px);
  display: flex;
  overflow: hidden;
}
#form-panel {
  width: 50%;
  overflow-y: auto;
  padding: 24px 20px;
  background: var(--bg);
  border-right: 1px solid var(--border);
  flex-shrink: 0;
}
#preview-panel {
  width: 50%;
  overflow-y: auto;
  background: #d8edf2;
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 28px 20px;
}
html.dark #preview-panel { background: #061418; }

/* ── A4 PREVIEW ─────────────────────────────────────────────────── */
#resume-preview {
  width: 794px;
  min-height: 1123px;
  background: #fff;
  box-shadow: 0 8px 40px rgba(0,0,0,.18);
  border-radius: 2px;
  position: relative;
  color: #1a1a1a;
  font-family: 'Literata', Georgia, serif;
  font-size: 11px;
  line-height: 1.55;
  overflow: hidden;
  flex-shrink: 0;
}

/* ── TEMPLATE: MINIMAL ─────────────────────────────────────────── */
#resume-preview.template-minimal { padding: 52px 56px; }
#resume-preview.template-minimal .res-name {
  font-family: 'Play', sans-serif;
  font-size: 26px; font-weight: 800;
  color: #111; letter-spacing: -.5px;
  margin-bottom: 2px;
}
#resume-preview.template-minimal .res-tagline {
  font-size: 11px; color: #555; margin-bottom: 10px;
}
#resume-preview.template-minimal .res-contact {
  display: flex; flex-wrap: wrap; gap: 8px 18px;
  font-size: 10.5px; color: #555; margin-bottom: 22px;
  border-bottom: 1.5px solid #1a1a1a; padding-bottom: 12px;
}
#resume-preview.template-minimal .res-section-title {
  font-family: 'Play', sans-serif;
  font-size: 10px; font-weight: 700;
  letter-spacing: .12em; text-transform: uppercase;
  color: #111; margin: 18px 0 8px;
}
#resume-preview.template-minimal .res-sidebar { display: none; }

/* ── TEMPLATE: MODERN ──────────────────────────────────────────── */
#resume-preview.template-modern { padding: 52px 56px; }
#resume-preview.template-modern .res-name {
  font-family: 'Play', sans-serif;
  font-size: 30px; font-weight: 800;
  color: #0a4d59; letter-spacing: -1px; margin-bottom: 3px;
}
#resume-preview.template-modern .res-tagline {
  font-size: 11.5px; color: #06a9c4; font-weight: 500; margin-bottom: 10px;
}
#resume-preview.template-modern .res-contact {
  display: flex; flex-wrap: wrap; gap: 6px 16px;
  font-size: 10.5px; color: #555; margin-bottom: 20px;
}
#resume-preview.template-modern .res-section-title {
  font-family: 'Play', sans-serif;
  font-size: 11px; font-weight: 700;
  letter-spacing: .08em; text-transform: uppercase;
  color: #06a9c4;
  margin: 18px 0 6px;
  padding-bottom: 4px;
  border-bottom: 2px solid #06a9c4;
}
#resume-preview.template-modern .res-sidebar { display: none; }

/* ── TEMPLATE: PREMIUM ─────────────────────────────────────────── */
#resume-preview.template-premium { padding: 0; }
#resume-preview.template-premium .res-header-block {
  background: linear-gradient(135deg, #06a9c4 0%, #0a4d59 100%);
  padding: 36px 48px 28px;
  color: #fff;
}
#resume-preview.template-premium .res-name {
  font-family: 'Play', sans-serif;
  font-size: 28px; font-weight: 800;
  color: #fff; letter-spacing: -.5px; margin-bottom: 2px;
}
#resume-preview.template-premium .res-tagline {
  font-size: 12px; color: rgba(255,255,255,.75); margin-bottom: 12px;
}
#resume-premium-contact-strip { display: none; }
#resume-preview.template-premium .res-contact {
  display: flex; flex-wrap: wrap; gap: 6px 18px;
  font-size: 10.5px; color: rgba(255,255,255,.80);
}
#resume-preview.template-premium .res-body { padding: 28px 48px; }
#resume-preview.template-premium .res-section-title {
  font-family: 'Play', sans-serif;
  font-size: 9px; font-weight: 700;
  letter-spacing: .16em; text-transform: uppercase;
  color: #0a4d59; margin: 18px 0 6px;
  padding-bottom: 3px; border-bottom: 1px solid #b8dde6;
}
#resume-preview.template-premium .res-sidebar { display: none; }

/* ── TEMPLATE: TECH ────────────────────────────────────────────── */
#resume-preview.template-tech { padding: 0; display: flex; }
#resume-preview.template-tech .res-sidebar {
  display: flex; flex-direction: column;
  width: 30%; min-height: 1123px;
  background: #0d2f3a;
  padding: 36px 20px;
  color: #c9e8ef;
  font-size: 10.5px;
}
#resume-preview.template-tech .res-sidebar .res-name {
  font-family: 'Play', sans-serif;
  font-size: 20px; font-weight: 800;
  color: #fff; line-height: 1.2; margin-bottom: 4px;
}
#resume-preview.template-tech .res-sidebar .res-tagline {
  font-size: 10px; color: #06a9c4; margin-bottom: 16px;
}
#resume-preview.template-tech .res-sidebar .side-title {
  font-family: 'Play', sans-serif;
  font-size: 8.5px; font-weight: 700;
  letter-spacing: .14em; text-transform: uppercase;
  color: #06a9c4; margin: 16px 0 6px;
  padding-bottom: 3px; border-bottom: 1px solid rgba(6,169,196,.3);
}
#resume-preview.template-tech .res-sidebar .contact-item {
  margin-bottom: 4px; color: #9eccd6; font-size: 10px; word-break: break-all;
}
#resume-preview.template-tech .res-main {
  flex: 1; padding: 36px 28px;
}
#resume-preview.template-tech .res-section-title {
  font-family: 'Play', sans-serif;
  font-size: 9.5px; font-weight: 700;
  letter-spacing: .12em; text-transform: uppercase;
  color: #0a4d59; margin: 16px 0 6px;
  padding-bottom: 3px; border-bottom: 1.5px solid #b0dce7;
}
#resume-preview.template-tech .res-main-name { display: none; }

/* ── SHARED RESUME ELEMENTS ────────────────────────────────────── */
.res-entry { margin-bottom: 11px; }
.res-entry-header { display: flex; justify-content: space-between; align-items: baseline; flex-wrap: wrap; gap: 2px; }
.res-entry-title { font-family: 'Play', sans-serif; font-size: 11.5px; font-weight: 700; color: #1a1a1a; }
.res-entry-sub { font-size: 10.5px; color: #444; }
.res-entry-date { font-size: 10px; color: #777; white-space: nowrap; }
.res-entry-desc { font-size: 10.5px; color: #444; margin-top: 3px; }
.res-skills-list { display: flex; flex-wrap: wrap; gap: 5px; }
.res-skill-tag {
  font-family: 'Play', sans-serif;
  font-size: 9.5px; font-weight: 600;
  background: #eef8fb; color: #0a4d59;
  padding: 2px 8px; border-radius: 3px;
  border: 1px solid #c8e8ef;
}
.template-tech .res-skill-tag {
  background: rgba(6,169,196,.15); color: #9eccd6; border-color: rgba(6,169,196,.3);
}
.res-summary { font-size: 10.5px; color: #444; line-height: 1.65; }
.template-premium .res-summary { color: #3a3a3a; }
.res-cert-item { margin-bottom: 5px; }
.res-cert-name { font-family: 'Play', sans-serif; font-size: 10.5px; font-weight: 600; color: #1a1a1a; }
.res-cert-meta { font-size: 10px; color: #777; }

/* ── TEMPLATE DROPDOWN ─────────────────────────────────────────── */
.template-select {
  background: var(--input-bg);
  border: 1px solid var(--input-border);
  color: var(--text);
  font-family: 'Play', sans-serif;
  font-size: 12px; font-weight: 600;
  border-radius: 20px;
  padding: 6px 12px;
  outline: none; cursor: pointer;
  transition: border-color .2s, box-shadow .2s;
  max-width: 130px;
}
.template-select:focus {
  border-color: var(--c1);
  box-shadow: 0 0 0 3px rgba(6,169,196,.12);
}
@media (max-width: 400px) {
  .template-select { max-width: 90px; font-size: 11px; padding: 5px 8px; }
}

/* ── MOBILE ────────────────────────────────────────────────────── */
@media (max-width: 1023px) {
  #builder-section {
    height: auto;
    flex-direction: column;
    overflow: visible;
  }
  #form-panel, #preview-panel { width: 100%; border-right: none; }
  #preview-panel { padding: 20px 12px; }
  #resume-preview {
    width: 100%; max-width: 794px; min-height: auto;
    transform-origin: top center;
    font-size: 9px;
  }
}

/* ── PRINT STYLES ──────────────────────────────────────────────── */
@media print {
  @page { margin: 0; size: A4 portrait; }

  /* Hide everything that is NOT the resume */
  nav,
  #form-panel,
  #guide-section,
  footer,
  .preview-label {
    display: none !important;
  }

  /* Reset page chrome */
  html, body {
    margin: 0 !important; padding: 0 !important;
    background: #fff !important;
    height: auto !important; overflow: visible !important;
  }
  body > div { padding: 0 !important; }

  /* Builder section becomes flat */
  #builder-section {
    display: block !important;
    height: auto !important;
    overflow: visible !important;
  }

  /* Preview panel fills page */
  #preview-panel {
    display: block !important;
    width: 100% !important;
    padding: 0 !important;
    background: #fff !important;
    overflow: visible !important;
  }

  /* Scaler: reset transform for print */
  #resume-preview-scaler {
    transform: none !important;
    width: 794px !important;
    margin: 0 auto !important;
  }

  /* The resume itself */
  #resume-preview {
    width: 794px !important;
    min-height: 1123px !important;
    box-shadow: none !important;
    border-radius: 0 !important;
    margin: 0 !important;
    overflow: visible !important;
  }

  /* Preserve gradient/color backgrounds */
  .res-header-block { -webkit-print-color-adjust: exact; print-color-adjust: exact; }
  #resume-preview.template-tech .res-sidebar { -webkit-print-color-adjust: exact; print-color-adjust: exact; }
  .res-skill-tag { -webkit-print-color-adjust: exact; print-color-adjust: exact; }
}

/* ── PREVIEW SCALER CSS ────────────────────────────────────────── */
#preview-panel { overflow-x: hidden; }
#resume-preview-scaler {
  width: 794px;
  transform-origin: top center;
  flex-shrink: 0;
}

/* ── SEO GUIDE ─────────────────────────────────────────────────── */
.guide-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 28px 28px;
  transition: border-color .2s, box-shadow .2s;
}
.guide-card:hover { border-color: var(--c1); box-shadow: 0 4px 24px rgba(6,169,196,.10); }
.max-limit-note {
  font-size: 11px; color: #e05a00;
  font-family: 'Play', sans-serif;
  margin-top: 6px;
}
