/*
==================================================
CV BUILDER PRO - MAIN STYLESHEET
Theme: Pakistani Professional (Dark UI + A4 Print)
==================================================
*/

:root {
  /* Base Canvas (Dark Mode UI) */
  --bg-dark: #06060d;
  --glass-bg: rgba(18, 18, 30, 0.75);
  --glass-hover: rgba(28, 28, 45, 0.75);
  
  /* Text Hierarchy */
  --text-primary: #e8e8f0;
  --text-secondary: #b0b0c0;
  --text-muted: #6b6b80;
  
  /* Accent Core */
  --accent-main: #6c5ce7;
  --accent-teal: #0d7377;
  --accent-gold: #c9a84c;
  
  /* Semantic Colors */
  --color-success: #00cec9;
  --color-warning: #fdcb6e;
  --color-danger: #e17055;
  
  /* Glass Borders */
  --border-subtle: rgba(255, 255, 255, 0.06);
  --border-medium: rgba(255, 255, 255, 0.12);
  --border-glow: rgba(255, 255, 255, 0.2);
  
  /* Default CV Variable (Overwritten by JS) */
  --cv-accent: #6c5ce7;
  
  /* Add these for the searchable dropdown compatibility */
  --font-ui: 'Inter', system-ui, sans-serif;
  --bg-card-solid: rgba(22, 22, 38, 0.95);
  --accent-2: #a29bfe;
  --transition-fast: 0.15s cubic-bezier(0.4, 0, 0.2, 1);
  --shadow-lg: 0 20px 60px rgba(0, 0, 0, 0.5);
  --blur-glass: blur(20px) saturate(130%);
  --radius-md: 14px;
  --accent: var(--accent-main);  /* alias so dropdown references work */
}

/* ==================== GLOBAL ==================== */
html {
  font-size: 15px;
  box-sizing: border-box;
}

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

body {
  font-family: 'Inter', system-ui, sans-serif;
  background-color: var(--bg-dark);
  color: var(--text-primary);
  min-height: 100vh;
  overflow: hidden;
  position: relative;
}

/* Custom Scrollbars */
::-webkit-scrollbar {
  width: 8px;
  height: 8px;
}
::-webkit-scrollbar-track {
  background: transparent;
}
::-webkit-scrollbar-thumb {
  background: var(--border-medium);
  border-radius: 4px;
}
::-webkit-scrollbar-thumb:hover {
  background: var(--border-glow);
}

.hidden {
  opacity: 0 !important;
  visibility: hidden !important;
  pointer-events: none !important;
}

/* ==================== BACKGROUND ORBS ==================== */
.bg-orb {
  position: absolute;
  border-radius: 50%;
  filter: blur(80px);
  z-index: -1;
  opacity: 0.5;
  animation: floatOrb infinite alternate linear;
}
.bg-orb-1 {
  width: 40vw; height: 40vw;
  max-width: 500px; max-height: 500px;
  background: var(--accent-main);
  top: -10%; left: -5%;
  animation-duration: 18s;
}
.bg-orb-2 {
  width: 35vw; height: 35vw;
  max-width: 400px; max-height: 400px;
  background: var(--accent-teal);
  bottom: -10%; right: 5%;
  animation-duration: 22s;
}
.bg-orb-3 {
  width: 25vw; height: 25vw;
  max-width: 300px; max-height: 300px;
  background: rgba(201, 168, 76, 0.4); /* Pink shifted to soft gold/pink blend */
  top: 40%; left: 40%;
  animation-duration: 20s;
  opacity: 0.3;
}

@keyframes floatOrb {
  0% { transform: translate(0, 0) scale(1); }
  100% { transform: translate(50px, 40px) scale(1.1); }
}

/* ==================== BUTTONS & INPUTS ==================== */
.btn {
  font-family: inherit;
  font-size: 0.9rem;
  font-weight: 500;
  padding: 0.6rem 1.2rem;
  border-radius: 8px;
  cursor: pointer;
  transition: all 0.2s cubic-bezier(0.25, 0.8, 0.25, 1);
  border: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
}
.btn:active {
  transform: scale(0.97);
}
.btn-sm {
  padding: 0.4rem 0.8rem;
  font-size: 0.85rem;
}

