/* ============================================================
   FieldCam — Shared Styles  (mobile-first)
   ============================================================ */

:root {
  --brand:        #61B746;   /* company green */
  --brand-dark:   #52a03a;
  --brand-light:  #edf7e9;
  --surface:      #ffffff;
  --bg:           #f4f5f7;
  --text:         #111827;
  --text-muted:   #6b7280;
  --border:       #e5e7eb;
  --danger:       #ef4444;
  --success:      #22c55e;
  --radius:       12px;
  --shadow:       0 2px 12px rgba(0,0,0,.08);
  --nav-height:   64px;
  --header-height:56px;
}

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

html { font-size: 16px; -webkit-text-size-adjust: 100%; }

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  background: var(--bg);
  color: var(--text);
  min-height: 100dvh;
  padding-bottom: var(--nav-height);
}

/* ── Top Header ──────────────────────────────────────────── */
.app-header {
  position: sticky;
  top: 0;
  z-index: 100;
  background: var(--brand);
  color: #fff;
  height: var(--header-height);
  display: flex;
  align-items: center;
  padding: 0 16px;
  gap: 12px;
  box-shadow: 0 2px 8px rgba(0,0,0,.15);
}

.app-header .logo {
  font-size: 1.25rem;
  font-weight: 800;
  letter-spacing: -.5px;
  color: #fff;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

.app-header .logo-img {
  height: 36px;
  width: 36px;
  object-fit: contain;
}

.app-header .header-title {
  font-size: 1rem;
  font-weight: 600;
  flex: 1;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.app-header .back-btn {
  background: none;
  border: none;
  color: #fff;
  font-size: 1.5rem;
  cursor: pointer;
  padding: 4px 8px 4px 0;
  line-height: 1;
}

.app-header .header-actions {
  display: flex;
  gap: 8px;
  margin-left: auto;
}

.icon-btn {
  background: rgba(255,255,255,.2);
  border: none;
  border-radius: 8px;
  color: #fff;
  width: 36px;
  height: 36px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.1rem;
  cursor: pointer;
  text-decoration: none;
  transition: background .15s;
}
.icon-btn:hover { background: rgba(255,255,255,.3); }

/* ── Bottom Nav ──────────────────────────────────────────── */
.bottom-nav {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  height: var(--nav-height);
  background: var(--surface);
  border-top: 1px solid var(--border);
  display: flex;
  z-index: 100;
  box-shadow: 0 -2px 12px rgba(0,0,0,.07);
}

.nav-link {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 3px;
  color: var(--text-muted);
  text-decoration: none;
  font-size: .65rem;
  font-weight: 500;
  transition: color .15s;
}

.nav-link .nav-icon { font-size: 1.4rem; line-height: 1; }
.nav-link.active { color: var(--brand); }
.nav-link:hover  { color: var(--brand); }

/* ── Page / Content ──────────────────────────────────────── */
.page { padding: 16px; max-width: 600px; margin: 0 auto; }

/* ── Cards ───────────────────────────────────────────────── */
.card {
  background: var(--surface);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  overflow: hidden;
}

.card-body { padding: 16px; }

/* ── Property Card ───────────────────────────────────────── */
.property-card {
  background: var(--surface);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  overflow: hidden;
  text-decoration: none;
  color: var(--text);
  display: block;
  margin-bottom: 12px;
  transition: transform .15s, box-shadow .15s;
}
.property-card:active { transform: scale(.98); }

.property-thumb {
  width: 100%;
  height: 160px;
  object-fit: cover;
  background: var(--bg);
  display: block;
}

.property-thumb-placeholder {
  width: 100%;
  height: 160px;
  background: linear-gradient(135deg, #f0f0f0, #e0e0e0);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 3rem;
  color: #ccc;
}

.property-info { padding: 12px 16px 16px; }
.property-name { font-size: 1rem; font-weight: 700; margin-bottom: 2px; }
.property-address { font-size: .82rem; color: var(--text-muted); }
.property-meta { display: flex; gap: 12px; margin-top: 8px; font-size: .78rem; color: var(--text-muted); }
.property-meta span { display: flex; align-items: center; gap: 4px; }

/* ── Photo Grid ──────────────────────────────────────────── */
.photo-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 2px;
}

.photo-thumb-wrap {
  position: relative;
  aspect-ratio: 1;
  overflow: hidden;
  cursor: pointer;
  background: var(--bg);
}

.photo-thumb-wrap img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  transition: transform .2s;
}
.photo-thumb-wrap:hover img { transform: scale(1.05); }

.photo-thumb-overlay {
  position: absolute;
  inset: 0;
  background: rgba(0,0,0,.35);
  color: #fff;
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  padding: 6px;
  font-size: .65rem;
  opacity: 0;
  transition: opacity .2s;
}
.photo-thumb-wrap:hover .photo-thumb-overlay { opacity: 1; }

/* ── Lightbox ────────────────────────────────────────────── */
.lightbox {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,.92);
  z-index: 999;
  flex-direction: column;
  align-items: center;
  justify-content: center;
}
.lightbox.open { display: flex; }

