/* ==========================================================================
   ⚡ Smart ATS Resume Builder & AI Transformer - Core Styles
   ========================================================================== */

:root {
  --bg-app: #0e131b;
  --bg-panel: #141a24;
  --bg-card: #1c2432;
  --bg-card-hover: #263245;
  --border-color: #2b394f;
  --border-focus: #38bdf8;
  
  --text-main: #f0f6fc;
  --text-muted: #8b9bb0;
  --text-secondary: #cbd5e1;
  
  --accent-primary: #10b981;
  --accent-primary-hover: #059669;
  --accent-blue: #38bdf8;
  --accent-blue-hover: #0ea5e9;
  --accent-purple: #a855f7;
  --accent-amber: #f59e0b;
  --accent-danger: #f43f5e;
  --accent-cyan: #06b6d4;
  
  --doc-bg: #ffffff;
  --doc-text: #1a1a1a;
  --doc-muted: #475569;
  --doc-border: #cbd5e1;
  --doc-line: #0f172a;
  
  --font-ui: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  --font-cv: "Calibri", "Inter", -apple-system, sans-serif;
  --font-mono: "JetBrains Mono", "Space Mono", "Courier Prime", monospace;
  
  --sidebar-width: 480px;
  --header-height: 56px;
}

[data-theme="light"] {
  --bg-app: #f4f0e6;
  --bg-panel: #fcfbf8;
  --bg-card: #f7f3ea;
  --bg-card-hover: #ede7d8;
  --border-color: #d8cebd;
  --border-focus: #b45309;
  
  --text-main: #1c2024;
  --text-muted: #656d76;
  --text-secondary: #3b434c;
  
  --accent-primary: #059669;
  --accent-primary-hover: #047857;
  --accent-blue: #2563eb;
  --accent-blue-hover: #1d4ed8;
  --accent-amber: #b45309;
  --accent-cyan: #0891b2;
}

[data-theme="light"] .app-header {
  background: #fcfbf8;
  border-bottom: 1px solid #d8cebd;
}

[data-theme="light"] .doc-toolbar {
  background: #fcfbf8;
  border-bottom: 1px solid #d8cebd;
}

[data-theme="light"] .sidebar-quick-nav {
  background: #f7f3ea;
  border-bottom: 1px solid #d8cebd;
}

[data-theme="light"] .doc-scroll-viewport {
  background-color: #e8e2d4 !important;
  background-image: 
    radial-gradient(circle at 1px 1px, rgba(180, 83, 9, 0.12) 1px, transparent 0),
    linear-gradient(to right, rgba(0, 0, 0, 0.03) 1px, transparent 1px),
    linear-gradient(to bottom, rgba(0, 0, 0, 0.03) 1px, transparent 1px) !important;
  background-size: 24px 24px, 120px 120px, 120px 120px !important;
}

[data-theme="light"] .select-control,
[data-theme="light"] .form-input,
[data-theme="light"] .form-textarea {
  background: #ffffff;
  color: #1c2024;
  border-color: #d8cebd;
}

[data-theme="light"] .dropdown-menu {
  background: #fcfbf8;
  border-color: #d8cebd;
  box-shadow: 0 10px 25px rgba(0, 0, 0, 0.08), 0 0 15px rgba(180, 83, 9, 0.06);
}

[data-theme="light"] .dropdown-item {
  color: #1c2024;
}
[data-theme="light"] .dropdown-item:hover {
  background: #ede7d8;
  color: #b45309;
}

