/* ============================================================
   main.css
   Lebenslauf CV Builder
   Nile Bridge Group - nilebridgegroup.co.ke/lebenslauf
   ============================================================ */

/* ============================================================
   CSS Custom Properties
   ============================================================ */

:root {
  /* Colors */
  --color-primary:       #0A1F44;
  --color-primary-light: #112a5e;
  --color-accent:        #C9952A;
  --color-accent-light:  #e0aa3e;
  --color-bg:            #F7F8FA;
  --color-white:         #FFFFFF;
  --color-text:          #1C1C1E;
  --color-text-muted:    #6B7280;
  --color-border:        #E5E7EB;
  --color-success:       #22C55E;
  --color-error:         #EF4444;
  --color-overlay:       rgba(10, 31, 68, 0.72);

  /* Typography */
  --font-main:    'Inter', 'Segoe UI', Arial, sans-serif;
  --font-cv:      'Georgia', 'Times New Roman', serif;
  --font-size-xs: 0.75rem;
  --font-size-sm: 0.875rem;
  --font-size-md: 1rem;
  --font-size-lg: 1.125rem;
  --font-size-xl: 1.25rem;
  --font-size-2xl: 1.5rem;
  --font-size-3xl: 1.875rem;

  /* Spacing */
  --space-1:  0.25rem;
  --space-2:  0.5rem;
  --space-3:  0.75rem;
  --space-4:  1rem;
  --space-5:  1.25rem;
  --space-6:  1.5rem;
  --space-8:  2rem;
  --space-10: 2.5rem;
  --space-12: 3rem;
  --space-16: 4rem;

  /* Borders */
  --radius-sm: 4px;
  --radius-md: 8px;
  --radius-lg: 12px;
  --radius-xl: 16px;
  --radius-full: 9999px;

  /* Shadows */
  --shadow-sm: 0 1px 3px rgba(0,0,0,0.08), 0 1px 2px rgba(0,0,0,0.04);
  --shadow-md: 0 4px 12px rgba(0,0,0,0.10), 0 2px 4px rgba(0,0,0,0.06);
  --shadow-lg: 0 10px 30px rgba(0,0,0,0.12), 0 4px 8px rgba(0,0,0,0.06);
  --shadow-xl: 0 20px 50px rgba(0,0,0,0.15);

  /* Transitions */
  --transition-fast:   150ms ease;
  --transition-normal: 250ms ease;
  --transition-slow:   400ms ease;

  /* Layout */
  --topbar-height:    64px;
  --bottombar-height: 68px;
  --form-width:       480px;
  --preview-width:    calc(100% - var(--form-width));
  --sidebar-width:    260px;
}

/* ============================================================
   Reset and Base
   ============================================================ */

*,
*::before,
*::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html {
  font-size: 16px;
  scroll-behavior: smooth;
  -webkit-text-size-adjust: 100%;
}

body {
  font-family: var(--font-main);
  font-size: var(--font-size-md);
  color: var(--color-text);
  background-color: var(--color-bg);
  line-height: 1.6;
  min-height: 100vh;
  overflow-x: hidden;
}

img {
  max-width: 100%;
  display: block;
}

a {
  color: var(--color-accent);
  text-decoration: none;
  transition: color var(--transition-fast);
}

a:hover {
  color: var(--color-accent-light);
}

button {
  cursor: pointer;
  font-family: var(--font-main);
  border: none;
  outline: none;
  background: none;
}

input,
select,
textarea {
  font-family: var(--font-main);
  font-size: var(--font-size-md);
}

ul, ol {
  list-style: none;
}

/* ============================================================
   Top Navigation Bar
   ============================================================ */

.app-topbar {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  height: var(--topbar-height);
  background-color: var(--color-primary);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 var(--space-6);
  z-index: 1000;
  box-shadow: var(--shadow-md);
}

.topbar-left {
  display: flex;
  align-items: center;
  gap: var(--space-4);
}

.topbar-logo {
  height: 38px;
  width: auto;
  object-fit: contain;
}

.topbar-divider {
  width: 1px;
  height: 28px;
  background-color: rgba(255,255,255,0.2);
}

.topbar-title {
  display: flex;
  flex-direction: column;
}

.topbar-title-main {
  font-size: var(--font-size-md);
  font-weight: 600;
  color: var(--color-white);
  letter-spacing: 0.01em;
  line-height: 1.2;
}

.topbar-title-sub {
  font-size: var(--font-size-xs);
  color: rgba(255,255,255,0.6);
  letter-spacing: 0.02em;
}

.topbar-right {
  display: flex;
  align-items: center;
  gap: var(--space-3);
}

.topbar-back-link {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  color: rgba(255,255,255,0.75);
  font-size: var(--font-size-sm);
  font-weight: 500;
  transition: color var(--transition-fast);
  padding: var(--space-2) var(--space-3);
  border-radius: var(--radius-md);
}

.topbar-back-link:hover {
  color: var(--color-white);
  background-color: rgba(255,255,255,0.08);
}

.topbar-back-link svg {
  width: 16px;
  height: 16px;
}

.topbar-back-text {
  display: inline;
}

/* Language Toggle */
.lang-toggle {
  display: flex;
  align-items: center;
  background-color: rgba(255,255,255,0.1);
  border-radius: var(--radius-full);
  padding: var(--space-1);
  gap: 2px;
}

