/* ================================================================
   JKFM PWA — SHARED STYLES
   Matches jkfm.co branding: dark green, gold, Montserrat/Open Sans
================================================================ */

:root {
  --green-dark:   #1B4332;
  --green-mid:    #2D6A4F;
  --green-light:  #52B788;
  --gold:         #C9A84C;
  --gold-light:   #E8C97A;
  --white:        #FFFFFF;
  --off-white:    #F4F6F4;
  --light-grey:   #E8EDE8;
  --text:         #2C2C2C;
  --text-light:   #6B7B6B;
  --border:       #D4E0D4;
  --red:          #D32F2F;
  --red-light:    #FFEBEE;
  --blue:         #1E6091;
}

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { scroll-behavior: smooth; -webkit-text-size-adjust: 100%; }
body {
  font-family: 'Open Sans', sans-serif;
  color: var(--text);
  background: var(--off-white);
  min-height: 100vh;
  min-height: 100dvh;
}

/* ── TYPOGRAPHY ── */
h1, h2, h3 { font-family: 'Montserrat', sans-serif; line-height: 1.2; }
h1 { font-size: 1.5rem; font-weight: 800; }
h2 { font-size: 1.2rem; font-weight: 700; }
h3 { font-size: 1rem; font-weight: 700; }
p { line-height: 1.6; color: var(--text-light); }

/* ── APP SHELL ── */
.app-header {
  background: var(--green-dark);
  color: var(--white);
  padding: 1rem 1.25rem;
  display: flex;
  align-items: center;
  gap: 0.75rem;
  position: sticky;
  top: 0;
  z-index: 100;
}
.app-header .back-btn {
  color: var(--gold);
  font-size: 1.3rem;
  text-decoration: none;
  line-height: 1;
}
.app-header h1 { font-size: 1.15rem; font-weight: 700; }
.app-header .subtitle {
  font-size: 0.75rem;
  color: var(--gold-light);
  font-weight: 400;
}

/* ── CARDS / CONTAINERS ── */
.container { max-width: 480px; margin: 0 auto; padding: 1rem; }
.card {
  background: var(--white);
  border-radius: 12px;
  padding: 1.25rem;
  margin-bottom: 1rem;
  box-shadow: 0 1px 3px rgba(0,0,0,0.08);
}
.card-title {
  font-family: 'Montserrat', sans-serif;
  font-size: 0.85rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--green-mid);
  margin-bottom: 0.75rem;
}

/* ── FORMS ── */
.form-group { margin-bottom: 1rem; }
.form-group label {
  display: block;
  font-size: 0.85rem;
  font-weight: 600;
  margin-bottom: 0.35rem;
  color: var(--text);
}
.form-group input,
.form-group select,
.form-group textarea {
  width: 100%;
  padding: 0.7rem 0.85rem;
  border: 1.5px solid var(--border);
  border-radius: 8px;
  font-size: 0.95rem;
  font-family: 'Open Sans', sans-serif;
  transition: border-color 0.2s;
  background: var(--white);
}
.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus {
  outline: none;
  border-color: var(--green-mid);
  box-shadow: 0 0 0 3px rgba(45, 106, 79, 0.12);
}
.form-group textarea { resize: vertical; min-height: 80px; }
.form-group .hint {
  font-size: 0.75rem;
  color: var(--text-light);
  margin-top: 0.25rem;
}
.form-group.error input,
.form-group.error select {
  border-color: var(--red);
}
.form-group .error-msg {
  font-size: 0.75rem;
  color: var(--red);
  margin-top: 0.25rem;
  display: none;
}
.form-group.error .error-msg { display: block; }

/* ── FILE UPLOAD / PHOTO ── */
.photo-upload {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.5rem;
}
.photo-upload .preview {
  width: 100%;
  max-width: 280px;
  aspect-ratio: 4/3;
  background: var(--light-grey);
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  border: 2px dashed var(--border);
}
.photo-upload .preview img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: none;
}
.photo-upload .preview .placeholder {
  color: var(--text-light);
  font-size: 0.85rem;
  text-align: center;
  padding: 1rem;
}
.photo-upload .preview.has-photo .placeholder { display: none; }
.photo-upload .preview.has-photo img { display: block; }
.photo-upload input[type="file"] { display: none; }