[data-theme="light"] .modal-box {
  background: #fcfbf8;
  border-color: #d8cebd;
  color: #1c2024;
  box-shadow: 0 20px 40px rgba(0, 0, 0, 0.12);
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

body {
  font-family: var(--font-ui);
  background-color: var(--bg-app);
  color: var(--text-main);
  line-height: 1.5;
  overflow: hidden;
  height: 100vh;
  display: flex;
  flex-direction: column;
}

/* ==========================================================================
   Header & Navbar
   ========================================================================== */

.app-header {
  height: var(--header-height);
  background-color: var(--bg-panel);
  border-bottom: 1px solid var(--border-color);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 1.25rem;
  z-index: 100;
  flex-shrink: 0;
}

.brand-area {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.brand-icon {
  width: 32px;
  height: 32px;
  background: linear-gradient(135deg, #1f6feb, #238636);
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  font-size: 1.1rem;
  font-weight: bold;
}

.brand-title {
  font-size: 1rem;
  font-weight: 700;
  letter-spacing: -0.02em;
}

.brand-badge {
  font-size: 0.7rem;
  padding: 0.15rem 0.45rem;
  background: rgba(35, 134, 54, 0.2);
  color: #3fb950;
  border: 1px solid rgba(59, 185, 80, 0.4);
  border-radius: 999px;
  font-weight: 600;
}

.header-actions {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

/* Buttons */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.45rem 0.85rem;
  font-size: 0.85rem;
  font-weight: 500;
  border-radius: 6px;
  cursor: pointer;
  border: 1px solid transparent;
  transition: all 0.15s ease;
  background: var(--bg-card);
  color: var(--text-main);
}

.btn:hover {
  background: var(--bg-card-hover);
  border-color: var(--border-color);
}

.btn-primary {
  background: var(--accent-primary);
  color: #ffffff;
  border-color: rgba(255, 255, 255, 0.1);
}
.btn-primary:hover {
  background: var(--accent-primary-hover);
}

.btn-blue {
  background: var(--accent-blue);
  color: #ffffff;
}
.btn-blue:hover {
  background: var(--accent-blue-hover);
}

.btn-sm {
  padding: 0.3rem 0.6rem;
  font-size: 0.78rem;
}

.btn-icon {
  padding: 0.45rem;
  min-width: 34px;
  justify-content: center;
}

/* Dropdown Menus (Header & Toolbar) */
.dropdown-wrapper {
  position: relative;
  display: inline-block;
}

.dropdown-menu {
  position: absolute;
  top: calc(100% + 6px);
  right: 0;
  background: var(--bg-panel);
  border: 1px solid var(--border-color);
  border-radius: 8px;
  box-shadow: 0 10px 25px rgba(0, 0, 0, 0.4), 0 0 15px rgba(31, 111, 235, 0.15);
  min-width: 215px;
  padding: 0.35rem;
  display: none;
  flex-direction: column;
  gap: 0.2rem;
  z-index: 10000;
  animation: dropdownFadeIn 0.15s ease-out;
}

.dropdown-menu.show {
  display: flex;
}

@keyframes dropdownFadeIn {
  from { opacity: 0; transform: translateY(-4px); }
  to { opacity: 1; transform: translateY(0); }
}

.dropdown-item {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  width: 100%;
  padding: 0.5rem 0.75rem;
  font-size: 0.8rem;
  font-weight: 500;
  color: var(--text-main);
  background: transparent;
  border: none;
  border-radius: 5px;
  cursor: pointer;
  text-align: left;
  transition: all 0.12s ease;
}

.dropdown-item:hover {
  background: var(--bg-card-hover);
  color: var(--accent-blue);
}

.dropdown-item i {
  width: 16px;
  text-align: center;
  font-size: 0.88rem;
}

/* ==========================================================================
   Main App Layout
   ========================================================================== */

.app-main {
  display: flex;
  flex: 1;
  height: calc(100vh - var(--header-height));
  overflow: hidden;
}

/* Left Sidebar Controls */
.control-sidebar {
  width: var(--sidebar-width);
  min-width: 360px;
  max-width: 600px;
  background: var(--bg-panel);
  border-right: 1px solid var(--border-color);
  display: flex;
  flex-direction: column;
  flex-shrink: 0;
  overflow: hidden;
}

/* Sidebar Quick Nav (All Visible Workflow) */
.sidebar-quick-nav {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 0.35rem;
  padding: 0.65rem 0.85rem;
  background: var(--bg-card);
  border-bottom: 1px solid var(--border-color);
  flex-shrink: 0;
}

.nav-pill {
  padding: 0.45rem 0.3rem;
  font-size: 0.73rem;
  font-weight: 600;
  color: var(--text-secondary);
  background: var(--bg-panel);
  border: 1px solid var(--border-color);
  border-radius: 6px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.3rem;
  transition: all 0.15s ease;
  white-space: nowrap;
}

.nav-pill:hover {
  color: var(--accent-blue);
  border-color: var(--accent-blue);
  background: rgba(31, 111, 235, 0.08);
}

.nav-pill.active {
  color: #0c1017 !important;
  background: var(--accent-blue) !important;
  border-color: var(--accent-blue) !important;
  font-weight: 700;
  box-shadow: 0 0 12px rgba(56, 189, 248, 0.4);
}

/* Dedicated Workflow View Pages Container */
.workflow-container {
  flex: 1;
  overflow-y: auto;
  padding: 0.85rem;
  display: flex;
  flex-direction: column;
}

.workflow-page {
  display: none;
  flex-direction: column;
  gap: 0.85rem;
  animation: fadeIn 0.15s ease-out;
}

.workflow-page.active {
  display: flex;
}

.section-header-banner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.45rem 0.65rem;
  background: rgba(31, 111, 235, 0.08);
  border-left: 3px solid var(--accent-blue);
  border-radius: 0 6px 6px 0;
  font-size: 0.82rem;
  font-weight: 700;
  color: var(--text-main);
  margin-bottom: 0.2rem;
}

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

/* Right Document Workspace */
.doc-workspace {
  flex: 1;
  background: var(--bg-app);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  position: relative;
}

/* Workspace Toolbar (Auto-wrapping, zero horizontal scrolling) */
.doc-toolbar {
  min-height: 44px;
  height: auto;
  background: var(--bg-panel);
  border-bottom: 1px solid var(--border-color);
  display: flex;
  align-items: center;
  justify-content: flex-start;
  flex-wrap: wrap;
  padding: 0.35rem 0.75rem;
  gap: 0.35rem 0.5rem;
  flex-shrink: 0;
}

.toolbar-group {
  display: flex;
  align-items: center;
  gap: 0.35rem;
  flex-wrap: wrap;
}

.toolbar-divider {
  width: 1px;
  height: 20px;
  background: var(--border-color);
  margin: 0 0.15rem;
}

.select-control {
  background: var(--bg-card);
  color: var(--text-main);
  border: 1px solid var(--border-color);
  padding: 0.35rem 0.5rem;
  border-radius: 6px;
  font-size: 0.78rem;
  height: 30px;
  cursor: pointer;
  outline: none;
  box-sizing: border-box;
  display: inline-flex;
  align-items: center;
}
.select-control:focus {
  border-color: var(--border-focus);
}

.doc-toolbar .btn-icon {
  height: 30px;
  width: 30px;
  min-width: 30px;
  padding: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  box-sizing: border-box;
}

/* Doc Scroll Container (Google Docs / MS Word Canvas) */
.doc-scroll-viewport {
  flex: 1;
  overflow-y: auto;
  padding: 2.5rem 1rem 5rem 1rem;
  display: flex;
  flex-direction: column;
  align-items: center;
  background-color: #0c1017 !important;
  background-image: 
    radial-gradient(circle at 1px 1px, rgba(56, 189, 248, 0.08) 1px, transparent 0),
    linear-gradient(to right, rgba(255, 255, 255, 0.015) 1px, transparent 1px),
    linear-gradient(to bottom, rgba(255, 255, 255, 0.015) 1px, transparent 1px) !important;
  background-size: 24px 24px, 120px 120px, 120px 120px !important;
  position: relative;
}

[data-theme="light"] .doc-scroll-viewport {
  background-color: #e8e2d4 !important;
  background-image: 
    radial-gradient(circle at 1px 1px, rgba(180, 83, 9, 0.12) 1px, transparent 0),
    linear-gradient(to right, rgba(0, 0, 0, 0.03) 1px, transparent 1px),
    linear-gradient(to bottom, rgba(0, 0, 0, 0.03) 1px, transparent 1px) !important;
  background-size: 24px 24px, 120px 120px, 120px 120px !important;
}

.doc-canvas {
  display: flex;
  flex-direction: column;
  align-items: center;
  width: 100%;
  transform-origin: top center;
  transition: transform 0.15s cubic-bezier(0.16, 1, 0.3, 1);
}

/* ==========================================================================
   A4 Document Sheet (Authentic Archival Paper)
   ========================================================================== */

.doc-page {
  width: 210mm;
  min-height: 297mm;
  height: auto;
  background: #ffffff !important;
  color: #111827 !important;
  box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 20px 25px -5px rgba(0, 0, 0, 0.25), 0 0 0 1px rgba(0, 0, 0, 0.08);
  border: 1px solid #d1d5db;
  padding: 18mm 20mm;
  position: relative;
  font-family: var(--font-cv);
  font-size: 10pt;
  line-height: 1.35;
  box-sizing: border-box;
  margin: 0 auto 24px auto;
  border-radius: 2px;
}

.doc-page-header-badge {
  position: absolute;
  top: 10px;
  right: 18px;
  font-size: 8pt;
  color: #94a3b8;
  user-select: none;
  font-weight: 500;
}

.doc-page-gap {
  height: 20px;
  width: 210mm;
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 4px 0 20px 0;
  user-select: none;
}

.doc-page-gap-indicator {
  background: #cbd5e1;
  color: #334155;
  font-size: 0.72rem;
  font-weight: 700;
  padding: 0.15rem 0.75rem;
  border-radius: 999px;
  border: 1px solid #94a3b8;
}

/* Direct Inline Editable Hover & Focus Styles */
.doc-page [contenteditable="true"] {
  outline: none;
  transition: background 0.1s ease, outline 0.1s ease;
  cursor: text;
}

.doc-page [contenteditable="true"]:hover {
  background: rgba(59, 130, 246, 0.05);
  outline: 1px dashed rgba(59, 130, 246, 0.35);
}

.doc-page [contenteditable="true"]:focus {
  background: rgba(59, 130, 246, 0.08);
  outline: 1.5px solid #1f6feb;
}

/* Section styling inside A4 sheet */
.cv-header {
  text-align: center;
  margin-bottom: 0.75rem;
}

.cv-name {
  font-size: 18pt;
  font-weight: 700;
  color: #1A242B;
  letter-spacing: -0.01em;
  margin-bottom: 2px;
}

.cv-title {
  font-size: 11pt;
  font-weight: 700;
  color: #46505A;
  margin-bottom: 4px;
}

.cv-contact {
  font-size: 9.5pt;
  color: #46505A;
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 0.5rem;
}

.cv-contact span:not(:last-child)::after {
  content: "|";
  margin-left: 0.5rem;
  color: #9ca3af;
}

.cv-section {
  margin-top: 0.7rem;
  margin-bottom: 0.6rem;
}

.cv-section-title {
  font-size: 11.5pt;
  font-weight: 700;
  text-transform: uppercase;
  color: #1A242B;
  border-bottom: 1px solid #CCCCCC;
  padding-bottom: 3px;
  margin-bottom: 6px;
  letter-spacing: 0.02em;
}

.cv-item {
  margin-bottom: 0.6rem;
}

.cv-item-title {
  font-weight: 700;
  color: #1A242B;
  font-size: 10.5pt;
}

.cv-item-subtitle {
  font-style: italic;
  color: #212529;
  font-size: 10pt;
  margin-bottom: 3px;
}

.cv-bullets {
  padding-left: 1.2rem;
  margin-top: 2px;
  margin-bottom: 4px;
}

.cv-bullets li {
  margin-bottom: 2.5px;
  font-size: 10pt;
  color: #212529;
  text-align: justify;
  line-height: 1.25;
}

.cv-skills-grid {
  display: flex;
  flex-direction: column;
  gap: 3px;
}

.cv-skill-category {
  font-size: 9.8pt;
}

/* ==========================================================================
   Template Variations (Harvard, Modern Minimalist, Technical)
   ========================================================================== */

/* Template 1: Classic Harvard Monograph ATS */
.doc-page.template-harvard {
  font-family: 'Newsreader', 'Times New Roman', serif;
  font-size: 10.2pt;
  line-height: 1.34;
  color: #111827 !important;
}

.doc-page.template-harvard .cv-name {
  font-family: 'Newsreader', 'Times New Roman', serif;
  font-size: 21pt;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: #000000;
  margin-bottom: 3px;
}

.doc-page.template-harvard .cv-title {
  font-family: 'Newsreader', 'Times New Roman', serif;
  font-style: italic;
  font-size: 11pt;
  color: #374151;
  letter-spacing: 0.02em;
}

.doc-page.template-harvard .cv-section-title {
  font-family: 'Newsreader', 'Times New Roman', serif;
  border-bottom: 1.5px solid #000000;
  color: #000000;
  font-weight: 700;
  letter-spacing: 0.06em;
  font-size: 11pt;
  padding-bottom: 2px;
  margin-top: 10pt;
}

.doc-page.template-harvard .cv-item-title {
  font-family: 'Newsreader', 'Times New Roman', serif;
  font-size: 10.5pt;
  font-weight: 700;
}

/* Template 2: Technical Engineering & Cyber-SecOps ATS */
.doc-page.template-technical {
  font-family: 'Inter', 'Roboto', sans-serif;
  font-size: 9.8pt;
  line-height: 1.34;
  color: #0f172a !important;
}

.doc-page.template-technical .cv-header {
  text-align: left;
  border-bottom: 2px solid #0284c7;
  padding-bottom: 0.65rem;
  margin-bottom: 0.85rem;
}

.doc-page.template-technical .cv-name {
  color: #0369a1;
  font-size: 20pt;
  font-weight: 800;
  letter-spacing: -0.02em;
}

.doc-page.template-technical .cv-title {
  color: #475569;
  font-family: 'JetBrains Mono', 'Space Mono', monospace;
  font-size: 10pt;
  font-weight: 600;
  letter-spacing: 0.03em;
}

.doc-page.template-technical .cv-contact {
  justify-content: flex-start;
  font-size: 9.2pt;
  gap: 0.4rem;
}

.doc-page.template-technical .cv-section-title {
  color: #0369a1;
  border-bottom: 1.5px solid #cbd5e1;
  font-size: 11pt;
  font-weight: 800;
  letter-spacing: 0.04em;
}

.doc-page.template-technical .cv-skill-category {
  background: #f1f5f9;
  padding: 3px 8px;
  border-radius: 4px;
  border-left: 3px solid #0284c7;
  margin-bottom: 4px;
  font-size: 9.5pt;
}

/* Template 3: Modern Minimalist / Swiss Editorial (Default) */
.doc-page.template-modern {
  font-family: 'Calibri', 'Inter', -apple-system, sans-serif;
  font-size: 10pt;
  line-height: 1.32;
  color: #111827 !important;
}

.doc-page.template-modern .cv-header {
  text-align: center;
  margin-bottom: 0.8rem;
}

.doc-page.template-modern .cv-name {
  font-size: 19pt;
  font-weight: 800;
  letter-spacing: -0.01em;
  color: #0f172a;
}

.doc-page.template-modern .cv-section-title {
  font-size: 11pt;
  font-weight: 700;
  color: #0f172a;
  border-bottom: 1.5px solid #334155;
  padding-bottom: 2px;
  letter-spacing: 0.03em;
}

.card {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: 8px;
  padding: 1rem;
  margin-bottom: 1rem;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.12);
  transition: border-color 0.15s ease;
}

.card:hover {
  border-color: rgba(56, 189, 248, 0.35);
}

.card-title {
  font-size: 0.9rem;
  font-weight: 600;
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 0.75rem;
  color: var(--text-main);
}

.form-group {
  margin-bottom: 0.85rem;
}

.form-label {
  display: block;
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--text-secondary);
  margin-bottom: 0.3rem;
}

