/* ================================================================
   CV BUILDER — Styles
   Matches McGheeLab site design: --bg, --surface, --accent, --text, --muted
   ================================================================ */

/* ── Layout ────────────────────────────────────────────────────── */
.cv-app {
  display: flex;
  min-height: calc(100vh - var(--banner-height, 64px));
  color: var(--text, #eef2f7);
}

/* ── Sidebar ───────────────────────────────────────────────────── */
.cv-sidebar {
  width: 220px;
  flex-shrink: 0;
  background: var(--surface, #121620);
  border-right: 1px solid rgba(255,255,255,.08);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  transition: width .18s;
}
.cv-sidebar-header {
  padding: 14px 14px 12px;
  border-bottom: 1px solid rgba(255,255,255,.08);
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-shrink: 0;
}
.cv-sidebar-title {
  font-size: .8rem;
  font-weight: 700;
  color: var(--accent, #5baed1);
  letter-spacing: .04em;
  white-space: nowrap;
}
.cv-sidebar-nav {
  overflow-y: auto;
  flex: 1;
  padding: 6px 0;
}
.cv-nav-group-label {
  font-size: .65rem;
  letter-spacing: .12em;
  text-transform: uppercase;
  color: var(--muted, #a8b3c7);
  padding: 10px 14px 3px;
  opacity: .7;
}
.cv-nav-btn {
  display: flex;
  align-items: center;
  gap: 9px;
  width: 100%;
  background: none;
  border: none;
  border-left: 2px solid transparent;
  padding: 8px 14px;
  cursor: pointer;
  font-family: inherit;
  font-size: .8rem;
  text-align: left;
  transition: all .12s;
  color: var(--muted, #a8b3c7);
  white-space: nowrap;
  overflow: hidden;
  min-height: 38px;
}
.cv-nav-btn:hover {
  background: rgba(255,255,255,.04);
  border-left-color: rgba(255,255,255,.15);
  color: var(--text, #eef2f7);
}
.cv-nav-btn.active {
  background: rgba(91,174,209,.08);
  border-left-color: var(--accent, #5baed1);
  color: var(--text, #eef2f7);
}
.cv-nav-icon {
  font-size: 14px;
  flex-shrink: 0;
  width: 16px;
  text-align: center;
}
.cv-nav-label {
  flex: 1;
  overflow: hidden;
  text-overflow: ellipsis;
}
.cv-nav-count {
  font-size: .7rem;
  opacity: .7;
}

/* ── Main Content ──────────────────────────────────────────────── */
.cv-main {
  flex: 1;
  overflow: auto;
  padding: 28px 32px;
}

/* ── Cards & Surfaces ──────────────────────────────────────────── */
.cv-card {
  background: linear-gradient(180deg, rgba(255,255,255,.04), rgba(255,255,255,.02));
  border: 1px solid rgba(255,255,255,.08);
  border-radius: var(--radius, 12px);
  padding: 22px 26px;
  box-shadow: var(--shadow, 0 10px 30px rgba(0,0,0,.25));
}

/* ── Inputs ────────────────────────────────────────────────────── */
.cv-field {
  background: rgba(255,255,255,.04);
  border: 1px solid rgba(255,255,255,.12);
  border-radius: 6px;
  color: var(--text, #eef2f7);
  padding: 9px 12px;
  font-family: inherit;
  font-size: .9rem;
  width: 100%;
  transition: border-color .15s;
  -webkit-appearance: none;
  box-sizing: border-box;
}
.cv-field:focus {
  border-color: var(--accent, #5baed1);
  box-shadow: 0 0 0 3px rgba(91,174,209,.2);
  outline: none;
}
.cv-field::placeholder {
  color: var(--muted, #a8b3c7);
  opacity: .6;
}
textarea.cv-field {
  resize: vertical;
  line-height: 1.6;
}
select.cv-field {
  appearance: none;
  cursor: pointer;
}
select.cv-field option {
  background: var(--surface, #121620);
  color: var(--text, #eef2f7);
}

/* ── Buttons ───────────────────────────────────────────────────── */
.cv-btn {
  cursor: pointer;
  font-family: inherit;
  font-size: .85rem;
  font-weight: 600;
  border: none;
  border-radius: 6px;
  padding: 8px 18px;
  transition: all .15s;
  display: inline-flex;
  align-items: center;
  gap: 7px;
  white-space: nowrap;
  min-height: 36px;
  touch-action: manipulation;
}
.cv-btn:hover:not(:disabled) { filter: brightness(1.12); }
.cv-btn:disabled { opacity: .45; cursor: not-allowed; }
.cv-btn:active:not(:disabled) { transform: scale(.97); }

.cv-btn-gold {
  background: var(--accent, #5baed1);
  color: #031a16;
}
.cv-btn-outline {
  background: var(--surface-2, #1a2030);
  border: 1px solid rgba(255,255,255,.1);
  color: var(--text, #eef2f7);
}
.cv-btn-outline:hover:not(:disabled) {
  background: rgba(255,255,255,.08);
}
.cv-btn-danger {
  background: rgba(185,28,28,.15);
  border: 1px solid rgba(185,28,28,.25);
  color: #fca5a5;
}
.cv-btn-danger:hover:not(:disabled) {
  background: rgba(185,28,28,.25);
}

/* ── Chips ─────────────────────────────────────────────────────── */
.cv-chip {
  display: inline-block;
  padding: 3px 10px;
  font-size: .7rem;
  letter-spacing: .06em;
  text-transform: uppercase;
  font-weight: 600;
  border-radius: 9999px;
  background: rgba(91,174,209,.12);
  color: var(--accent, #5baed1);
}

/* ── Headings ──────────────────────────────────────────────────── */
.cv-h2 {
  font-size: 1.35rem;
  font-weight: 600;
  color: var(--text, #eef2f7);
  margin: 0 0 20px;
}
.cv-section-label {
  font-size: .7rem;
  letter-spacing: .08em;
  text-transform: uppercase;
  color: var(--muted, #a8b3c7);
  font-weight: 600;
}

/* ── Stats ─────────────────────────────────────────────────────── */
.cv-stat {
  background: linear-gradient(180deg, rgba(255,255,255,.04), rgba(255,255,255,.02));
  border: 1px solid rgba(255,255,255,.08);
  border-radius: var(--radius, 12px);
  padding: 16px 20px;
  flex: 1;
  min-width: 100px;
}
.cv-stat-value {
  font-size: 1.75rem;
  font-weight: 700;
  line-height: 1;
  margin-bottom: 4px;
  color: var(--text, #eef2f7);
}
.cv-stat-label {
  font-size: .7rem;
  letter-spacing: .08em;
  text-transform: uppercase;
  color: var(--muted, #a8b3c7);
  font-weight: 600;
}

/* ── Entry Rows ────────────────────────────────────────────────── */
.cv-entry-row {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 14px;
  background: rgba(255,255,255,.02);
  border: 1px solid rgba(255,255,255,.06);
  border-radius: 8px;
  transition: background .1s;
  margin-bottom: 4px;
}
.cv-entry-row:hover {
  background: rgba(255,255,255,.05);
}
.cv-entry-row:hover .cv-row-acts { opacity: 1; }
.cv-row-acts {
  display: flex;
  gap: 5px;
  opacity: 0;
  transition: opacity .15s;
  flex-shrink: 0;
}
.cv-entry-num {
  width: 22px;
  font-size: .75rem;
  opacity: .45;
  flex-shrink: 0;
  color: var(--muted, #a8b3c7);
}
.cv-entry-title {
  font-size: .9rem;
  color: var(--text, #eef2f7);
  line-height: 1.35;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.cv-entry-sub {
  font-size: .75rem;
  color: var(--muted, #a8b3c7);
  margin-top: 2px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* ── Form Grid ─────────────────────────────────────────────────── */
.cv-form-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
}
.cv-form-grid .cv-span-2 { grid-column: span 2; }
.cv-form-label {
  display: block;
  font-size: .8rem;
  font-weight: 600;
  margin-bottom: 5px;
  color: var(--muted, #a8b3c7);
}
.cv-form-label.required { color: var(--accent, #5baed1); }

/* ── DOI Bar ───────────────────────────────────────────────────── */
.cv-doi-bar {
  background: rgba(91,174,209,.06);
  border: 1px solid rgba(91,174,209,.18);
  border-radius: var(--radius, 12px);
  padding: 13px 16px;
  margin-bottom: 20px;
}

/* ── Tab Strip ─────────────────────────────────────────────────── */
.cv-tab-strip {
  display: flex;
  border-bottom: 1px solid rgba(255,255,255,.08);
  margin-bottom: 20px;
  gap: 2px;
}
.cv-tab-btn {
  background: none;
  border: none;
  border-bottom: 2px solid transparent;
  color: var(--muted, #a8b3c7);
  padding: 9px 18px;
  cursor: pointer;
  font-family: inherit;
  font-size: .8rem;
  font-weight: 600;
  letter-spacing: .04em;
  text-transform: uppercase;
  margin-bottom: -1px;
  transition: all .15s;
  white-space: nowrap;
}
.cv-tab-btn.active {
  border-bottom-color: var(--accent, #5baed1);
  color: var(--accent, #5baed1);
}
.cv-tab-btn:hover:not(.active) { color: var(--text, #eef2f7); }

/* ── Toast ─────────────────────────────────────────────────────── */
.cv-toast {
  position: fixed;
  bottom: 72px;
  right: 16px;
  z-index: 9999;
  color: #fff;
  padding: 10px 18px;
  font-size: .85rem;
  border-radius: 8px;
  box-shadow: 0 4px 24px rgba(0,0,0,.5);
  max-width: 320px;
  transition: opacity .3s;
}
.cv-toast.ok { background: rgba(22,101,52,.85); }
.cv-toast.error { background: rgba(185,28,28,.85); }
.cv-toast.hidden { opacity: 0; pointer-events: none; }

/* ── Spinner ───────────────────────────────────────────────────── */
.cv-spin {
  display: inline-block;
  border: 2px solid rgba(255,255,255,.1);
  border-top-color: var(--accent, #5baed1);
  border-radius: 50%;
  animation: cvSpin .75s linear infinite;
}
@keyframes cvSpin { to { transform: rotate(360deg); } }

/* ── Progress Bar ──────────────────────────────────────────────── */
.cv-bar-track {
  background: rgba(255,255,255,.08);
  border-radius: 4px;
  height: 4px;
  overflow: hidden;
}
.cv-bar-fill {
  height: 100%;
  background: var(--accent, #5baed1);
  border-radius: 4px;
  transition: width .4s ease;
}

/* ── LaTeX Code Block ──────────────────────────────────────────── */
.cv-latex-block {
  background: rgba(0,0,0,.3);
  border: 1px solid rgba(255,255,255,.08);
  border-radius: 8px;
  padding: 16px 18px;
  font-family: 'JetBrains Mono', 'Fira Code', monospace;
  font-size: .8rem;
  line-height: 1.7;
  color: #86efac;
  white-space: pre;
  overflow-x: auto;
  max-height: 420px;
  overflow-y: auto;
}

/* ── Drop Zone ─────────────────────────────────────────────────── */
.cv-drop-zone {
  border: 2px dashed rgba(255,255,255,.15);
  background: rgba(255,255,255,.02);
  border-radius: var(--radius, 12px);
  padding: 28px 20px;
  text-align: center;
  cursor: pointer;
  transition: all .2s;
  color: var(--muted, #a8b3c7);
}
.cv-drop-zone.active {
  border-color: var(--accent, #5baed1);
  background: rgba(91,174,209,.04);
}
.cv-drop-zone:hover {
  border-color: var(--accent, #5baed1);
}

/* ── Dashboard Section Tiles ───────────────────────────────────── */
.cv-dash-tile {
  background: rgba(255,255,255,.03);
  border: 1px solid rgba(255,255,255,.06);
  border-radius: 8px;
  padding: 13px 16px;
  display: flex;
  align-items: center;
  gap: 12px;
  cursor: pointer;
  transition: background .12s;
}
.cv-dash-tile:hover {
  background: rgba(255,255,255,.06);
}

/* ── Animations ────────────────────────────────────────────────── */
.cv-fade-up {
  animation: cvFadeUp .2s ease forwards;
}
@keyframes cvFadeUp {
  from { opacity: 0; transform: translateY(6px); }
  to   { opacity: 1; transform: translateY(0); }
}

/* ── Mobile Bottom Nav ─────────────────────────────────────────── */
.cv-bottom-nav {
  display: none;
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  height: 56px;
  background: var(--surface, #121620);
  border-top: 1px solid rgba(255,255,255,.08);
  z-index: 100;
  align-items: center;
  justify-content: space-around;
}
.cv-bottom-nav-btn {
  background: none;
  border: none;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  padding: 4px 10px;
  cursor: pointer;
  min-width: 48px;
  color: var(--muted, #a8b3c7);
  transition: color .12s;
}
.cv-bottom-nav-btn.active,
.cv-bottom-nav-btn:hover {
  color: var(--accent, #5baed1);
}
.cv-bottom-nav-btn span:first-child { font-size: 18px; line-height: 1; }
.cv-bottom-nav-btn span:last-child {
  font-size: .6rem;
  letter-spacing: .06em;
  text-transform: uppercase;
  font-weight: 600;
}

/* ── Mobile Header ─────────────────────────────────────────────── */
.cv-mobile-header {
  display: none;
  position: fixed;
  top: var(--banner-height, 64px);
  left: 0;
  right: 0;
  height: 48px;
  background: rgba(18,22,32,.95);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid rgba(255,255,255,.08);
  z-index: 100;
  align-items: center;
  padding: 0 16px;
  gap: 12px;
  color: var(--text, #eef2f7);
}
.cv-mobile-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,.6);
  z-index: 200;
  display: none;
}
.cv-mobile-overlay.open { display: block; }
.cv-mobile-drawer {
  position: fixed;
  top: 0;
  left: 0;
  bottom: 0;
  width: 260px;
  background: var(--surface, #121620);
  border-right: 1px solid rgba(255,255,255,.08);
  z-index: 201;
  transform: translateX(-100%);
  transition: transform .22s cubic-bezier(.4,0,.2,1);
  overflow-y: auto;
  display: flex;
  flex-direction: column;
}
.cv-mobile-drawer.open { transform: translateX(0); }

/* ── Charts Container ──────────────────────────────────────────── */
.cv-chart-wrap {
  position: relative;
  height: 200px;
}
.cv-chart-wrap canvas {
  width: 100% !important;
  height: 100% !important;
}

/* ── Import Entry List ─────────────────────────────────────────── */
.cv-import-entry {
  display: flex;
  gap: 10px;
  padding: 10px 12px;
  border-bottom: 1px solid rgba(255,255,255,.05);
  align-items: flex-start;
  border-radius: 6px;
}
.cv-import-entry.dupe { background: rgba(185,28,28,.06); }
.cv-import-entry.selected { background: rgba(91,174,209,.06); }
.cv-import-entry input[type="checkbox"] {
  accent-color: var(--accent, #5baed1);
  width: 14px;
  height: 14px;
  margin-top: 2px;
  cursor: pointer;
  flex-shrink: 0;
}

/* ── Version Editor ────────────────────────────────────────────── */
.cv-ver-grid {
  display: grid;
  grid-template-columns: 200px 1fr;
  gap: 1px;
  min-height: 360px;
}
.cv-ver-list {
  background: var(--surface, #121620);
  border: 1px solid rgba(255,255,255,.08);
  border-radius: var(--radius, 12px) 0 0 var(--radius, 12px);
  overflow: hidden;
}
.cv-ver-item {
  padding: 11px 14px;
  cursor: pointer;
  border-left: 2px solid transparent;
  transition: background .1s;
  color: var(--text, #eef2f7);
}
.cv-ver-item:hover { background: rgba(255,255,255,.04); }
.cv-ver-item.active {
  background: rgba(91,174,209,.08);
  border-left-color: var(--accent, #5baed1);
}

/* ── Evaluation Bars ───────────────────────────────────────────── */
.cv-eval-bar {
  height: 4px;
  background: rgba(255,255,255,.08);
  border-radius: 4px;
  overflow: hidden;
}
.cv-eval-bar-fill {
  height: 100%;
  background: var(--accent, #5baed1);
  border-radius: 4px;
  transition: width .4s;
}

/* ── Back link ─────────────────────────────────────────────────── */
.cv-back-link {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  color: var(--muted, #a8b3c7);
  font-size: .8rem;
  text-decoration: none;
  margin-bottom: 12px;
  transition: color .12s;
}
.cv-back-link:hover { color: var(--text, #eef2f7); text-decoration: none; }

/* ── Responsive ────────────────────────────────────────────────── */
@media (max-width: 768px) {
  .cv-sidebar { display: none; }
  .cv-mobile-header { display: flex !important; }
  .cv-bottom-nav { display: flex !important; }
  .cv-main {
    padding: 16px !important;
    padding-top: calc(var(--banner-height, 64px) + 60px) !important;
    padding-bottom: 72px !important;
  }
  .cv-form-grid { grid-template-columns: 1fr !important; }
  .cv-form-grid .cv-span-2 { grid-column: span 1; }
  .cv-ver-grid { grid-template-columns: 1fr !important; }
  .cv-stat { min-width: calc(50% - 8px) !important; }
}
@media (min-width: 769px) {
  .cv-mobile-header { display: none !important; }
  .cv-mobile-overlay { display: none !important; }
  .cv-mobile-drawer { display: none !important; }
  .cv-bottom-nav { display: none !important; }
}
