/* ════════════════════════════════════════
   MedJobs Design System
   Single source of truth for tokens,
   resets, and shared components.
   ════════════════════════════════════════ */

/* ── Tokens ── */
:root {
  --primary:   #0f6bd8;
  --secondary: #74c92d;
  --dark:      #15324b;
  --text:      #334155;
  --muted:     #475569;   /* raised from #64748b for WCAG AA on light bg */
  --bg:        #f0f5fc;
  --white:     #ffffff;
  --border:    #dbe7f3;
  --danger:    #dc2626;
  --warning:   #d97706;
  --success:   #2f8f22;
  --shadow:    0 2px 12px rgba(15,50,86,.08);
  --shadow-lg: 0 8px 28px rgba(15,50,86,.14);
  --radius:    16px;
  --radius-sm: 10px;
}

/* ── Resets ── */
*, *::before, *::after { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  margin: 0;
  font-family: Inter, Arial, Helvetica, sans-serif;
  color: var(--text);
  background: var(--bg);
  line-height: 1.5;
}
a { color: inherit; text-decoration: none; }
img { max-width: 100%; display: block; }

/* ── Buttons ── */
.btn {
  display: inline-flex; align-items: center;
  justify-content: center; gap: 7px;
  border-radius: 999px; padding: 9px 18px;
  font-weight: 700; font-size: .9rem;
  border: 1px solid var(--border);
  background: var(--white); color: var(--dark);
  cursor: pointer; transition: .2s; font-family: inherit;
  text-decoration: none;
}
.btn:hover { background: var(--bg); }