.btn-primary {
  background: linear-gradient(135deg, var(--accent-main), #8e7dff);
  color: #fff;
  box-shadow: 0 4px 15px rgba(108, 92, 231, 0.3);
}
.btn-primary:hover {
  box-shadow: 0 6px 20px rgba(108, 92, 231, 0.5);
  transform: translateY(-1px);
}

.btn-secondary {
  background: rgba(255, 255, 255, 0.05);
  color: var(--text-primary);
  border: 1px solid var(--border-subtle);
}
.btn-secondary:hover {
  background: rgba(255, 255, 255, 0.1);
  border-color: var(--border-medium);
}

.btn-accent-outline {
  background: transparent;
  color: var(--text-secondary);
  border: 2px solid var(--border-subtle);
}
.btn-accent-outline.active, .btn-accent-outline:hover {
  background: rgba(108, 92, 231, 0.15);
  color: #fff;
  border-color: var(--accent-main);
  box-shadow: 0 0 15px rgba(108, 92, 231, 0.2);
}

.btn-danger {
  background: rgba(225, 112, 85, 0.1);
  color: var(--color-danger);
  border: 1px solid rgba(225, 112, 85, 0.3);
}
.btn-danger:hover {
  background: var(--color-danger);
  color: #fff;
}

input, textarea, select {
  width: 100%;
  background: rgba(0, 0, 0, 0.3);
  border: 1px solid var(--border-subtle);
  color: var(--text-primary);
  border-radius: 8px;
  padding: 0.6rem 0.8rem;
  font-size: 0.85rem;
  font-family: inherit;
  transition: all 0.2s ease;
  outline: none;
}
input:focus, textarea:focus, select:focus {
  border-color: var(--accent-main);
  box-shadow: 0 0 0 3px rgba(108, 92, 231, 0.2);
  background: rgba(0, 0, 0, 0.5);
}
input::placeholder, textarea::placeholder {
  color: var(--text-muted);
}
select option {
  background: var(--bg-dark);
  color: var(--text-primary);
}

label {
  display: block;
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-secondary);
  margin-bottom: 0.4rem;
  font-weight: 600;
}

/* ==================== AUTH OVERLAY ==================== */
.auth-overlay {
  position: fixed;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(6, 6, 13, 0.8);
  backdrop-filter: blur(12px);
  z-index: 1000;
  transition: opacity 0.4s ease, visibility 0.4s ease;
}
.auth-card {
  background: var(--glass-bg);
  border: 1px solid var(--border-medium);
  border-radius: 24px;
  padding: 2.5rem;
  max-width: 440px;
  width: 90%;
  text-align: center;
  box-shadow: 0 20px 40px rgba(0,0,0,0.5), inset 0 0 20px rgba(108, 92, 231, 0.05);
  animation: cardEnter 0.6s cubic-bezier(0.175, 0.885, 0.32, 1.275) forwards;
}
.auth-icon {
  width: 64px;
  height: 64px;
  border-radius: 16px;
  background: linear-gradient(135deg, var(--accent-main), var(--accent-teal));
  margin: 0 auto 1.5rem;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.8rem;
  color: #fff;
  box-shadow: 0 8px 20px rgba(13, 115, 119, 0.3);
}
.auth-card h2 { margin-bottom: 0.5rem; font-weight: 700; font-size: 1.5rem; }
.auth-card p { color: var(--text-secondary); font-size: 0.9rem; margin-bottom: 1.5rem; }
.auth-card .input-group { margin-bottom: 1.5rem; }
.auth-note { font-size: 0.75rem !important; color: var(--text-muted) !important; margin-top: 1.5rem; margin-bottom: 0 !important; }

@keyframes cardEnter {
  from { transform: translateY(30px) scale(0.95); opacity: 0; }
  to { transform: translateY(0) scale(1); opacity: 1; }
}

/* ==================== APP CONTAINER & TOP BAR ==================== */
.app-container {
  display: flex;
  flex-direction: column;
  height: 100vh;
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.5s ease 0.2s;
}
.app-container.active {
  opacity: 1;
  visibility: visible;
}

.top-bar {
  background: var(--glass-bg);
  backdrop-filter: blur(16px);
  border-bottom: 1px solid var(--border-subtle);
  padding: 0.75rem 1.5rem;
  display: flex;
  align-items: center;
  gap: 1rem;
  flex-wrap: wrap;
  z-index: 100;
}

.logo {
  font-weight: 800;
  font-size: 1.2rem;
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin-right: auto;
  background: linear-gradient(to right, var(--text-primary), var(--text-secondary));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}
.logo i {
  background: linear-gradient(135deg, var(--accent-main), var(--accent-teal));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}

