/* Mobile-First Candidate Form Stylesheet */
@import url('https://fonts.googleapis.com/css2?family=Sarabun:wght@300;400;500;600;700&display=swap');

:root {
  --primary: #990000;
  --primary-hover: #7a0000;
  --primary-light: #fef2f2;
  --secondary: #1e293b;
  --text-main: #1e293b;
  --text-muted: #64748b;
  --border: #e2e8f0;
  --bg-page: #f8fafc;
  --bg-card: #ffffff;
  --radius-sm: 8px;
  --radius-md: 12px;
  --radius-lg: 16px;
  --shadow-sm: 0 1px 3px rgba(0,0,0,0.06);
  --shadow-md: 0 4px 12px rgba(0,0,0,0.08);
  --shadow-lg: 0 10px 25px rgba(0,0,0,0.1);
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  font-family: 'Sarabun', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  -webkit-tap-highlight-color: transparent;
}

body {
  background-color: var(--bg-page);
  color: var(--text-main);
  line-height: 1.5;
  padding-bottom: 90px;
}

/* Header */
.app-header {
  background: #ffffff;
  border-bottom: 1px solid var(--border);
  padding: 12px 16px;
  position: sticky;
  top: 0;
  z-index: 100;
  display: flex;
  align-items: center;
  justify-content: space-between;
  box-shadow: var(--shadow-sm);
}

.header-brand {
  display: flex;
  align-items: center;
  gap: 10px;
}

.header-brand img {
  height: 38px;
  width: auto;
}

.header-brand h1 {
  font-size: 16px;
  font-weight: 700;
  color: var(--primary);
  line-height: 1.2;
}
.header-brand p {
  font-size: 11px;
  color: var(--text-muted);
}

.save-status {
  font-size: 12px;
  font-weight: 500;
  color: #16a34a;
  display: flex;
  align-items: center;
  gap: 4px;
}

/* Container */
.container {
  max-width: 800px;
  margin: 0 auto;
  padding: 16px;
}

/* Progress Bar / Steps Bar */
.steps-container {
  background: var(--bg-card);
  border-radius: var(--radius-md);
  padding: 12px 14px;
  margin-bottom: 16px;
  border: 1px solid var(--border);
  box-shadow: var(--shadow-sm);
  overflow-x: auto;
}

.steps-list {
  display: flex;
  list-style: none;
  gap: 8px;
  min-width: 480px;
}

.step-item {
  flex: 1;
  text-align: center;
  padding: 8px 6px;
  border-radius: var(--radius-sm);
  background: #f1f5f9;
  color: var(--text-muted);
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  border: 1px solid transparent;
}

.step-item.active {
  background: var(--primary);
  color: #ffffff;
}

.step-item.completed {
  background: #ecfdf5;
  color: #059669;
  border-color: #a7f3d0;
}

/* Card Sections */
.form-card {
  background: var(--bg-card);
  border-radius: var(--radius-md);
  padding: 20px;
  margin-bottom: 16px;
  border: 1px solid var(--border);
  box-shadow: var(--shadow-sm);
}

.card-title {
  font-size: 17px;
  font-weight: 700;
  color: var(--primary);
  margin-bottom: 4px;
  display: flex;
  align-items: center;
  gap: 8px;
}

.card-subtitle {
  font-size: 13px;
  color: var(--text-muted);
  margin-bottom: 16px;
}

/* Form Groups & Inputs */
.form-grid-2 {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
}

.form-grid-3 {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  gap: 12px;
}

.form-grid-4 {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr 1fr;
  gap: 10px;
}

@media (max-width: 640px) {
  .form-grid-2,
  .form-grid-3,
  .form-grid-4 {
    grid-template-columns: 1fr;
    gap: 12px;
  }
}

.form-group {
  margin-bottom: 14px;
}

.form-label {
  display: block;
  font-size: 13.5px;
  font-weight: 600;
  color: #334155;
  margin-bottom: 6px;
}
.form-label .sub {
  font-size: 11.5px;
  font-weight: 400;
  color: var(--text-muted);
}
.form-label .req {
  color: #dc2626;
  font-weight: bold;
}

.form-control {
  width: 100%;
  padding: 10px 14px;
  font-size: 15px;
  border: 1.5px solid var(--border);
  border-radius: var(--radius-sm);
  background: #ffffff;
  color: var(--text-main);
  transition: border-color 0.2s, box-shadow 0.2s;
  outline: none;
}

.form-control:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(153, 0, 0, 0.12);
}