.lightbox-img {
  max-width: 100vw;
  max-height: 80dvh;
  object-fit: contain;
  border-radius: 4px;
}

.lightbox-meta {
  color: #fff;
  margin-top: 12px;
  font-size: .85rem;
  text-align: center;
  padding: 0 24px;
}

.lightbox-close {
  position: absolute;
  top: 16px;
  right: 16px;
  background: rgba(255,255,255,.2);
  border: none;
  color: #fff;
  font-size: 1.5rem;
  border-radius: 50%;
  width: 40px;
  height: 40px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
}

.lightbox-delete {
  margin-top: 16px;
  background: var(--danger);
  border: none;
  color: #fff;
  padding: 8px 20px;
  border-radius: 8px;
  cursor: pointer;
  font-size: .9rem;
}

/* ── Forms ───────────────────────────────────────────────── */
.form-group { margin-bottom: 16px; }
.form-label { display: block; font-size: .85rem; font-weight: 600; margin-bottom: 6px; }

.form-input, .form-select, .form-textarea {
  width: 100%;
  padding: 12px 14px;
  border: 1.5px solid var(--border);
  border-radius: 10px;
  font-size: 1rem;
  background: var(--surface);
  color: var(--text);
  transition: border-color .15s;
  appearance: none;
}
.form-input:focus, .form-select:focus, .form-textarea:focus {
  outline: none;
  border-color: var(--brand);
  box-shadow: 0 0 0 3px rgba(97,183,70,.12);
}
.form-textarea { resize: vertical; min-height: 80px; }

/* ── Buttons ─────────────────────────────────────────────── */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 13px 24px;
  border-radius: 10px;
  font-size: 1rem;
  font-weight: 600;
  border: none;
  cursor: pointer;
  transition: background .15s, transform .1s;
  text-decoration: none;
}
.btn:active { transform: scale(.97); }