/* ── BUTTONS ── */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  padding: 0.75rem 1.5rem;
  border: none;
  border-radius: 8px;
  font-size: 0.95rem;
  font-weight: 600;
  font-family: 'Montserrat', sans-serif;
  cursor: pointer;
  transition: all 0.2s;
  text-decoration: none;
}
.btn-primary {
  background: var(--green-dark);
  color: var(--white);
  width: 100%;
}
.btn-primary:hover { background: var(--green-mid); }
.btn-primary:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}
.btn-secondary {
  background: var(--white);
  color: var(--green-dark);
  border: 1.5px solid var(--green-dark);
  width: 100%;
}
.btn-secondary:hover { background: var(--off-white); }
.btn-gold {
  background: var(--gold);
  color: var(--white);
}
.btn-gold:hover { background: var(--gold-light); color: var(--text); }
.btn-sm { padding: 0.5rem 1rem; font-size: 0.85rem; }
.btn-icon {
  width: 40px;
  height: 40px;
  padding: 0;
  border-radius: 50%;
  font-size: 1.2rem;
}

/* ── PHOTO CAPTURE BUTTON ── */
.capture-btn {
  background: var(--green-mid);
  color: var(--white);
  padding: 0.6rem 1.2rem;
  border-radius: 8px;
  border: none;
  font-size: 0.85rem;
  font-weight: 600;
  cursor: pointer;
}

/* ── CHECKBOX / INDUCTION ── */
.checkbox-group {
  display: flex;
  align-items: flex-start;
  gap: 0.75rem;
  padding: 0.75rem;
  background: var(--off-white);
  border-radius: 8px;
  margin-bottom: 0.5rem;
}
.checkbox-group input[type="checkbox"] {
  width: 20px;
  height: 20px;
  margin-top: 2px;
  flex-shrink: 0;
  accent-color: var(--green-dark);
}
.checkbox-group label {
  font-size: 0.9rem;
  line-height: 1.4;
  cursor: pointer;
}

/* ── STATUS BADGES ── */
.badge {
  display: inline-block;
  padding: 0.2rem 0.6rem;
  border-radius: 20px;
  font-size: 0.7rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.03em;
}
.badge-success { background: #E8F5E9; color: #2E7D32; }
.badge-warning { background: #FFF8E1; color: #F57F17; }
.badge-danger  { background: var(--red-light); color: var(--red); }
.badge-info    { background: #E3F2FD; color: var(--blue); }

/* ── GPS STATUS BAR ── */
.gps-bar {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.6rem 1rem;
  border-radius: 8px;
  font-size: 0.85rem;
  font-weight: 600;
  margin-bottom: 1rem;
}
.gps-bar.checking  { background: #FFF8E1; color: #F57F17; }
.gps-bar.in-range  { background: #E8F5E9; color: #2E7D32; }
.gps-bar.out-range { background: var(--red-light); color: var(--red); }
.gps-bar .dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: currentColor;
  animation: pulse 1.5s infinite;
}
@keyframes pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.4; }
}

/* ── TASK CHECKLIST ── */
.task-item {
  display: flex;
  align-items: flex-start;
  gap: 0.75rem;
  padding: 0.85rem;
  background: var(--white);
  border-radius: 8px;
  margin-bottom: 0.5rem;
  border: 1.5px solid var(--border);
  transition: border-color 0.2s;
}
.task-item.completed {
  border-color: var(--green-light);
  background: #F0FFF4;
}
.task-item .task-check {
  width: 24px;
  height: 24px;
  flex-shrink: 0;
  margin-top: 2px;
  accent-color: var(--green-dark);
}
.task-item .task-info { flex: 1; }
.task-item .task-name { font-weight: 600; font-size: 0.9rem; }
.task-item .task-area { font-size: 0.75rem; color: var(--text-light); }
.task-item .task-photo-btn {
  font-size: 0.75rem;
  color: var(--green-mid);
  cursor: pointer;
  margin-top: 0.3rem;
  font-weight: 600;
}
.task-item .task-photo-btn.uploaded { color: var(--green-light); }

/* ── DASHBOARD STATS ── */
.stats-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.75rem;
  margin-bottom: 1rem;
}
.stat-card {
  background: var(--white);
  border-radius: 12px;
  padding: 1rem;
  text-align: center;
  box-shadow: 0 1px 3px rgba(0,0,0,0.08);
}
.stat-card .stat-value {
  font-family: 'Montserrat', sans-serif;
  font-size: 1.8rem;
  font-weight: 800;
  color: var(--green-dark);
}
.stat-card .stat-label {
  font-size: 0.7rem;
  color: var(--text-light);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin-top: 0.2rem;
}

/* ── LOG TABLE ── */
.log-list { list-style: none; }
.log-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0.85rem;
  border-bottom: 1px solid var(--light-grey);
}
.log-item:last-child { border-bottom: none; }
.log-item .log-name { font-weight: 600; font-size: 0.9rem; }
.log-item .log-company { font-size: 0.8rem; color: var(--text-light); }
.log-item .log-time { font-size: 0.75rem; color: var(--text-light); text-align: right; }