.form-input, .form-textarea {
  width: 100%;
  background: var(--bg-panel);
  border: 1px solid var(--border-color);
  color: var(--text-main);
  padding: 0.5rem 0.65rem;
  border-radius: 6px;
  font-size: 0.85rem;
  outline: none;
  font-family: inherit;
  transition: border-color 0.15s;
}

.form-input:focus, .form-textarea:focus {
  border-color: var(--border-focus);
}

.form-textarea {
  resize: vertical;
  min-height: 80px;
}

/* Upload Dropzone */
.dropzone {
  border: 2px dashed var(--border-color);
  border-radius: 8px;
  padding: 1.5rem;
  text-align: center;
  cursor: pointer;
  transition: all 0.2s ease;
  background: rgba(255, 255, 255, 0.01);
}

.dropzone:hover, .dropzone.dragover {
  border-color: var(--accent-blue);
  background: rgba(31, 111, 235, 0.05);
}

.dropzone-icon {
  font-size: 2rem;
  color: var(--accent-blue);
  margin-bottom: 0.5rem;
}

/* Quick Action Chips */
.action-chips-container {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
  margin-bottom: 0.75rem;
}

.chip-btn {
  padding: 0.3rem 0.6rem;
  font-size: 0.75rem;
  border-radius: 999px;
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  color: var(--text-secondary);
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  transition: all 0.15s;
}

