/* ─────────────────────────────────────────
   ResumeForge — Global Stylesheet
   ───────────────────────────────────────── */

/* ── Base ── */
*, *::before, *::after { box-sizing: border-box; }

html { scroll-behavior: smooth; -webkit-text-size-adjust: 100%; }

body {
  font-family: 'Inter', system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

/* ── Scrollbar ── */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: #d1d5db; border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: #9ca3af; }
.dark ::-webkit-scrollbar-thumb { background: #374151; }
.dark ::-webkit-scrollbar-thumb:hover { background: #4b5563; }

.custom-scrollbar {
  scrollbar-width: thin;
  scrollbar-color: #cbd5e1 transparent;
}
.dark .custom-scrollbar {
  scrollbar-color: #475569 transparent;
}
.custom-scrollbar::-webkit-scrollbar {
  width: 5px;
}
.custom-scrollbar::-webkit-scrollbar-track {
  background: transparent;
}
.custom-scrollbar::-webkit-scrollbar-thumb {
  background: #cbd5e1;
  border-radius: 9999px;
}
.custom-scrollbar::-webkit-scrollbar-thumb:hover {
  background: #94a3af;
}
.dark .custom-scrollbar::-webkit-scrollbar-thumb {
  background: #475569;
}
.dark .custom-scrollbar::-webkit-scrollbar-thumb:hover {
  background: #64748b;
}

/* ── Selection ── */
::selection { background: #bfdbfe; color: #1e3a8a; }
.dark ::selection { background: #1e3a8a; color: #bfdbfe; }

/* ── Focus Ring ── */
:focus-visible {
  outline: 2px solid #2563eb;
  outline-offset: 2px;
  border-radius: 4px;
}

/* ── Typography ── */
.font-display { font-family: 'Plus Jakarta Sans', 'Inter', sans-serif; }

/* ── Form Elements ── */
.form-label {
  display: block;
  font-size: 0.8125rem;
  font-weight: 500;
  color: #374151;
  margin-bottom: 0.25rem;
}
.dark .form-label { color: #d1d5db; }

.form-input {
  display: block;
  width: 100%;
  padding: 0.45rem 0.75rem;
  border: 1px solid #d1d5db;
  border-radius: 4px;
  background: #ffffff;
  color: #111827;
  font-size: 0.875rem;
  line-height: 1.4;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}
.form-input:focus {
  outline: none;
  border-color: #2563eb;
  box-shadow: 0 0 0 2px rgba(37, 99, 235, 0.15);
}
.dark .form-input {
  background: #111827;
  border-color: #374151;
  color: #f9fafb;
}
.dark .form-input:focus { border-color: #3b82f6; box-shadow: 0 0 0 2px rgba(59, 130, 246, 0.2); }
.form-input::placeholder { color: #9ca3af; }
.dark .form-input::placeholder { color: #6b7280; }

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

/* ── Buttons ── */
.btn-primary {
  display: inline-flex; align-items: center; justify-content: center; gap: 0.375rem;
  padding: 0.45rem 0.875rem;
  background: #2563eb; color: #ffffff;
  font-size: 0.875rem; font-weight: 500;
  border: 1px solid #1d4ed8; border-radius: 5px; cursor: pointer;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.05);
  transition: background 0.15s ease;
}
.btn-primary:hover { background: #1d4ed8; }
.btn-primary:active { transform: translateY(1px); }

.btn-secondary {
  display: inline-flex; align-items: center; justify-content: center; gap: 0.375rem;
  padding: 0.45rem 0.875rem;
  background: #ffffff; color: #374151;
  font-size: 0.875rem; font-weight: 500;
  border: 1px solid #d1d5db; border-radius: 5px; cursor: pointer;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.03);
  transition: border-color 0.15s ease, color 0.15s ease, background 0.15s ease;
}
.btn-secondary:hover { border-color: #9ca3af; color: #111827; background: #f9fafb; }
.dark .btn-secondary { background: #1f2937; color: #d1d5db; border-color: #4b5563; }
.dark .btn-secondary:hover { border-color: #6b7280; color: #ffffff; background: #374151; }

/* ── Cards & Surfaces ── */
.card {
  background: #ffffff;
  border: 1px solid #e5e7eb;
  border-radius: 6px;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.04);
}
.dark .card { background: #111827; border-color: #1f2937; }

/* ── Solid Clean Header (No fake glass) ── */
.glass {
  background: #ffffff;
  border-bottom: 1px solid #e5e7eb;
}
.dark .glass {
  background: #111827;
  border-bottom: 1px solid #1f2937;
}

/* ── Typography ── */
.gradient-text {
  color: #1d4ed8;
  font-weight: 700;
}
.dark .gradient-text {
  color: #60a5fa;
}

/* ── Skeleton Loading ── */
.skeleton {
  background: linear-gradient(90deg, #f3f4f6 25%, #e5e7eb 50%, #f3f4f6 75%);
  background-size: 200% 100%;
  animation: skeleton-shimmer 1.5s infinite;
  border-radius: 0.5rem;
}
.dark .skeleton {
  background: linear-gradient(90deg, #374151 25%, #4b5563 50%, #374151 75%);
  background-size: 200% 100%;
}
@keyframes skeleton-shimmer {
  0% { background-position: 200% 0; }
  100% { background-position: -200% 0; }
}

/* ── Navigation ── */
#navbar.scrolled .nav-inner {
  box-shadow: 0 1px 20px rgba(0,0,0,0.08);
}

.nav-link { position: relative; }
.nav-link::after {
  content: '';
  position: absolute;
  bottom: -2px; left: 50%; right: 50%;
  height: 2px;
  background: #2563eb;
  border-radius: 1px;
  transition: left 0.2s, right 0.2s;
}
.nav-link:hover::after, .nav-link.active::after { left: 0.5rem; right: 0.5rem; }

/* ── Hero Animations ── */
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }
@keyframes slideUp { from { opacity: 0; transform: translateY(24px); } to { opacity: 1; transform: translateY(0); } }
@keyframes slideDown { from { opacity: 0; transform: translateY(-10px); } to { opacity: 1; transform: translateY(0); } }
@keyframes float { 0%, 100% { transform: translateY(0); } 50% { transform: translateY(-12px); } }
@keyframes pulse-slow { 0%, 100% { opacity: 1; } 50% { opacity: 0.5; } }
@keyframes spin { to { transform: rotate(360deg); } }

.animate-fade-in { animation: fadeIn 0.6s ease-out both; }
.animate-slide-up { animation: slideUp 0.5s ease-out both; }
.animate-slide-down { animation: slideDown 0.3s ease-out both; }
.animate-float { animation: float 6s ease-in-out infinite; }
.animate-pulse-slow { animation: pulse-slow 3s ease-in-out infinite; }
.animate-spin { animation: spin 1s linear infinite; }

/* Staggered children */
.stagger-children > *:nth-child(1) { animation-delay: 0ms; }
.stagger-children > *:nth-child(2) { animation-delay: 100ms; }
.stagger-children > *:nth-child(3) { animation-delay: 200ms; }
.stagger-children > *:nth-child(4) { animation-delay: 300ms; }
.stagger-children > *:nth-child(5) { animation-delay: 400ms; }
.stagger-children > *:nth-child(6) { animation-delay: 500ms; }

/* ── Flash Messages ── */
.flash-msg { animation: slideDown 0.3s ease-out; }

/* ── Resume Builder ── */
.section-panel { border-left: 3px solid transparent; }
.section-panel.active { border-left-color: #2563eb; }

/* ── ATS Score Ring ── */
.ats-ring {
  position: relative;
  width: 80px; height: 80px;
}
.ats-ring svg { transform: rotate(-90deg); }
.ats-ring .track { stroke: #e5e7eb; }
.dark .ats-ring .track { stroke: #374151; }
.ats-ring .progress { transition: stroke-dashoffset 1s ease-out; }

/* ── Tag Input ── */
.tag-list { display: flex; flex-wrap: wrap; gap: 6px; }
.tag-item {
  display: inline-flex; align-items: center; gap: 4px;
  padding: 4px 10px;
  background: #eff6ff; color: #2563eb;
  border: 1px solid #bfdbfe;
  border-radius: 20px; font-size: 0.8125rem; font-weight: 500;
  cursor: pointer; transition: background 0.15s;
}
.dark .tag-item { background: rgba(37,99,235,0.15); color: #93c5fd; border-color: rgba(37,99,235,0.3); }
.tag-item:hover { background: #dbeafe; }
.dark .tag-item:hover { background: rgba(37,99,235,0.25); }
.tag-item .remove {
  width: 14px; height: 14px;
  background: rgba(37,99,235,0.2);
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-size: 10px; line-height: 1;
}
.tag-item:hover .remove { background: rgba(220,38,38,0.2); color: #dc2626; }

/* ── Entry Card (Builder) ── */
.entry-card {
  background: white; border: 1px solid #e5e7eb; border-radius: 6px;
  overflow: hidden; transition: border-color 0.15s;
}
.dark .entry-card { background: #111827; border-color: #374151; }
.entry-card:hover { border-color: #cbd5e1; }
.entry-card-header {
  display: flex; align-items: center; justify-content: space-between;
  padding: 14px 16px;
  background: #f9fafb; border-bottom: 1px solid #e5e7eb; cursor: pointer;
}
.dark .entry-card-header { background: #111827; border-bottom-color: #374151; }
.entry-card-body { padding: 16px; }

/* ── Toggle Switch ── */
.toggle-switch {
  position: relative; display: inline-block;
  width: 44px; height: 24px;
}
.toggle-switch input { opacity: 0; width: 0; height: 0; }
.toggle-slider {
  position: absolute; cursor: pointer;
  top: 0; left: 0; right: 0; bottom: 0;
  background: #d1d5db; border-radius: 24px;
  transition: 0.3s;
}
.toggle-slider::before {
  position: absolute; content: '';
  width: 18px; height: 18px;
  left: 3px; bottom: 3px;
  background: white; border-radius: 50%;
  transition: 0.3s;
  box-shadow: 0 1px 3px rgba(0,0,0,0.2);
}
input:checked + .toggle-slider { background: #2563eb; }
input:checked + .toggle-slider::before { transform: translateX(20px); }

/* ── Progress Bar ── */
.progress-bar { background: #e5e7eb; border-radius: 999px; overflow: hidden; }
.dark .progress-bar { background: #374151; }
.progress-fill {
  height: 100%; border-radius: 999px;
  background: #2563eb;
  transition: width 0.8s cubic-bezier(0.4, 0, 0.2, 1);
}

/* ── Badge ── */
.badge {
  display: inline-flex; align-items: center; gap: 4px;
  padding: 3px 10px; border-radius: 20px;
  font-size: 0.75rem; font-weight: 600; white-space: nowrap;
}
.badge-brand { background: #eff6ff; color: #2563eb; border: 1px solid #bfdbfe; }
.badge-green { background: #f0fdf4; color: #16a34a; border: 1px solid #bbf7d0; }
.badge-amber { background: #fffbeb; color: #d97706; border: 1px solid #fde68a; }
.badge-red { background: #fef2f2; color: #dc2626; border: 1px solid #fecaca; }
.badge-gray { background: #f9fafb; color: #6b7280; border: 1px solid #e5e7eb; }
.dark .badge-brand { background: rgba(37,99,235,0.15); color: #93c5fd; border-color: rgba(37,99,235,0.3); }
.dark .badge-green { background: rgba(22,163,74,0.15); color: #4ade80; border-color: rgba(22,163,74,0.3); }
.dark .badge-gray { background: #1f2937; color: #9ca3af; border-color: #374151; }

/* ── Tooltip ── */
[data-tooltip] { position: relative; }
[data-tooltip]::after {
  content: attr(data-tooltip);
  position: absolute; bottom: calc(100% + 6px); left: 50%;
  transform: translateX(-50%);
  padding: 5px 10px;
  background: #1f2937; color: white;
  font-size: 0.75rem; font-weight: 500;
  border-radius: 6px; white-space: nowrap;
  opacity: 0; pointer-events: none;
  transition: opacity 0.15s;
  z-index: 999;
}
[data-tooltip]:hover::after { opacity: 1; }

/* ── Divider ── */
.divider { display: flex; align-items: center; gap: 12px; }
.divider::before, .divider::after {
  content: ''; flex: 1; height: 1px; background: #e5e7eb;
}
.dark .divider::before, .dark .divider::after { background: #374151; }
.divider span { font-size: 0.75rem; font-weight: 500; color: #9ca3af; white-space: nowrap; }

/* ── Line Clamp ── */
.line-clamp-1 { overflow: hidden; display: -webkit-box; -webkit-line-clamp: 1; -webkit-box-orient: vertical; }
.line-clamp-2 { overflow: hidden; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; }
.line-clamp-3 { overflow: hidden; display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; }

/* ── Prose Overrides ── */
.prose { max-width: none; color: #374151; }
.prose h2 { color: #111827; font-size: 1.5rem; font-weight: 700; margin-top: 2rem; margin-bottom: 0.75rem; }
.prose h3 { color: #1f2937; font-size: 1.25rem; font-weight: 600; margin-top: 1.5rem; margin-bottom: 0.5rem; }
.prose p { margin-bottom: 1.25rem; line-height: 1.8; }
.prose a { color: #2563eb; text-decoration: underline; text-underline-offset: 2px; }
.prose strong { color: #111827; font-weight: 700; }
.dark .prose { color: #d1d5db; }
.dark .prose h2, .dark .prose h3 { color: #f9fafb; }
.dark .prose strong { color: #f9fafb; }

/* ── Scroll Indicator ── */
.scroll-indicator {
  position: fixed; top: 0; left: 0; right: 0;
  height: 3px; background: transparent;
  z-index: 9999;
}
.scroll-indicator-fill {
  height: 100%;
  background: #2563eb;
  transition: width 0.1s linear;
}

/* ── Print Styles ── */
@media print {
  .no-print, nav, footer, #flash-container, #cookie-banner, #scroll-top { display: none !important; }
  body { background: white; color: black; }
  a { color: inherit; text-decoration: none; }
}

/* ── Responsive Helpers ── */
@media (max-width: 640px) {
  .hide-mobile { display: none !important; }
  .full-mobile { width: 100% !important; }
}
@media (min-width: 641px) {
  .show-mobile-only { display: none !important; }
}

/* ── Loading Spinner ── */
.spinner {
  width: 20px; height: 20px;
  border: 2px solid transparent;
  border-top-color: currentColor;
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
}

/* ── Notification Dot ── */
.notif-dot {
  position: absolute; top: -2px; right: -2px;
  width: 8px; height: 8px;
  background: #ef4444; border-radius: 50%;
  border: 2px solid white;
}
.dark .notif-dot { border-color: #111827; }

/* ── Cookie Banner ── */
#cookie-banner { animation: slideUp 0.4s ease-out; }

/* ── Scroll to Top ── */
#scroll-top {
  opacity: 0; transform: translateY(8px);
  transition: opacity 0.2s, transform 0.2s;
}
#scroll-top.visible { opacity: 1; transform: translateY(0); }

/* ── Intersect Reveal ── */
.reveal {
  opacity: 0; transform: translateY(20px);
  transition: opacity 0.5s ease-out, transform 0.5s ease-out;
}
.reveal.visible { opacity: 1; transform: translateY(0); }

/* ── Custom Color Picker ── */
input[type="color"] {
  -webkit-appearance: none;
  border: none; cursor: pointer;
  padding: 0;
}
input[type="color"]::-webkit-color-swatch-wrapper { padding: 0; }
input[type="color"]::-webkit-color-swatch { border: 2px dashed #d1d5db; border-radius: 50%; }

/* ── Draggable ── */
.dragging { opacity: 0.5; }
.drag-over { border-color: #2563eb !important; background: rgba(37,99,235,0.05); }

/* ── Dark Mode Transition ── */
html { transition: background-color 0.2s, color 0.2s; }
