/* common.css — Shared design system (mirrors auth-portal) */
@import url('https://fonts.googleapis.com/css2?family=Oswald:wght@400;500;600;700&family=Poppins:wght@300;400;500;600;700&display=swap');

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

body {
  font-family: 'Poppins', system-ui, -apple-system, BlinkMacSystemFont, sans-serif;
  background: #ffffff;
  color: #1a1a1a;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  line-height: 1.6;
}

h1, h2, h3, legend {
  font-family: 'Oswald', sans-serif;
  text-transform: uppercase;
  letter-spacing: 1px;
}

/* ── Header / Footer ── */
.site-header, .site-footer {
  padding: 0.75rem 2rem;
  background: #181a21;
  color: #ffffff;
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.site-header { border-bottom: 1px solid rgba(255,255,255,0.1); }
.site-footer {
  border-top: 1px solid rgba(255,255,255,0.1);
  margin-top: auto;
  font-size: 0.85rem;
  color: rgba(255,255,255,0.4);
}
.brand-logo { height: 36px; width: 36px; border-radius: 50%; object-fit: cover; margin-right: 0.6rem; vertical-align: middle; }
.brand { display: flex; align-items: center;
  font-family: 'Oswald', sans-serif;
  font-weight: 700;
  letter-spacing: 0.2em;
  font-size: 1.1rem;
  color: #ffffff;
  text-transform: uppercase;
}
nav { display: flex; gap: 0.75rem; align-items: center; }
.nav-link { color: #36454F; text-decoration: none; font-size: 1rem; }
.nav-link:hover { color: #1a1a1a; }
.site-header .nav-link { color: #f9c248; }
.site-header .nav-link:hover { color: #fff; }
.user-chip { font-size: 0.85rem; color: rgba(255,255,255,0.5); margin-right: 0.5rem; }

/* ── Layout ── */
.main { padding: 2rem; max-width: 1200px; width: 100%; margin: 0 auto; flex: 1; }
.main.narrow { max-width: 720px; }
.main.wide { max-width: 1400px; }

/* ── Buttons ── */
.btn {
  display: inline-block;
  border: none;
  padding: 0.65rem 1.2rem;
  font-family: 'Oswald', sans-serif;
  text-transform: uppercase;
  letter-spacing: 1px;
  font-weight: 600;
  font-size: 1rem;
  cursor: pointer;
  background: #000000;
  color: #fff;
  text-decoration: none;
  text-align: center;
  border-radius: 4px;
  transition: opacity 0.2s, box-shadow 0.2s;
}
.btn:hover { opacity: 0.85; }
.btn:focus-visible { outline: 2px solid #f9c248; outline-offset: 2px; }
.btn.primary { background: #f9c248; color: #000; }
.btn.primary:hover { background: #ffd060; }
.btn.ghost { background: transparent; border: 1px solid #333; color: #1a1a1a; }
.btn.ghost:hover { border-color: #f9c248; }
.btn.danger { background: #c0392b; color: #fff; }
.btn.save { background: #27ae60; color: #fff; }
.btn.save:hover { background: #2ecc71; }
.btn.success { background: #27ae60; color: #fff; }
.btn.tiny { font-size: 0.75rem; padding: 0.25rem 0.5rem; }
.btn.sm { font-size: 0.85rem; padding: 0.35rem 0.8rem; }
.btn.full { width: 100%; }
.btn:disabled { opacity: 0.5; cursor: not-allowed; }

/* Header ghost buttons on dark bg */
.site-header .btn.ghost { border-color: rgba(255,255,255,0.3); color: #fff; }
.site-header .btn.ghost:hover { border-color: #f9c248; color: #f9c248; }

/* ── Cards ── */
.card {
  background: #f5f5f5;
  padding: 2rem;
  border-radius: 0.75rem;
  box-shadow: 0 4px 20px rgba(0,0,0,0.08);
  border: 1px solid #e0e0e0;
}

/* ── Forms ── */
.form-group { margin-bottom: 1.25rem; }
.form-group label,
label {
  display: block;
  font-size: 0.85rem;
  font-weight: 500;
  color: #36454F;
  margin-bottom: 0.4rem;
}

input:not([type="checkbox"]):not([type="radio"]):not([type="file"]):not([type="submit"]):not([type="button"]):not([type="hidden"]),
input[type="text"],
input[type="password"],
input[type="email"],
input[type="url"],
input[type="tel"],
input[type="number"],
select,
textarea {
  display: block;
  width: 100%;
  padding: 0.7rem 0.85rem;
  border-radius: 0.5rem;
  border: 1px solid #888;
  background: #ffffff;
  color: #1a1a1a;
  font-family: 'Poppins', sans-serif;
  font-size: 1rem;
  transition: border-color 0.2s;
  outline: none;
}
input:focus, select:focus, textarea:focus { border-color: #f9c248; }

input[type="file"] { padding: 0.5rem; }

small { color: #36454F; font-size: 0.85rem; }

/* ── Fieldsets ── */
fieldset {
  border: 1px solid #e0e0e0;
  border-radius: 0.75rem;
  padding: 1.5rem;
  margin-bottom: 1.5rem;
  background: #fff;
  box-shadow: 0 1px 3px rgba(0,0,0,0.06);
}
legend {
  color: #36454F;
  font-weight: 600;
  padding: 0 0.5rem;
  font-size: 1rem;
}

/* ── Flex rows ── */
.row { display: flex; gap: 1rem; }
.row .field { flex: 1; }
.field { position: relative; margin-bottom: 1rem; }
.field-small { max-width: 120px; }

/* ── Flash messages ── */
.flash { padding: 1rem; border-radius: 0.6rem; margin-bottom: 1.5rem; font-size: 1rem; }
.flash.success { background: rgba(46,204,113,0.1); border: 1px solid rgba(46,204,113,0.3); color: #27ae60; }
.flash.error { background: rgba(231,76,60,0.1); border: 1px solid rgba(231,76,60,0.3); color: #c0392b; }

/* ── Tables ── */
table { width: 100%; border-collapse: collapse; margin-top: 1rem; }
th, td { padding: 0.75rem; border-bottom: 1px solid #e0e0e0; text-align: left; font-size: 1rem; }
th { color: #36454F; font-weight: 500; font-size: 0.85rem; text-transform: uppercase; letter-spacing: 0.05em; }

/* ── Tabs (underline style) ── */
.tabs { display: flex; gap: 0.25rem; margin-bottom: 2rem; border-bottom: 1px solid #e0e0e0; }
.tab {
  text-decoration: none;
  padding: 0.75rem 1.25rem;
  border-bottom: 2px solid transparent;
  color: #36454F;
  font-weight: 500;
  font-size: 1rem;
  cursor: pointer;
  background: none;
  border-top: none;
  border-left: none;
  border-right: none;
  transition: color 0.2s, border-color 0.2s;
}
.tab:hover { color: #1a1a1a; border-bottom-color: #ccc; }
.tab.active { color: #1a1a1a; border-bottom-color: #f9c248; font-weight: 600; }

/* ── Status pills ── */
.status-pill, .status-badge {
  display: inline-block;
  padding: 0.2rem 0.6rem;
  border-radius: 20px;
  font-size: 0.75rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}
.status-new { background: rgba(53,112,255,0.12); color: #2563eb; }
.status-routed { background: rgba(53,112,255,0.12); color: #2563eb; }
.status-pending_confirmation { background: rgba(241,196,15,0.12); color: #36454F; }
.status-collection_booked { background: rgba(155,89,182,0.12); color: #8e44ad; }
.status-in_transit_to_agent { background: rgba(155,89,182,0.12); color: #8e44ad; }
.status-received_by_agent { background: rgba(46,204,113,0.12); color: #27ae60; }
.status-under_review { background: rgba(241,196,15,0.12); color: #36454F; }
.status-review_complete { background: rgba(26,188,156,0.12); color: #0e8c6e; }
.status-ready_for_collection { background: rgba(26,188,156,0.12); color: #0e8c6e; }
.status-awaiting_supplier { background: rgba(230,126,34,0.12); color: #a34200; }
.status-replacement_sent { background: rgba(46,204,113,0.12); color: #27ae60; }
.status-return_to_customer { background: rgba(155,89,182,0.12); color: #8e44ad; }
.status-closed { background: rgba(0,0,0,0.08); color: #36454F; }

/* ── Modals ── */
.modal {
  position: fixed; top: 0; left: 0; right: 0; bottom: 0;
  background: rgba(0,0,0,0.4);
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1rem;
}
.modal-content {
  background: #ffffff;
  border: 1px solid #e0e0e0;
  border-radius: 0.75rem;
  padding: 2rem;
  box-shadow: 0 1px 3px rgba(0,0,0,0.06);
  max-width: 700px;
  width: 100%;
  max-height: 90vh;
  overflow-y: auto;
  position: relative;
}
.modal-content.wide { max-width: 900px; }
.modal-close {
  position: absolute;
  top: 1rem;
  right: 1rem;
  background: none;
  border: none;
  color: #36454F;
  font-size: 1.4rem;
  cursor: pointer;
}

/* ── Phone input ── */
.phone-input { display: flex; align-items: center; }
.phone-prefix {
  background: #f5f5f5;
  border: 1px solid #888;
  border-right: none;
  border-radius: 0.5rem 0 0 0.5rem;
  padding: 0.7rem;
  color: #36454F;
  font-size: 1rem;
  white-space: nowrap;
}
.phone-input input { border-radius: 0 0.5rem 0.5rem 0; }

/* ── Dropdowns ── */
.dropdown {
  position: absolute;
  width: 100%;
  max-height: 250px;
  overflow-y: auto;
  background: #ffffff;
  border: 1px solid #888;
  border-radius: 0.5rem;
  margin-top: 4px;
  display: none;
  z-index: 100;
}
.dropdown.active { display: block; }
.dropdown-item {
  padding: 0.6rem 0.9rem;
  cursor: pointer;
  border-bottom: 1px solid #e0e0e0;
  font-size: 1rem;
}
.dropdown-item:hover { background: #f5f5f5; }
.dropdown-item .sku { color: #36454F; font-size: 0.85rem; }

/* ── Success card ── */
.success-card {
  text-align: center;
  background: #f5f5f5;
  border: 1px solid #e0e0e0;
  border-radius: 0.75rem;
  padding: 3rem 2rem;
  max-width: 500px;
  margin: 4rem auto;
}
.success-icon { font-size: 3rem; margin-bottom: 1rem; }
.success-card h1 { color: #27ae60; margin-bottom: 1rem; font-size: 1.4rem; }
.ref-badge {
  display: inline-block;
  background: #ffffff;
  border: 2px solid #f9c248;
  border-radius: 0.5rem;
  padding: 0.8rem 1.5rem;
  font-size: 1.4rem;
  font-weight: 700;
  color: #36454F;
  margin-bottom: 1.5rem;
  letter-spacing: 1px;
}
.btn-link { display: inline-block; margin-top: 1rem; color: #36454F; text-decoration: none; font-weight: 500; }
.btn-link:hover { text-decoration: underline; }

/* ── Age badges ── */
.days-badge { padding: 0.1rem 0.4rem; border-radius: 6px; font-weight: 600; font-size: 0.75rem; }
.days-green { background: rgba(46,204,113,0.15); color: #27ae60; }
.days-yellow { background: rgba(241,196,15,0.15); color: #36454F; }
.days-red { background: rgba(231,76,60,0.15); color: #c0392b; }

/* ── Responsive ── */
@media (max-width: 600px) {
  .site-header { flex-direction: column; gap: 0.5rem; }
  nav { flex-wrap: wrap; justify-content: center; }
  .main { padding: 1rem; }
  .row { flex-direction: column; gap: 0; }
  .field-small { max-width: none; }
}

/* ── Dividers ── */
.divider, hr { border: none; border-top: 2px solid #f9c248; margin: 1.25rem 0; height: 0; }

/* Semantic icon colours */
.bi-floppy, .bi-check-circle, .bi-check-lg, .bi-check2 { color: #27ae60; }
.bi-pencil, .bi-arrow-clockwise, .bi-plus-lg, .bi-plus-circle { color: #f9c248; }
.bi-trash, .bi-x-lg, .bi-x-circle { color: #c0392b; }
.bi-search, .bi-eye, .bi-clipboard, .bi-info-circle, .bi-file-text, .bi-link-45deg { color: #36454F; }
.bi-envelope, .bi-telephone, .bi-phone, .bi-chat, .bi-people, .bi-person { color: #36454F; }
.bi-box-seam, .bi-truck, .bi-paperclip, .bi-inbox, .bi-wrench, .bi-lock, .bi-lightbulb { color: #36454F; }

/* Icons inside coloured buttons inherit button text colour */
.btn.primary i, .btn.danger i, .btn.save i { color: inherit; }
.btn.save { background: #27ae60; color: #fff; }
.btn.save:hover { background: #2ecc71; }

/* ── Progress Tracker ── */
.progress-tracker {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin: 1.25rem 0 1.5rem;
  padding: 0 0.5rem;
}
.progress-step {
  display: flex;
  flex-direction: column;
  align-items: center;
  position: relative;
  z-index: 1;
  flex: 0 0 auto;
}
.progress-step .step-circle {
  width: 40px; height: 40px; border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-family: 'Oswald', sans-serif; font-size: 1rem; font-weight: 600;
  border: 2px solid #d0d0d0; background: #fff; color: #888;
  transition: all 0.3s;
}
.progress-step.completed .step-circle {
  background: #27ae60; border-color: #27ae60; color: #fff;
}
.progress-step.active .step-circle {
  background: #f9c248; border-color: #f9c248; color: #000;
}
.progress-step .step-label {
  font-size: 0.7rem; color: #888; margin-top: 0.35rem;
  text-transform: uppercase; letter-spacing: 0.5px; font-weight: 500;
  white-space: nowrap;
}
.progress-step.completed .step-label { color: #27ae60; }
.progress-step.active .step-label { color: #f9c248; font-weight: 700; }
.progress-connector {
  flex: 1; height: 3px; background: #e0e0e0; margin: 0 0.25rem;
  margin-bottom: 1.2rem; /* align with circles */
}
.progress-connector.completed { background: #27ae60; }