.industry-select {
  width: auto;
  min-width: 200px;
  background: rgba(0,0,0,0.4);
  border-radius: 20px;
  padding: 0.4rem 1rem;
}

.badge {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.4rem 0.8rem;
  border-radius: 20px;
  font-size: 0.85rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s ease;
}
.badge-credits {
  background: rgba(201, 168, 76, 0.1);
  color: var(--accent-gold);
  border: 1px solid rgba(201, 168, 76, 0.3);
}
.badge-credits:hover {
  background: rgba(201, 168, 76, 0.2);
  border-color: var(--accent-gold);
}

.top-bar .btn-primary[onclick="exportPDF()"] {
  border: 1px solid var(--accent-gold);
  background: linear-gradient(135deg, var(--accent-main), var(--accent-teal));
}

/* ==================== MAIN CONTENT ==================== */
.main-content {
  display: flex;
  flex: 1;
  overflow: hidden;
}

/* --------- FORM PANEL (LEFT) --------- */
.form-panel {
  width: 48%;
  min-width: 380px;
  background: rgba(6, 6, 13, 0.4);
  border-right: 1px solid var(--border-subtle);
  display: flex;
  flex-direction: column;
}

.section-nav {
  display: flex;
  overflow-x: auto;
  padding: 1rem;
  gap: 0.5rem;
  border-bottom: 1px solid var(--border-subtle);
}
.section-nav button {
  background: var(--glass-bg);
  border: 1px solid var(--border-subtle);
  color: var(--text-secondary);
  padding: 0.5rem 1rem;
  border-radius: 20px;
  white-space: nowrap;
  font-size: 0.85rem;
  cursor: pointer;
  transition: all 0.2s ease;
}
.section-nav button:hover {
  background: var(--glass-hover);
  color: var(--text-primary);
}
.section-nav button.active {
  background: var(--accent-main);
  color: #fff;
  border-color: var(--accent-main);
  box-shadow: 0 0 10px rgba(108, 92, 231, 0.3);
}

#formSections {
  flex: 1;
  overflow-y: auto;
  padding: 1.5rem;
}

.form-section {
  display: none;
  animation: fadeIn 0.4s ease forwards;
}
.form-section.active { display: block; }

@keyframes fadeIn {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: translateY(0); }
}

.form-section h3 {
  font-size: 1.1rem;
  font-weight: 600;
  margin-bottom: 1.5rem;
  color: var(--text-primary);
  border-bottom: 1px solid var(--border-subtle);
  padding-bottom: 0.5rem;
}

.form-group {
  margin-bottom: 1.2rem;
  flex: 1;
}
.form-row {
  display: flex;
  gap: 1rem;
}

.photo-upload {
  display: flex;
  align-items: center;
  gap: 1.5rem;
  margin-bottom: 1.5rem;
}
.photo-preview {
  width: 80px;
  height: 80px;
  border-radius: 50%;
  object-fit: cover;
  border: 2px solid var(--accent-main);
  box-shadow: 0 0 15px rgba(108, 92, 231, 0.3);
}

.dynamic-entry {
  background: var(--glass-bg);
  border: 1px solid var(--border-subtle);
  border-radius: 12px;
  padding: 1.2rem;
  margin-bottom: 1rem;
  position: relative;
  transition: all 0.3s ease;
}
.dynamic-entry:hover {
  background: var(--glass-hover);
  border-color: var(--border-medium);
  transform: translateY(-2px);
  box-shadow: 0 4px 15px rgba(0,0,0,0.2);
}
.remove-entry {
  position: absolute;
  top: 0.8rem;
  right: 0.8rem;
  background: transparent;
  border: none;
  color: var(--color-danger);
  cursor: pointer;
  opacity: 0.6;
  transition: opacity 0.2s;
  font-size: 1.1rem;
}
.remove-entry:hover { opacity: 1; }

/* --------- PREVIEW PANEL (RIGHT) --------- */
.preview-panel {
  flex: 1;
  background: rgba(0, 0, 0, 0.2);
  display: flex;
  justify-content: center;
  align-items: flex-start;
  padding: 2rem;
  overflow-y: auto;
}

.cv-page {
  background: #ffffff;
  width: 210mm;
  min-height: 297mm;
  box-shadow: 0 10px 40px rgba(0,0,0,0.5);
  border-radius: 4px; /* Dynamic via JS but 4px default */
  color: #333;
  font-size: 16px; /* Base for em scaling */
  overflow: hidden;
  transition: all 0.3s ease;
}