.chip-btn:hover {
  background: var(--bg-card-hover);
  color: var(--text-main);
  border-color: var(--accent-blue);
}

/* Match Rate & Keyword Badges (High Contrast, Zero Overlay Glitch) */
.match-chip {
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  padding: 0.25rem 0.55rem;
  border-radius: 999px;
  font-size: 0.75rem;
  font-weight: 600;
  margin: 0.15rem 0.2rem;
}

.match-chip-good {
  background: rgba(46, 160, 67, 0.18);
  color: #3fb950 !important;
  border: 1px solid rgba(46, 160, 67, 0.4);
}

.match-chip-missing {
  background: rgba(210, 153, 34, 0.18);
  color: #d29922 !important;
  border: 1px solid rgba(210, 153, 34, 0.4);
}

.match-advice-box {
  background: var(--bg-panel);
  border: 1px solid var(--border-color);
  border-radius: 6px;
  padding: 0.65rem 0.85rem;
  margin-top: 0.6rem;
  color: var(--text-main) !important;
}

.match-advice-box li {
  color: var(--text-main) !important;
  font-size: 0.8rem;
  line-height: 1.5;
  margin-bottom: 0.35rem;
}

/* ATS Score Meter Card */
.score-card {
  display: flex;
  align-items: center;
  gap: 1rem;
  background: linear-gradient(135deg, rgba(31, 111, 235, 0.1), rgba(35, 134, 54, 0.1));
  border: 1px solid rgba(56, 139, 253, 0.3);
  border-radius: 8px;
  padding: 0.85rem;
  margin-bottom: 1rem;
}

.score-circle {
  width: 54px;
  height: 54px;
  border-radius: 50%;
  background: var(--bg-panel);
  border: 3px solid #3fb950;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.1rem;
  font-weight: 700;
  color: #3fb950;
  flex-shrink: 0;
}