textarea.form-control {
  min-height: 90px;
  resize: vertical;
}

/* Radio & Checkbox Cards */
.radio-group,
.checkbox-group {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.radio-card,
.checkbox-card {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 14px;
  border: 1.5px solid var(--border);
  border-radius: var(--radius-sm);
  font-size: 13.5px;
  background: #fff;
  cursor: pointer;
  user-select: none;
  transition: all 0.15s;
}

.radio-card input,
.checkbox-card input {
  accent-color: var(--primary);
  width: 16px;
  height: 16px;
}

.radio-card:has(input:checked),
.checkbox-card:has(input:checked) {
  border-color: var(--primary);
  background-color: var(--primary-light);
  font-weight: 600;
  color: var(--primary);
}

/* Photo Upload Box */
.photo-uploader {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  border: 2px dashed #cbd5e1;
  border-radius: var(--radius-md);
  padding: 20px;
  background: #f8fafc;
  cursor: pointer;
  text-align: center;
  position: relative;
  overflow: hidden;
  transition: border-color 0.2s;
}

.photo-uploader:hover {
  border-color: var(--primary);
}

.photo-preview {
  width: 120px;
  height: 150px;
  border-radius: var(--radius-sm);
  object-fit: cover;
  border: 2px solid var(--border);
  margin-bottom: 10px;
  background: #fff;
}

/* Tables for Education, Work, Family */
.mobile-table-card {
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 12px;
  margin-bottom: 12px;
  background: #fdfdfd;
}

.mobile-table-card .row-title {
  font-weight: 700;
  font-size: 14px;
  color: var(--secondary);
  border-bottom: 1px solid #f1f5f9;
  padding-bottom: 6px;
  margin-bottom: 10px;
}

/* Signature Pad */
.signature-wrapper {
  border: 1.5px solid var(--border);
  border-radius: var(--radius-md);
  background: #ffffff;
  padding: 10px;
  text-align: center;
}

#signatureCanvas {
  width: 100%;
  height: 160px;
  border: 1px dashed #cbd5e1;
  border-radius: var(--radius-sm);
  background: #fafafa;
  touch-action: none;
}

.sig-actions {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-top: 8px;
}

.btn-sig-clear {
  background: #f1f5f9;
  color: #475569;
  border: none;
  padding: 6px 14px;
  border-radius: var(--radius-sm);
  font-size: 12.5px;
  font-weight: 600;
  cursor: pointer;
}

/* Bottom Action Bar (Fixed on mobile) */
.bottom-bar {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  background: #ffffff;
  border-top: 1px solid var(--border);
  padding: 12px 16px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  box-shadow: 0 -4px 15px rgba(0,0,0,0.06);
  z-index: 100;
}

.bottom-bar .inner {
  max-width: 800px;
  margin: 0 auto;
  width: 100%;
  display: flex;
  justify-content: space-between;
  gap: 12px;
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 12px 20px;
  font-size: 15px;
  font-weight: 600;
  border-radius: var(--radius-sm);
  border: none;
  cursor: pointer;
  transition: all 0.2s;
  text-decoration: none;
}

.btn-primary {
  background: var(--primary);
  color: #ffffff;
}
.btn-primary:hover {
  background: var(--primary-hover);
}

.btn-secondary {
  background: #e2e8f0;
  color: #334155;
}
.btn-secondary:hover {
  background: #cbd5e1;
}

.btn-draft {
  background: #ecfdf5;
  color: #059669;
  border: 1px solid #10b981;
}
.btn-draft:hover {
  background: #d1fae5;
}

/* Alert Boxes */
.alert-box {
  padding: 16px;
  border-radius: var(--radius-md);
  margin-bottom: 20px;
  font-size: 14px;
  line-height: 1.5;
}

.alert-warning {
  background: #fffbeb;
  border: 1px solid #fde68a;
  color: #92400e;
}

.alert-danger {
  background: #fef2f2;
  border: 1px solid #fecaca;
  color: #991b1b;
}

.alert-success {
  background: #f0fdf4;
  border: 1px solid #bbf7d0;
  color: #166534;
}

/* Lockout view */
.locked-container {
  min-height: 80vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
}

.locked-card {
  background: #ffffff;
  border-radius: var(--radius-lg);
  padding: 36px 24px;
  text-align: center;
  max-width: 460px;
  border: 1px solid var(--border);
  box-shadow: var(--shadow-lg);
}

.locked-icon {
  font-size: 48px;
  margin-bottom: 16px;
  color: #ef4444;
}