.cv-inner {
  display: flex;
  min-height: 297mm;
  width: 100%;
}

/* CV Sidebar */
.cv-sidebar {
  width: 35%;
  background-color: #f8f9fc;
  padding: 2.5em 2em;
  border-right: 1px solid rgba(0,0,0,0.05);
  display: flex;
  flex-direction: column;
  gap: 2.5em;
  color: #4a4a4a;
}
.cv-photo-section { text-align: center; }
.cv-photo {
  width: 130px;
  height: 130px;
  border-radius: 50%;
  object-fit: cover;
  margin-bottom: 1.2em;
  border: 4px solid var(--cv-accent);
}
.cv-name {
  font-size: 1.8em;
  font-weight: 700;
  color: #1a1a1a;
  line-height: 1.2;
  margin-bottom: 0.3em;
}
.cv-title-role {
  font-size: 1em;
  color: var(--cv-accent);
  font-weight: 600;
  letter-spacing: 0.03em;
}

.cv-contact-details {
  display: flex;
  flex-direction: column;
  gap: 0.9em;
  font-size: 0.9em;
}
.cv-contact-item {
  display: flex;
  align-items: center;
  gap: 0.8em;
  word-break: break-word;
}
.cv-icon {
  color: var(--cv-accent);
  width: 1.2em;
  text-align: center;
  font-size: 1.1em;
}

