/* CST Field App - web/styles.css. Shared_Styles.html (the time card's and Hub.html's stylesheet) moved here on
   2026-10-28 by phases/PHASE-W4-TIMECARD-PORT.md step 3, followed by the Phase 1.5 rules Timecard.html carried
   in its own <style>. index.html keeps its own inline stylesheet: the two agree only on box-sizing and the
   font stack, so nothing of the work order's was merged. */

:root {
  --primary: #1a73e8;
  --primary-dark: #0d47a1;
  --success: #1e8e3e;
  --error: #d93025;
  --warn: #b06000;
  --bg: #f1f3f4;
  --card-bg: #ffffff;
  --text: #202124;
  --label: #5f6368;
  --border: #dadce0;
  --row-bg: #f8f9fa;
  --job-bg: #ffffff;
  --lunch-bg: #fff8e1;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  padding: 0;
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
  display: flex;
  justify-content: center;
  align-items: flex-start;
  padding-top: env(safe-area-inset-top, 0);
}

.container { width: 100%; max-width: 640px; padding: 16px; }

.card {
  background: var(--card-bg);
  border-radius: 12px;
  box-shadow: 0 1px 3px rgba(60,64,67,0.15), 0 4px 8px rgba(60,64,67,0.1);
  padding: 24px 20px 28px;
}

.header { text-align: center; margin-bottom: 20px; }
.header h1 { font-size: 22px; margin: 0 0 4px; color: var(--primary-dark); }
.header p { margin: 0; color: var(--label); font-size: 14px; }

.invalid-box {
  text-align: center;
  padding: 30px 16px;
  color: var(--label);
  font-size: 15px;
}

.week-nav {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 16px;
  gap: 10px;
}

.week-nav button {
  padding: 10px 14px;
  font-size: 14px;
  font-weight: 600;
  border: 1px solid var(--border);
  background: #fff;
  border-radius: 8px;
  cursor: pointer;
  color: var(--primary-dark);
}

.week-nav button:disabled { opacity: 0.4; cursor: not-allowed; }

.week-label {
  font-size: 15px;
  font-weight: 700;
  text-align: center;
  flex: 1;
}

.submitted-banner {
  background: #e6f4ea;
  color: var(--success);
  border: 1px solid #b7e1c0;
  border-radius: 8px;
  padding: 10px 14px;
  font-size: 13px;
  font-weight: 600;
  text-align: center;
  margin-bottom: 16px;
}

.day-block {
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 12px 14px 14px;
  margin-bottom: 14px;
  background: var(--row-bg);
}

.day-block .day-title {
  font-size: 14px;
  font-weight: 700;
  color: var(--primary-dark);
  margin-bottom: 10px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.day-block .day-total {
  font-size: 12px;
  font-weight: 600;
  color: var(--label);
}

.job-row {
  background: var(--job-bg);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 10px 12px 12px;
  margin-bottom: 8px;
  position: relative;
}

.job-row .job-row-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 6px;
}

.job-row .job-row-header span {
  font-size: 11px;
  font-weight: 700;
  color: var(--label);
  text-transform: uppercase;
  letter-spacing: 0.02em;
}

.remove-job-btn {
  background: none;
  border: none;
  color: var(--error);
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  padding: 2px 6px;
}

label {
  display: block;
  font-size: 11px;
  font-weight: 600;
  color: var(--label);
  margin: 6px 0 4px;
}

input[type="text"],
input[type="number"],
input[type="time"],
select {
  width: 100%;
  padding: 9px 10px;
  font-size: 15px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: #fff;
  color: var(--text);
}

input:focus,
select:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 2px rgba(26,115,232,0.15);
}


.hours-grid {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr 1fr;
  gap: 8px;
}

.hours-grid > div { min-width: 0; }
.hours-grid label { font-size: 10px; }

.add-job-btn {
  width: 100%;
  padding: 9px;
  font-size: 13px;
  font-weight: 600;
  color: var(--primary-dark);
  background: #fff;
  border: 1px dashed var(--primary);
  border-radius: 8px;
  cursor: pointer;
  margin-top: 2px;
}

