/* ============================================================
   LAYOUT.CSS — App Shell, Top Bar, Split Panel
   ============================================================ */

/* ── App Shell ──────────────────────────────────────────── */
#app {
  display: flex;
  flex-direction: column;
  height: 100vh;
  overflow: hidden;
  background: var(--bg);
}

/* ── Top Bar ────────────────────────────────────────────── */
#top-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 56px;
  background: var(--bg-panel);
  border-bottom: 1px solid var(--border);
  padding: 0 20px;
  position: relative;
  z-index: var(--z-sticky);
  flex-shrink: 0;
  box-shadow: var(--shadow-xs);
}

#top-bar .logo {
  display: flex;
  align-items: center;
  gap: 8px;
  font-weight: 700;
  font-size: 1rem;
  color: var(--primary);
  text-decoration: none;
}

#top-bar .logo .logo-icon {
  width: 30px;
  height: 30px;
  background: var(--primary);
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: white;
  font-size: 0.875rem;
  font-weight: 700;
  box-shadow: 0 2px 8px rgba(27,45,231,0.3);
}

/* Mode Tabs (Edit / Customize) */
.mode-tabs {
  display: flex;
  align-items: center;
  background: var(--bg-sidebar);
  border-radius: var(--radius-full);
  padding: 3px;
  gap: 2px;
  position: absolute;
  left: 50%;
  transform: translateX(-50%);
  border: 1px solid var(--border);
}

.mode-tab {
  padding: 5px 18px;
  border-radius: var(--radius-full);
  font-size: 0.875rem;
  font-weight: 500;
  color: var(--text-muted);
  transition: all var(--transition-base);
  cursor: pointer;
  background: transparent;
  border: none;
  white-space: nowrap;
}

.mode-tab.active {
  background: var(--bg-panel);
  color: var(--primary);
  box-shadow: var(--shadow-xs);
  font-weight: 600;
}

/* Top Bar Right Actions */
.top-bar-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}

.autosave-indicator {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 0.8125rem;
  color: var(--text-muted);
  transition: opacity var(--transition-base);
  display: none;
}

.autosave-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--success);
  transition: background var(--transition-base);
}

.autosave-indicator.saving .autosave-dot {
  background: var(--warning);
  animation: pulse 1s ease infinite;
}

.lang-selector {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 5px 10px;
  border: 1.5px solid var(--border);
  border-radius: var(--radius-md);
  font-size: 0.8125rem;
  font-weight: 500;
  color: var(--text-secondary);
  cursor: pointer;
  background: var(--bg-panel);
  transition: all var(--transition-fast);
  display: none;
}

.lang-selector:hover {
  border-color: var(--primary);
  color: var(--primary);
  display: none;
}

.lang-flag { width: 18px; height: 14px; border-radius: 2px; }

/* ── Score Bar ──────────────────────────────────────────── */
#score-bar {
  padding: 8px 20px 0;
  background: var(--bg-panel);
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
  display: none;
}

.score-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 6px;
}

.score-label {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 0.8125rem;
  color: var(--text-secondary);
}

.score-badge {
  padding: 2px 8px;
  border-radius: var(--radius-full);
  font-size: 0.75rem;
  font-weight: 700;
}

.score-badge.low { background: rgba(231,76,60,0.12); color: var(--error); }
.score-badge.medium { background: rgba(243,156,18,0.12); color: var(--warning); }
.score-badge.high { background: rgba(39,174,96,0.12); color: var(--success); }

.score-bar-track {
  height: 3px;
  background: var(--border);
  border-radius: var(--radius-full);
  overflow: hidden;
}

.score-bar-fill {
  height: 100%;
  border-radius: var(--radius-full);
  transition: width 600ms var(--ease-out);
  background: linear-gradient(90deg, var(--warning), var(--success));
}

/* ── Main Layout ────────────────────────────────────────── */
#main {
  display: flex;
  flex-direction: column;
  flex: 1;
  min-height: 0;
  overflow: hidden;
}

/* Bootstrap row must grow via flex, not height:100%, so that
   col-6 children can use align-items:stretch reliably */
#main > .row {
  flex: 1 1 0 !important;
  min-height: 0;
}

#left-col,
#right-col {
  flex: 0 0 50%;
  width: 50%;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  min-height: 0;
}

