/* ScopeSnap — Mobile-First PWA Styles */
/* Design rule: a 10-year-old can use it */

:root {
  --bg: #0f172a;
  --card: #1e293b;
  --border: #334155;
  --blue: #2563eb;
  --blue-light: #3b82f6;
  --green: #22c55e;
  --red: #ef4444;
  --orange: #f59e0b;
  --text: #f1f5f9;
  --text-dim: #94a3b8;
  --text-muted: #475569;
  --radius: 12px;
}

* { margin: 0; padding: 0; box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { height: 100%; overflow: hidden; }
body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  background: var(--bg); color: var(--text);
  display: flex; flex-direction: column;
  touch-action: manipulation; /* Prevent double-tap zoom */
  user-select: none;
}

/* ─── Top Bar ─── */
.topbar {
  display: flex; align-items: center; justify-content: space-between;
  padding: 12px 16px; background: var(--card); border-bottom: 1px solid var(--border);
  flex-shrink: 0;
}
.topbar h1 { font-size: 18px; font-weight: 700; color: var(--blue-light); }
.topbar .user-btn {
  width: 36px; height: 36px; border-radius: 50%; background: var(--blue);
  border: none; color: white; font-weight: bold; font-size: 14px; cursor: pointer;
}

/* ─── Main Content Area ─── */
.main { flex: 1; overflow-y: auto; padding: 16px; -webkit-overflow-scrolling: touch; }

/* ─── Job List Screen ─── */
.job-list { display: flex; flex-direction: column; gap: 10px; }

.job-card {
  background: var(--card); border: 1px solid var(--border); border-radius: var(--radius);
  padding: 14px 16px; cursor: pointer; transition: border-color 0.15s;
}
.job-card:active { border-color: var(--blue); }
.job-card .job-title { font-size: 16px; font-weight: 600; margin-bottom: 4px; }
.job-card .job-address { font-size: 13px; color: var(--text-dim); }
.job-card .job-meta {
  display: flex; justify-content: space-between; margin-top: 8px;
  font-size: 12px; color: var(--text-muted);
}
.job-card .photo-count { color: var(--blue-light); font-weight: 600; }

/* ─── Job Detail Screen ─── */
.job-header { margin-bottom: 16px; }
.job-header h2 { font-size: 20px; font-weight: 700; }
.job-header .address { font-size: 14px; color: var(--text-dim); margin-top: 4px; }

.photo-grid {
  display: grid; grid-template-columns: repeat(3, 1fr); gap: 4px;
}
.photo-thumb {
  aspect-ratio: 1; border-radius: 6px; object-fit: cover; width: 100%;
  background: var(--card); cursor: pointer;
}
.photo-thumb:active { opacity: 0.7; }

.empty-state {
  text-align: center; padding: 60px 20px; color: var(--text-muted);
}
.empty-state .icon { font-size: 48px; margin-bottom: 12px; }
.empty-state p { font-size: 14px; line-height: 1.5; }

/* ─── Big Action Buttons (Bottom) ─── */
.bottom-actions {
  display: flex; gap: 10px; padding: 12px 16px;
  background: var(--card); border-top: 1px solid var(--border);
  flex-shrink: 0;
}

.btn {
  flex: 1; padding: 16px; border: none; border-radius: var(--radius);
  font-size: 16px; font-weight: 700; cursor: pointer;
  display: flex; align-items: center; justify-content: center; gap: 8px;
  transition: transform 0.1s, opacity 0.1s;
  min-height: 56px; /* Big thumb target */
}
.btn:active { transform: scale(0.97); opacity: 0.9; }
.btn-primary { background: var(--blue); color: white; }
.btn-green { background: var(--green); color: white; }
.btn-orange { background: var(--orange); color: white; }
.btn-outline { background: transparent; border: 2px solid var(--border); color: var(--text-dim); }

