/*
 * SMMS Forms — Mobile-First Stylesheet
 * File: smms-forms/smms-forms.css
 */

/* ── Reset & Base ─────────────────────────────── */
.smms-form-wrap *,
.smms-form-wrap *::before,
.smms-form-wrap *::after {
  box-sizing: border-box;
}

.smms-form-wrap {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  max-width: 680px;
  margin: 0 auto;
  padding: 0 16px 60px;
  color: #1a1a1a;
}

/* ── Sections ─────────────────────────────────── */
.smms-section {
  background: #fff;
  border: 1px solid #e2e8f0;
  border-radius: 12px;
  padding: 20px 16px;
  margin-bottom: 20px;
}

.smms-section-title {
  font-size: 16px;
  font-weight: 600;
  color: #1e3a5f;
  margin: 0 0 16px;
  padding-bottom: 10px;
  border-bottom: 2px solid #e2e8f0;
}

/* ── Grid ─────────────────────────────────────── */
.smms-row {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  margin-bottom: 12px;
}

.smms-row:last-child { margin-bottom: 0; }

.smms-col { flex: 1 1 100%; }

@media (min-width: 480px) {
  .smms-col-half  { flex: 1 1 calc(50% - 6px);  max-width: calc(50% - 6px); }
  .smms-col-third { flex: 1 1 calc(33% - 8px);  max-width: calc(33% - 8px); }
  .smms-col-full  { flex: 1 1 100%; max-width: 100%; }
}

/* ── Labels & Inputs ──────────────────────────── */
.smms-label {
  display: block;
  font-size: 13px;
  font-weight: 500;
  color: #374151;
  margin-bottom: 5px;
}

.smms-label .req {
  color: #dc2626;
  margin-left: 2px;
}

.smms-input {
  display: block;
  width: 100%;
  padding: 11px 13px;
  font-size: 16px; /* prevents iOS zoom */
  border: 1.5px solid #cbd5e1;
  border-radius: 8px;
  background: #f8fafc;
  color: #1a1a1a;
  transition: border-color 0.15s;
  -webkit-appearance: none;
  appearance: none;
}

.smms-input:focus {
  outline: none;
  border-color: #2563eb;
  background: #fff;
}

.smms-textarea {
  resize: vertical;
  min-height: 100px;
}

select.smms-input {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath d='M1 1l5 5 5-5' stroke='%23374151' stroke-width='1.5' fill='none' stroke-linecap='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 13px center;
  padding-right: 36px;
}

/* ── Checkbox ─────────────────────────────────── */
.smms-checkbox-label {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 14px;
  cursor: pointer;
  padding: 10px 0;
}

.smms-checkbox-label input[type="checkbox"] {
  width: 20px;
  height: 20px;
  border-radius: 4px;
  border: 1.5px solid #cbd5e1;
  cursor: pointer;
}

/* ── GPS Status ───────────────────────────────── */
.smms-gps-status {
  padding: 12px 16px;
  border-radius: 8px;
  font-size: 14px;
  font-weight: 500;
  margin-bottom: 10px;
}

.smms-gps-pending {
  background: #fef3c7;
  color: #92400e;
  border: 1px solid #fcd34d;
}

.smms-gps-success {
  background: #d1fae5;
  color: #065f46;
  border: 1px solid #6ee7b7;
}

.smms-gps-error {
  background: #fee2e2;
  color: #991b1b;
  border: 1px solid #fca5a5;
}

/* ── Photo Upload ─────────────────────────────── */
.smms-photo-area { margin-top: 4px; }

.smms-file-input {
  position: absolute;
  width: 1px;
  height: 1px;
  opacity: 0;
  overflow: hidden;
}

.smms-photo-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 14px;
  background: #f0f9ff;
  border: 2px dashed #7dd3fc;
  border-radius: 8px;
  font-size: 15px;
  font-weight: 500;
  color: #0369a1;
  cursor: pointer;
  text-align: center;
  transition: background 0.15s;
}

.smms-photo-btn:hover,
.smms-photo-btn:active {
  background: #e0f2fe;
}

.smms-photo-preview {
  margin-top: 10px;
}

.smms-photo-preview img {
  width: 100%;
  border-radius: 8px;
  border: 1px solid #e2e8f0;
  display: block;
}