.cv-sidebar-heading {
  font-size: 1.1em;
  font-weight: 700;
  color: #1a1a1a;
  margin-bottom: 1.2em;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.cv-skill-item { margin-bottom: 1em; font-size: 0.9em; }
.cv-skill-name { margin-bottom: 0.4em; font-weight: 600; color: #333; }
.cv-skill-bar {
  background: #e0e0e0;
  border-radius: 0.175em;
  height: 0.35em;
  overflow: hidden;
}
.cv-skill-fill {
  height: 100%;
  border-radius: 0.175em;
  transition: width 0.5s ease-in-out;
}

.cv-language-item { margin-bottom: 0.8em; font-size: 0.9em; }
.cv-empty { font-size: 0.85em; color: #999; font-style: italic; }

/* CV Main Content */
.cv-main {
  width: 65%;
  padding: 3em;
  background: #ffffff;
  display: flex;
  flex-direction: column;
  gap: 2.2em;
}

.cv-section-heading {
  font-size: 1.4em;
  color: #1a1a1a;
  margin-bottom: 1.2em;
  padding-bottom: 0.4em;
  border-bottom: 1px solid var(--accent-gold);
  position: relative;
}
.cv-section-heading::after {
  content: '';
  position: absolute;
  left: 0;
  bottom: -1px;
  width: 40px;
  height: 2px;
  background: var(--cv-accent);
}

.cv-summary {
  font-size: 0.95em;
  line-height: 1.6;
  color: #444;
}

.cv-entry { margin-bottom: 1.5em; }
.cv-entry:last-child { margin-bottom: 0; }
.cv-entry-title {
  font-size: 1.1em;
  font-weight: 700;
  color: #1a1a1a;
}
.cv-entry-sub {
  font-size: 0.9em;
  color: #666;
  margin-top: 0.2em;
  margin-bottom: 0.5em;
  font-weight: 500;
}
.cv-entry-desc {
  font-size: 0.9em;
  line-height: 1.5;
  color: #444;
}

/* ==================== TEMPLATE VARIATIONS ==================== */
/* Classic is default */

/* Modern: Dark sidebar */
.cv-page.modern .cv-sidebar {
  background-color: #1f2937;
  color: #e5e7eb;
}
.cv-page.modern .cv-name, .cv-page.modern .cv-sidebar-heading { color: #ffffff; }
.cv-page.modern .cv-title-role, .cv-page.modern .cv-icon { color: var(--cv-accent); filter: brightness(1.2); }
.cv-page.modern .cv-skill-name { color: #e5e7eb; }
.cv-page.modern .cv-skill-bar { background: rgba(255,255,255,0.15); }

/* Creative: Bold headers */
.cv-page.creative .cv-section-heading {
  border-bottom: none;
  display: inline-block;
  background: var(--cv-accent);
  color: #fff;
  padding: 0.2em 0.6em;
  border-radius: 4px;
}
.cv-page.creative .cv-section-heading::after { display: none; }
.cv-page.creative .cv-photo { border-radius: 12px; }

/* ==================== MODALS ==================== */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(6, 6, 13, 0.7);
  backdrop-filter: blur(8px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 2000;
  opacity: 0;
  visibility: hidden;
  transition: all 0.3s ease;
}
.modal-overlay.active {
  opacity: 1;
  visibility: visible;
}
.modal {
  background: var(--glass-bg);
  border: 1px solid var(--border-medium);
  border-radius: 24px;
  padding: 2rem;
  width: 90%;
  max-width: 420px;
  box-shadow: 0 10px 30px rgba(0,0,0,0.5);
  transform: translateY(30px) scale(0.95);
  transition: all 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}
.modal-overlay.active .modal {
  transform: translateY(0) scale(1);
}

.modal h3 { font-size: 1.25rem; margin-bottom: 0.5rem; display: flex; align-items: center; gap: 0.5rem; }
.modal p { color: var(--text-secondary); font-size: 0.9rem; margin-bottom: 1.5rem; }

.payment-option {
  background: rgba(0,0,0,0.3);
  border: 1px solid var(--border-subtle);
  border-radius: 12px;
  padding: 1rem;
  display: flex;
  align-items: center;
  gap: 1rem;
  cursor: pointer;
  margin-bottom: 1rem;
  transition: all 0.2s ease;
}
.payment-option:hover {
  background: rgba(108, 92, 231, 0.1);
  border-color: var(--accent-main);
  transform: translateY(-2px);
}
.pay-icon {
  width: 48px;
  height: 48px;
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.4rem;
  background: var(--glass-bg);
}
.payment-option[onclick*="JazzCash"] .pay-icon { color: #e17055; text-shadow: 0 0 10px rgba(225,112,85,0.4); } /* Adjust to Jazzcash subtle hints */
.payment-option[onclick*="EasyPaisa"] .pay-icon { color: #00cec9; text-shadow: 0 0 10px rgba(0,206,201,0.4); }
.pay-info { flex: 1; display: flex; flex-direction: column; }
.pay-info strong { font-size: 0.95rem; color: var(--text-primary); }
.pay-info span { font-size: 0.75rem; color: var(--text-secondary); }
.pay-credits {
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--accent-gold);
  background: rgba(201, 168, 76, 0.1);
  padding: 0.3rem 0.6rem;
  border-radius: 12px;
}

#customizationModal input[type="color"] {
  padding: 0;
  height: 40px;
  border: none;
  border-radius: 8px;
  cursor: pointer;
}
#customizationModal input[type="color"]::-webkit-color-swatch-wrapper { padding: 0; }
#customizationModal input[type="color"]::-webkit-color-swatch { border: none; border-radius: 8px; }

/* ==================== TOASTS ==================== */
.toast-container {
  position: fixed;
  top: 20px;
  right: 20px;
  z-index: 3000;
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.toast {
  background: var(--glass-bg);
  backdrop-filter: blur(10px);
  border: 1px solid var(--border-subtle);
  color: var(--text-primary);
  padding: 1rem 1.5rem;
  border-radius: 8px;
  box-shadow: 0 5px 15px rgba(0,0,0,0.3);
  font-size: 0.9rem;
  animation: slideInRight 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275) forwards, slideOutRight 0.3s ease forwards 2.5s;
}
.toast.success { border-left: 4px solid var(--color-success); }
.toast.error { border-left: 4px solid var(--color-danger); }

@keyframes slideInRight {
  from { transform: translateX(120%); opacity: 0; }
  to { transform: translateX(0); opacity: 1; }
}
@keyframes slideOutRight {
  from { transform: translateX(0); opacity: 1; }
  to { transform: translateX(120%); opacity: 0; }
}

/* ==================== RESPONSIVE (Enhanced) ==================== */
/* Tablet and below */
@media (max-width: 900px) {
  .main-content {
    flex-direction: column;
  }
  .form-panel {
    width: 100%;
    height: 50vh;
    min-width: 0;
    border-right: none;
    border-bottom: 1px solid var(--border-subtle);
  }
  .preview-panel {
    height: 50vh;
    padding: 1rem;
  }
  .cv-page {
    transform: scale(0.7);
    transform-origin: top center;
  }
  .top-bar {
    justify-content: center;
  }
  .logo {
    margin: 0 auto 0.5rem auto;
    width: 100%;
    text-align: center;
    justify-content: center;
  }
  .template-switcher {
    justify-content: center;
  }
  /* Section nav: still horizontal but better for touch */
  .section-nav {
    padding: 0.8rem 1rem;
    gap: 0.4rem;
    flex-wrap: nowrap;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
  }
  .section-nav button {
    padding: 0.4rem 0.8rem;
    font-size: 0.8rem;
    flex-shrink: 0;
  }
}

/* Small mobile (≤ 500px) */
@media (max-width: 500px) {
  .top-bar {
    padding: 0.5rem;
    gap: 0.4rem;
  }
  .logo {
    font-size: 1rem;
    margin-bottom: 0.3rem;
  }
  .cv-page {
    transform: scale(0.5);
    transform-origin: top center;
  }
  .form-panel {
    height: 45vh;
  }
  .preview-panel {
    height: 55vh;
    padding: 0.5rem;
  }
  .form-row {
    flex-direction: column;
    gap: 0;
  }
  .industry-select {
    width: 100%;
  }
  /* Hide some less-essential template buttons on very small screens */
  .template-switcher .btn[data-template="academic"],
  .template-switcher .btn[data-template="infographic"],
  .template-switcher .btn[data-template="creative2"],
  .template-switcher .btn[data-template="executive"] {
    display: none;
  }

  /* Floating preview toggle button */
  .preview-toggle-btn {
    display: flex;
    position: fixed;
    bottom: 20px;
    right: 20px;
    z-index: 500;
    background: var(--accent-main);
    color: #fff;
    border: none;
    width: 50px;
    height: 50px;
    border-radius: 50%;
    align-items: center;
    justify-content: center;
    font-size: 1.2rem;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.4);
    cursor: pointer;
  }

  /* When preview is hidden, show form full screen */
  .app-container.preview-hidden .preview-panel {
    display: none;
  }
  .app-container.preview-hidden .form-panel {
    height: 100vh;
  }
}

/* Hide toggle on larger screens */
.preview-toggle-btn {
  display: none;
}
@media (max-width: 500px) {
  .preview-toggle-btn {
    display: flex;
  }
}

/* ==================== PRINT STYLES ==================== */
@media print {
  body * {
    visibility: hidden;
  }
  body, html {
    background: white;
    height: 100%;
    margin: 0;
    padding: 0;
    overflow: visible;
  }
  .cv-page, .cv-page * {
    visibility: visible;
  }
  .cv-page {
    position: absolute;
    left: 0;
    top: 0;
    box-shadow: none;
    border: none;
    border-radius: 0 !important;
    width: 210mm;
    min-height: 297mm;
    margin: 0;
    padding: 0;
    transform: none !important;
  }
  .cv-sidebar {
    -webkit-print-color-adjust: exact !important;
    print-color-adjust: exact !important;
  }
  .cv-skill-fill {
    -webkit-print-color-adjust: exact !important;
    print-color-adjust: exact !important;
  }
  .cv-page.creative .cv-section-heading {
    -webkit-print-color-adjust: exact !important;
    print-color-adjust: exact !important;
  }
}

/* ================= SEARCHABLE INDUSTRY SELECT ================= */
.searchable-select {
  position: relative;
  width: 260px;            /* adjust to match top bar spacing */
  font-family: var(--font-ui);
  font-size: 0.72rem;
  z-index: 50;
}

.search-input-wrap {
  display: flex;
  align-items: center;
  background: rgba(255,255,255,0.04);
  border: 1px solid var(--border-medium);
  border-radius: 20px;
  padding: 0.4rem 0.6rem;
  cursor: pointer;
  transition: all var(--transition-fast);
}
.search-input-wrap:hover { border-color: var(--border-glow); }
.search-input-wrap:focus-within {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(108,92,231,0.15);
}

.search-icon {
  color: var(--text-muted);
  font-size: 0.7rem;
  margin-right: 0.3rem;
  flex-shrink: 0;
}

.search-input-wrap input {
  flex: 1;
  background: transparent;
  border: none;
  outline: none;
  color: var(--text-primary);
  font-size: 0.72rem;
  font-family: inherit;
  padding: 0.15rem 0;
}
.search-input-wrap input::placeholder {
  color: var(--text-muted);
  font-size: 0.7rem;
}

.toggle-arrow {
  color: var(--text-muted);
  font-size: 0.65rem;
  margin-left: 0.3rem;
  cursor: pointer;
  transition: transform 0.2s;
}
.toggle-arrow.open { transform: rotate(180deg); }

.search-dropdown {
  position: absolute;
  top: 100%;
  left: 0;
  right: 0;
  margin-top: 4px;
  background: var(--bg-card-solid);
  border: 1px solid var(--border-medium);
  border-radius: var(--radius-md);
  max-height: 300px;
  overflow-y: auto;
  display: none;
  backdrop-filter: var(--blur-glass);
  box-shadow: var(--shadow-lg);
}
.search-dropdown.show { display: block; }

.search-dropdown .optgroup-label {
  padding: 0.5rem 0.8rem 0.3rem;
  font-size: 0.65rem;
  font-weight: 700;
  color: var(--accent-2);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  border-bottom: 1px solid var(--border-subtle);
  background: rgba(255,255,255,0.02);
}
.search-dropdown .option-item {
  padding: 0.45rem 0.8rem;
  font-size: 0.75rem;
  color: var(--text-primary);
  cursor: pointer;
  transition: background 0.12s;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.search-dropdown .option-item:hover,
.search-dropdown .option-item.active {
  background: rgba(108,92,231,0.15);
}
.search-dropdown .option-item mark {
  background: rgba(253,203,110,0.35);
  color: #fdcb6e;
  border-radius: 2px;
  padding: 0 1px;
}

/* Scrollbar for dropdown */
.search-dropdown::-webkit-scrollbar { width: 4px; }
.search-dropdown::-webkit-scrollbar-track { background: transparent; }
.search-dropdown::-webkit-scrollbar-thumb { background: rgba(255,255,255,0.15); border-radius: 4px; }

/* Selected item highlight */
.searchable-select .selected-highlight {
  background: rgba(108,92,231,0.2);
  font-weight: 600;
}

/* ── NEW TEMPLATES ── */
/* ATS Classic (ultra‑safe for parsers) */
.cv-page.ats-classic .cv-sidebar {
  width: 28%;
  background: #f0f2f5;
  border-right: 2px solid #d0d5dd;
}
.cv-page.ats-classic .cv-main {
  width: 72%;
  padding: 2.5em;
}
.cv-page.ats-classic .cv-photo { border-radius: 2px; }
.cv-page.ats-classic .cv-section-heading::after { height: 3px; }
.cv-page.ats-classic .cv-name { font-size: 2em; }

/* Executive (bold top header, no sidebar) */
.cv-page.executive .cv-inner {
  flex-direction: column;
}
.cv-page.executive .cv-sidebar {
  width: 100%;
  padding: 1.5em 2.5em;
  background: #1a1a1a;
  color: #fff;
  display: flex;
  flex-wrap: wrap;
  gap: 1.5em;
  align-items: center;
}
.cv-page.executive .cv-sidebar .cv-photo-section {
  text-align: left;
  flex: 1;
}
.cv-page.executive .cv-contact-details {
  flex: 2;
  flex-direction: row;
  gap: 2em;
}
.cv-page.executive .cv-sidebar-section {
  display: none;
}
.cv-page.executive .cv-main {
  width: 100%;
  padding: 2em 2.5em;
}
.cv-page.executive .cv-section-heading {
  border-bottom: 2px solid #000;
  font-size: 1.6em;
}

/* Minimalist (no sidebar, clean single column) */
.cv-page.minimal .cv-inner {
  flex-direction: column;
}
.cv-page.minimal .cv-sidebar {
  display: none;
}
.cv-page.minimal .cv-main {
  width: 100%;
  padding: 2.5em 3em;
}
.cv-page.minimal .cv-name {
  font-size: 2.5em;
  text-align: center;
  border-bottom: 2px solid var(--cv-accent);
  padding-bottom: 0.5em;
  margin-bottom: 1em;
}
.cv-page.minimal .cv-title-role {
  text-align: center;
  font-size: 1.2em;
  margin-bottom: 2em;
}
.cv-page.minimal .cv-contact-details {
  display: flex;
  justify-content: center;
  gap: 2em;
  margin-bottom: 2em;
}
.cv-page.minimal .cv-section-heading {
  font-size: 1.6em;
  border-bottom: none;
  text-transform: uppercase;
}
.cv-page.minimal .cv-section-heading::after {
  display: none;
}

/* Tech (monospace accents) */
.cv-page.tech .cv-sidebar {
  background: #0d1117;
  color: #c9d1d9;
}
.cv-page.tech .cv-main {
  background: #f6f8fa;
}
.cv-page.tech .cv-section-heading {
  font-family: 'JetBrains Mono', monospace;
  border-bottom: 2px dashed var(--cv-accent);
}
.cv-page.tech .cv-skill-fill {
  border-radius: 0;
}

/* Academic (serif fonts, traditional look) */
.cv-page.academic .cv-sidebar {
  width: 32%;
  background: #faf9f6;
  border-right: 3px solid var(--cv-accent);
}
.cv-page.academic .cv-main {
  width: 68%;
  font-family: 'Playfair Display', serif;
}
.cv-page.academic .cv-section-heading {
  font-family: 'Playfair Display', serif;
  border-bottom: 1px solid #333;
}
.cv-page.academic .cv-name {
  font-family: 'Playfair Display', serif;
}

/* Infographic (visual bars, big icons) – we will use extra classes in JS to render differently */
/* We'll handle this template via dynamic JS, just CSS classes for now */
.cv-page.infographic .cv-inner {
  flex-direction: column;
}
.cv-page.infographic .cv-sidebar {
  width: 100%;
  padding: 1em;
  background: var(--cv-accent);
  color: #fff;
  display: flex;
  justify-content: space-between;
  align-items: center;
}
.cv-page.infographic .cv-photo { width: 60px; height: 60px; margin: 0; }
.cv-page.infographic .cv-sidebar-section { display: none; }
.cv-page.infographic .cv-main {
  width: 100%;
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
}
.cv-page.infographic .cv-section {
  width: 45%;
  margin-bottom: 1.5em;
}
.cv-page.infographic .cv-section-heading {
  font-size: 1.3em;
  border: none;
  margin-bottom: 0.5em;
}
.cv-page.infographic .cv-section-heading::after { display: none; }

/* Creative 2 (reverse layout) */
.cv-page.creative2 .cv-inner {
  flex-direction: row-reverse;
}
.cv-page.creative2 .cv-sidebar {
  width: 30%;
  background: #fef9ef;
}
.cv-page.creative2 .cv-main {
  width: 70%;
  padding: 3em;
}
.cv-page.creative2 .cv-section-heading {
  font-weight: 300;
  letter-spacing: 2px;
}

/* ========== ENHANCED UI/UX ========== */
/* Softer top bar */
.top-bar {
  padding: 0.5rem 1rem;
  gap: 0.75rem;
}

/* Template switcher container */
.template-switcher {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
}

/* Subtle card hover lift on dynamic entries */
.dynamic-entry {
  transition: transform 0.2s, box-shadow 0.2s;
}
.dynamic-entry:hover {
  transform: translateY(-1px);
  box-shadow: 0 8px 25px rgba(0,0,0,0.25);
}

/* Rounded inputs & selects */
input, textarea, select {
  border-radius: 10px;
}

/* Section nav polished */
.section-nav button {
  transition: all 0.15s ease;
}
.section-nav button:hover {
  background: var(--glass-hover);
  color: #fff;
  transform: translateY(-1px);
}

/* Button active scale */
.btn:active {
  transform: scale(0.96);
}

/* Smooth fade on modal */
.modal-overlay {
  transition: opacity 0.25s ease;
}

/* Preview panel subtle grid background */
.preview-panel {
  background: repeating-linear-gradient(
    0deg,
    transparent,
    transparent 10px,
    rgba(255,255,255,0.015) 10px,
    rgba(255,255,255,0.015) 20px
  );
}

/* ==================== ACHIEVEMENT / EXAMPLE GUIDANCE ==================== */
/* Lightbulb example button */
.btn-example {
  background: none;
  border: none;
  color: var(--accent-gold);
  cursor: pointer;
  font-size: 0.9rem;
  margin-left: 0.3rem;
  vertical-align: middle;
  transition: color 0.2s;
  line-height: 1;
}
.btn-example:hover {
  color: #fdcb6e;
}

/* Floating global tooltip for examples */
#globalExampleTooltip {
  position: fixed;
  z-index: 999;
  background: rgba(30, 30, 45, 0.98);
  border: 1px solid var(--accent-gold);
  border-radius: 8px;
  padding: 0.8rem;
  font-size: 0.8rem;
  color: var(--text-secondary);
  white-space: pre-line;
  max-width: 300px;
  box-shadow: 0 8px 20px rgba(0,0,0,0.6);
  backdrop-filter: blur(10px);
  animation: fadeIn 0.15s ease;
  display: none;
}