.lang-btn {
  padding: var(--space-1) var(--space-3);
  border-radius: var(--radius-full);
  font-size: var(--font-size-sm);
  font-weight: 600;
  color: rgba(255,255,255,0.6);
  transition: all var(--transition-fast);
  letter-spacing: 0.05em;
}

.lang-btn.active {
  background-color: var(--color-accent);
  color: var(--color-white);
}

.lang-btn:hover:not(.active) {
  color: var(--color-white);
}

/* Save Status Indicator */
.save-status {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  font-size: var(--font-size-xs);
  color: rgba(255,255,255,0.6);
  min-width: 80px;
}

.save-status-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background-color: var(--color-success);
  flex-shrink: 0;
}

.save-status-dot.saving {
  background-color: var(--color-accent);
  animation: pulse 1s infinite;
}

.save-status-dot.error {
  background-color: var(--color-error);
}

@keyframes pulse {
  0%, 100% { opacity: 1; }
  50%       { opacity: 0.3; }
}

/* ============================================================
   Main App Layout
   ============================================================ */

.app-wrapper {
  display: flex;
  height: 100vh;
  padding-top: var(--topbar-height);
  padding-bottom: var(--bottombar-height);
  overflow: hidden;
}

/* ============================================================
   Left Panel - Form Editor
   ============================================================ */

.app-editor {
  width: var(--form-width);
  min-width: var(--form-width);
  height: 100%;
  background-color: var(--color-white);
  border-right: 1px solid var(--color-border);
  overflow-y: auto;
  overflow-x: hidden;
  display: flex;
  flex-direction: column;
  position: relative;
}

.app-editor::-webkit-scrollbar {
  width: 4px;
}

.app-editor::-webkit-scrollbar-track {
  background: transparent;
}

.app-editor::-webkit-scrollbar-thumb {
  background: var(--color-border);
  border-radius: var(--radius-full);
}

.editor-header {
  padding: var(--space-5) var(--space-6);
  border-bottom: 1px solid var(--color-border);
  background-color: var(--color-white);
  position: sticky;
  top: 0;
  z-index: 10;
}

.editor-header-title {
  font-size: var(--font-size-sm);
  font-weight: 600;
  color: var(--color-text-muted);
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

/* ============================================================
   Right Panel - CV Preview
   ============================================================ */

.app-preview {
  flex: 1;
  height: 100%;
  background-color: #D1D5DB;
  overflow-y: auto;
  overflow-x: hidden;
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: var(--space-8) var(--space-4);
  gap: var(--space-4);
}

.app-preview::-webkit-scrollbar {
  width: 6px;
}

.app-preview::-webkit-scrollbar-track {
  background: transparent;
}

.app-preview::-webkit-scrollbar-thumb {
  background: rgba(0,0,0,0.2);
  border-radius: var(--radius-full);
}

.preview-label {
  font-size: var(--font-size-xs);
  font-weight: 600;
  color: rgba(0,0,0,0.4);
  text-transform: uppercase;
  letter-spacing: 0.1em;
  align-self: flex-start;
  margin-left: auto;
  margin-right: auto;
  max-width: 794px;
  width: 100%;
}

/* ============================================================
   A4 CV Page - Clean White Two Column
   ============================================================ */

.cv-page {
  width: 794px;
  min-height: 1123px;
  background-color: var(--color-white);
  box-shadow: var(--shadow-xl);
  position: relative;
  display: flex;
  flex-direction: column;
  font-family: var(--font-main);
  font-size: 10pt;
  line-height: 1.5;
  color: #1a1a1a;
  padding: 0;
}

/* CV Header Area - White background */
.cv-header {
  background-color: var(--color-white);
  color: var(--color-text);
  padding: 36px 40px 24px 40px;
  display: flex;
  gap: 24px;
  align-items: flex-start;
  border-bottom: 2px solid var(--color-primary);
}

.cv-header-photo {
  width: 110px;
  height: 140px;
  border-radius: var(--radius-sm);
  object-fit: cover;
  border: 1px solid var(--color-border);
  flex-shrink: 0;
  background-color: var(--color-bg);
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
}

.cv-header-photo img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.cv-header-photo-placeholder {
  width: 100%;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  background-color: var(--color-bg);
}

.cv-header-photo-placeholder svg {
  width: 40px;
  height: 40px;
  opacity: 0.3;
  fill: var(--color-text-muted);
}

.cv-header-info {
  flex: 1;
  min-width: 0;
}

.cv-name {
  font-size: 24pt;
  font-weight: 700;
  color: var(--color-primary);
  line-height: 1.1;
  margin-bottom: 2px;
  letter-spacing: -0.01em;
}

.cv-job-title {
  font-size: 11pt;
  color: var(--color-accent);
  font-weight: 600;
  margin-bottom: 14px;
  letter-spacing: 0.02em;
}

.cv-contact-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 4px 20px;
}

.cv-contact-item {
  display: flex;
  align-items: center;
  gap: 5px;
  font-size: 8.5pt;
  color: var(--color-text);
}

.cv-contact-item svg {
  width: 11px;
  height: 11px;
  fill: var(--color-accent);
  flex-shrink: 0;
}

/* CV Body - Single column with tabular entries */
.cv-body {
  display: flex;
  flex-direction: column;
  flex: 1;
  padding: 0;
}

/* Remove sidebar completely */
.cv-sidebar {
  display: none;
}

