/* ── Reset & Base ─────────────────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  background: #f5f7fa; color: #333; line-height: 1.6;
}

/* ── Navigation ───────────────────────────────────────────────────────────── */
nav {
  display: flex; align-items: center; justify-content: space-between;
  padding: 14px 24px; background: #0b2545; color: #fff;
}
nav a { color: #fff; text-decoration: none; }
nav .logo { font-size: 18px; font-weight: 700; }
nav .nav-links { display: flex; gap: 16px; align-items: center; }
nav .nav-links a { font-size: 14px; }
nav .btn-primary { background: #1a73e8; padding: 8px 16px; border-radius: 6px; }

/* ── User Dropdown Menu ──────────────────────────────────────────────────── */
.user-menu { position: relative; }
.user-trigger {
  background: none; border: 1px solid rgba(255,255,255,0.25); color: #fff;
  padding: 4px 12px; border-radius: 6px; font-size: 13px; cursor: pointer;
  font-family: inherit; white-space: nowrap;
}
.user-trigger:hover { background: rgba(255,255,255,0.1); }
.user-trigger .arrow { font-size: 9px; margin-left: 2px; }
.user-dropdown {
  display: none; position: absolute; right: 0; top: 100%; margin-top: 6px;
  background: #fff; border-radius: 8px; box-shadow: 0 4px 16px rgba(0,0,0,0.15);
  min-width: 180px; z-index: 100; overflow: hidden;
}
.user-menu.open .user-dropdown { display: block; }
.dropdown-item {
  display: block; width: 100%; padding: 10px 16px; font-size: 13px;
  color: #333 !important; text-align: left; background: none; border: none;
  cursor: pointer; font-family: inherit; text-decoration: none;
}
.dropdown-item:hover { background: #f0f4ff; }
.logout-btn { color: #d32f2f !important; border-top: 1px solid #eee; }

/* ── Hamburger (mobile only) ─────────────────────────────────────────────── */
.hamburger {
  display: none; background: none; border: none; color: #fff;
  font-size: 22px; cursor: pointer; padding: 4px 8px;
}

/* ── Mobile (≤ 640px) ──────────────────────────────────────────────────── */
@media (max-width: 640px) {
  .hamburger { display: block; }
  nav { flex-wrap: wrap; }
  nav .nav-links {
    display: none; flex-direction: column; width: 100%;
    gap: 0; margin-top: 10px; padding-top: 10px;
    border-top: 1px solid rgba(255,255,255,0.15);
  }
  nav .nav-links.open { display: flex; }
  nav .nav-links > a,
  nav .nav-links > .btn-primary {
    display: block; padding: 10px 8px; font-size: 14px;
    border-radius: 6px; text-align: center;
  }
  nav .nav-links > a:hover { background: rgba(255,255,255,0.08); }
  .mobile-full { width: 100%; }
  .user-menu { margin-top: 4px; }
  .user-trigger { width: 100%; text-align: center; padding: 10px; }
  .user-dropdown { left: 0; right: 0; }
}

/* ── Layout ────────────────────────────────────────────────────────────────── */
main { max-width: 960px; margin: 0 auto; padding: 24px 16px 48px; }
h1 { font-size: 24px; margin-bottom: 8px; color: #0b2545; }
h2 { font-size: 18px; margin: 24px 0 12px; color: #0b2545; }
h3 { font-size: 14px; margin: 12px 0 6px; color: #555; }

/* ── Cards ─────────────────────────────────────────────────────────────────── */
.card {
  background: #fff; border-radius: 8px; padding: 16px 20px;
  box-shadow: 0 1px 3px rgba(0,0,0,0.08); margin-bottom: 12px;
}
.card.warning { background: #fff8e1; border-left: 4px solid #f5a623; }
.card.error { background: #fdecea; border-left: 4px solid #d32f2f; }
.card.success { background: #e8f5e9; border-left: 4px solid #2e7d32; }

/* ── Forms ─────────────────────────────────────────────────────────────────── */
.form-group { margin-bottom: 14px; }
.form-group label { display: block; font-size: 13px; font-weight: 600; margin-bottom: 4px; color: #555; }
.form-group input[type="text"],
.form-group input[type="file"],
.form-group textarea {
  width: 100%; padding: 10px 12px; border: 1px solid #ddd; border-radius: 6px;
  font-size: 14px; font-family: inherit;
}
.form-group textarea { resize: vertical; min-height: 120px; }
.form-group small { display: block; font-size: 12px; color: #888; margin-top: 4px; }
.form-row { display: flex; gap: 16px; }
.form-row .form-group { flex: 1; }

/* ── Buttons ───────────────────────────────────────────────────────────────── */
.btn-primary {
  display: inline-block; background: #0b2545; color: #fff;
  padding: 10px 20px; border: none; border-radius: 6px;
  font-size: 14px; font-weight: 600; cursor: pointer; text-decoration: none;
}
.btn-primary:hover { background: #123a66; }
.btn-secondary {
  display: inline-block; background: #e0e0e0; color: #333;
  padding: 6px 14px; border: none; border-radius: 6px;
  font-size: 12px; cursor: pointer;
}
.btn-danger {
  display: inline-block; background: #d32f2f; color: #fff;
  padding: 8px 16px; border: none; border-radius: 6px;
  font-size: 13px; cursor: pointer;
}

/* ── Action Buttons (rounded pill style) ─────────────────────────────────── */
.btn-action {
  display: inline-flex; align-items: center; gap: 8px;
  background: #7c3aed; color: #fff;
  padding: 8px 18px; border: none; border-radius: 24px;
  font-size: 13px; font-weight: 600; cursor: pointer; text-decoration: none;
  transition: background 0.2s, box-shadow 0.2s;
  white-space: nowrap;
}
.btn-action:hover { background: #6d28d9; box-shadow: 0 2px 8px rgba(124,58,237,0.3); }
.btn-action .btn-icon { font-size: 15px; }
.btn-outline {
  display: inline-flex; align-items: center; gap: 8px;
  background: #fff; color: #6b7280;
  padding: 8px 18px; border: 1.5px solid #d1d5db; border-radius: 24px;
  font-size: 13px; font-weight: 600; cursor: pointer; text-decoration: none;
  transition: border-color 0.2s, color 0.2s;
  white-space: nowrap;
}
.btn-outline:hover { border-color: #7c3aed; color: #7c3aed; }
.btn-outline .btn-icon { font-size: 15px; }

/* ── Regenerate Button ───────────────────────────────────────────────────── */
.btn-regenerate {
  display: inline-flex; align-items: center; gap: 6px;
  background: #fef3c7; color: #b45309;
  padding: 7px 14px; border: 1px solid #fcd34d; border-radius: 20px;
  font-size: 12px; font-weight: 600; cursor: pointer;
  transition: background 0.2s, box-shadow 0.2s;
  white-space: nowrap;
}
.btn-regenerate:hover { background: #fde68a; box-shadow: 0 1px 4px rgba(245,158,11,0.2); }
.btn-regenerate:disabled { opacity: 0.5; cursor: not-allowed; }
.btn-regenerate .btn-icon { font-size: 13px; }

/* ── Output Action Row ───────────────────────────────────────────────────── */
.output-actions {
  display: flex; align-items: center; gap: 8px; margin-top: 12px;
  flex-wrap: wrap;
}
.output-actions .spacer { flex: 1; }
.regenerate-cost {
  font-size: 10px; color: #b45309; font-weight: 600;
  background: #fef3c7; padding: 1px 6px; border-radius: 8px;
  border: 1px solid #fcd34d; margin-left: 2px;
}

/* ── Job Grid ──────────────────────────────────────────────────────────────── */
.job-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 12px; }
.job-card { text-decoration: none; color: inherit; display: block; transition: box-shadow 0.15s; }
.job-card:hover { box-shadow: 0 2px 8px rgba(0,0,0,0.12); }
.job-card-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 4px; }
.job-card .company { font-weight: 700; font-size: 14px; }
.job-card .role { font-size: 13px; color: #555; margin-bottom: 8px; }
.job-card .date { font-size: 11px; color: #999; margin-top: 8px; }

/* ── Status ────────────────────────────────────────────────────────────────── */
.status { font-size: 11px; padding: 2px 8px; border-radius: 10px; font-weight: 600; }
.status-pending { background: #fff3e0; color: #e65100; }
.status-generating { background: #e3f2fd; color: #1565c0; }
.status-ready { background: #e8f5e9; color: #2e7d32; }
.status-error { background: #fdecea; color: #c62828; }
.status-banner {
  padding: 10px 16px; border-radius: 6px; margin-bottom: 16px;
  font-size: 14px; font-weight: 600;
}
.status-banner.status-ready { background: #e8f5e9; color: #2e7d32; }
.status-banner.status-generating { background: #e3f2fd; color: #1565c0; }
.status-banner.status-error { background: #fdecea; color: #c62828; }
.status-banner.status-pending { background: #fff3e0; color: #e65100; }

/* ── Match Score ───────────────────────────────────────────────────────────── */
.match-score { display: flex; align-items: center; gap: 8px; font-size: 12px; }
.score-bar { flex: 1; height: 6px; background: #e0e0e0; border-radius: 3px; overflow: hidden; }
.score-fill { height: 100%; background: #2e7d32; border-radius: 3px; transition: width 0.3s; }

/* ── Output Grid ───────────────────────────────────────────────────────────── */
.output-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 10px; }
.output-card { text-decoration: none; color: inherit; text-align: center; padding: 16px; }
.output-card strong { display: block; margin-bottom: 4px; }
.output-card small { color: #888; }

/* ── Keyword Tags ──────────────────────────────────────────────────────────── */
.kw-section { margin-bottom: 12px; }
.kw-tags { display: flex; flex-wrap: wrap; gap: 6px; }
.kw-tag {
  font-size: 11px; padding: 3px 10px; border-radius: 12px; font-weight: 500;
}
.kw-tag.matched { background: #e8f5e9; color: #2e7d32; }
.kw-tag.missing { background: #fdecea; color: #c62828; }

/* ── Resume Preview ────────────────────────────────────────────────────────── */
.resume-iframe { width: 100%; height: 600px; border: 1px solid #ddd; border-radius: 4px; }
.resume-preview {
  background: #f9f9f9; padding: 12px; border-radius: 4px;
  font-size: 12px; line-height: 1.5; overflow-x: auto; overflow-y: auto;
  max-height: 500px; white-space: pre-wrap; word-break: break-word;
  margin-top: 12px;
}

/* ── Profile Photo ─────────────────────────────────────────────────────────── */
.photo-preview { text-align: center; margin-bottom: 12px; }
.profile-photo { max-width: 180px; max-height: 220px; border-radius: 8px; border: 2px solid #e0e0e0; object-fit: cover; }
.md-preview { max-height: 400px; overflow-y: auto; font-size: 13px; line-height: 1.6; }
.md-preview h1,.md-preview h2,.md-preview h3,.md-preview h4 { color: #0b2545; margin: 12px 0 6px; }
.md-preview h1 { font-size: 18px; } .md-preview h2 { font-size: 15px; } .md-preview h3 { font-size: 13px; }
.md-preview table { width: 100%; border-collapse: collapse; margin: 8px 0; font-size: 12px; }
.md-preview th,.md-preview td { border: 1px solid #ddd; padding: 6px 8px; text-align: left; }
.md-preview th { background: #f3f6fb; font-weight: 600; }
.md-preview ul,.md-preview ol { margin: 4px 0 4px 18px; }
.md-preview li { margin-bottom: 2px; }
.md-preview code { background: #f0f0f0; padding: 1px 4px; border-radius: 3px; font-size: 12px; }
.md-preview pre { background: #f5f5f5; padding: 10px; border-radius: 4px; overflow-x: auto; font-size: 12px; }
.md-preview hr { border: none; border-top: 1px solid #ddd; margin: 12px 0; }
.md-preview strong { color: #333; }
.md-preview p { margin: 4px 0; }

/* ── Utilities ─────────────────────────────────────────────────────────────── */
.text-muted { color: #888; font-size: 13px; }
.user-info { font-size: 12px; color: #a0c4ff; margin: 0 4px; }
.spinner {
  width: 32px; height: 32px; border: 3px solid #e0e0e0;
  border-top-color: #0b2545; border-radius: 50%; margin: 20px auto;
  animation: spin 0.8s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ── Layout Tabs (job-detail page) ────────────────────────────────────────── */
.layout-tabs {
  display: flex; gap: 10px; margin-bottom: 0; padding: 4px 0;
  flex-wrap: wrap;
}
.layout-tab {
  display: flex; align-items: center; gap: 8px;
  padding: 10px 18px; border: none; border-radius: 28px;
  background: #f0f1f3; color: #6b7280;
  font-size: 13px; font-weight: 600; cursor: pointer;
  transition: background 0.2s, color 0.2s, box-shadow 0.2s;
  white-space: nowrap;
}
.layout-tab:hover { background: #e2e4e8; color: #374151; }
.layout-tab.active {
  background: #1a5f8a; color: #fff;
  box-shadow: 0 2px 8px rgba(26,95,138,0.25);
}
.layout-tab .tab-icon { font-size: 16px; }
.layout-panel { display: none; }
.layout-panel.active { display: block; }
.layout-panel .resume-iframe {
  border: 2px solid #e0e0e0; border-radius: 8px;
  margin-top: 10px;
}

/* ── Progress Bar ─────────────────────────────────────────────────────────── */
.progress-bar-container {
  width: 100%; max-width: 400px; height: 10px; background: #e0e0e0;
  border-radius: 5px; overflow: hidden; margin: 0 auto;
}
.progress-bar-fill {
  height: 100%; background: linear-gradient(90deg, #1a5f8a, #2563eb);
  border-radius: 5px; transition: width 0.4s ease;
}

/* ── Layout Grid (new-job page) ───────────────────────────────────────────── */
.layout-grid {
  display: grid; grid-template-columns: repeat(4, 1fr); gap: 10px;
}
.layout-card {
  display: flex; flex-direction: column; align-items: center;
  padding: 14px 10px; border: 2px solid #e0e0e0; border-radius: 8px;
  cursor: pointer; text-align: center; transition: border-color 0.2s, box-shadow 0.2s, transform 0.15s;
  background: #fff; user-select: none;
}
.layout-card:hover { border-color: #1a5f8a; transform: translateY(-1px); }
.layout-selected {
  border-color: #1a5f8a;
  box-shadow: 0 0 12px rgba(26,95,138,0.35), 0 0 2px rgba(26,95,138,0.5);
  background: #e8f4fd;
}
.layout-icon { font-size: 24px; margin-bottom: 6px; }
.layout-name { font-size: 13px; font-weight: 700; color: #0b2545; margin-bottom: 3px; }
.layout-desc { font-size: 11px; color: #888; line-height: 1.4; }

@media (max-width: 700px) {
  .layout-grid { grid-template-columns: repeat(2, 1fr); }
}

/* ── Billing ──────────────────────────────────────────────────────────────── */
.billing-summary {
  display: flex; justify-content: space-between; align-items: center;
  padding: 20px 24px; margin-bottom: 28px;
}
.billing-credit-count { font-size: 32px; font-weight: 700; color: #0b2545; }
.billing-credit-label { font-size: 13px; color: #888; margin-top: 2px; }
.billing-plan-badge {
  display: inline-block; background: #e8f0fe; color: #1a5f8a;
  font-size: 12px; font-weight: 600; padding: 4px 14px; border-radius: 12px;
  margin-bottom: 8px;
}
.billing-stats { font-size: 13px; color: #555; }
.billing-stat-sep { margin: 0 6px; color: #ccc; }
.billing-renewal { font-size: 12px; color: #999; margin-top: 4px; }

/* ── Pricing Cards ─────────────────────────────────────────────────────────── */
.pricing-row {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 14px;
  margin-bottom: 32px;
}
.pricing-row-2col { grid-template-columns: repeat(2, 1fr); }
.pricing-card {
  text-align: center; padding: 24px 16px;
  display: flex; flex-direction: column; align-items: center;
  position: relative;
}
.pricing-card-featured {
  border: 2px solid #1a5f8a; box-shadow: 0 2px 12px rgba(26,95,138,0.12);
}
.pricing-badge {
  position: absolute; top: -10px;
  background: #1a5f8a; color: #fff; font-size: 11px; font-weight: 600;
  padding: 3px 14px; border-radius: 10px;
}
.pricing-header { font-size: 16px; font-weight: 700; color: #0b2545; margin-bottom: 6px; }
.pricing-amount { font-size: 28px; font-weight: 800; color: #0b2545; line-height: 1.2; }
.pricing-period { font-size: 12px; color: #999; margin-bottom: 16px; }
.pricing-features {
  list-style: none; text-align: center; width: 100%;
  margin-bottom: 20px; flex: 1;
}
.pricing-features li {
  font-size: 13px; color: #555; padding: 5px 0;
  border-bottom: 1px solid #f5f7fa;
}
.pricing-features li::before { content: "✓ "; color: #2ecc71; font-weight: 700; }
.pricing-btn {
  display: block; width: 100%; padding: 10px 16px; border-radius: 6px;
  font-size: 13px; font-weight: 600; cursor: pointer; text-align: center;
  text-decoration: none; border: none;
}
.pricing-btn-current {
  background: #f0f0f0; color: #999; cursor: default;
}
.pricing-btn-action {
  background: #0b2545; color: #fff;
}
.pricing-btn-action:hover { background: #123a66; }
.pricing-btn-featured-action {
  background: #1a5f8a; color: #fff;
}
.pricing-btn-featured-action:hover { background: #1d6fa3; }

@media (max-width: 800px) {
  .pricing-row { grid-template-columns: repeat(2, 1fr); }
  .pricing-row-2col { grid-template-columns: 1fr; }
}
@media (max-width: 500px) {
  .pricing-row { grid-template-columns: 1fr; }
  .billing-summary { flex-direction: column; text-align: center; gap: 12px; }
}

/* ── Footer ───────────────────────────────────────────────────────────────── */
.app-footer {
  text-align: center; padding: 16px 20px; margin-top: 40px;
  border-top: 1px solid #eef1f5; background: #fafbfc;
}
.app-footer p {
  font-size: 11px; color: #999; margin: 0; line-height: 1.5;
}
.app-footer a {
  color: #888; text-decoration: none; margin: 0 6px;
}
.app-footer a:hover { color: #1a5f8a; }

/* ── Resume Form: Toggle Tabs ──────────────────────────────────────────── */
.upload-toggle {
  display: flex; gap: 10px; margin-bottom: 18px;
  border-bottom: 2px solid #e0e0e0; padding-bottom: 0;
}
.toggle-btn {
  padding: 10px 20px; border: none; background: none;
  font-size: 14px; font-weight: 600; color: #888; cursor: pointer;
  border-bottom: 2px solid transparent; margin-bottom: -2px;
  transition: color 0.2s, border-color 0.2s;
}
.toggle-btn:hover { color: #555; }
.toggle-btn.active {
  color: #0b2545; border-bottom-color: #0b2545;
}
.upload-section { padding-top: 8px; }

/* ── Resume Form: Fieldsets ──────────────────────────────────────────────── */
.form-fieldset {
  border: 1px solid #e0e0e0; border-radius: 8px;
  padding: 16px; margin-bottom: 16px; background: #fafbfc;
}
.form-fieldset legend {
  font-size: 14px; font-weight: 700; color: #0b2545;
  padding: 0 8px;
}

/* ── Resume Form: Dynamic Item Blocks ────────────────────────────────────── */
.item-block {
  border: 1px solid #e0e0e0; border-radius: 8px;
  padding: 14px; margin-bottom: 12px; background: #fff;
}
.item-header {
  display: flex; justify-content: space-between; align-items: center;
  font-weight: 600; font-size: 13px; color: #555;
  margin-bottom: 10px; padding-bottom: 8px; border-bottom: 1px solid #f0f0f0;
}

/* ── Resume Form: Add/Remove Buttons ─────────────────────────────────────── */
.btn-add {
  display: inline-block; padding: 8px 16px; border: 1px dashed #1a73e8;
  background: #f0f7ff; color: #1a73e8; font-size: 13px; font-weight: 600;
  border-radius: 6px; cursor: pointer; margin-top: 4px;
  transition: background 0.15s;
}
.btn-add:hover { background: #e0efff; }
.btn-add-sm {
  display: inline-block; padding: 4px 12px; border: 1px dashed #888;
  background: #f9f9f9; color: #555; font-size: 11px; font-weight: 600;
  border-radius: 4px; cursor: pointer; margin-top: 4px;
  transition: background 0.15s;
}
.btn-add-sm:hover { background: #eee; }
.btn-remove {
  display: inline-block; padding: 3px 10px; border: 1px solid #e0e0e0;
  background: #fff; color: #c62828; font-size: 11px; font-weight: 600;
  border-radius: 4px; cursor: pointer;
  transition: background 0.15s;
}
.btn-remove:hover { background: #fdecea; }

/* ── Resume Form: Skills Row ─────────────────────────────────────────────── */
.skills-sub { margin-top: 10px; }
.skills-sub > label {
  display: block; font-size: 12px; font-weight: 600; color: #777;
  margin-bottom: 6px;
}
.skill-row {
  display: flex; gap: 8px; align-items: center; margin-bottom: 6px;
}
.skill-row input {
  padding: 6px 10px; border: 1px solid #ddd; border-radius: 4px;
  font-size: 12px; font-family: inherit;
}

/* ── Form Inputs: Email type ─────────────────────────────────────────────── */
.form-group input[type="email"] {
  width: 100%; padding: 10px 12px; border: 1px solid #ddd; border-radius: 6px;
  font-size: 14px; font-family: inherit;
}