/* ── SEARCH ── */
.search-bar {
  display: flex;
  gap: 0.5rem;
  margin-bottom: 1rem;
}
.search-bar input {
  flex: 1;
  padding: 0.6rem 0.85rem;
  border: 1.5px solid var(--border);
  border-radius: 8px;
  font-size: 0.9rem;
}
.search-bar input:focus {
  outline: none;
  border-color: var(--green-mid);
}

/* ── HOME PAGE MODULE CARDS ── */
.module-card {
  display: flex;
  align-items: center;
  gap: 1rem;
  padding: 1.25rem;
  background: var(--white);
  border-radius: 12px;
  margin-bottom: 0.75rem;
  box-shadow: 0 1px 3px rgba(0,0,0,0.08);
  text-decoration: none;
  color: var(--text);
  transition: transform 0.15s, box-shadow 0.15s;
}
.module-card:active { transform: scale(0.98); }
.module-card .module-icon {
  width: 52px;
  height: 52px;
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.5rem;
  flex-shrink: 0;
}
.module-icon.contractor { background: #E3F2FD; }
.module-icon.cleaner { background: #E8F5E9; }
.module-card .module-text h2 { font-size: 1rem; margin-bottom: 0.2rem; }
.module-card .module-text p { font-size: 0.8rem; margin: 0; }

/* ── TOAST NOTIFICATIONS ── */
.toast {
  position: fixed;
  bottom: 1.5rem;
  left: 50%;
  transform: translateX(-50%) translateY(100px);
  background: var(--green-dark);
  color: var(--white);
  padding: 0.75rem 1.25rem;
  border-radius: 8px;
  font-size: 0.9rem;
  font-weight: 600;
  box-shadow: 0 4px 12px rgba(0,0,0,0.2);
  z-index: 1000;
  transition: transform 0.3s ease;
  pointer-events: none;
}
.toast.show { transform: translateX(-50%) translateY(0); }

/* ── MODAL ── */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.5);
  display: none;
  align-items: center;
  justify-content: center;
  z-index: 200;
  padding: 1rem;
}
.modal-overlay.active { display: flex; }
.modal {
  background: var(--white);
  border-radius: 16px;
  padding: 1.5rem;
  width: 100%;
  max-width: 400px;
  max-height: 85vh;
  overflow-y: auto;
}
.modal h2 { margin-bottom: 1rem; }
.modal .btn { margin-top: 0.75rem; }

/* ── SUCCESS SCREEN ── */
.success-screen {
  display: none;
  text-align: center;
  padding: 3rem 1.5rem;
}
.success-screen.active { display: block; }
.success-screen .checkmark {
  width: 80px;
  height: 80px;
  border-radius: 50%;
  background: #E8F5E9;
  color: #2E7D32;
  font-size: 2.5rem;
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0 auto 1.5rem;
}
.success-screen h2 { margin-bottom: 0.5rem; }

/* ── UTILITIES ── */
.mt-1 { margin-top: 0.5rem; }
.mt-2 { margin-top: 1rem; }
.mb-1 { margin-bottom: 0.5rem; }
.mb-2 { margin-bottom: 1rem; }
.text-center { text-align: center; }
.hidden { display: none !important; }
.flex-between { display: flex; justify-content: space-between; align-items: center; }