/* CV Main Content - Full width */
.cv-main {
  flex: 1;
  padding: 24px 40px 36px 40px;
  display: flex;
  flex-direction: column;
  gap: 20px;
  min-width: 0;
}

/* CV Section */
.cv-section {
  display: flex;
  flex-direction: column;
  gap: 0;
}

.cv-section-title {
  font-size: 9pt;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.10em;
  color: var(--color-primary);
  border-bottom: 2px solid var(--color-accent);
  padding-bottom: 4px;
  margin-bottom: 10px;
}

/* CV Table Row - Two column tabular layout
   Left: dates (fixed width)
   Right: content (flexible)
   These two columns must NEVER collapse */
.cv-entry {
  display: flex;
  flex-direction: row;
  flex-wrap: nowrap;
  gap: 16px;
  padding: 7px 0;
  border-bottom: 1px solid #EEF0F5;
  page-break-inside: avoid;
}

.cv-entry:last-child {
  border-bottom: none;
}

.cv-entry-dates {
  font-size: 8.5pt;
  color: var(--color-text-muted);
  font-weight: 500;
  padding-top: 1px;
  line-height: 1.4;
  white-space: normal;
  word-wrap: break-word;
  overflow-wrap: break-word;
  hyphens: none;
  width: 130px;
  min-width: 130px;
  max-width: 130px;
  flex-shrink: 0;
}

.cv-entry-content {
  display: flex;
  flex-direction: column;
  gap: 2px;
  flex: 1;
  min-width: 0;
}

.cv-entry-title {
  font-size: 10pt;
  font-weight: 700;
  color: var(--color-primary);
  line-height: 1.3;
}

.cv-entry-subtitle {
  font-size: 8.5pt;
  color: var(--color-text-muted);
  line-height: 1.3;
}

.cv-entry-facility {
  font-size: 8pt;
  color: var(--color-text-muted);
  font-style: italic;
}

/* Remove entry type badge since we removed employment type */
.cv-entry-type-badge {
  display: none;
}

.cv-entry-bullets {
  margin-top: 4px;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.cv-entry-bullet {
  font-size: 8.5pt;
  color: var(--color-text);
  padding-left: 12px;
  position: relative;
  line-height: 1.45;
}

.cv-entry-bullet::before {
  content: '';
  position: absolute;
  left: 2px;
  top: 7px;
  width: 4px;
  height: 4px;
  border-radius: 50%;
  background-color: var(--color-accent);
}

/* Career Break Entry */
.cv-entry.is-break {
  background-color: transparent;
  opacity: 0.75;
}

.cv-entry.is-break .cv-entry-title {
  font-style: italic;
  font-weight: 400;
  color: var(--color-text-muted);
  font-size: 8.5pt;
}

/* CV Summary */
.cv-summary-text {
  font-size: 9pt;
  color: var(--color-text);
  line-height: 1.6;
}

/* CV Skill Item - Now in main area as tabular */
.cv-skill-entry {
  display: flex;
  flex-direction: row;
  flex-wrap: nowrap;
  gap: 16px;
  padding: 3px 0;
}

.cv-skill-category {
  font-size: 8.5pt;
  color: var(--color-text-muted);
  font-weight: 500;
  width: 130px;
  min-width: 130px;
  max-width: 130px;
  flex-shrink: 0;
  white-space: normal;
  word-wrap: break-word;
  overflow-wrap: break-word;
}

.cv-skill-content {
  flex: 1;
  min-width: 0;
}

.cv-skill-item {
  display: inline;
  font-size: 8.5pt;
  color: var(--color-text);
  line-height: 1.5;
}

.cv-skill-level {
  font-size: 7.5pt;
  color: var(--color-text-muted);
}

/* CV Language Item - Now in main area as tabular */
.cv-language-entry {
  display: flex;
  flex-direction: row;
  flex-wrap: nowrap;
  gap: 16px;
  padding: 4px 0;
  border-bottom: 1px solid #EEF0F5;
}

.cv-language-entry:last-child {
  border-bottom: none;
}

.cv-language-name {
  font-size: 9pt;
  font-weight: 600;
  color: var(--color-text);
  width: 130px;
  min-width: 130px;
  max-width: 130px;
  flex-shrink: 0;
  white-space: normal;
  word-wrap: break-word;
  overflow-wrap: break-word;
}

.cv-language-details {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 1px;
}

.cv-language-level {
  font-size: 8.5pt;
  color: var(--color-text);
}

.cv-language-cert {
  font-size: 7.5pt;
  color: var(--color-accent);
  font-style: italic;
}

/* CV Interest Item - Bullet list in main area */
.cv-interest-list {
  display: flex;
  flex-wrap: wrap;
  gap: 4px 16px;
  padding: 4px 0;
}

.cv-interest-item {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 8.5pt;
  color: var(--color-text);
  line-height: 1.4;
}

.cv-interest-item::before {
  content: '';
  width: 4px;
  height: 4px;
  border-radius: 50%;
  background-color: var(--color-accent);
  flex-shrink: 0;
}

/* CV License Entry */
.cv-license-entry {
  display: flex;
  flex-direction: row;
  flex-wrap: nowrap;
  gap: 16px;
  padding: 6px 0;
  border-bottom: 1px solid #EEF0F5;
}

.cv-license-entry:last-child {
  border-bottom: none;
}

.cv-license-dates {
  font-size: 8.5pt;
  color: var(--color-text-muted);
  font-weight: 500;
  width: 130px;
  min-width: 130px;
  max-width: 130px;
  flex-shrink: 0;
  line-height: 1.4;
  white-space: normal;
  word-wrap: break-word;
  overflow-wrap: break-word;
}

.cv-license-content {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
}

.cv-license-name {
  font-size: 10pt;
  font-weight: 700;
  color: var(--color-primary);
}

.cv-license-authority {
  font-size: 8.5pt;
  color: var(--color-text-muted);
}

.cv-license-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 0 16px;
  margin-top: 2px;
}