.lunch-section {
  background: var(--lunch-bg);
  border: 1px solid #f2d68a;
  border-radius: 8px;
  padding: 10px 12px 12px;
  margin-top: 10px;
}

.lunch-section .lunch-title {
  font-size: 12px;
  font-weight: 700;
  color: var(--warn);
  margin-bottom: 6px;
}

.lunch-times {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}

.lunch-times label { font-size: 10px; }

.lunch-checkbox-row {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-top: 8px;
  font-size: 12px;
  color: var(--text);
}

.lunch-checkbox-row input[type="checkbox"] {
  width: 16px;
  height: 16px;
  margin: 0;
}

/* Per diem (2026-11-05): the day's box, then the two ways the meals were covered. */
.perdiem-section {
  background: #f4f6fb;
  border: 1px solid #c9d3f5;
  border-radius: 8px;
  padding: 10px 12px 12px;
  margin-top: 10px;
}
.perdiem-section .lunch-checkbox-row { margin-top: 0; font-weight: 600; }
.perdiem-choices { margin: 8px 0 0 22px; }
.perdiem-choices .lunch-checkbox-row { font-weight: 500; }
.perdiem-choices input[type="radio"] { width: 16px; height: 16px; margin: 0; }
.perdiem-note { font-size: 11px; color: var(--label); margin: 6px 0 0 22px; }

/* Emergency call-out toggle on each job line. Same visual weight as
   the lunch checkboxes so it reads as a normal part of the line and not
   as a warning. */
.ecall-row {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: 10px;
  font-size: 14px;
  font-weight: 500;
  color: #333;
  cursor: pointer;
}

.ecall-row input[type="checkbox"] {
  width: 20px;
  height: 20px;
  margin: 0;
  flex: 0 0 auto;
}

.self-report-row {
  display: flex;
  align-items: flex-start;
  gap: 6px;
  margin-top: 8px;
  padding: 8px 10px;
  background: #fce8e6;
  border: 1px solid #f4c7c3;
  border-radius: 6px;
  font-size: 12px;
  color: var(--error);
}

.self-report-row input[type="checkbox"] {
  width: 16px;
  height: 16px;
  margin: 1px 0 0 0;
  flex-shrink: 0;
}