/* ── Left column divider ────────────────────────────────── */
#left-col {
  border-right: 1px solid var(--border);
}

/* ── Editor Panel (Left) ────────────────────────────────── */
#editor-panel {
  flex: 1 1 0;
  min-height: 0;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  background: var(--bg-panel);
  position: relative;
}

#editor-content {
  flex: 1;
  overflow-y: auto;
  padding: 28px 32px;
  scroll-behavior: smooth;
}

/* ── Bottom Nav ─────────────────────────────────────────── */
#bottom-nav {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 20px;
  background: var(--bg-panel);
  border-top: 1px solid var(--border);
  flex-shrink: 0;
}

.bottom-nav-left,
.bottom-nav-right {
  display: flex;
  align-items: center;
  gap: 10px;
}

.step-dots {
  display: flex;
  align-items: center;
  gap: 5px;
}

.step-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--border);
  transition: all var(--transition-base);
  border: none;
  padding: 0;
  cursor: pointer;
}

.step-dot:hover {
  background: var(--text-muted);
}

.step-dot.active {
  width: 28px;
  height: 8px;
  border-radius: var(--radius-full);
  background: var(--primary);
}

.step-dot.completed {
  background: var(--primary);
  opacity: 0.45;
}

.step-dot.completed:hover {
  opacity: 0.7;
}

/* ── Preview Panel (Right) ──────────────────────────────── */
#preview-panel {
  flex: 1 1 0;
  min-height: 0;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  background: #E8EBF7;
  position: relative;
}

#preview-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 16px;
  background: rgba(27, 45, 231, 0.04);
  border-bottom: 1px solid rgba(27, 45, 231, 0.07);
  flex-shrink: 0;
}

.preview-zoom-controls {
  display: flex;
  align-items: center;
  gap: 4px;
}

.preview-zoom-btn {
  width: 28px;
  height: 28px;
  border-radius: var(--radius-sm);
  background: rgba(255,255,255,0.7);
  border: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1rem;
  font-weight: 600;
  color: var(--text-secondary);
  transition: all var(--transition-fast);
}
.preview-zoom-btn:hover {
  background: white;
  color: var(--primary);
}

.zoom-display {
  font-size: 0.8125rem;
  font-weight: 500;
  color: var(--text-secondary);
  min-width: 44px;
  text-align: center;
}

.page-nav {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 0.8125rem;
  font-weight: 500;
  color: var(--text-secondary);
}

.page-nav-btn {
  width: 26px;
  height: 26px;
  border-radius: var(--radius-sm);
  background: rgba(255,255,255,0.7);
  border: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-secondary);
  transition: all var(--transition-fast);
}
.page-nav-btn:hover:not(:disabled) {
  background: white;
  color: var(--primary);
}
.page-nav-btn:disabled { opacity: 0.4; cursor: default; }

#preview-viewport {
  flex: 1;
  overflow: auto;
  display: flex;
  align-items: flex-start;
  justify-content: center;
  padding: 0;
  background: #EFF2FA; /* dark slate — makes white page cards stand out like a PDF viewer */
}

#preview-container {
  transform-origin: top center;
  transition: transform 200ms var(--ease-out);
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 0px 0; /* top/bottom breathing room — lives inside the zoom transform, not the scroll container */
}

/* #resume-preview is kept offscreen — used by PDFExporter only */
#resume-preview {
  position: fixed;
  top: 0;
  left: -99999px;
  background: white;
  pointer-events: none;
  z-index: -1;
}

/* ── Visible multi-page cards ───────────────────────────── */
.resume-page-shell {
  position: relative;
  overflow: hidden;
  background: white;
  box-shadow: 0 4px 24px rgba(0,0,0,0.18), 0 1px 4px rgba(0,0,0,0.10);
  flex-shrink: 0;
}

/* ── Page badge ‹ 1 / 2 › ───────────────────────────────── */
.page-badge {
  display: flex;
  align-items: center;
  gap: 6px;
  background: #1D2532;
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  border: 1px solid rgba(255,255,255,0.32);
  color: #fff;
  border-radius: 999px;
  padding: 7px 14px;
  font-size: 0.8125rem;
  font-weight: 600;
  white-space: nowrap;
  box-shadow: 0 2px 12px rgba(0,0,0,0.25);
  z-index: 10;
  pointer-events: auto;
  user-select: none;
}