.cv-license-meta-item {
  font-size: 7.5pt;
  color: var(--color-text-muted);
}

.cv-license-status {
  display: inline-block;
  font-size: 7pt;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  padding: 1px 6px;
  border-radius: var(--radius-full);
}

.cv-license-status.active   { background-color: #DCFCE7; color: #166534; }
.cv-license-status.expired  { background-color: #FEE2E2; color: #991B1B; }
.cv-license-status.pending  { background-color: #FEF3C7; color: #92400E; }
.cv-license-status.renewed  { background-color: #DBEAFE; color: #1E40AF; }
.cv-license-status.suspended { background-color: #F3F4F6; color: #374151; }

/* CV Reference */
.cv-reference-entry {
  display: flex;
  flex-direction: row;
  flex-wrap: nowrap;
  gap: 16px;
  padding: 6px 0;
  border-bottom: 1px solid #EEF0F5;
}

.cv-reference-entry:last-child {
  border-bottom: none;
}

.cv-reference-name-col {
  font-size: 9pt;
  font-weight: 700;
  color: var(--color-primary);
  width: 130px;
  min-width: 130px;
  max-width: 130px;
  flex-shrink: 0;
  white-space: normal;
  word-wrap: break-word;
  overflow-wrap: break-word;
}

.cv-reference-content {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 1px;
  min-width: 0;
}

.cv-reference-sub {
  font-size: 8.5pt;
  color: var(--color-text-muted);
}

/* CV Signature */
.cv-signature {
  margin-top: 20px;
  padding-top: 16px;
}

.cv-signature-line-label {
  font-size: 8.5pt;
  color: var(--color-text-muted);
  margin-bottom: 28px;
}

.cv-signature-line {
  border-top: 1px solid var(--color-text);
  width: 200px;
  margin-bottom: 4px;
}

.cv-signature-name {
  font-size: 9pt;
  color: var(--color-text);
}

/* CV Empty State */
.cv-empty {
  color: #CCC;
  font-style: italic;
  font-size: 8.5pt;
}

/* ============================================================
   CRITICAL: Two column layout must NEVER collapse
   ============================================================ */

@media (max-width: 768px) {
  .cv-entry,
  .cv-skill-entry,
  .cv-language-entry,
  .cv-license-entry,
  .cv-reference-entry {
    display: flex;
    flex-direction: row;
    flex-wrap: nowrap;
    gap: 10px;
  }

  .cv-entry-dates,
  .cv-skill-category,
  .cv-language-name,
  .cv-license-dates,
  .cv-reference-name-col {
    width: 90px;
    min-width: 90px;
    max-width: 90px;
    font-size: 7.5pt;
    white-space: normal;
    word-wrap: break-word;
    overflow-wrap: break-word;
  }

  .cv-page {
    width: 100%;
    min-height: auto;
  }

  .cv-header {
    padding: 24px 20px 16px 20px;
  }

  .cv-main {
    padding: 16px 20px 24px 20px;
  }

  .cv-header-photo {
    width: 80px;
    height: 100px;
  }

  .cv-name {
    font-size: 18pt;
  }

  .cv-job-title {
    font-size: 9pt;
  }
}

/* Print - ensure two columns never collapse */
@media print {
  .cv-entry,
  .cv-skill-entry,
  .cv-language-entry,
  .cv-license-entry,
  .cv-reference-entry {
    display: flex !important;
    flex-direction: row !important;
    flex-wrap: nowrap !important;
  }
}
@media print {
  .cv-entry-dates,
  .cv-skill-category,
  .cv-language-name,
  .cv-license-dates,
  .cv-reference-name-col {
    width: 130px !important;
    min-width: 130px !important;
    max-width: 130px !important;
    white-space: normal !important;
    word-wrap: break-word !important;
    overflow-wrap: break-word !important;
  }
}
/* ============================================================
   Form Sections
   ============================================================ */

.form-section {
  border-bottom: 1px solid var(--color-border);
}

.form-section-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: var(--space-4) var(--space-6);
  cursor: pointer;
  user-select: none;
  transition: background-color var(--transition-fast);
  background-color: var(--color-white);
  position: sticky;
  top: 48px;
  z-index: 5;
}

.form-section-header:hover {
  background-color: var(--color-bg);
}

.form-section-header-left {
  display: flex;
  align-items: center;
  gap: var(--space-3);
}

.form-section-number {
  width: 24px;
  height: 24px;
  border-radius: 50%;
  background-color: var(--color-primary);
  color: var(--color-white);
  font-size: var(--font-size-xs);
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  font-family: var(--font-main);
}

.form-section-title {
  font-size: var(--font-size-sm);
  font-weight: 600;
  color: var(--color-text);
  line-height: 1.3;
}

.form-section-subtitle {
  font-size: var(--font-size-xs);
  color: var(--color-text-muted);
  line-height: 1.2;
}

.form-section-header-right {
  display: flex;
  align-items: center;
  gap: var(--space-3);
}

/* Section Toggle */
.section-toggle {
  display: flex;
  align-items: center;
  gap: var(--space-2);
}

.section-toggle input[type="checkbox"] {
  display: none;
}

.toggle-track {
  width: 36px;
  height: 20px;
  background-color: var(--color-border);
  border-radius: var(--radius-full);
  position: relative;
  transition: background-color var(--transition-fast);
  cursor: pointer;
  flex-shrink: 0;
}

.toggle-track::after {
  content: '';
  position: absolute;
  top: 2px;
  left: 2px;
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background-color: var(--color-white);
  box-shadow: var(--shadow-sm);
  transition: transform var(--transition-fast);
}

.section-toggle input:checked + .toggle-track {
  background-color: var(--color-accent);
}

.section-toggle input:checked + .toggle-track::after {
  transform: translateX(16px);
}

/* Collapse Arrow */
.collapse-arrow {
  width: 18px;
  height: 18px;
  color: var(--color-text-muted);
  transition: transform var(--transition-normal);
  flex-shrink: 0;
}

.form-section-header.collapsed .collapse-arrow {
  transform: rotate(-90deg);
}

/* Section Body */
.form-section-body {
  padding: var(--space-4) var(--space-6) var(--space-6);
  display: flex;
  flex-direction: column;
  gap: var(--space-5);
}

.form-section-body.hidden {
  display: none;
}

/* ============================================================
   Form Fields
   ============================================================ */

.form-group {
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
}

.form-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: var(--space-4);
}

.form-row-3 {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  gap: var(--space-3);
}

.form-label {
  font-size: var(--font-size-sm);
  font-weight: 600;
  color: var(--color-text);
  display: flex;
  align-items: center;
  gap: var(--space-1);
}

.form-label-required {
  color: var(--color-error);
  font-size: var(--font-size-xs);
}

.form-label-optional {
  color: var(--color-text-muted);
  font-size: var(--font-size-xs);
  font-weight: 400;
}

.form-input,
.form-select,
.form-textarea {
  width: 100%;
  padding: 10px var(--space-3);
  border: 1.5px solid var(--color-border);
  border-radius: var(--radius-md);
  font-size: var(--font-size-sm);
  color: var(--color-text);
  background-color: var(--color-white);
  transition: border-color var(--transition-fast),
              box-shadow var(--transition-fast);
  outline: none;
  min-height: 44px;
  appearance: none;
  -webkit-appearance: none;
}

.form-input:focus,
.form-select:focus,
.form-textarea:focus {
  border-color: var(--color-primary);
  box-shadow: 0 0 0 3px rgba(10,31,68,0.08);
}

.form-input::placeholder,
.form-textarea::placeholder {
  color: var(--color-text-muted);
  opacity: 0.7;
}

.form-select {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' fill='none' viewBox='0 0 24 24' stroke='%236B7280'%3E%3Cpath stroke-linecap='round' stroke-linejoin='round' stroke-width='2' d='M19 9l-7 7-7-7'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 10px center;
  background-size: 16px;
  padding-right: 36px;
  cursor: pointer;
}

.form-select option {
  color: var(--color-text);
  background-color: var(--color-white);
}

.form-textarea {
  resize: vertical;
  min-height: 100px;
  line-height: 1.6;
}

.form-input.error,
.form-select.error,
.form-textarea.error {
  border-color: var(--color-error);
}

.form-hint {
  font-size: var(--font-size-xs);
  color: var(--color-text-muted);
  line-height: 1.5;
}

.form-hint.warning {
  color: var(--color-accent);
  background-color: #FEF3C7;
  padding: var(--space-2) var(--space-3);
  border-radius: var(--radius-sm);
  border-left: 3px solid var(--color-accent);
}

.form-hint.info {
  color: var(--color-primary);
  background-color: #EFF6FF;
  padding: var(--space-2) var(--space-3);
  border-radius: var(--radius-sm);
  border-left: 3px solid var(--color-primary);
}

.form-char-counter {
  font-size: var(--font-size-xs);
  color: var(--color-text-muted);
  text-align: right;
}

.form-char-counter.over {
  color: var(--color-error);
  font-weight: 600;
}

/* ============================================================
   Checkbox and Radio
   ============================================================ */

.form-check {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  cursor: pointer;
}

.form-check input[type="checkbox"],
.form-check input[type="radio"] {
  width: 18px;
  height: 18px;
  border: 2px solid var(--color-border);
  border-radius: var(--radius-sm);
  cursor: pointer;
  accent-color: var(--color-primary);
  flex-shrink: 0;
}

.form-check-label {
  font-size: var(--font-size-sm);
  color: var(--color-text);
  cursor: pointer;
  user-select: none;
}

/* ============================================================
   Date Fields - Month/Year
   ============================================================ */

.date-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: var(--space-2);
}

.date-separator {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0 var(--space-1);
  color: var(--color-text-muted);
  font-size: var(--font-size-sm);
  min-width: 20px;
}

/* ============================================================
   Phone Input with Country Code
   ============================================================ */

.phone-input-group {
  display: grid;
  grid-template-columns: 110px 1fr;
  gap: var(--space-2);
}

/* ============================================================
   Photo Upload
   ============================================================ */

.photo-upload-area {
  display: flex;
  align-items: center;
  gap: var(--space-4);
}

.photo-preview-box {
  width: 90px;
  height: 108px;
  border-radius: var(--radius-md);
  border: 2px dashed var(--color-border);
  background-color: var(--color-bg);
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  flex-shrink: 0;
  cursor: pointer;
  transition: border-color var(--transition-fast);
  position: relative;
}

.photo-preview-box:hover {
  border-color: var(--color-primary);
}

.photo-preview-box img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.photo-preview-placeholder {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: var(--space-2);
  color: var(--color-text-muted);
}

.photo-preview-placeholder svg {
  width: 28px;
  height: 28px;
  opacity: 0.5;
}

.photo-preview-placeholder span {
  font-size: var(--font-size-xs);
  text-align: center;
  line-height: 1.3;
}

.photo-upload-controls {
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
  flex: 1;
}

.photo-upload-hint {
  font-size: var(--font-size-xs);
  color: var(--color-text-muted);
  line-height: 1.5;
}

/* ============================================================
   Bullet Point Builder
   ============================================================ */

.bullet-builder {
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
}

.bullet-builder-item {
  display: flex;
  align-items: flex-start;
  gap: var(--space-2);
}

.bullet-builder-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background-color: var(--color-accent);
  margin-top: 14px;
  flex-shrink: 0;
}

.bullet-builder-input {
  flex: 1;
  padding: 8px var(--space-3);
  border: 1.5px solid var(--color-border);
  border-radius: var(--radius-md);
  font-size: var(--font-size-sm);
  color: var(--color-text);
  background-color: var(--color-white);
  outline: none;
  min-height: 40px;
  transition: border-color var(--transition-fast),
              box-shadow var(--transition-fast);
  resize: none;
  font-family: var(--font-main);
  line-height: 1.5;
}

.bullet-builder-input:focus {
  border-color: var(--color-primary);
  box-shadow: 0 0 0 3px rgba(10,31,68,0.08);
}

.bullet-builder-remove {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background-color: transparent;
  color: var(--color-text-muted);
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all var(--transition-fast);
  margin-top: 4px;
  flex-shrink: 0;
}

.bullet-builder-remove:hover {
  background-color: #FEE2E2;
  color: var(--color-error);
}

.bullet-builder-remove svg {
  width: 14px;
  height: 14px;
}

/* ============================================================
   Entry Cards (Experience, Education, etc.)
   ============================================================ */

.entries-list {
  display: flex;
  flex-direction: column;
  gap: var(--space-4);
}

.entry-card {
  border: 1.5px solid var(--color-border);
  border-radius: var(--radius-lg);
  background-color: var(--color-white);
  overflow: hidden;
  transition: box-shadow var(--transition-fast);
}

.entry-card:hover {
  box-shadow: var(--shadow-sm);
}

.entry-card.is-break {
  border-color: #FDE68A;
  background-color: #FFFBEB;
}

.entry-card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: var(--space-3) var(--space-4);
  cursor: pointer;
  background-color: transparent;
  border-bottom: 1px solid var(--color-border);
  gap: var(--space-3);
}

