/* ============================================================
   for-mo.co.za — Main Stylesheet
   ============================================================ */

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Arial, sans-serif;
  font-size: 15px;
  color: #111;
  background: #f5f4f0;
  line-height: 1.6;
}

a { color: #1D9E75; text-decoration: none; }
a:hover { text-decoration: underline; }

.container { max-width: 640px; margin: 0 auto; padding: 0 20px; }

/* ---- Header ---- */
.site-header {
  background: #fff;
  border-bottom: 0.5px solid #ddd;
  padding: 16px 0;
  margin-bottom: 32px;
}
.site-header .logo { font-size: 22px; font-weight: 700; letter-spacing: -0.5px; }
.site-header .logo span { color: #1D9E75; }
.site-header .tagline { font-size: 13px; color: #888; margin-top: 2px; }

/* ---- Footer ---- */
.site-footer {
  border-top: 0.5px solid #ddd;
  padding: 20px 0;
  margin-top: 48px;
  font-size: 13px;
  color: #888;
  text-align: center;
}

/* ---- Order hero ---- */
.order-hero { text-align: center; margin-bottom: 28px; }
.order-hero h1 { font-size: 26px; font-weight: 600; color: #111; }
.order-hero p { font-size: 14px; color: #666; margin-top: 6px; }

/* ---- Cards ---- */
.card {
  background: #fff;
  border: 0.5px solid #ddd;
  border-radius: 12px;
  padding: 20px;
  margin-bottom: 16px;
}
.card-title {
  font-size: 11px;
  font-weight: 600;
  color: #888;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  margin-bottom: 14px;
}
.table-card {
  padding: 0;
  border-radius: 12px;
  overflow: hidden;
}

/* ---- Scrollable table wrapper ---- */
.table-scroll {
  width: 100%;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}

/* ---- Form fields ---- */
.field { margin-bottom: 14px; }
.field label { display: block; font-size: 13px; color: #555; margin-bottom: 5px; }
.field input,
.field select,
.field textarea {
  width: 100%;
  padding: 9px 12px;
  font-size: 14px;
  border: 1px solid #ddd;
  border-radius: 8px;
  background: #fff;
  color: #111;
  transition: border-color 0.15s, box-shadow 0.15s;
  font-family: inherit;
}
.field input:focus,
.field select:focus,
.field textarea:focus {
  outline: none;
  border-color: #1D9E75;
  box-shadow: 0 0 0 3px rgba(29,158,117,0.12);
}
.field textarea { resize: vertical; min-height: 80px; }
.field-row { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }

/* ---- Segmented control ---- */
.seg-control { display: flex; border: 1px solid #ddd; border-radius: 8px; overflow: hidden; }
.seg-opt { flex: 1; }
.seg-opt input { display: none; }
.seg-opt span {
  display: block;
  padding: 10px;
  text-align: center;
  font-size: 14px;
  cursor: pointer;
  color: #666;
  transition: all 0.15s;
}
.seg-opt input:checked + span { background: #1D9E75; color: #fff; font-weight: 600; }

/* ---- Supply options ---- */
.supply-opts { display: flex; flex-direction: column; gap: 8px; }
.supply-opt { display: flex; align-items: center; gap: 10px; padding: 12px; border: 1px solid #ddd; border-radius: 8px; cursor: pointer; transition: border-color 0.15s; }
.supply-opt input { accent-color: #1D9E75; }
.supply-opt:has(input:checked) { border-color: #1D9E75; background: #f0faf6; }
.supply-opt span { font-size: 14px; }

/* ---- Upload area ---- */
.upload-area {
  border: 1.5px dashed #ccc;
  border-radius: 8px;
  padding: 24px 16px;
  text-align: center;
  cursor: pointer;
  transition: border-color 0.15s, background 0.15s;
}
.upload-area:hover { border-color: #1D9E75; background: #f0faf6; }
.upload-icon { font-size: 24px; margin-bottom: 6px; }
.upload-area p { font-size: 13px; color: #888; }

/* ---- Buttons ---- */
.btn-primary {
  display: block;
  width: 100%;
  padding: 13px;
  font-size: 15px;
  font-weight: 600;
  background: #1D9E75;
  color: #fff;
  border: none;
  border-radius: 8px;
  cursor: pointer;
  transition: background 0.15s;
  margin-top: 8px;
  margin-bottom: 32px;
  font-family: inherit;
}
.btn-primary:hover { background: #0F6E56; }
.btn-primary:active { transform: scale(0.99); }
.btn-primary:disabled { background: #b0b0b0; cursor: not-allowed; }

.btn-small {
  display: inline-block;
  padding: 5px 10px;
  font-size: 12px;
  border: 1px solid #ddd;
  border-radius: 6px;
  cursor: pointer;
  background: transparent;
  color: #333;
  white-space: nowrap;
  font-family: inherit;
  text-decoration: none;
}
.btn-small:hover { background: #f5f5f5; }
.btn-green { border-color: #5DCAA5 !important; color: #0F6E56 !important; }
.btn-green:hover { background: #f0faf6 !important; }

/* ---- Alerts ---- */
.alert {
  padding: 12px 16px;
  border-radius: 8px;
  margin-bottom: 16px;
  font-size: 14px;
}
.alert-success { background: #E1F5EE; border: 1px solid #5DCAA5; color: #0F6E56; }
.alert-error { background: #FAECE7; border: 1px solid #F0997B; color: #4A1B0C; }

/* ---- Status badges ---- */
.badge {
  display: inline-block;
  font-size: 11px;
  font-weight: 600;
  padding: 3px 9px;
  border-radius: 6px;
  white-space: nowrap;
}
.badge-quote { background: #FAEEDA; color: #633806; }
.badge-awaiting { background: #FAECE7; color: #4A1B0C; }
.badge-production { background: #E6F1FB; color: #0C447C; }
.badge-done { background: #EAF3DE; color: #27500A; }
.badge-collected { background: #F1EFE8; color: #444; }
.badge-rejected  { background: #FAECE7; color: #c0392b; }

/* ---- Progress bar ---- */
.progress-bar {
  height: 6px;
  background: #eee;
  border-radius: 3px;
  overflow: hidden;
  min-width: 80px;
}
.progress-fill { height: 100%; background: #1D9E75; border-radius: 3px; transition: width 0.3s; }

/* ---- Login page ---- */
.login-page { background: #f5f4f0; display: flex; align-items: flex-start; justify-content: center; min-height: 100vh; padding-top: 80px; }
.login-wrap { background: #fff; border: 0.5px solid #ddd; border-radius: 12px; padding: 32px; width: 360px; max-width: 95vw; }
.login-logo { font-size: 24px; font-weight: 700; margin-bottom: 8px; }
.login-logo span { color: #1D9E75; }
.login-wrap h2 { font-size: 18px; margin-bottom: 20px; color: #444; }

/* ---- Admin layout ---- */
.admin-body { background: #f5f4f0; min-height: 100vh; }
.admin-header {
  background: #fff;
  border-bottom: 0.5px solid #ddd;
  padding: 12px 24px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  position: relative;
}
.admin-header .logo { font-size: 18px; font-weight: 700; }
.admin-header .logo span { color: #1D9E75; }
.admin-tag { font-size: 11px; font-weight: 600; background: #1D9E75; color: #fff; padding: 2px 7px; border-radius: 4px; margin-left: 6px; vertical-align: middle; }
.btn-new-job, .admin-nav a.btn-new-job { background: #1D9E75; color: #fff !important; font-size: 13px; font-weight: 600; padding: 5px 14px; border-radius: 7px; text-decoration: none; white-space: nowrap; margin-right: 8px; }
.btn-new-job:hover, .admin-nav a.btn-new-job:hover { background: #0F6E56; color: #fff !important; }
.menu-toggle { display: none; }
.admin-nav {
  display: flex;
  flex-direction: row;
  align-items: center;
  gap: 2px;
}
.admin-nav a {
  font-size: 13px;
  color: #555;
  text-decoration: none;
  padding: 6px 11px;
  border-radius: 6px;
  white-space: nowrap;
  transition: background 0.12s, color 0.12s;
}
.admin-nav a:hover, .admin-nav a.active { background: #f0faf6; color: #1D9E75; }
.admin-container { max-width: 1200px; margin: 0 auto; padding: 24px 20px; }

/* ---- Metrics ---- */
.metrics-grid { display: grid; grid-template-columns: repeat(4, minmax(0,1fr)); gap: 12px; margin-bottom: 24px; }
.metric { background: #fff; border-radius: 10px; padding: 16px; border: 0.5px solid #ddd; text-decoration: none !important; display: block; cursor: pointer; transition: border-color 0.15s, box-shadow 0.15s, background 0.15s; }
.metric:hover { border-color: #1D9E75; box-shadow: 0 0 0 3px #e0f5ee; background: #f7fdfb; }
.metric-active { border-color: #1D9E75 !important; background: #f0faf6 !important; }
.metric-label { font-size: 12px; color: #888; margin-bottom: 4px; text-decoration: none; }
.metric-value { font-size: 24px; font-weight: 700; color: #111; text-decoration: none; }

/* ---- Filters ---- */
.filter-row { display: flex; gap: 8px; margin-bottom: 14px; flex-wrap: wrap; }
.filter-btn {
  padding: 6px 14px;
  font-size: 12px;
  border: 1px solid #ddd;
  border-radius: 6px;
  cursor: pointer;
  background: #fff;
  color: #555;
  text-decoration: none;
  transition: all 0.15s;
}
.filter-btn:hover { background: #f0faf6; border-color: #5DCAA5; text-decoration: none; }
.filter-btn.active { background: #1D9E75; color: #fff; border-color: #1D9E75; }

/* ---- Admin table ---- */
.admin-table {
  width: 100%;
  min-width: 750px;
  border-collapse: collapse;
  font-size: 13px;
}
.admin-table th {
  text-align: left;
  padding: 10px 12px;
  font-size: 11px;
  font-weight: 600;
  color: #888;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  border-bottom: 1px solid #eee;
  background: #fafafa;
  white-space: nowrap;
}
.admin-table td {
  padding: 11px 12px;
  border-bottom: 0.5px solid #eee;
  color: #111;
  vertical-align: middle;
}
.admin-table tr:last-child td { border-bottom: none; }
.admin-table tr:hover td { background: #fafff9; }
.admin-table small { font-size: 11px; color: #888; display: block; }
.actions-cell { display: flex; gap: 6px; flex-wrap: wrap; }
.muted { color: #aaa; font-size: 12px; }

/* ---- Job detail ---- */
.detail-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.detail-table { width: 100%; border-collapse: collapse; font-size: 13px; }
.detail-table td { padding: 7px 4px; border-bottom: 0.5px solid #eee; }
.detail-table tr:last-child td { border-bottom: none; }
.detail-table td:first-child { color: #888; width: 45%; }

/* ---- Responsive ---- */
@media (max-width: 768px) {
  .metrics-grid { grid-template-columns: 1fr 1fr; }
  .detail-grid { grid-template-columns: 1fr; }
  .field-row { grid-template-columns: 1fr; }
  .admin-container { padding: 16px 12px; }
  .admin-table { font-size: 12px; }
  .admin-table th, .admin-table td { padding: 8px 8px; }


  /* Smooth table scroll */
  .table-scroll { -webkit-overflow-scrolling: touch; scroll-snap-type: none; }
}
@media (max-width: 480px) {
  .metrics-grid { grid-template-columns: 1fr 1fr; gap: 8px; }
  .metric-value { font-size: 20px; }
  .metric { padding: 12px; }

  .admin-header { padding: 8px 12px; }
  .logo { font-size: 16px !important; }
  .admin-tag { display: none; }
  .menu-toggle {
    display: block;
    background: none;
    border: 1px solid #ddd;
    border-radius: 6px;
    padding: 6px 10px;
    font-size: 18px;
    cursor: pointer;
    color: #555;
    line-height: 1;
    touch-action: manipulation;
    -webkit-tap-highlight-color: transparent;
  }
  .menu-toggle:hover { background: #f5f4f0; }
  .admin-nav {
    display: none;
    position: absolute;
    top: 52px;
    right: 12px;
    background: #fff;
    border: 0.5px solid #ddd;
    border-radius: 10px;
    box-shadow: 0 4px 16px rgba(0,0,0,.10);
    padding: 8px 0;
    min-width: 200px;
    z-index: 100;
    flex-direction: column;
    gap: 0;
  }
  .admin-nav.open { display: flex; }
  .admin-nav a {
    font-size: 14px;
    padding: 10px 18px;
    border-radius: 0;
  }
}
