/* ─────────────────────────────────────────────────────────────────────────
   CV Builder — App Styles
   ─────────────────────────────────────────────────────────────────────── */

:root {
  --sidebar-w: 240px;
  --accent: #2563eb;
  --sidebar-bg: #111827;
  --sidebar-text: #d1d5db;
  --sidebar-hover: #1f2937;
  --sidebar-active: rgba(37, 99, 235, 0.15);
  --top-bar-h: 60px;
}

/* ── Base ─────────────────────────────────────────────────────────────── */
* { box-sizing: border-box; }
body { font-family: 'Inter', sans-serif; background: #f8fafc; color: #1e293b; margin: 0; }

/* ── Layout ───────────────────────────────────────────────────────────── */
.app-wrapper { display: flex; min-height: 100vh; }

/* ── Sidebar ──────────────────────────────────────────────────────────── */
.sidebar {
  width: var(--sidebar-w);
  background: var(--sidebar-bg);
  color: var(--sidebar-text);
  display: flex;
  flex-direction: column;
  flex-shrink: 0;
  position: fixed;
  top: 0; left: 0; bottom: 0;
  overflow-y: auto;
  transition: transform .3s ease;
  z-index: 100;
}

.sidebar-brand {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 20px 16px 16px;
  border-bottom: 1px solid #1f2937;
}
.brand-icon {
  width: 40px; height: 40px;
  background: var(--accent);
  border-radius: 10px;
  display: flex; align-items: center; justify-content: center;
  color: #fff; font-size: 18px; flex-shrink: 0;
}
.brand-name   { font-weight: 700; font-size: 15px; color: #fff; }
.brand-sub    { font-size: 11px; color: #6b7280; }

.sidebar-user {
  display: flex; align-items: center; gap: 10px;
  padding: 14px 16px;
  border-bottom: 1px solid #1f2937;
}
.user-avatar {
  width: 36px; height: 36px;
  background: var(--accent);
  color: #fff; font-weight: 700; font-size: 15px;
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
}
.user-name  { font-size: 13px; font-weight: 600; color: #f3f4f6; }
.user-role  { font-size: 11px; color: #6b7280; }

.sidebar-nav { flex: 1; padding: 12px 8px; }
.nav-item {
  display: flex; align-items: center; gap: 10px;
  padding: 9px 12px; border-radius: 8px;
  color: var(--sidebar-text); text-decoration: none;
  font-size: 14px; transition: background .15s;
  cursor: pointer;
}
.nav-item:hover   { background: var(--sidebar-hover); color: #fff; }
.nav-item.active  { background: var(--sidebar-active); color: #60a5fa; font-weight: 600; }
.nav-item i       { width: 18px; text-align: center; }

.sidebar-footer { padding: 12px 8px; border-top: 1px solid #1f2937; }

/* ── Main area ────────────────────────────────────────────────────────── */
.main-area { margin-left: var(--sidebar-w); flex: 1; display: flex; flex-direction: column; }

.top-bar {
  height: var(--top-bar-h);
  background: #fff;
  border-bottom: 1px solid #e2e8f0;
  display: flex; align-items: center; gap: 16px;
  padding: 0 24px;
  position: sticky; top: 0; z-index: 50;
}
.page-title { font-size: 18px; font-weight: 600; flex: 1; margin: 0; }
.top-bar-actions { display: flex; gap: 8px; }

.content-area { padding: 24px; flex: 1; }

/* ── Auth pages ───────────────────────────────────────────────────────── */
.auth-page { background: linear-gradient(135deg, #eff6ff 0%, #f0fdf4 100%); }
.auth-container { min-height: 100vh; display: flex; align-items: center; justify-content: center; padding: 20px; }
.auth-card {
  background: #fff; border-radius: 16px;
  box-shadow: 0 10px 40px rgba(0,0,0,.08);
  padding: 40px; width: 100%; max-width: 440px;
}
.auth-brand { text-align: center; margin-bottom: 32px; }
.brand-icon-lg {
  width: 64px; height: 64px; background: var(--accent);
  border-radius: 16px; display: flex; align-items: center; justify-content: center;
  color: #fff; font-size: 28px; margin: 0 auto 16px;
}
.auth-brand h2 { font-weight: 700; margin-bottom: 6px; }

/* ── Stat cards ───────────────────────────────────────────────────────── */
.stat-card {
  background: #fff; border-radius: 12px;
  box-shadow: 0 1px 4px rgba(0,0,0,.06);
  padding: 20px;
  display: flex; align-items: center; gap: 16px;
  transition: box-shadow .2s;
}
.stat-card:hover { box-shadow: 0 4px 12px rgba(0,0,0,.1); }
.stat-icon {
  width: 50px; height: 50px; border-radius: 12px;
  display: flex; align-items: center; justify-content: center;
  font-size: 20px; flex-shrink: 0;
}
.bg-primary-soft { background: #eff6ff; }
.bg-success-soft { background: #f0fdf4; }
.bg-warning-soft { background: #fffbeb; }
.stat-value { font-size: 28px; font-weight: 700; line-height: 1; }
.stat-label { font-size: 13px; color: #64748b; margin-top: 4px; }
.stat-card-action { justify-content: center; }

/* ── CV Cards ─────────────────────────────────────────────────────────── */
.cv-card {
  background: #fff; border-radius: 12px;
  box-shadow: 0 1px 4px rgba(0,0,0,.06);
  overflow: hidden; transition: box-shadow .2s, transform .2s;
}
.cv-card:hover { box-shadow: 0 8px 24px rgba(0,0,0,.1); transform: translateY(-2px); }
.cv-card-color { height: 6px; }
.cv-card-body  { padding: 20px 20px 12px; }
.cv-template-badge { font-size: 11px; background: #f1f5f9; color: #64748b; padding: 2px 8px; border-radius: 20px; display: inline-block; margin-bottom: 8px; }
.cv-card-title { font-size: 16px; font-weight: 600; margin: 0 0 8px; }
.cv-card-meta  { font-size: 13px; }
.cv-card-actions { padding: 12px 20px; border-top: 1px solid #f1f5f9; display: flex; gap: 8px; }

/* ── Empty state ──────────────────────────────────────────────────────── */
.empty-state { text-align: center; padding: 80px 20px; }
.empty-icon  { font-size: 48px; color: #cbd5e1; margin-bottom: 16px; }
.empty-state h4 { font-weight: 600; margin-bottom: 8px; }

/* ── Wizard ───────────────────────────────────────────────────────────── */
.wizard-container {
  background: #fff; border-radius: 16px;
  box-shadow: 0 2px 8px rgba(0,0,0,.07);
  overflow: hidden;
}

.wizard-progress-bar {
  display: flex; overflow-x: auto;
  padding: 0 20px;
  background: #f8fafc;
  border-bottom: 1px solid #e2e8f0;
  gap: 0;
}
.progress-step {
  display: flex; flex-direction: column; align-items: center;
  padding: 14px 12px; min-width: 70px; cursor: pointer;
  position: relative; transition: all .2s;
}
.progress-step + .progress-step::before {
  content: ''; position: absolute;
  left: 0; top: 24px; width: 1px; height: 20px;
  background: #e2e8f0;
}
.step-circle {
  width: 34px; height: 34px; border-radius: 50%;
  background: #e2e8f0; color: #94a3b8;
  display: flex; align-items: center; justify-content: center;
  font-size: 13px; transition: all .2s;
}
.step-label { font-size: 10px; color: #94a3b8; margin-top: 4px; white-space: nowrap; }
.progress-step.active   .step-circle { background: var(--accent); color: #fff; }
.progress-step.active   .step-label  { color: var(--accent); font-weight: 600; }
.progress-step.done     .step-circle { background: #10b981; color: #fff; }
.progress-step.done     .step-label  { color: #10b981; }

.wizard-step { display: none; padding: 32px; }
.wizard-step.active { display: block; }

.step-header { margin-bottom: 24px; }
.step-header h3 { font-size: 22px; font-weight: 700; margin: 0 0 6px; }

.wizard-nav {
  display: flex; align-items: center; justify-content: space-between;
  padding: 20px 32px; border-top: 1px solid #f1f5f9; background: #f8fafc;
}
.step-indicator { font-size: 14px; color: #64748b; }

/* ── Entry cards ──────────────────────────────────────────────────────── */
.entries-list { display: flex; flex-direction: column; gap: 12px; }
.entry-card {
  background: #f8fafc; border: 1px solid #e2e8f0;
  border-radius: 10px; padding: 16px;
  display: flex; gap: 12px; align-items: flex-start;
  position: relative;
}
.entry-drag    { color: #cbd5e1; cursor: grab; padding-top: 4px; }
.entry-body    { flex: 1; }
.entry-remove  {
  position: absolute; top: 10px; right: 10px;
  background: none; border: none; color: #ef4444; cursor: pointer;
  padding: 4px 6px; border-radius: 6px; transition: background .15s;
}
.entry-remove:hover { background: #fee2e2; }

/* Skill level picker */
.skill-level-picker { display: flex; align-items: center; gap: 6px; }
.level-dot {
  width: 18px; height: 18px; border-radius: 50%;
  background: #e2e8f0; border: none; cursor: pointer;
  transition: background .15s, transform .1s;
}
.level-dot.filled { background: var(--accent); }
.level-dot:hover  { transform: scale(1.2); }
.level-label { font-size: 12px; color: #64748b; margin-left: 6px; }

/* Photo upload */
.photo-upload-area {
  width: 100%; aspect-ratio: 1;
  border: 2px dashed #e2e8f0; border-radius: 12px;
  display: flex; align-items: center; justify-content: center;
  flex-direction: column; cursor: pointer; overflow: hidden;
  transition: border-color .2s;
}
.photo-upload-area:hover { border-color: var(--accent); }
.photo-preview { width: 100%; height: 100%; object-fit: cover; }
.photo-placeholder { text-align: center; padding: 20px; }

/* Color picker group */
.color-picker-group { display: flex; flex-direction: column; gap: 8px; }
.color-presets { display: flex; gap: 6px; flex-wrap: wrap; }
.color-dot {
  width: 24px; height: 24px; border-radius: 50%; cursor: pointer;
  border: 2px solid transparent; transition: transform .15s, border-color .15s;
}
.color-dot:hover { transform: scale(1.2); }
.color-dot.selected { border-color: #374151; }

/* ── CV Document (print/view) ─────────────────────────────────────────── */
.cv-document {
  max-width: 900px; margin: 0 auto;
  background: #fff;
  box-shadow: 0 2px 20px rgba(0,0,0,.1);
  border-radius: 8px;
  overflow: hidden;
  font-size: 13px;
}

.template-modern .cv-sidebar,
.template-executive .cv-sidebar {
  display: grid;
  grid-template-columns: 260px 1fr;
}

.template-modern  { display: grid; grid-template-columns: 260px 1fr; }
.template-executive { display: grid; grid-template-columns: 280px 1fr; }

/* Sidebar */
.cv-sidebar {
  background: var(--accent, #2563eb);
  color: #fff;
  padding: 30px 20px;
}
.cv-sidebar .section-title {
  font-size: 12px; text-transform: uppercase; letter-spacing: 1px;
  opacity: .7; margin: 20px 0 10px; padding-bottom: 4px;
  border-bottom: 1px solid rgba(255,255,255,.2);
  display: flex; align-items: center; gap: 8px;
}
.cv-photo { text-align: center; margin-bottom: 20px; }
.cv-photo img {
  width: 120px; height: 120px; border-radius: 50%; object-fit: cover;
  border: 3px solid rgba(255,255,255,.3);
}
.skill-item { margin-bottom: 10px; font-size: 12px; }
.skill-bar  { height: 4px; background: rgba(255,255,255,.2); border-radius: 4px; margin-top: 4px; }
.skill-fill { height: 100%; background: #fff; border-radius: 4px; }
.lang-item  { margin-bottom: 10px; font-size: 12px; }
.lang-bar   { height: 4px; background: rgba(255,255,255,.2); border-radius: 4px; margin: 3px 0; }
.lang-fill  { height: 100%; background: #fff; border-radius: 4px; }

/* Main column */
.cv-main { padding: 36px 32px; }
.cv-header { margin-bottom: 24px; }
.cv-name   { font-size: 28px; font-weight: 800; color: #1e293b; margin: 0; }
.cv-title  { font-size: 14px; color: var(--accent); font-weight: 600; margin: 4px 0 12px; }
.cv-contacts { display: flex; flex-wrap: wrap; gap: 12px; font-size: 11px; color: #64748b; }
.cv-contacts span { display: flex; align-items: center; gap: 5px; }

.cv-section     { margin-bottom: 24px; }
.section-heading {
  font-size: 14px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.8px;
  color: var(--accent); border-bottom: 2px solid var(--accent);
  padding-bottom: 6px; margin-bottom: 14px;
}
.cv-entry        { margin-bottom: 16px; }
.entry-header    { display: flex; justify-content: space-between; margin-bottom: 4px; }
.entry-title     { font-weight: 600; font-size: 14px; }
.entry-org       { font-size: 13px; color: #64748b; }
.entry-date      { font-size: 12px; color: #64748b; white-space: nowrap; }
.entry-location  { font-size: 11px; color: #94a3b8; text-align: right; }
.entry-gpa       { font-size: 11px; color: #94a3b8; }
.entry-desc      { font-size: 12px; color: #475569; line-height: 1.6; white-space: pre-line; margin-top: 6px; }
.entry-tech      { font-size: 11px; color: var(--accent); margin-top: 2px; }
.entry-link      { color: var(--accent); margin-left: 6px; font-size: 11px; }

.references-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.reference-card  { background: #f8fafc; border-radius: 8px; padding: 14px; }
.ref-name        { font-weight: 600; font-size: 13px; }
.ref-pos, .ref-company { font-size: 12px; color: #64748b; }
.ref-contact     { font-size: 11px; color: #94a3b8; display: flex; align-items: center; gap: 5px; margin-top: 3px; }

/* Classic template overrides */
.cv-classic .cv-header.classic-header { display: flex; align-items: center; gap: 20px; padding: 24px; background: var(--accent); color: #fff; }
.cv-classic .cv-name { color: #fff; }
.cv-classic .cv-title { color: rgba(255,255,255,.8); }
.cv-classic .cv-contacts { color: rgba(255,255,255,.7); }
.cv-photo-classic { width: 90px; height: 90px; border-radius: 50%; object-fit: cover; border: 3px solid rgba(255,255,255,.4); flex-shrink: 0; }

/* ── CV View toolbar ──────────────────────────────────────────────────── */
.cv-view-toolbar { margin-bottom: 16px; }

/* ── Print styles ─────────────────────────────────────────────────────── */
@media print {
  .sidebar, .top-bar, .cv-view-toolbar { display: none !important; }
  .main-area { margin-left: 0 !important; }
  .content-area { padding: 0 !important; }
  .cv-document { box-shadow: none !important; border-radius: 0 !important; max-width: 100% !important; }
}

/* ── Preview container ────────────────────────────────────────────────── */
.cv-preview-container {
  border: 1px solid #e2e8f0; border-radius: 8px;
  overflow: hidden; background: #fff;
  min-height: 400px;
}

/* ── Mobile ───────────────────────────────────────────────────────────── */
@media (max-width: 992px) {
  .sidebar     { transform: translateX(-100%); }
  .sidebar.open{ transform: translateX(0); }
  .main-area   { margin-left: 0; }
}
@media (max-width: 640px) {
  .template-modern, .template-executive { grid-template-columns: 1fr; }
  .cv-sidebar { display: none; }
  .wizard-nav { flex-wrap: wrap; gap: 10px; justify-content: center; }
}