/* ── Buttons ──────────────────────────────────── */
.smms-btn {
  display: block;
  width: 100%;
  padding: 15px;
  border: none;
  border-radius: 10px;
  font-size: 16px;
  font-weight: 600;
  cursor: pointer;
  text-align: center;
  transition: opacity 0.15s, transform 0.1s;
}

.smms-btn:active { transform: scale(0.98); }

.smms-btn-primary {
  background: #1e3a5f;
  color: #fff;
}

.smms-btn-primary:hover { opacity: 0.9; }

.smms-btn-secondary {
  background: #f0f9ff;
  color: #0369a1;
  border: 1.5px solid #7dd3fc;
  margin-bottom: 8px;
}

.smms-btn-secondary:hover { background: #e0f2fe; }

/* ── Submit Area ──────────────────────────────── */
.smms-submit-area {
  position: sticky;
  bottom: 0;
  background: #fff;
  padding: 16px 0 8px;
  border-top: 1px solid #e2e8f0;
  margin-top: 8px;
}

/* ── Errors ───────────────────────────────────── */
.smms-errors {
  background: #fee2e2;
  border: 1px solid #fca5a5;
  border-radius: 8px;
  padding: 14px 16px;
  margin-bottom: 16px;
}

.smms-errors ul {
  margin: 0;
  padding-left: 18px;
}

.smms-errors li {
  font-size: 14px;
  color: #991b1b;
  margin-bottom: 4px;
}

/* ── Hint text ────────────────────────────────── */
.smms-hint {
  font-size: 12px;
  color: #6b7280;
  margin: 6px 0 0;
  text-align: center;
}

/* ── Empty state ──────────────────────────────── */
.smms-empty {
  text-align: center;
  color: #6b7280;
  padding: 32px 0;
}

/* ── Job List ─────────────────────────────────── */
.smms-job-list h2 {
  font-size: 18px;
  font-weight: 600;
  margin-bottom: 16px;
}

.smms-jobs {
  list-style: none;
  padding: 0;
  margin: 0;
}

.smms-job-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 14px 16px;
  background: #fff;
  border: 1px solid #e2e8f0;
  border-radius: 10px;
  margin-bottom: 10px;
  gap: 10px;
}

.smms-job-customer { font-weight: 500; flex: 1; }
.smms-job-date     { font-size: 13px; color: #6b7280; }
.smms-job-status   {
  font-size: 12px;
  font-weight: 500;
  padding: 4px 10px;
  border-radius: 20px;
  white-space: nowrap;
}

.smms-status-completed .smms-job-status { background: #d1fae5; color: #065f46; }
.smms-status-in_progress .smms-job-status { background: #fef3c7; color: #92400e; }
.smms-status-pending .smms-job-status { background: #f1f5f9; color: #475569; }

/* ── Inspection checklist ─────────────────────── */
.smms-checklist-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 0;
  border-bottom: 1px solid #f1f5f9;
  gap: 12px;
}

.smms-checklist-item:last-child { border-bottom: none; }

.smms-checklist-label {
  font-size: 14px;
  flex: 1;
}

.smms-checklist-options {
  display: flex;
  gap: 6px;
  flex-shrink: 0;
}

.smms-check-btn {
  padding: 6px 10px;
  border-radius: 6px;
  border: 1.5px solid #cbd5e1;
  background: #fff;
  font-size: 12px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.15s;
}

.smms-check-btn.active-pass    { background: #d1fae5; border-color: #6ee7b7; color: #065f46; }
.smms-check-btn.active-fail    { background: #fee2e2; border-color: #fca5a5; color: #991b1b; }
.smms-check-btn.active-na      { background: #f1f5f9; border-color: #cbd5e1; color: #475569; }

/* ── Loading overlay ──────────────────────────── */
.smms-loading {
  display: none;
  position: fixed;
  top: 0; left: 0; right: 0; bottom: 0;
  background: rgba(0,0,0,0.5);
  z-index: 9999;
  align-items: center;
  justify-content: center;
}

.smms-loading.active { display: flex; }

.smms-loading-inner {
  background: #fff;
  border-radius: 12px;
  padding: 32px;
  text-align: center;
}

.smms-spinner {
  width: 40px;
  height: 40px;
  border: 4px solid #e2e8f0;
  border-top-color: #1e3a5f;
  border-radius: 50%;
  animation: smms-spin 0.8s linear infinite;
  margin: 0 auto 12px;
}

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