.entry-card.is-break .entry-card-header {
  border-bottom-color: #FDE68A;
}

.entry-card-header-info {
  flex: 1;
  min-width: 0;
}

.entry-card-title {
  font-size: var(--font-size-sm);
  font-weight: 600;
  color: var(--color-text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.entry-card-subtitle {
  font-size: var(--font-size-xs);
  color: var(--color-text-muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.entry-card-badge {
  display: inline-flex;
  align-items: center;
  padding: 2px 8px;
  border-radius: var(--radius-full);
  font-size: var(--font-size-xs);
  font-weight: 600;
  background-color: rgba(10,31,68,0.08);
  color: var(--color-primary);
  white-space: nowrap;
  flex-shrink: 0;
}

.entry-card.is-break .entry-card-badge {
  background-color: #FDE68A;
  color: #92400E;
}

.entry-card-actions {
  display: flex;
  align-items: center;
  gap: var(--space-1);
  flex-shrink: 0;
}

.entry-card-btn {
  width: 30px;
  height: 30px;
  border-radius: var(--radius-md);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--color-text-muted);
  transition: all var(--transition-fast);
}

.entry-card-btn:hover {
  background-color: var(--color-bg);
  color: var(--color-text);
}

.entry-card-btn.delete:hover {
  background-color: #FEE2E2;
  color: var(--color-error);
}

.entry-card-btn svg {
  width: 14px;
  height: 14px;
}

.entry-card-body {
  padding: var(--space-4);
  display: flex;
  flex-direction: column;
  gap: var(--space-4);
}

.entry-card-body.hidden {
  display: none;
}

/* ============================================================
   Buttons
   ============================================================ */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-2);
  padding: 10px var(--space-5);
  border-radius: var(--radius-md);
  font-size: var(--font-size-sm);
  font-weight: 600;
  transition: all var(--transition-fast);
  white-space: nowrap;
  min-height: 44px;
  letter-spacing: 0.01em;
}

.btn svg {
  width: 16px;
  height: 16px;
  flex-shrink: 0;
}

.btn-primary {
  background-color: var(--color-primary);
  color: var(--color-white);
}

.btn-primary:hover {
  background-color: var(--color-primary-light);
}

.btn-accent {
  background-color: var(--color-accent);
  color: var(--color-white);
}

.btn-accent:hover {
  background-color: var(--color-accent-light);
}

.btn-outline {
  background-color: transparent;
  color: var(--color-primary);
  border: 1.5px solid var(--color-primary);
}

.btn-outline:hover {
  background-color: var(--color-primary);
  color: var(--color-white);
}

.btn-ghost {
  background-color: transparent;
  color: var(--color-text-muted);
  border: 1.5px solid var(--color-border);
}

.btn-ghost:hover {
  background-color: var(--color-bg);
  color: var(--color-text);
  border-color: var(--color-text-muted);
}

.btn-danger {
  background-color: transparent;
  color: var(--color-error);
  border: 1.5px solid var(--color-error);
}

.btn-danger:hover {
  background-color: var(--color-error);
  color: var(--color-white);
}

.btn-sm {
  padding: 6px var(--space-3);
  font-size: var(--font-size-xs);
  min-height: 34px;
}

.btn-full {
  width: 100%;
}

.btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
  pointer-events: none;
}