/* Modal Dialog */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.7);
  backdrop-filter: blur(3px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s ease;
}

.modal-overlay.open {
  opacity: 1;
  pointer-events: auto;
}

.modal-box {
  background: var(--bg-panel);
  border: 1px solid var(--border-color);
  border-radius: 10px;
  width: 90%;
  max-width: 580px;
  max-height: 85vh;
  overflow-y: auto;
  box-shadow: 0 20px 40px rgba(0, 0, 0, 0.5);
  padding: 1.5rem;
}

/* AI Settings Modal Custom Styling */
.ai-modal-box {
  max-width: 520px;
  width: 92%;
  padding: 1.35rem 1.4rem;
  border-radius: 14px;
}

.modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 0.5rem;
  border-bottom: 1px solid var(--border-color);
  padding-bottom: 0.5rem;
}

.modal-header-title {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 1.02rem;
  font-weight: 700;
  color: var(--text-main);
}

.modal-subtitle {
  font-size: 0.78rem;
  color: var(--text-muted);
  line-height: 1.4;
  margin-bottom: 0.85rem;
}

.ai-presets-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
  margin-top: 0.25rem;
}

.input-with-icon {
  position: relative;
  display: flex;
  align-items: center;
  width: 100%;
}

.btn-key-toggle {
  position: absolute;
  right: 6px;
  border: none;
  background: transparent;
  color: var(--text-muted);
  cursor: pointer;
  padding: 0.3rem 0.5rem;
}

.model-header-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 0.35rem;
}

.ai-status-box {
  margin-top: 0.75rem;
  font-size: 0.8rem;
  border-radius: 8px;
  padding: 0.6rem 0.85rem;
  line-height: 1.4;
}

.modal-footer-actions {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 0.6rem;
  margin-top: 1.25rem;
  padding-top: 0.85rem;
  border-top: 1px solid var(--border-color);
}

.footer-btn-group-left,
.footer-btn-group-right {
  display: flex;
  align-items: center;
  gap: 0.4rem;
}

@media screen and (max-width: 580px) {
  .ai-modal-box {
    width: 95% !important;
    padding: 1.1rem 0.85rem !important;
  }

  .modal-footer-actions {
    flex-direction: column !important;
    gap: 0.5rem !important;
  }

  .footer-btn-group-left,
  .footer-btn-group-right {
    width: 100% !important;
    justify-content: space-between !important;
  }

  .footer-btn-group-left .btn,
  .footer-btn-group-right .btn {
    flex: 1 1 auto !important;
    text-align: center !important;
    justify-content: center !important;
    font-size: 0.75rem !important;
    padding: 0.35rem 0.45rem !important;
  }

  .model-header-row {
    flex-direction: row;
    gap: 0.3rem;
  }
  
  .model-header-row #btn-fetch-models {
    font-size: 0.72rem !important;
    padding: 0.2rem 0.45rem !important;
  }
}

/* Balloon Tooltips */
[data-tooltip] {
  position: relative;
}

[data-tooltip]::after {
  content: attr(data-tooltip);
  position: absolute;
  bottom: calc(100% + 7px);
  left: 50%;
  transform: translateX(-50%) translateY(4px);
  background: #0d1117;
  color: #ffffff;
  font-size: 0.73rem;
  font-weight: 500;
  padding: 0.35rem 0.65rem;
  border-radius: 6px;
  white-space: nowrap;
  pointer-events: none;
  opacity: 0;
  visibility: hidden;
  transition: all 0.15s ease;
  box-shadow: 0 6px 18px rgba(0, 0, 0, 0.6), 0 0 10px rgba(31, 111, 235, 0.2);
  border: 1px solid rgba(255, 255, 255, 0.2);
  z-index: 999999 !important;
}

[data-tooltip]::before {
  content: "";
  position: absolute;
  bottom: calc(100% + 2px);
  left: 50%;
  transform: translateX(-50%) translateY(4px);
  border: 5px solid transparent;
  border-top-color: #0d1117;
  pointer-events: none;
  opacity: 0;
  visibility: hidden;
  transition: all 0.15s ease;
  z-index: 999999 !important;
}

/* Tooltips in Header, Quick Nav, and Toolbar display downwards to prevent clipping */
.app-header [data-tooltip]::after,
.sidebar-quick-nav [data-tooltip]::after,
.doc-toolbar [data-tooltip]::after {
  bottom: auto;
  top: calc(100% + 8px);
  transform: translateX(-50%) translateY(-4px);
}

.app-header [data-tooltip]::before,
.sidebar-quick-nav [data-tooltip]::before,
.doc-toolbar [data-tooltip]::before {
  bottom: auto;
  top: calc(100% + 1px);
  border-top-color: transparent;
  border-bottom-color: #0d1117;
  transform: translateX(-50%) translateY(-4px);
}

[data-tooltip]:hover::after,
[data-tooltip]:hover::before {
  opacity: 1;
  visibility: visible;
  transform: translateX(-50%) translateY(0);
}

/* Real-Time Process Toast & Progress Overlay */
.process-toast {
  position: fixed;
  bottom: 24px;
  right: 24px;
  background: #0d1117;
  border: 1px solid #1f6feb;
  box-shadow: 0 12px 30px rgba(0, 0, 0, 0.6), 0 0 20px rgba(31, 111, 235, 0.25);
  border-radius: 8px;
  padding: 0.9rem 1.1rem;
  width: 320px;
  z-index: 9999;
  color: #e6edf3;
  animation: slideInUp 0.3s cubic-bezier(0.16, 1, 0.3, 1);
}

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

.process-toast-header {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  margin-bottom: 0.35rem;
}

.process-spinner {
  color: #58a6ff;
  font-size: 1.05rem;
}