.btn-primary {
  background: linear-gradient(135deg, var(--primary), #1557b8);
  color: #fff; border: 0;
  box-shadow: 0 4px 14px rgba(15,107,216,.25);
}
.btn-primary:hover {
  transform: translateY(-1px);
  box-shadow: 0 8px 22px rgba(15,107,216,.32);
  background: linear-gradient(135deg, var(--primary), #1557b8);
}

.btn-green {
  background: linear-gradient(135deg, var(--secondary), #5aad1e);
  color: var(--dark); border: 0;
  box-shadow: 0 4px 14px rgba(116,201,45,.22);
}
.btn-green:hover {
  background: linear-gradient(135deg, #6ab828, #4f9e1a);
  transform: translateY(-1px);
}

.btn-outline {
  background: transparent;
  color: var(--primary);
  border: 1.5px solid rgba(15,107,216,.3);
}
.btn-outline:hover { background: rgba(15,107,216,.05); }

.btn-danger {
  background: transparent;
  color: var(--danger);
  border: 1px solid rgba(220,38,38,.3);
}
.btn-danger:hover { background: rgba(220,38,38,.06); }

.btn-sm { padding: 7px 14px; font-size: .84rem; }
.btn-lg { padding: 13px 28px; font-size: 1rem; }

/* ── Toast ── */
.toast {
  position: fixed;
  bottom: 28px; right: 28px;
  background: var(--dark); color: #fff;
  padding: 13px 20px; border-radius: 12px;
  font-weight: 700; font-size: .9rem;
  display: flex; align-items: center; gap: 10px;
  box-shadow: 0 12px 36px rgba(15,50,86,.22);
  transform: translateY(80px); opacity: 0;
  transition: transform .3s ease, opacity .3s ease;
  z-index: 200; pointer-events: none;
}
.toast.show    { transform: translateY(0); opacity: 1; }
.toast.success { background: #1a5c0f; }
.toast.error   { background: #8b1010; }
.toast.warning { background: #92510a; }

/* ── Flash messages ── */
.flash-messages {
  position: fixed; top: 16px; right: 16px;
  z-index: 9999; display: grid; gap: 8px;
  max-width: 380px; pointer-events: none;
}
.flash-msg {
  padding: 13px 18px; border-radius: 12px;
  font-size: .92rem; font-weight: 700; color: #fff;
  display: flex; align-items: center; gap: 10px;
  box-shadow: 0 8px 28px rgba(0,0,0,.15);
  background: var(--dark);
  transition: opacity .4s;
}
.flash-msg.error   { background: #8b1010; }
.flash-msg.success { background: #1a5c0f; }
.flash-msg.warning { background: #92510a; }

/* ── Card ── */
.card {
  background: var(--white);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}
.card-sm { border-radius: var(--radius-sm); }
.card-body { padding: 20px 24px; }
.card-header {
  display: flex; align-items: center;
  justify-content: space-between;
  padding: 18px 24px;
  border-bottom: 1px solid var(--border);
}
.card-title { font-size: .97rem; font-weight: 900; color: var(--dark); }

/* ── Tags / pills ── */
.tag {
  display: inline-flex; align-items: center;
  padding: 3px 10px; border-radius: 999px;
  font-size: .76rem; font-weight: 700;
}
.tag-blue   { background: rgba(15,107,216,.08);  color: var(--primary); border: 1px solid rgba(15,107,216,.14); }
.tag-green  { background: rgba(116,201,45,.09);  color: #3a6c0e;        border: 1px solid rgba(116,201,45,.18); }
.tag-orange { background: rgba(234,88,12,.08);   color: #c2410c;        border: 1px solid rgba(234,88,12,.14); }
.tag-red    { background: rgba(220,38,38,.08);   color: #dc2626;        border: 1px solid rgba(220,38,38,.14); }
.tag-gray   { background: var(--bg);             color: var(--muted);   border: 1px solid var(--border); }

/* ── Pill (larger, for chips/filters) ── */
.pill {
  display: inline-flex; align-items: center; gap: 5px;
  padding: 5px 13px; border-radius: 999px;
  font-size: .82rem; font-weight: 700;
  background: var(--bg); border: 1px solid var(--border);
  color: var(--text); cursor: pointer; transition: .15s;
  font-family: inherit;
}
.pill:hover           { border-color: var(--primary); color: var(--primary); }
.pill.active, .pill.selected {
  background: var(--primary); border-color: var(--primary); color: #fff;
}

/* ── Badge (status dot, e.g. on job cards) ── */
.badge {
  display: inline-flex; align-items: center;
  padding: 2px 8px; border-radius: 999px;
  font-size: .68rem; font-weight: 800;
  letter-spacing: .05em; text-transform: uppercase;
}
.badge-new      { background: #dbeafe; color: #1d4ed8; }
.badge-verified { background: #dcfce7; color: #16a34a; }
.badge-rapida   { background: #fef9c3; color: #a16207; }
.badge-premium  { background: rgba(15,107,216,.1); color: var(--primary); }

/* ── Avatar ── */
.avatar-circle {
  border-radius: 50%; overflow: hidden; flex-shrink: 0;
  display: flex; align-items: center; justify-content: center;
  background: linear-gradient(135deg, var(--primary), #1557b8);
  color: #fff; font-weight: 900; font-family: inherit;
}
.avatar-circle img { width: 100%; height: 100%; object-fit: cover; }
.avatar-sm  { width: 36px;  height: 36px;  font-size: .85rem; }
.avatar-md  { width: 48px;  height: 48px;  font-size: 1rem; }
.avatar-lg  { width: 72px;  height: 72px;  font-size: 1.4rem; }
.avatar-xl  { width: 96px;  height: 96px;  font-size: 1.8rem; }

/* ── Form elements ── */
input[type="text"],
input[type="email"],
input[type="tel"],
input[type="url"],
input[type="password"],
input[type="number"],
input[type="date"],
select,
textarea {
  width: 100%;
  border: 1.5px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 10px 13px;
  font-family: inherit;
  font-size: .93rem;
  color: var(--dark);
  background: var(--white);
  transition: border-color .15s, box-shadow .15s;
  outline: none;
  box-sizing: border-box;
}
input:focus,
select:focus,
textarea:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(15,107,216,.1);
}
input::placeholder,
textarea::placeholder { color: var(--muted); font-weight: 400; }
textarea { resize: vertical; min-height: 90px; line-height: 1.55; }
select { cursor: pointer; }
input:disabled, select:disabled, textarea:disabled { background: var(--bg); color: var(--muted); cursor: not-allowed; }

/* ── Form label ── */
label {
  display: grid; gap: 6px;
  font-weight: 700; font-size: .9rem; color: var(--dark);
}
.field-hint { font-size: .8rem; font-weight: 500; color: var(--muted); }
.field-error { font-size: .8rem; font-weight: 700; color: var(--danger); }

/* ── Section pattern (profile/detail pages) ── */
.section-card {
  background: var(--white);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  overflow: hidden;
  margin-bottom: 16px;
}
.section-header {
  display: flex; align-items: center;
  justify-content: space-between;
  padding: 18px 24px;
  border-bottom: 1px solid var(--border);
}
.section-header-left { display: flex; align-items: center; gap: 14px; }
.section-icon {
  width: 38px; height: 38px; border-radius: 11px;
  background: linear-gradient(135deg, rgba(15,107,216,.12), rgba(116,201,45,.18));
  display: grid; place-items: center; font-size: 1rem; flex-shrink: 0;
}
.section-title    { font-size: .97rem; font-weight: 900; color: var(--dark); }
.section-subtitle { font-size: .83rem; color: var(--muted); margin-top: 2px; }
.section-body { padding: 24px; }

/* ── Section autosave status ── */
.section-save-status {
  font-size: .8rem; font-weight: 700;
  opacity: 0; transition: opacity .3s;
  white-space: nowrap;
}
.section-save-status[data-status="saving"] { color: var(--muted); }
.section-save-status[data-status="saved"]  { color: #16a34a; }
.section-save-status[data-status="error"]  { color: var(--danger); }

/* ── Modal overlay ── */
.modal-overlay {
  display: none; position: fixed; inset: 0;
  background: rgba(0,0,0,.45); z-index: 200;
  align-items: center; justify-content: center;
}
.modal-overlay.open { display: flex; }
.modal-box {
  background: var(--white); border-radius: var(--radius);
  padding: 36px 32px;
  max-width: 480px; width: calc(100% - 32px);
  box-shadow: var(--shadow-lg); position: relative;
}
.modal-close {
  position: absolute; top: 16px; right: 18px;
  background: none; border: none; font-size: 1.4rem;
  cursor: pointer; color: var(--muted); line-height: 1;
}
.modal-close:hover { color: var(--dark); }
.modal-title { font-size: 1.2rem; font-weight: 800; color: var(--dark); margin-bottom: 6px; }
.modal-subtitle { font-size: .9rem; color: var(--muted); margin-bottom: 20px; }

/* ── Wizard banner ── */
.wizard-banner {
  position: fixed; top: 0; left: 0; right: 0; z-index: 100;
  background: var(--dark); color: #fff;
  padding: 14px 24px;
  display: none; align-items: center; justify-content: space-between;
  gap: 16px; flex-wrap: wrap;
  box-shadow: 0 4px 20px rgba(15,50,86,.3);
}
.wizard-banner.visible { display: flex; }
.wb-info { display: flex; align-items: center; gap: 16px; }
.wb-label { font-size: .82rem; color: rgba(255,255,255,.55); font-weight: 600; white-space: nowrap; }
.wb-steps { display: flex; gap: 6px; align-items: center; }
.wb-step {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 5px 14px; border-radius: 999px;
  font-size: .8rem; font-weight: 700;
  background: rgba(255,255,255,.1); color: rgba(255,255,255,.55);
  border: 1px solid rgba(255,255,255,.12);
}
.wb-step.active { background: var(--primary); color: #fff; border-color: var(--primary); }
.wb-step.done   { background: rgba(116,201,45,.25); color: #a8e063; border-color: rgba(116,201,45,.3); }
.wb-actions { display: flex; gap: 10px; align-items: center; flex-shrink: 0; }
.wb-skip {
  background: none; border: none; color: rgba(255,255,255,.5);
  font-family: inherit; font-size: .85rem; font-weight: 700;
  cursor: pointer; padding: 6px 0; transition: color .15s;
}
.wb-skip:hover { color: rgba(255,255,255,.8); }
.wb-next {
  padding: 9px 20px; border-radius: 999px;
  background: linear-gradient(135deg, var(--primary), #1557b8);
  color: #fff; border: none; font-family: inherit;
  font-size: .88rem; font-weight: 800; cursor: pointer; transition: filter .15s;
}
.wb-next:hover { filter: brightness(1.1); }

/* body offset when wizard banner is shown */
body.wizard-active { padding-top: 56px; }
body.wizard-active .profile-section { opacity: .3; pointer-events: none; transition: opacity .25s; }
body.wizard-active .profile-section.wizard-focus { opacity: 1; pointer-events: auto; }

/* ── Focus rings (accessibility) ── */
:focus-visible {
  outline: 3px solid var(--primary);
  outline-offset: 2px;
  border-radius: 4px;
}
/* Remove default :focus outline (keep :focus-visible only) */
:focus:not(:focus-visible) { outline: none; }

/* ── Empty state ── */
.empty-state {
  text-align: center;
  padding: 56px 24px;
  color: var(--muted);
}
.empty-state-icon {
  font-size: 2.8rem;
  margin-bottom: 14px;
  opacity: .6;
}
.empty-state-title {
  font-size: 1rem; font-weight: 800;
  color: var(--dark); margin-bottom: 6px;
}
.empty-state-desc {
  font-size: .9rem; line-height: 1.55;
  max-width: 320px; margin: 0 auto 18px;
}

/* ── Skeleton loader ── */
.skeleton {
  background: linear-gradient(90deg, var(--bg) 25%, #e4ecf7 50%, var(--bg) 75%);
  background-size: 200% 100%;
  animation: shimmer 1.4s infinite;
  border-radius: var(--radius-sm);
}
@keyframes shimmer {
  0%   { background-position: 200% 0; }
  100% { background-position: -200% 0; }
}
.skeleton-card {
  background: var(--white);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px 18px;
  display: flex; align-items: center; gap: 14px;
}
.skeleton-avatar {
  width: 48px; height: 48px;
  border-radius: 50%; flex-shrink: 0;
}
.skeleton-lines { flex: 1; display: grid; gap: 8px; }
.skeleton-line   { height: 12px; }
.skeleton-line.w-60 { width: 60%; }
.skeleton-line.w-40 { width: 40%; }
.skeleton-line.w-80 { width: 80%; }

/* ── Image lazy load fade-in ── */
img[loading="lazy"] {
  opacity: 0;
  transition: opacity .3s;
}
img[loading="lazy"].loaded { opacity: 1; }
