/* ===== RESET & BASE ===== */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  --bg: #121212;
  --card: #181818;
  --card-border: #282828;
  --accent: #1DB954;
  --accent-hover: #1ed760;
  --text: #e0e0e0;
  --text-muted: #999;
  --text-heading: #fff;
  --input-bg: #222;
  --input-border: #333;
  --radius: 8px;
}

[data-theme="light"] {
  --bg: #f5f5f5;
  --card: #fff;
  --card-border: #ddd;
  --text: #333;
  --text-muted: #666;
  --text-heading: #111;
  --input-bg: #f9f9f9;
  --input-border: #ccc;
}

html { scroll-behavior: smooth; }
body {
  font-family: 'Inter', sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.6;
  min-height: 100vh;
}

/* ===== THEME TOGGLE ===== */
.theme-toggle {
  position: fixed;
  top: 16px;
  right: 16px;
  z-index: 1000;
  width: 40px;
  height: 40px;
  border-radius: 50%;
  border: 1px solid var(--card-border);
  background: var(--card);
  color: var(--text);
  font-size: 18px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
}

/* ===== HEADER ===== */
.site-header {
  background: var(--card);
  border-bottom: 1px solid var(--card-border);
  padding: 14px 24px;
}
.header-inner {
  max-width: 1400px;
  margin: 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 12px;
}
.logo {
  font-size: 20px;
  font-weight: 800;
  color: var(--accent);
  text-decoration: none;
}
.header-inner nav { display: flex; gap: 16px; flex-wrap: wrap; }
.header-inner nav a {
  color: var(--text-muted);
  text-decoration: none;
  font-size: 14px;
  transition: color .2s;
}
.header-inner nav a:hover { color: var(--accent); }

/* ===== HERO ===== */
.hero {
  text-align: center;
  padding: 48px 24px 24px;
}
.hero h1 {
  font-size: 2rem;
  color: var(--text-heading);
  margin-bottom: 8px;
}
.hero p {
  color: var(--text-muted);
  max-width: 640px;
  margin: 0 auto;
  font-size: 15px;
}

/* ===== TEMPLATE SELECTOR ===== */
.template-selector {
  padding: 0 24px 24px;
  text-align: center;
}
.template-selector h2 {
  font-size: 1.1rem;
  color: var(--text-heading);
  margin-bottom: 16px;
}
.template-cards {
  display: flex;
  justify-content: center;
  gap: 16px;
  flex-wrap: wrap;
}
.template-card {
  background: var(--card);
  border: 2px solid var(--card-border);
  border-radius: var(--radius);
  padding: 12px;
  cursor: pointer;
  transition: border-color .2s, transform .2s;
  text-align: center;
  width: 140px;
}
.template-card:hover { border-color: var(--accent); transform: translateY(-2px); }
.template-card.active { border-color: var(--accent); }
.template-card span {
  display: block;
  margin-top: 8px;
  font-size: 13px;
  font-weight: 600;
  color: var(--text);
}