.process-title {
  font-size: 0.85rem;
  font-weight: 700;
  color: #58a6ff;
  flex: 1;
}

.process-timer {
  font-family: 'Space Mono', monospace;
  font-size: 0.75rem;
  color: #8b949e;
}

.process-toast-step {
  font-size: 0.76rem;
  color: #8b949e;
  margin-bottom: 0.5rem;
}

.process-progress-bar-container {
  height: 4px;
  background: #21262d;
  border-radius: 2px;
  overflow: hidden;
}

.process-progress-bar-fill {
  height: 100%;
  background: linear-gradient(90deg, #1f6feb, #2ea043);
  border-radius: 2px;
  transition: width 0.2s ease;
}

/* ==========================================================================
   Floating Canvas Zoom Controls Dock
   ========================================================================== */

.canvas-zoom-dock {
  position: absolute;
  bottom: 20px;
  right: 24px;
  background: var(--bg-panel);
  border: 1px solid var(--border-color);
  border-radius: 999px;
  padding: 0.25rem 0.55rem;
  display: flex;
  align-items: center;
  gap: 0.35rem;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.4), 0 0 12px rgba(31, 111, 235, 0.15);
  z-index: 99;
  backdrop-filter: blur(8px);
}

.canvas-zoom-dock .zoom-btn {
  background: transparent;
  border: none;
  color: var(--text-main);
  width: 28px;
  height: 28px;
  border-radius: 50%;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.78rem;
  transition: all 0.12s ease;
}

.canvas-zoom-dock .zoom-btn:hover {
  background: var(--bg-card-hover);
  color: var(--accent-blue);
}

.canvas-zoom-dock .zoom-val {
  font-family: 'Space Mono', monospace;
  font-size: 0.75rem;
  font-weight: 700;
  color: var(--text-main);
  min-width: 44px;
  text-align: center;
  cursor: pointer;
  padding: 2px 4px;
  border-radius: 4px;
}
.canvas-zoom-dock .zoom-val:hover {
  background: var(--bg-card-hover);
}

.canvas-zoom-dock .zoom-divider {
  width: 1px;
  height: 16px;
  background: var(--border-color);
  margin: 0 0.1rem;
}

/* ==========================================================================
   Visual Diff Comparison Viewer
   ========================================================================== */

.diff-container {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  font-size: 0.82rem;
  line-height: 1.5;
  max-height: 60vh;
  overflow-y: auto;
  padding-right: 0.25rem;
}

.diff-section-card {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: 6px;
  padding: 0.75rem;
}

.diff-section-title {
  font-size: 0.82rem;
  font-weight: 700;
  color: var(--accent-blue);
  margin-bottom: 0.4rem;
  display: flex;
  align-items: center;
  gap: 0.4rem;
}

.diff-badge-deleted {
  background: rgba(248, 81, 73, 0.18);
  color: #f85149;
  text-decoration: line-through;
  padding: 2px 5px;
  border-radius: 3px;
  margin-right: 4px;
  display: inline-block;
}

.diff-badge-added {
  background: rgba(46, 160, 67, 0.18);
  color: #3fb950;
  font-weight: 600;
  padding: 2px 5px;
  border-radius: 3px;
  display: inline-block;
}

.diff-actions-bar {
  display: flex;
  justify-content: flex-end;
  gap: 0.6rem;
  margin-top: 1rem;
  border-top: 1px solid var(--border-color);
  padding-top: 0.75rem;
}

/* ==========================================================================
   Print Rules (CSS Paged Media - Clean Vector A4 Export)
   ========================================================================== */

@page {
  size: A4 portrait;
  margin: 0;
}

/* ==========================================
   Recruiter Eye-Tracking Heatmap Simulation (6-Second Scan)
   ========================================== */
.heatmap-active .doc-page {
  position: relative;
}

.heatmap-active .doc-page::after {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  pointer-events: none;
  border-radius: 0;
  z-index: 10;
  background: 
    /* Hotspot 1: Header (Name & Title) - 80% focus */
    radial-gradient(circle at 50% 6%, rgba(248, 81, 73, 0.45) 0%, rgba(248, 81, 73, 0.25) 120px, transparent 200px),
    /* Hotspot 2: Summary Hook & Left F-stem - 75% focus */
    radial-gradient(ellipse at 25% 18%, rgba(248, 81, 73, 0.4) 0%, rgba(210, 153, 34, 0.3) 140px, transparent 220px),
    /* Hotspot 3: Skills keywords - 65% focus */
    radial-gradient(ellipse at 35% 26%, rgba(210, 153, 34, 0.38) 0%, rgba(210, 153, 34, 0.2) 130px, transparent 200px),
    /* Hotspot 4: First Job Title & Company - 85% focus */
    radial-gradient(ellipse at 30% 36%, rgba(248, 81, 73, 0.48) 0%, rgba(210, 153, 34, 0.3) 150px, transparent 240px),
    /* Hotspot 5: Top 2 Bullet Points - 60% focus */
    radial-gradient(ellipse at 32% 43%, rgba(210, 153, 34, 0.35) 0%, rgba(56, 139, 253, 0.2) 120px, transparent 180px),
    /* Hotspot 6: Second Job & Education - 35% focus */
    radial-gradient(ellipse at 35% 62%, rgba(56, 139, 253, 0.3) 0%, rgba(56, 139, 253, 0.1) 140px, transparent 220px);
  box-shadow: inset 0 0 40px rgba(248, 81, 73, 0.15);
  mix-blend-mode: multiply;
}

.heatmap-legend-dock {
  position: fixed;
  bottom: 60px;
  right: 28px;
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  box-shadow: var(--shadow-lg);
  border-radius: 8px;
  padding: 0.65rem 0.85rem;
  z-index: 1000;
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
  font-size: 0.74rem;
  color: var(--text-main);
  animation: fadeIn 0.2s ease-out;
}