/* Add Entry Button */
.add-entry-group {
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
}

.add-entry-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-2);
  padding: var(--space-3) var(--space-4);
  border: 1.5px dashed var(--color-border);
  border-radius: var(--radius-lg);
  background-color: transparent;
  color: var(--color-text-muted);
  font-size: var(--font-size-sm);
  font-weight: 500;
  width: 100%;
  transition: all var(--transition-fast);
  min-height: 48px;
}

.add-entry-btn:hover {
  border-color: var(--color-primary);
  color: var(--color-primary);
  background-color: rgba(10,31,68,0.03);
}

.add-entry-btn.break-btn:hover {
  border-color: var(--color-accent);
  color: var(--color-accent);
  background-color: rgba(201,149,42,0.04);
}

.add-entry-btn svg {
  width: 18px;
  height: 18px;
}

/* ============================================================
   Bottom Action Bar
   ============================================================ */

.app-bottombar {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  height: var(--bottombar-height);
  background-color: var(--color-white);
  border-top: 1px solid var(--color-border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 var(--space-6);
  z-index: 1000;
  box-shadow: 0 -4px 12px rgba(0,0,0,0.06);
}

.bottombar-left {
  display: flex;
  align-items: center;
  gap: var(--space-3);
}

.bottombar-right {
  display: flex;
  align-items: center;
  gap: var(--space-3);
}

/* ============================================================
   Toast Notifications
   ============================================================ */

.toast-container {
  position: fixed;
  bottom: calc(var(--bottombar-height) + var(--space-4));
  right: var(--space-6);
  z-index: 2000;
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
  pointer-events: none;
}

.toast {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  padding: var(--space-3) var(--space-4);
  border-radius: var(--radius-lg);
  background-color: var(--color-primary);
  color: var(--color-white);
  font-size: var(--font-size-sm);
  font-weight: 500;
  box-shadow: var(--shadow-lg);
  min-width: 240px;
  max-width: 360px;
  pointer-events: all;
  animation: slideInToast var(--transition-normal) forwards;
}

.toast.success { background-color: #166534; }
.toast.error   { background-color: #991B1B; }
.toast.info    { background-color: var(--color-primary); }

.toast svg {
  width: 18px;
  height: 18px;
  flex-shrink: 0;
}

.toast.hide {
  animation: slideOutToast var(--transition-normal) forwards;
}

@keyframes slideInToast {
  from { transform: translateX(100%); opacity: 0; }
  to   { transform: translateX(0);    opacity: 1; }
}

@keyframes slideOutToast {
  from { transform: translateX(0);    opacity: 1; }
  to   { transform: translateX(100%); opacity: 0; }
}

/* ============================================================
   Modal / Confirm Dialog
   ============================================================ */

.modal-overlay {
  position: fixed;
  inset: 0;
  background-color: var(--color-overlay);
  z-index: 3000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: var(--space-4);
  animation: fadeIn var(--transition-fast) forwards;
}

.modal-overlay.hidden {
  display: none;
}

.modal-box {
  background-color: var(--color-white);
  border-radius: var(--radius-xl);
  padding: var(--space-8);
  max-width: 400px;
  width: 100%;
  box-shadow: var(--shadow-xl);
  animation: slideUp var(--transition-normal) forwards;
}

.modal-title {
  font-size: var(--font-size-lg);
  font-weight: 700;
  color: var(--color-text);
  margin-bottom: var(--space-2);
}

.modal-message {
  font-size: var(--font-size-sm);
  color: var(--color-text-muted);
  margin-bottom: var(--space-6);
  line-height: 1.6;
}

.modal-actions {
  display: flex;
  gap: var(--space-3);
  justify-content: flex-end;
}

@keyframes fadeIn {
  from { opacity: 0; }
  to   { opacity: 1; }
}

@keyframes slideUp {
  from { transform: translateY(20px); opacity: 0; }
  to   { transform: translateY(0);    opacity: 1; }
}

/* ============================================================
   Loading Overlay
   ============================================================ */

.loading-overlay {
  position: fixed;
  inset: 0;
  background-color: var(--color-white);
  z-index: 4000;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: var(--space-4);
}

.loading-overlay.hidden {
  display: none;
}

.loading-spinner {
  width: 48px;
  height: 48px;
  border: 4px solid var(--color-border);
  border-top-color: var(--color-primary);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

.loading-text {
  font-size: var(--font-size-md);
  color: var(--color-text-muted);
  font-weight: 500;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

/* ============================================================
   Mobile Tab Bar
   ============================================================ */

.mobile-tabs {
  display: none;
  position: fixed;
  top: var(--topbar-height);
  left: 0;
  right: 0;
  background-color: var(--color-white);
  border-bottom: 1px solid var(--color-border);
  z-index: 900;
}

.mobile-tab-btns {
  display: flex;
}

.mobile-tab-btn {
  flex: 1;
  padding: var(--space-3) var(--space-4);
  font-size: var(--font-size-sm);
  font-weight: 600;
  color: var(--color-text-muted);
  text-align: center;
  border-bottom: 2px solid transparent;
  transition: all var(--transition-fast);
}

.mobile-tab-btn.active {
  color: var(--color-primary);
  border-bottom-color: var(--color-primary);
}

/* ============================================================
   Responsive - Tablet
   ============================================================ */

@media (max-width: 1024px) {
  :root {
    --form-width: 400px;
  }
}

/* ============================================================
   Responsive - Mobile
   ============================================================ */

@media (max-width: 768px) {
  :root {
    --topbar-height:    56px;
    --bottombar-height: 72px;
  }

  /* Top Bar */
  .topbar-title-sub  { display: none; }
  .topbar-divider    { display: none; }
  .topbar-back-text  { display: none; }

  .app-topbar {
    padding: 0 var(--space-4);
  }

  .topbar-logo {
    height: 30px;
  }

  /* Mobile Tabs */
  .mobile-tabs {
    display: block;
  }

  /* App Wrapper */
  .app-wrapper {
    flex-direction: column;
    padding-top: calc(var(--topbar-height) + 44px);
    overflow: auto;
  }

  /* Editor Panel */
  .app-editor {
    width: 100%;
    min-width: 100%;
    height: auto;
    border-right: none;
    overflow-y: visible;
  }

  .app-editor.mobile-hidden {
    display: none;
  }

  /* Preview Panel */
  .app-preview {
    padding: var(--space-4) var(--space-2);
    height: auto;
  }

  .app-preview.mobile-hidden {
    display: none;
  }

  /* CV Page - Scale down on mobile */
  .cv-page {
    width: 100%;
    min-height: auto;
    transform-origin: top center;
  }

  .cv-page-scaler {
    width: 100%;
    overflow-x: auto;
  }

  /* Form */
  .form-row   { grid-template-columns: 1fr; }
  .form-row-3 { grid-template-columns: 1fr; }

  .form-section-header {
    padding: var(--space-4);
  }

  .form-section-body {
    padding: var(--space-3) var(--space-4) var(--space-5);
  }

  /* Bottom Bar */
  .app-bottombar {
    padding: 0 var(--space-4);
    gap: var(--space-2);
  }

  .bottombar-left,
  .bottombar-right {
    gap: var(--space-2);
  }

  .btn {
    padding: 10px var(--space-3);
    font-size: var(--font-size-xs);
  }

  .btn svg {
    width: 14px;
    height: 14px;
  }

  /* Hide text labels on small buttons */
  .btn-text-mobile-hide {
    display: none;
  }

  /* Phone Input */
  .phone-input-group {
    grid-template-columns: 100px 1fr;
  }

  /* Entry card */
  .entry-card-header {
    padding: var(--space-3);
  }

  .entry-card-body {
    padding: var(--space-3);
  }

  /* Modal */
  .modal-box {
    padding: var(--space-5);
  }

  .modal-actions {
    flex-direction: column-reverse;
  }

  .modal-actions .btn {
    width: 100%;
  }

  /* Toast */
  .toast-container {
    left: var(--space-4);
    right: var(--space-4);
    bottom: calc(var(--bottombar-height) + var(--space-3));
  }

  .toast {
    min-width: unset;
    max-width: 100%;
  }
}

@media (max-width: 400px) {
  .cv-header {
    flex-direction: column;
    align-items: center;
    text-align: center;
    padding: 20px;
  }

  .cv-contact-grid {
    justify-content: center;
  }
}

/* ============================================================
   Utility Classes
   ============================================================ */

.hidden   { display: none !important; }
.sr-only  {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0,0,0,0);
  border: 0;
}

.text-muted   { color: var(--color-text-muted); }
.text-accent  { color: var(--color-accent); }
.text-primary { color: var(--color-primary); }
.text-error   { color: var(--color-error); }
.text-success { color: var(--color-success); }

.font-bold    { font-weight: 700; }
.font-medium  { font-weight: 500; }

.mt-2  { margin-top: var(--space-2); }
.mt-4  { margin-top: var(--space-4); }
.mt-6  { margin-top: var(--space-6); }
.mb-2  { margin-bottom: var(--space-2); }
.mb-4  { margin-bottom: var(--space-4); }

.flex         { display: flex; }
.flex-col     { flex-direction: column; }
.items-center { align-items: center; }
.gap-2        { gap: var(--space-2); }
.gap-3        { gap: var(--space-3); }
.gap-4        { gap: var(--space-4); }

.w-full  { width: 100%; }
.text-sm { font-size: var(--font-size-sm); }
.text-xs { font-size: var(--font-size-xs); }