.action-buttons {
  margin-top: 20px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

button.action-btn {
  width: 100%;
  padding: 14px;
  font-size: 16px;
  font-weight: 600;
  color: #fff;
  border: none;
  border-radius: 8px;
  cursor: pointer;
}

#saveBtn { background: var(--primary); }
#submitBtn { background: var(--success); }
button.action-btn:disabled { background: #9aa0a6; cursor: not-allowed; }

.status {
  margin-top: 16px;
  padding: 12px 14px;
  border-radius: 8px;
  font-size: 14px;
  display: none;
  white-space: pre-wrap;
}

.status.success { display: block; background: #e6f4ea; color: var(--success); border: 1px solid #b7e1c0; }
.status.error { display: block; background: #fce8e6; color: var(--error); border: 1px solid #f4c7c3; }

.spinner {
  display: inline-block;
  width: 16px;
  height: 16px;
  border: 2px solid rgba(255,255,255,0.4);
  border-top-color: #fff;
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
  margin-right: 8px;
  vertical-align: middle;
}

@keyframes spin { to { transform: rotate(360deg); } }

.loading { text-align: center; padding: 30px; color: var(--label); }

/* Hub-specific (added Phase 1) */
.hub-buttons {
  display: flex;
  flex-direction: column;
  gap: 12px;
  margin-top: 8px;
}

a.hub-btn {
  display: block;
  width: 100%;
  padding: 16px;
  font-size: 16px;
  font-weight: 600;
  color: #fff;
  background: var(--primary);
  border-radius: 8px;
  text-align: center;
  text-decoration: none;
  box-sizing: border-box;
}

/* Phase 1.5 additions - scoped to this file only (Shared_Styles.html
   is shared with Hub.html and is out of scope for this phase). */
.work-period { border: 1px solid #d8dde3; border-radius: 8px; padding: 10px; margin-bottom: 10px; background: #fafbfc; }
.work-period-title { font-weight: 600; font-size: 13px; color: #555; margin-bottom: 8px; display:flex; justify-content:space-between; align-items:center; }
.segment-row { border: 1px solid #e2e6ea; border-radius: 6px; padding: 8px; margin-bottom: 8px; background: #fff; }
.segment-row-header { display:flex; justify-content:space-between; align-items:center; margin-bottom:6px; }
.segment-row-header .seg-label { font-size: 12px; font-weight: 600; color:#666; }
.time-grid { display:grid; grid-template-columns: 1fr 1fr; gap: 8px; margin: 6px 0; }
.time-grid label { font-size: 11px; color:#666; display:block; margin-bottom:2px; }
.time-grid input[type="time"] { width:100%; box-sizing:border-box; padding:6px; border:1px solid #ccc; border-radius:4px; font-size:14px; }
.time-grid input[type="time"].is-default { background:#fff7db; border-color:#e0c341; color:#7a6a12; }
.time-grid input[type="time"][readonly] { background:#eef1f4; color:#555; }
/* 2026-11-25: the start and end times are lists of quarter hours (timecard.js buildTimeField). */
.time-grid select.time-select { width:100%; box-sizing:border-box; padding:6px; border:1px solid #ccc; border-radius:4px; font-size:14px; background:#fff; color:#202124; }
.time-grid select.time-select.is-default { background:#fff7db; border-color:#e0c341; color:#7a6a12; }
.time-grid select.time-select[disabled] { background:#eef1f4; color:#555; opacity:1; }
/* 2026-11-25: the hours on a segment beside its name, and the day's hours by job under the date. */
.segment-row-header .seg-hours { font-size:14px; font-weight:700; color:#0d47a1; margin-left:8px; margin-right:auto; }
.day-block .day-breakdown { font-size:13px; color:#333; margin:2px 0 8px; font-weight:600; }
/* 2026-11-25: the time choices. One sentence under the choice, a hint for the day, the week's split, the guide. */
.choice-help { font-size:12px; color:#555; margin:2px 0 6px; line-height:1.35; }
.day-block .day-hint { font-size:12px; color:#8a4b00; margin:0 0 6px; }
.week-split { font-size:14px; font-weight:600; color:#202124; margin:12px 0 4px; }
.choice-guide { font-size:13px; color:#333; margin:8px 0 10px; }
.choice-guide p { margin:0 0 4px; }
.choice-guide summary { color:#1a56b8; cursor:pointer; margin:2px 0 6px; }
.choice-guide details div { margin:0 0 6px; line-height:1.35; }
.seg-computed { font-size:11px; color:#666; margin-top:4px; }
.seg-computed .override-note { color:#b45309; font-weight:600; }
.entry-type-select { width:100%; box-sizing:border-box; padding:6px; border:1px solid #ccc; border-radius:4px; font-size:14px; margin-bottom:6px; }
.job-number-row { margin-bottom:6px; }
.job-number-row input { width:100%; box-sizing:border-box; padding:6px; border:1px solid #ccc; border-radius:4px; font-size:14px; }
.add-segment-btn, .add-workperiod-btn, .add-special-btn { font-size:12px; padding:6px 10px; border:1px dashed #999; background:#fff; border-radius:6px; cursor:pointer; margin-top:4px; }
.remove-seg-btn, .remove-special-btn { font-size:11px; padding:3px 8px; border:1px solid #c33; color:#c33; background:#fff; border-radius:4px; cursor:pointer; }
.special-row { border: 1px solid #e2e6ea; border-radius: 6px; padding: 8px; margin-bottom: 8px; background: #f5f7fa; }
.special-row-header { display:flex; justify-content:space-between; align-items:center; margin-bottom:6px; }
.day-warning { font-size: 12px; color: #b45309; margin: 6px 0; }
.day-block-actions { display:flex; gap:8px; flex-wrap:wrap; margin-top:6px; }