.btn-primary { background: var(--brand); color: #fff; }
.btn-primary:hover { background: var(--brand-dark); }

.btn-secondary { background: var(--bg); color: var(--text); border: 1.5px solid var(--border); }
.btn-secondary:hover { background: #eee; }

.btn-danger { background: var(--danger); color: #fff; }
.btn-full { width: 100%; }

/* ── FAB (Floating Action Button) ────────────────────────── */
.fab {
  position: fixed;
  bottom: calc(var(--nav-height) + 16px);
  right: 20px;
  width: 58px;
  height: 58px;
  border-radius: 50%;
  background: var(--brand);
  color: #fff;
  border: none;
  font-size: 1.8rem;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 4px 16px rgba(97,183,70,.5);
  cursor: pointer;
  text-decoration: none;
  z-index: 90;
  transition: transform .15s, box-shadow .15s;
}
.fab:hover { transform: scale(1.07); box-shadow: 0 6px 20px rgba(97,183,70,.6); }

/* ── Badge ───────────────────────────────────────────────── */
.badge {
  display: inline-block;
  background: var(--brand-light);
  color: var(--brand);
  border-radius: 100px;
  padding: 2px 10px;
  font-size: .75rem;
  font-weight: 600;
}
.badge-green { background: #dcfce7; color: #15803d; }
.badge-red   { background: #fee2e2; color: #b91c1c; }

/* ── Nearby Banner ───────────────────────────────────────── */
.nearby-banner {
  background: linear-gradient(135deg, var(--brand), #86d468);
  color: #fff;
  border-radius: var(--radius);
  padding: 14px 16px;
  margin-bottom: 16px;
  display: flex;
  align-items: center;
  gap: 12px;
  cursor: pointer;
}
.nearby-banner .nearby-icon { font-size: 2rem; }
.nearby-banner .nearby-text strong { font-size: 1rem; display: block; }
.nearby-banner .nearby-text span  { font-size: .8rem; opacity: .9; }

/* ── Section Header ──────────────────────────────────────── */
.section-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 12px;
}
.section-title { font-size: 1rem; font-weight: 700; }

/* ── Empty State ─────────────────────────────────────────── */
.empty-state {
  text-align: center;
  padding: 48px 24px;
  color: var(--text-muted);
}
.empty-state .empty-icon { font-size: 3.5rem; margin-bottom: 12px; }
.empty-state p { margin-bottom: 20px; }

/* ── Avatar / Team ───────────────────────────────────────── */
.team-row {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 0;
  border-bottom: 1px solid var(--border);
}
.team-row:last-child { border-bottom: none; }

.avatar {
  width: 42px;
  height: 42px;
  border-radius: 50%;
  background: var(--brand);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 1rem;
  flex-shrink: 0;
}

.team-info { flex: 1; }
.team-name  { font-weight: 600; font-size: .95rem; }
.team-email { font-size: .8rem; color: var(--text-muted); }

/* ── Camera Page ─────────────────────────────────────────── */
.camera-preview {
  width: 100%;
  aspect-ratio: 4/3;
  background: #000;
  border-radius: var(--radius);
  overflow: hidden;
  position: relative;
}
.camera-preview video,
.camera-preview img { width: 100%; height: 100%; object-fit: cover; display: block; }

.camera-controls {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 24px;
  padding: 16px 0;
}

.shutter-btn {
  width: 68px;
  height: 68px;
  border-radius: 50%;
  background: var(--brand);
  border: 4px solid #fff;
  box-shadow: 0 0 0 3px var(--brand);
  cursor: pointer;
  transition: transform .1s;
}
.shutter-btn:active { transform: scale(.93); }

/* ── Toast ───────────────────────────────────────────────── */
.toast {
  position: fixed;
  bottom: calc(var(--nav-height) + 12px);
  left: 50%;
  transform: translateX(-50%) translateY(16px);
  background: #1f2937;
  color: #fff;
  padding: 12px 20px;
  border-radius: 100px;
  font-size: .9rem;
  font-weight: 500;
  z-index: 9999;
  opacity: 0;
  transition: opacity .25s, transform .25s;
  white-space: nowrap;
  max-width: calc(100vw - 32px);
  text-align: center;
}
.toast-visible { opacity: 1; transform: translateX(-50%) translateY(0); }
.toast-error   { background: var(--danger); }

/* ── Spinner ─────────────────────────────────────────────── */
.spinner {
  display: inline-block;
  width: 16px;
  height: 16px;
  border: 2px solid rgba(255,255,255,.4);
  border-top-color: #fff;
  border-radius: 50%;
  animation: spin .6s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ── GPS Pill ────────────────────────────────────────────── */
.gps-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: #ecfdf5;
  color: #15803d;
  border-radius: 100px;
  padding: 4px 12px;
  font-size: .8rem;
  font-weight: 500;
}
.gps-pill.warn { background: #fef3c7; color: #92400e; }
.gps-pill.err  { background: #fee2e2; color: #b91c1c; }

/* ── Login Page ──────────────────────────────────────────── */
.login-wrap {
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 24px;
  background: linear-gradient(160deg, #edf7e9 0%, #ffffff 100%);
}

.login-logo-img {
  width: 180px;
  height: 180px;
  object-fit: contain;
  margin-bottom: 4px;
  display: block;
}

.login-logo {
  font-size: 2.5rem;
  font-weight: 900;
  color: var(--brand);
  margin-bottom: 4px;
  letter-spacing: -1px;
}
.login-tagline {
  color: var(--text-muted);
  margin-bottom: 32px;
  font-size: .95rem;
}

.login-card {
  width: 100%;
  max-width: 400px;
  background: var(--surface);
  border-radius: 16px;
  box-shadow: 0 8px 40px rgba(0,0,0,.1);
  padding: 28px 24px;
}

.tab-row {
  display: flex;
  border-bottom: 2px solid var(--border);
  margin-bottom: 20px;
}
.tab-btn {
  flex: 1;
  background: none;
  border: none;
  padding: 10px;
  font-size: .95rem;
  font-weight: 600;
  color: var(--text-muted);
  cursor: pointer;
  border-bottom: 2px solid transparent;
  margin-bottom: -2px;
}
.tab-btn.active { color: var(--brand); border-bottom-color: var(--brand); }

/* ── Search Box ──────────────────────────────────────────── */
.search-box {
  position: relative;
  margin-bottom: 16px;
}
.search-box input {
  padding-left: 40px;
}
.search-box .search-icon {
  position: absolute;
  left: 12px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--text-muted);
  pointer-events: none;
}

/* ── Divider ─────────────────────────────────────────────── */
.divider {
  display: flex;
  align-items: center;
  gap: 12px;
  color: var(--text-muted);
  font-size: .8rem;
  margin: 16px 0;
}
.divider::before, .divider::after {
  content: '';
  flex: 1;
  height: 1px;
  background: var(--border);
}

/* ── Scrollable Photo Row ────────────────────────────────── */
.photo-row {
  display: flex;
  gap: 8px;
  overflow-x: auto;
  padding-bottom: 8px;
  scrollbar-width: none;
}
.photo-row::-webkit-scrollbar { display: none; }
.photo-row-thumb {
  flex-shrink: 0;
  width: 80px;
  height: 80px;
  border-radius: 8px;
  object-fit: cover;
  cursor: pointer;
}

/* ── Utilities ───────────────────────────────────────────── */
.mt-8  { margin-top: 8px; }
.mt-12 { margin-top: 12px; }
.mt-16 { margin-top: 16px; }
.mt-24 { margin-top: 24px; }
.mb-4  { margin-bottom: 4px; }
.mb-8  { margin-bottom: 8px; }
.mb-16 { margin-bottom: 16px; }
.text-muted { color: var(--text-muted); }
.text-sm    { font-size: .85rem; }
.text-xs    { font-size: .75rem; }
.font-bold  { font-weight: 700; }
.flex { display: flex; }
.items-center { align-items: center; }
.gap-8 { gap: 8px; }
.gap-12 { gap: 12px; }
.justify-between { justify-content: space-between; }
.hidden { display: none !important; }