/* ─── NEW JOB button (full width, prominent) ─── */
.btn-new-job {
  width: 100%; padding: 18px; background: var(--blue); color: white;
  border: none; border-radius: var(--radius); font-size: 18px; font-weight: 700;
  cursor: pointer; min-height: 60px;
  display: flex; align-items: center; justify-content: center; gap: 10px;
}
.btn-new-job:active { transform: scale(0.98); opacity: 0.9; }

/* ─── Camera Button (biggest on screen) ─── */
.btn-camera {
  width: 100%; padding: 24px; background: var(--green); color: white;
  border: none; border-radius: var(--radius); font-size: 20px; font-weight: 800;
  cursor: pointer; min-height: 72px;
  display: flex; align-items: center; justify-content: center; gap: 12px;
  letter-spacing: 0.5px;
}
.btn-camera:active { transform: scale(0.97); }

/* ─── Send Report Button ─── */
.btn-send {
  width: 100%; padding: 18px; background: var(--orange); color: white;
  border: none; border-radius: var(--radius); font-size: 16px; font-weight: 700;
  cursor: pointer; min-height: 56px;
  display: flex; align-items: center; justify-content: center; gap: 10px;
}

/* ─── Modal / Dialog ─── */
.modal-overlay {
  position: fixed; top: 0; left: 0; right: 0; bottom: 0;
  background: rgba(0,0,0,0.7); display: flex; align-items: flex-end;
  z-index: 100; backdrop-filter: blur(4px);
}
.modal {
  background: var(--card); width: 100%; border-radius: 20px 20px 0 0;
  padding: 24px 20px; max-height: 80vh; overflow-y: auto;
  animation: slideUp 0.2s ease-out;
}
@keyframes slideUp { from { transform: translateY(100%); } to { transform: translateY(0); } }

.modal h3 { font-size: 18px; font-weight: 700; margin-bottom: 16px; }

.input-group { margin-bottom: 14px; }
.input-group label { display: block; font-size: 12px; color: var(--text-dim); margin-bottom: 6px; }
.input-group input, .input-group textarea {
  width: 100%; padding: 14px; background: var(--bg); border: 1px solid var(--border);
  border-radius: 8px; color: var(--text); font-size: 16px; /* Prevent iOS zoom */
  outline: none;
}
.input-group input:focus, .input-group textarea:focus { border-color: var(--blue); }

/* ─── Back Button ─── */
.back-btn {
  background: none; border: none; color: var(--blue-light); font-size: 16px;
  cursor: pointer; padding: 4px 0; display: flex; align-items: center; gap: 4px;
}

/* ─── Tag Pills ─── */
.tag-pills { display: flex; gap: 8px; margin: 12px 0; }
.tag-pill {
  padding: 8px 16px; border-radius: 20px; border: 1px solid var(--border);
  background: transparent; color: var(--text-dim); font-size: 13px;
  cursor: pointer; font-weight: 600;
}
.tag-pill.active { background: var(--blue); color: white; border-color: var(--blue); }

/* ─── Toast Notification ─── */
.toast {
  position: fixed; bottom: 80px; left: 50%; transform: translateX(-50%);
  background: var(--green); color: white; padding: 12px 24px; border-radius: 8px;
  font-size: 14px; font-weight: 600; z-index: 200; animation: fadeInUp 0.3s;
  box-shadow: 0 4px 12px rgba(0,0,0,0.3);
}
@keyframes fadeInUp { from { opacity: 0; transform: translate(-50%, 20px); } }

/* ─── Loading Spinner ─── */
.spinner {
  width: 24px; height: 24px; border: 3px solid var(--border);
  border-top: 3px solid var(--blue); border-radius: 50%;
  animation: spin 0.8s linear infinite; margin: 0 auto;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ─── Hide file input ─── */
#photoInput { display: none; }

/* ─── Screen visibility ─── */
.screen { display: none; }
.screen.active { display: flex; flex-direction: column; height: 100%; }