.heatmap-legend-item {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.heatmap-legend-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
}

/* ==========================================================================
   PWA App Splash Screen & Loading Animation
   ========================================================================== */
.app-splash-screen {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  width: 100vw;
  height: 100vh;
  background: radial-gradient(circle at 50% 40%, #162235 0%, #0d1117 70%, #070a0e 100%);
  z-index: 999999;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 1;
  visibility: visible;
  transition: opacity 0.5s cubic-bezier(0.16, 1, 0.3, 1), visibility 0.5s ease;
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
}

.app-splash-screen.hidden {
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
}

.splash-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  max-width: 90%;
  width: 360px;
  padding: 2.2rem 1.5rem;
  background: rgba(22, 27, 34, 0.85);
  border: 1px solid rgba(56, 139, 253, 0.3);
  border-radius: 20px;
  box-shadow: 0 20px 50px rgba(0, 0, 0, 0.7), 0 0 30px rgba(31, 111, 235, 0.25);
  animation: splashCardEnter 0.6s cubic-bezier(0.16, 1, 0.3, 1);
}

@keyframes splashCardEnter {
  from {
    transform: scale(0.9) translateY(20px);
    opacity: 0;
  }
  to {
    transform: scale(1) translateY(0);
    opacity: 1;
  }
}

.splash-icon-wrapper {
  position: relative;
  width: 80px;
  height: 80px;
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 1.25rem;
}

.splash-pulse-ring {
  position: absolute;
  top: -6px;
  left: -6px;
  right: -6px;
  bottom: -6px;
  border-radius: 22px;
  border: 2px solid rgba(56, 139, 253, 0.6);
  animation: splashPulse 2s infinite cubic-bezier(0.25, 1, 0.5, 1);
}

@keyframes splashPulse {
  0% {
    transform: scale(0.85);
    opacity: 0.8;
  }
  50% {
    transform: scale(1.15);
    opacity: 0.2;
  }
  100% {
    transform: scale(0.85);
    opacity: 0.8;
  }
}