/* Template preview thumbnails */
.template-preview {
  width: 100%;
  height: 100px;
  background: #fff;
  border-radius: 4px;
  padding: 8px;
  position: relative;
  overflow: hidden;
}
.tp-header { height: 10px; width: 50%; margin: 0 auto 6px; background: #333; border-radius: 2px; }
.tp-line { height: 5px; background: #ddd; border-radius: 2px; margin-bottom: 4px; }
.tp-section { height: 6px; width: 40%; background: #333; border-radius: 2px; margin: 6px 0 4px; }
.w60 { width: 60%; } .w70 { width: 70%; } .w80 { width: 80%; } .w90 { width: 90%; }

.template-preview-modern {
  display: flex;
  gap: 4px;
  padding: 0;
}
.tp-sidebar { width: 30%; background: #1DB954; border-radius: 4px 0 0 4px; }
.tp-main { flex: 1; padding: 8px; }

.template-preview-minimal .tp-name { height: 12px; width: 50%; background: #222; border-radius: 2px; margin-bottom: 6px; }
.template-preview-minimal .tp-hr { height: 1px; background: #bbb; margin: 6px 0; }

/* ===== 3-COLUMN LAYOUT ===== */
.main-layout {
  display: grid;
  grid-template-columns: 160px 1fr 160px;
  gap: 0;
  max-width: 1600px;
  margin: 0 auto;
  padding: 0 8px;
}
.ad-sidebar {
  padding: 16px 8px;
  position: sticky;
  top: 16px;
  align-self: start;
}

/* ===== BUILDER SPLIT ===== */
.builder-split {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 24px;
  padding: 16px;
  min-height: 600px;
}

/* ===== FORM PANEL ===== */
.form-panel {
  max-height: 80vh;
  overflow-y: auto;
  padding-right: 12px;
}
.form-panel::-webkit-scrollbar { width: 6px; }
.form-panel::-webkit-scrollbar-thumb { background: var(--card-border); border-radius: 3px; }

.form-actions-top {
  display: flex;
  gap: 8px;
  margin-bottom: 16px;
  position: sticky;
  top: 0;
  z-index: 10;
  background: var(--bg);
  padding: 8px 0;
}

.btn {
  padding: 10px 20px;
  border: none;
  border-radius: var(--radius);
  font-family: inherit;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  transition: background .2s;
}
.btn-print { background: var(--accent); color: #fff; flex: 1; }
.btn-print:hover { background: var(--accent-hover); }
.btn-clear { background: var(--card); color: var(--text); border: 1px solid var(--card-border); }
.btn-clear:hover { background: var(--input-bg); }

.form-section {
  background: var(--card);
  border: 1px solid var(--card-border);
  border-radius: var(--radius);
  padding: 16px;
  margin-bottom: 12px;
}
.form-section legend {
  font-size: 15px;
  font-weight: 700;
  color: var(--text-heading);
  display: flex;
  align-items: center;
  gap: 8px;
}

.field-row { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin-bottom: 8px; }
.field { margin-bottom: 8px; }
.field label {
  display: block;
  font-size: 12px;
  font-weight: 600;
  color: var(--text-muted);
  margin-bottom: 4px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}
.field input, .field textarea, .field select {
  width: 100%;
  padding: 8px 10px;
  background: var(--input-bg);
  border: 1px solid var(--input-border);
  border-radius: 6px;
  color: var(--text);
  font-family: inherit;
  font-size: 14px;
  transition: border-color .2s;
}
.field input:focus, .field textarea:focus, .field select:focus {
  outline: none;
  border-color: var(--accent);
}
.char-count { font-size: 11px; color: var(--text-muted); text-align: right; display: block; margin-top: 2px; }

.btn-add {
  background: var(--accent);
  color: #fff;
  border: none;
  border-radius: 4px;
  padding: 2px 10px;
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  margin-left: auto;
}
.btn-add:hover { background: var(--accent-hover); }

.repeatable-item {
  background: var(--input-bg);
  border: 1px solid var(--input-border);
  border-radius: 6px;
  padding: 12px;
  margin-bottom: 8px;
  position: relative;
}
.btn-remove {
  position: absolute;
  top: 8px;
  right: 8px;
  background: #e74c3c;
  color: #fff;
  border: none;
  border-radius: 4px;
  width: 24px;
  height: 24px;
  font-size: 14px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
}
.btn-remove:hover { background: #c0392b; }

/* ===== PREVIEW PANEL ===== */
.preview-panel {
  position: sticky;
  top: 16px;
  align-self: start;
}
.preview-label {
  font-size: 12px;
  font-weight: 700;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 1px;
  margin-bottom: 8px;
  text-align: center;
}
.resume-preview {
  background: #fff;
  color: #222;
  width: 100%;
  aspect-ratio: 210 / 297;
  border-radius: 4px;
  box-shadow: 0 4px 24px rgba(0,0,0,0.3);
  overflow: hidden;
  font-size: 9px;
  line-height: 1.4;
  position: relative;
}

/* ===== RESUME STYLES (inside preview) ===== */
/* Classic */
.resume-classic {
  padding: 24px 28px;
  font-family: Georgia, 'Times New Roman', serif;
  height: 100%;
  overflow: hidden;
}
.resume-classic .r-name {
  text-align: center;
  font-size: 18px;
  font-weight: bold;
  color: #111;
  margin-bottom: 2px;
}
.resume-classic .r-title {
  text-align: center;
  font-size: 11px;
  color: #555;
  margin-bottom: 6px;
}
.resume-classic .r-contact {
  text-align: center;
  font-size: 8px;
  color: #666;
  margin-bottom: 12px;
  word-break: break-all;
}
.resume-classic .r-contact span { margin: 0 4px; }
.resume-classic .r-section-title {
  font-size: 11px;
  font-weight: bold;
  color: #111;
  border-bottom: 1px solid #333;
  padding-bottom: 2px;
  margin: 10px 0 6px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}
.resume-classic .r-exp-header {
  display: flex;
  justify-content: space-between;
  font-size: 9px;
  margin-bottom: 2px;
}
.resume-classic .r-exp-company { font-weight: bold; color: #222; }
.resume-classic .r-exp-date { color: #666; font-style: italic; }
.resume-classic .r-exp-position { font-style: italic; color: #444; font-size: 8.5px; margin-bottom: 2px; }
.resume-classic .r-exp-desc { font-size: 8px; color: #444; margin-bottom: 6px; white-space: pre-line; }
.resume-classic .r-edu-line { font-size: 8.5px; margin-bottom: 3px; }
.resume-classic .r-skills { font-size: 8px; color: #444; }
.resume-classic .r-summary { font-size: 8.5px; color: #444; margin-bottom: 4px; }
.resume-classic .r-custom-content { font-size: 8px; color: #444; white-space: pre-line; }

/* Modern */
.resume-modern {
  display: flex;
  height: 100%;
  font-family: 'Inter', sans-serif;
  overflow: hidden;
}
.resume-modern .r-sidebar {
  width: 35%;
  background: #1a5c34;
  color: #fff;
  padding: 20px 12px;
  font-size: 8px;
}
.resume-modern .r-sidebar .r-photo {
  width: 56px;
  height: 56px;
  border-radius: 50%;
  background: rgba(255,255,255,0.2);
  margin: 0 auto 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 20px;
  color: rgba(255,255,255,0.5);
}
.resume-modern .r-sidebar .r-name {
  text-align: center;
  font-size: 12px;
  font-weight: 700;
  margin-bottom: 2px;
}
.resume-modern .r-sidebar .r-title {
  text-align: center;
  font-size: 8px;
  opacity: 0.8;
  margin-bottom: 14px;
}
.resume-modern .r-sidebar .r-section-title {
  font-size: 9px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin: 10px 0 6px;
  border-bottom: 1px solid rgba(255,255,255,0.3);
  padding-bottom: 2px;
}
.resume-modern .r-sidebar .r-contact-item {
  margin-bottom: 4px;
  font-size: 7px;
  word-break: break-all;
}
.resume-modern .r-skill-bar {
  margin-bottom: 5px;
}
.resume-modern .r-skill-bar .r-skill-name {
  font-size: 7.5px;
  margin-bottom: 2px;
}
.resume-modern .r-skill-bar .r-bar {
  height: 4px;
  background: rgba(255,255,255,0.2);
  border-radius: 2px;
}
.resume-modern .r-skill-bar .r-bar-fill {
  height: 100%;
  background: #1DB954;
  border-radius: 2px;
}
.resume-modern .r-lang-item { font-size: 7.5px; margin-bottom: 3px; }
.resume-modern .r-main {
  flex: 1;
  padding: 20px 16px;
  color: #222;
  overflow: hidden;
}
.resume-modern .r-main .r-section-title {
  font-size: 10px;
  font-weight: 700;
  color: #1a5c34;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  border-bottom: 1px solid #ddd;
  padding-bottom: 2px;
  margin: 10px 0 6px;
}
.resume-modern .r-main .r-summary { font-size: 8px; color: #555; margin-bottom: 4px; }
.resume-modern .r-main .r-exp-header {
  display: flex;
  justify-content: space-between;
  font-size: 8.5px;
  margin-bottom: 1px;
}
.resume-modern .r-main .r-exp-company { font-weight: 700; color: #222; }
.resume-modern .r-main .r-exp-date { color: #888; font-size: 7.5px; }
.resume-modern .r-main .r-exp-position { font-size: 8px; color: #555; font-style: italic; margin-bottom: 2px; }
.resume-modern .r-main .r-exp-desc { font-size: 7.5px; color: #555; margin-bottom: 6px; white-space: pre-line; }
.resume-modern .r-main .r-edu-line { font-size: 8px; margin-bottom: 3px; }
.resume-modern .r-main .r-custom-content { font-size: 7.5px; color: #555; white-space: pre-line; }

/* Minimal */
.resume-minimal {
  padding: 28px 32px;
  font-family: 'Inter', sans-serif;
  height: 100%;
  overflow: hidden;
}
.resume-minimal .r-name {
  font-size: 20px;
  font-weight: 800;
  color: #111;
  margin-bottom: 2px;
}
.resume-minimal .r-title {
  font-size: 10px;
  color: #888;
  margin-bottom: 4px;
}
.resume-minimal .r-contact {
  font-size: 7.5px;
  color: #888;
  margin-bottom: 12px;
}
.resume-minimal .r-contact span { margin-right: 8px; }
.resume-minimal hr {
  border: none;
  border-top: 1px solid #ddd;
  margin: 8px 0;
}
.resume-minimal .r-section-title {
  font-size: 10px;
  font-weight: 700;
  color: #333;
  text-transform: uppercase;
  letter-spacing: 1px;
  margin-bottom: 6px;
}
.resume-minimal .r-summary { font-size: 8.5px; color: #555; margin-bottom: 4px; }
.resume-minimal .r-exp-header {
  display: flex;
  justify-content: space-between;
  font-size: 8.5px;
  margin-bottom: 1px;
}
.resume-minimal .r-exp-company { font-weight: 700; color: #222; }
.resume-minimal .r-exp-date { color: #999; }
.resume-minimal .r-exp-position { font-size: 8px; color: #666; margin-bottom: 2px; }
.resume-minimal .r-exp-desc { font-size: 8px; color: #555; margin-bottom: 6px; white-space: pre-line; }
.resume-minimal .r-edu-line { font-size: 8px; margin-bottom: 3px; }
.resume-minimal .r-skills { font-size: 8px; color: #555; }
.resume-minimal .r-custom-content { font-size: 8px; color: #555; white-space: pre-line; }

/* ===== CONTENT SECTION ===== */
.content-section {
  padding: 48px 24px;
  max-width: 800px;
  margin: 0 auto;
}
.content-inner h2 {
  font-size: 1.5rem;
  color: var(--text-heading);
  margin-bottom: 16px;
}
.content-inner h3 {
  font-size: 1.1rem;
  color: var(--text-heading);
  margin: 24px 0 12px;
}
.content-inner p {
  margin-bottom: 12px;
  color: var(--text);
  font-size: 15px;
}
.content-inner ul {
  padding-left: 20px;
  margin-bottom: 16px;
}
.content-inner li {
  margin-bottom: 8px;
  font-size: 14px;
  color: var(--text);
}

/* FAQ */
.faq-list { margin-top: 16px; }
.faq-item {
  background: var(--card);
  border: 1px solid var(--card-border);
  border-radius: var(--radius);
  margin-bottom: 8px;
  overflow: hidden;
}
.faq-item summary {
  padding: 14px 16px;
  font-weight: 600;
  font-size: 15px;
  color: var(--text-heading);
  cursor: pointer;
  list-style: none;
}
.faq-item summary::before {
  content: '+';
  display: inline-block;
  width: 20px;
  font-weight: 700;
  color: var(--accent);
}
.faq-item[open] summary::before { content: '-'; }
.faq-item p {
  padding: 0 16px 14px 36px;
  font-size: 14px;
  color: var(--text-muted);
}

/* ===== FOOTER ===== */
.site-footer {
  background: var(--card);
  border-top: 1px solid var(--card-border);
  padding: 32px 24px;
  text-align: center;
}
.footer-inner { max-width: 800px; margin: 0 auto; }
.cross-links { margin-bottom: 16px; }
.cross-links h3 {
  font-size: 14px;
  color: var(--text-heading);
  margin-bottom: 8px;
}
.cross-links a {
  color: var(--accent);
  text-decoration: none;
  margin: 0 12px;
  font-size: 14px;
}
.cross-links a:hover { text-decoration: underline; }
.copyright { font-size: 12px; color: var(--text-muted); }

/* ===== RESPONSIVE ===== */
@media (max-width: 1100px) {
  .main-layout {
    grid-template-columns: 1fr;
  }
  .ad-sidebar { display: none; }
}

@media (max-width: 768px) {
  .builder-split {
    grid-template-columns: 1fr;
  }
  .preview-panel {
    position: static;
  }
  .form-panel {
    max-height: none;
  }
  .field-row {
    grid-template-columns: 1fr;
  }
  .hero h1 { font-size: 1.5rem; }
  .resume-preview {
    aspect-ratio: auto;
    min-height: 500px;
  }
}

/* ===== PRINT ===== */
@media print {
  body {
    background: #fff !important;
    margin: 0 !important;
    padding: 0 !important;
  }
  .site-header,
  .hero,
  .template-selector,
  .ad-sidebar,
  .form-panel,
  .preview-label,
  .form-actions-top,
  .content-section,
  .site-footer,
  .theme-toggle {
    display: none !important;
  }
  .main-layout {
    display: block !important;
  }
  .builder-split {
    display: block !important;
  }
  .preview-panel {
    position: static !important;
    width: 100% !important;
  }
  .resume-preview {
    width: 210mm !important;
    height: 297mm !important;
    aspect-ratio: auto !important;
    box-shadow: none !important;
    border-radius: 0 !important;
    margin: 0 !important;
    font-size: 11px !important;
  }
  .resume-classic { padding: 32px 36px !important; }
  .resume-classic .r-name { font-size: 22px !important; }
  .resume-classic .r-section-title { font-size: 13px !important; }
  .resume-classic .r-exp-header { font-size: 11px !important; }
  .resume-classic .r-exp-desc, .resume-classic .r-skills, .resume-classic .r-summary { font-size: 10px !important; }
  .resume-classic .r-contact { font-size: 9px !important; }
  .resume-classic .r-edu-line { font-size: 10px !important; }
  .resume-classic .r-exp-position { font-size: 10px !important; }

  .resume-modern .r-sidebar { padding: 28px 16px !important; }
  .resume-modern .r-sidebar .r-name { font-size: 16px !important; }
  .resume-modern .r-sidebar .r-section-title { font-size: 11px !important; }
  .resume-modern .r-sidebar .r-contact-item { font-size: 9px !important; }
  .resume-modern .r-skill-bar .r-skill-name { font-size: 9px !important; }
  .resume-modern .r-lang-item { font-size: 9px !important; }
  .resume-modern .r-main { padding: 28px 20px !important; }
  .resume-modern .r-main .r-section-title { font-size: 12px !important; }
  .resume-modern .r-main .r-summary { font-size: 10px !important; }
  .resume-modern .r-main .r-exp-header { font-size: 10px !important; }
  .resume-modern .r-main .r-exp-desc { font-size: 9px !important; }
  .resume-modern .r-main .r-edu-line { font-size: 10px !important; }
  .resume-modern .r-sidebar .r-photo { width: 72px !important; height: 72px !important; }

  .resume-minimal { padding: 36px 40px !important; }
  .resume-minimal .r-name { font-size: 24px !important; }
  .resume-minimal .r-section-title { font-size: 12px !important; }
  .resume-minimal .r-exp-header { font-size: 10px !important; }
  .resume-minimal .r-exp-desc, .resume-minimal .r-skills, .resume-minimal .r-summary { font-size: 10px !important; }
  .resume-minimal .r-contact { font-size: 9px !important; }
  .resume-minimal .r-edu-line { font-size: 10px !important; }
}