.page-badge-arrow {
  background: none;
  border: none;
  color: #fff;
  font-size: 1.15rem;
  line-height: 1;
  cursor: pointer;
  padding: 0 2px;
  display: flex;
  align-items: center;
  opacity: 0.8;
  transition: opacity 0.15s;
}

.page-badge-arrow:hover:not(:disabled) { opacity: 1; }
.page-badge-arrow:disabled { opacity: 0.25; cursor: default; }

.page-badge-label {
  min-width: 36px;
  text-align: center;
  letter-spacing: 0.03em;
}


.page-shell-inner {
  position: absolute;
  left: 0;
  top: 0;
}

/* ── Continuation header (pages 2+) ─────────────────────── */
.page-cont-header {
  display: flex;
  align-items: baseline;
  gap: 10px;
  padding: 0 var(--resume-margin-lr, 0.5in);
  padding-bottom: 6px;
  border-bottom: 1.5px solid var(--resume-accent, #1a5c45);
  font-family: var(--resume-font-secondary, 'Open Sans'), sans-serif;
}

.page-cont-name {
  font-family: var(--resume-font-primary, 'Merriweather'), serif;
  font-size: 13pt;
  font-weight: var(--resume-primary-weight, 700);
  color: var(--resume-accent, #1a5c45);
  white-space: nowrap;
}

.page-cont-contact {
  font-size: 8.5pt;
  color: #555;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* Gap between page cards — shows dark viewport background, centers the page badge */
.page-shell-gap {
  width: 100%;
  height: 40px;
  flex-shrink: 0;
  background: transparent;
  display: flex;
  align-items: center;
  justify-content: center;
}

/* ── Page format toggle (A4 / Letter) ────────────────────── */
.page-format-toggle {
  display: flex;
  align-items: center;
  gap: 2px;
  background: rgba(0,0,0,0.06);
  border-radius: var(--radius-sm);
  padding: 2px;
}

.page-format-btn {
  font-size: 0.75rem;
  font-weight: 600;
  padding: 3px 10px;
  border: none;
  border-radius: calc(var(--radius-sm) - 2px);
  background: transparent;
  color: var(--text-muted);
  cursor: pointer;
  transition: background 0.15s, color 0.15s;
  white-space: nowrap;
}

.page-format-btn.active {
  background: white;
  color: var(--text-primary);
  box-shadow: 0 1px 3px rgba(0,0,0,0.12);
}

/* ── Customize Panel ────────────────────────────────────── */
#customize-panel {
  display: none;
  flex-direction: column;
  overflow: hidden;
  background: var(--bg-panel);
  flex: 1 1 0;
  min-height: 0;
}

#customize-panel.active {
  display: flex;
}

.customize-tabs {
  display: flex;
  border-bottom: 1px solid var(--border);
  padding: 0 8px;
  flex-shrink: 0;
}

.customize-tab {
  padding: 12px 16px;
  font-size: 0.875rem;
  font-weight: 500;
  color: var(--text-muted);
  border-bottom: 2px solid transparent;
  transition: all var(--transition-base);
  cursor: pointer;
  white-space: nowrap;
}

.customize-tab.active {
  color: var(--primary);
  border-bottom-color: var(--primary);
}

#customize-content {
  flex: 1;
  overflow-y: auto;
}

/* ── Step Header ────────────────────────────────────────── */
.step-header {
  margin-bottom: 24px;
}

.step-header h2 {
  font-size: 1.5rem;
  font-weight: 700;
  color: var(--text-primary);
  margin-bottom: 6px;
}

.step-header p {
  font-size: 0.875rem;
  color: var(--text-muted);
  line-height: 1.5;
}

.step-header .score-boost {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 0.8125rem;
  font-weight: 600;
  color: var(--success);
  margin-left: 8px;
}

/* ── Entry Card ─────────────────────────────────────────── */
.entry-card {
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  margin-bottom: 12px;
  overflow: hidden;
  transition: box-shadow var(--transition-base);
  background: var(--bg-panel);
}

.entry-card:hover {
  box-shadow: var(--shadow-sm);
}