.splash-icon-inner {
  width: 68px;
  height: 68px;
  border-radius: 18px;
  background: linear-gradient(135deg, #1f6feb 0%, #1158c7 50%, #2ea043 100%);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 2rem;
  color: #ffffff;
  box-shadow: 0 10px 25px rgba(31, 111, 235, 0.4);
}

.splash-brand-title {
  font-size: 1.25rem;
  font-weight: 800;
  color: #ffffff;
  letter-spacing: -0.02em;
  margin-bottom: 0.3rem;
}

.splash-brand-tagline {
  font-size: 0.78rem;
  color: #8b949e;
  margin-bottom: 1.6rem;
  font-weight: 500;
}

.splash-progress-track {
  width: 100%;
  height: 6px;
  background: rgba(48, 54, 61, 0.8);
  border-radius: 999px;
  overflow: hidden;
  position: relative;
  margin-bottom: 0.85rem;
}

.splash-progress-fill {
  height: 100%;
  width: 25%;
  background: linear-gradient(90deg, #1f6feb, #56d364, #79c0ff);
  border-radius: 999px;
  transition: width 0.35s ease;
  box-shadow: 0 0 10px rgba(56, 139, 253, 0.8);
}

.splash-status-text {
  font-size: 0.74rem;
  color: #58a6ff;
  font-weight: 600;
  letter-spacing: 0.01em;
}

/* ==========================================================================
   Universal Device Compatibility & Responsive Layouts (Mobile, Tablet, 4K)
   ========================================================================== */

/* Tablet & Medium Screens (769px to 1024px) */
@media screen and (min-width: 769px) and (max-width: 1024px) {
  .app-main {
    flex-direction: row;
    height: calc(100vh - 56px);
  }
  .control-sidebar {
    width: 360px;
    min-width: 330px;
    max-width: 380px;
  }
  .brand-badge {
    display: none;
  }
  .doc-scroll-viewport {
    padding: 1.5rem 1rem 5rem 1rem;
  }
}

/* Mobile Devices & Small Screens (<= 768px) */
@media screen and (max-width: 768px) {
  html, body {
    overflow-x: hidden !important;
    width: 100% !important;
    max-width: 100vw !important;
    height: auto !important;
    min-height: 100vh;
  }
  
  .app-container {
    width: 100% !important;
    max-width: 100vw !important;
    overflow-x: hidden !important;
  }

  .app-header {
    padding: 0.5rem 0.75rem !important;
    height: auto !important;
    min-height: auto !important;
    display: flex !important;
    flex-wrap: wrap !important;
    align-items: center !important;
    justify-content: space-between !important;
    gap: 0.4rem !important;
    width: 100% !important;
    box-sizing: border-box !important;
  }

  .brand-area {
    width: auto !important;
    gap: 0.4rem !important;
  }

  .brand-title {
    font-size: 0.9rem !important;
  }

  .brand-badge {
    display: none !important;
  }

  .header-actions {
    width: auto !important;
    display: flex !important;
    flex-wrap: nowrap !important;
    overflow-x: auto !important;
    -webkit-overflow-scrolling: touch !important;
    gap: 0.3rem !important;
    margin-left: auto !important;
  }

  .header-actions > button,
  .header-actions > .dropdown-wrapper {
    flex: 0 0 auto !important;
  }

  .header-actions .btn {
    width: auto !important;
    font-size: 0.72rem !important;
    padding: 0.3rem 0.55rem !important;
    white-space: nowrap !important;
  }

  .app-main {
    flex-direction: column !important;
    width: 100% !important;
    max-width: 100vw !important;
    height: auto !important;
    overflow: visible !important;
  }

  .control-sidebar {
    width: 100% !important;
    min-width: 100% !important;
    max-width: 100% !important;
    height: auto !important;
    overflow: visible !important;
    border-right: none !important;
    border-bottom: 2px solid var(--border-color) !important;
  }

  .sidebar-quick-nav {
    display: flex !important;
    overflow-x: auto !important;
    flex-wrap: nowrap !important;
    gap: 0.35rem !important;
    padding: 0.5rem !important;
    -webkit-overflow-scrolling: touch !important;
  }

  .nav-pill {
    flex: 0 0 auto !important;
    font-size: 0.75rem !important;
    padding: 0.4rem 0.75rem !important;
    white-space: nowrap !important;
  }

  .workflow-container {
    padding: 0.75rem 0.5rem !important;
    max-height: none !important;
    overflow: visible !important;
    width: 100% !important;
    box-sizing: border-box !important;
  }

  .doc-workspace {
    width: 100% !important;
    max-width: 100vw !important;
    min-height: auto !important;
    overflow: visible !important;
  }

  .doc-toolbar {
    width: 100% !important;
    overflow-x: auto !important;
    flex-wrap: nowrap !important;
    padding: 0.4rem !important;
    gap: 0.35rem !important;
    justify-content: flex-start !important;
    -webkit-overflow-scrolling: touch !important;
    box-sizing: border-box !important;
  }

  .doc-toolbar .toolbar-group {
    flex-shrink: 0 !important;
  }

  .doc-scroll-viewport {
    padding: 0.75rem 0.35rem 5rem 0.35rem !important;
    width: 100% !important;
    box-sizing: border-box !important;
    overflow-x: hidden !important;
    background: #e2e8f0 !important;
  }

  [data-theme="dark"] .doc-scroll-viewport {
    background: #141a24 !important;
  }

  .doc-canvas {
    width: 100% !important;
    max-width: 100% !important;
    transform: none !important;
    margin: 0 auto !important;
    display: flex !important;
    flex-direction: column !important;
    align-items: center !important;
  }

  .doc-page {
    width: 100% !important;
    max-width: 100% !important;
    min-height: auto !important;
    padding: 16px 12px !important;
    margin: 0 auto 16px auto !important;
    box-sizing: border-box !important;
    border-radius: 8px !important;
    font-size: 9.5pt !important;
    box-shadow: var(--shadow-sm) !important;
  }

  .doc-page-gap {
    width: 100% !important;
    height: 16px !important;
    margin: 4px 0 16px 0 !important;
  }

  /* Force responsive stacked grids inside forms */
  div[style*="grid-template-columns"],
  .form-grid,
  .form-row {
    grid-template-columns: 1fr !important;
  }

  .canvas-zoom-dock {
    display: none !important;
  }

  .heatmap-legend-dock {
    bottom: 20px;
    right: 14px;
    transform: scale(0.85);
    transform-origin: bottom right;
  }

  .modal-box {
    width: 95% !important;
    max-width: 95% !important;
    padding: 1.1rem !important;
    margin: 1rem auto !important;
  }
}

/* Extra Small Phones (<= 480px) */
@media screen and (max-width: 480px) {
  .doc-page {
    padding: 12px 10px !important;
    font-size: 9pt !important;
  }
  .cv-name {
    font-size: 15pt !important;
  }
  .cv-title {
    font-size: 10pt !important;
  }
  .cv-contact {
    font-size: 8.5pt !important;
    gap: 0.3rem !important;
  }
}

/* Ultra-Wide Monitors (>= 1600px) */
@media screen and (min-width: 1600px) {
  .control-sidebar {
    width: 480px;
    max-width: 520px;
  }
/* ==========================================================================
   App Developer Footer (CV Builder & Studio)
   ========================================================================== */
.app-sidebar-footer,
.studio-sidebar-footer {
  margin-top: auto;
  padding: 0.9rem 1rem;
  background: var(--bg-panel);
  border-top: 1px solid var(--border-color);
  text-align: center;
  font-size: 0.76rem;
  color: var(--text-secondary);
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
  box-shadow: 0 -2px 10px rgba(0, 0, 0, 0.05);
}

.footer-copyright-line {
  font-weight: 600;
  color: var(--text-main);
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.35rem;
  flex-wrap: wrap;
}

.footer-heart {
  color: #ef4444;
  animation: heartPulse 1.5s ease-in-out infinite;
  display: inline-block;
}

@keyframes heartPulse {
  0%, 100% { transform: scale(1); }
  50% { transform: scale(1.22); }
}

.footer-links-line {
  display: flex;
  align-items: center;
  justify-content: center;
  flex-wrap: wrap;
  gap: 0.45rem 0.6rem;
  font-size: 0.73rem;
}

.footer-link {
  color: var(--accent-blue);
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  transition: all 0.2s ease;
}

.footer-link:hover {
  color: #58a6ff;
  text-decoration: underline;
  transform: translateY(-1px);
}

.footer-sep {
  color: var(--text-muted);
  font-size: 0.65rem;
  user-select: none;
}

@media print {
  body {
    background: transparent !important;
    color: #000000 !important;
    overflow: visible !important;
    height: auto !important;
  }
  
  .app-splash-screen,
  .app-header,
  .control-sidebar,
  .doc-toolbar,
  .modal-overlay,
  .no-print {
    display: none !important;
  }
  
  .app-main,
  .doc-workspace,
  .doc-scroll-viewport {
    background: transparent !important;
    padding: 0 !important;
    margin: 0 !important;
    overflow: visible !important;
    display: block !important;
  }
  
  .doc-page {
    box-shadow: none !important;
    border: none !important;
    margin: 0 auto !important;
    width: 100% !important;
    min-height: auto !important;
    padding: 15mm 18mm !important;
    page-break-after: always;
  }

  .doc-page:last-child {
    page-break-after: auto;
  }

  .doc-page-gap,
  .doc-page-header-badge {
    display: none !important;
  }
}