.entry-card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 16px;
  cursor: pointer;
  user-select: none;
  background: var(--bg-panel);
  transition: background var(--transition-fast);
}

.entry-card-header:hover { background: var(--bg-sidebar); }

.entry-card-header-left {
  display: flex;
  align-items: center;
  gap: 10px;
  flex: 1;
  min-width: 0;
}

.drag-handle {
  display: flex;
  flex-direction: column;
  gap: 3px;
  cursor: grab;
  padding: 4px;
  margin-right: 10px;
  color: #0F1117;
  transition: color var(--transition-fast);
  flex-shrink: 0;
}

.drag-handle:active { cursor: grabbing; }
.drag-handle:hover { color: var(--text-muted); }

.drag-handle span {
  display: block;
  width: 16px;
  height: 2px;
  background: currentColor;
  border-radius: 1px;
}

.entry-title {
  font-size: 0.9375rem;
  font-weight: 500;
  color: var(--text-primary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.entry-subtitle {
  font-size: 0.8125rem;
  color: var(--text-muted);
  margin-top: 1px;
}

.entry-card-actions {
  display: flex;
  align-items: center;
  gap: 2px;
  flex-shrink: 0;
}

.entry-card-body {
  padding: 16px;
  border-top: 1px solid var(--border);
  display: none;
}

.entry-card-body.open { display: block; }

.collapse-icon {
  transition: transform var(--transition-base);
  color: var(--text-muted);
  flex-shrink: 0;
}

.entry-card-header[aria-expanded="true"] .collapse-icon {
  transform: rotate(180deg);
}

/* ── Dragging State ─────────────────────────────────────── */
.entry-card.dragging {
  opacity: 0.5;
  box-shadow: var(--shadow-lg);
}

.entry-card.drag-over {
  border-color: var(--primary);
  box-shadow: 0 0 0 2px var(--primary-xlight);
}

/* ── Add Button Row ─────────────────────────────────────── */
.add-entry-btn {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 0;
  font-size: 0.9rem;
  font-weight: 500;
  color: var(--primary);
  background: none;
  border: none;
  cursor: pointer;
  transition: opacity var(--transition-fast);
}

.add-entry-btn:hover { opacity: 0.75; }

/* ── Language Picker Modal ──────────────────────────────── */
.lang-modal-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 6px;
  max-height: 400px;
  overflow-y: auto;
}

.lang-option {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  border: 1.5px solid var(--border);
  border-radius: var(--radius-md);
  cursor: pointer;
  transition: all var(--transition-fast);
  font-size: 0.875rem;
}

.lang-option:hover {
  border-color: var(--primary);
  background: var(--primary-xlight);
}

.lang-option.active {
  border-color: var(--primary);
  background: var(--primary-xlight);
  color: var(--primary);
  font-weight: 500;
}

/* ── Mobile Bottom Navigation ───────────────────────────── */
/* position:static on mobile so it's in flex flow (see responsive.css) */
#mobile-nav {
  display: none;
  background: var(--bg-panel);
  border-top: 1px solid var(--border);
  z-index: var(--z-sticky);
  align-items: center;
  justify-content: space-around;
  padding: 0 8px;
  padding-bottom: env(safe-area-inset-bottom, 0px);
  box-shadow: 0 -4px 20px rgba(27, 45, 231, 0.07);
}

.mobile-nav-tab {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 3px;
  padding: 8px 16px;
  border-radius: var(--radius-lg);
  font-size: 0.625rem;
  font-weight: 600;
  color: var(--text-muted);
  letter-spacing: 0.04em;
  text-transform: uppercase;
  transition: all var(--transition-base);
  background: none;
  border: none;
  cursor: pointer;
  min-width: 64px;
}

.mobile-nav-tab svg {
  width: 20px;
  height: 20px;
  stroke-width: 2;
  transition: stroke var(--transition-fast);
}

.mobile-nav-tab.active {
  color: var(--primary);
}

.mobile-nav-tab.active svg {
  stroke: var(--primary);
}

.mobile-nav-tab-dot {
  width: 4px;
  height: 4px;
  border-radius: 50%;
  background: var(--primary);
  margin-top: 2px;
  opacity: 0;
  transition: opacity var(--transition-base);
}

.mobile-nav-tab.active .mobile-nav-tab-dot {
  opacity: 1;
}
