@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700&family=Playfair+Display:ital,wght@0,600;0,700;1,600&display=swap');

:root {
  --primary-dark: #1b2f4f;   /* Header background */
  --primary: #2d558a;        /* Main brand color */
  --primary-light: #e6f0fa;  /* Pill backgrounds, hover states */
  
  --accent-yellow: #f6b714;  /* Status bar offline, stars */
  --accent-green: #2e8b57;   /* Status bar online, GNSS lock */
  --accent-red: #d32f2f;     /* Errors, low rating text */
  
  --bg-app: #f4f6f8;
  --bg-card: #ffffff;
  
  --text-main: #1a1a1a;
  --text-muted: #666666;
  --text-label: #5a6673;     /* Serif labels */
  
  --border-light: #dbe2e8;
  
  --font-sans: 'Inter', system-ui, sans-serif;
  --font-serif: 'Playfair Display', Georgia, serif;
}

* { box-sizing: border-box; margin: 0; padding: 0; -webkit-tap-highlight-color: transparent; }
html { font-size: 16px; scroll-behavior: smooth; }

body {
  font-family: var(--font-sans);
  background: var(--bg-app);
  color: var(--text-main);
  padding-top: 80px; /* status bar + header */
  padding-bottom: 70px;
  min-height: 100dvh;
}

/* ═══════════════ Status Bar ═══════════════ */
.status-bar {
  position: fixed; top: 0; left: 0; right: 0; z-index: 100;
  height: 24px;
  display: flex; justify-content: space-between; align-items: center;
  padding: 0 12px;
  font-size: 10px; font-weight: 700; letter-spacing: 0.5px;
  text-transform: uppercase;
}
.status-bar.offline { background: var(--accent-yellow); color: #000; }
.status-bar.online  { background: var(--accent-green);  color: #fff; }

.status-left { display: flex; align-items: center; gap: 4px; }
.status-icon { font-size: 11px; }

.status-right .status-badge {
  background: rgba(0,0,0,0.1);
  padding: 2px 6px; border-radius: 4px;
}
.status-bar.online .status-badge { background: rgba(255,255,255,0.2); }

/* ═══════════════ Header ═══════════════ */
.app-header {
  position: fixed; top: 24px; left: 0; right: 0; z-index: 90;
  height: 56px;
  background: var(--primary-dark);
  color: white;
  display: flex; align-items: center; padding: 0 16px; gap: 12px;
}

.header-logo-box {
  width: 32px; height: 32px;
  background: rgba(255,255,255,0.15);
  border-radius: 4px;
  display: flex; align-items: center; justify-content: center;
}
.header-logo-icon { width: 18px; height: 18px; color: #fff; }

.header-text { flex: 1; }
.header-text h1 { font-size: 15px; font-weight: 600; margin-bottom: 2px; letter-spacing: -0.2px; }
.header-text p { font-size: 10px; color: #a4b5c7; font-weight: 500; }

.header-indicator {
  display: flex; align-items: center; gap: 6px;
  font-size: 10px; font-weight: 700; color: #fff;
}
.indicator-dot {
  width: 6px; height: 6px; border-radius: 50%;
  background: var(--accent-green);
  box-shadow: 0 0 6px var(--accent-green);
}

/* ═══════════════ Draft Info Bar ═══════════════ */
.draft-info-bar {
  display: flex; justify-content: space-between; align-items: center;
  padding: 10px 16px;
  font-size: 11px; font-weight: 500; color: var(--text-muted);
  background: var(--primary-light);
  border-bottom: 1px solid var(--border-light);
}
.draft-time { display: flex; align-items: center; gap: 4px; color: var(--primary); }

/* ═══════════════ Main Card ═══════════════ */
.main-content {
  max-width: 600px; margin: 0 auto;
}

.inspection-card {
  background: var(--bg-card);
  border-radius: 0 0 16px 16px;
  padding: 16px;
  box-shadow: 0 4px 12px rgba(0,0,0,0.05);
}

/* ═══════════════ Section Blocks ═══════════════ */
.section-block {
  margin-bottom: 24px;
}

.section-header {
  display: flex; justify-content: space-between; align-items: flex-end;
  margin-bottom: 8px;
}

.section-title {
  font-family: var(--font-serif);
  font-size: 13px; font-weight: 600;
  color: var(--text-label);
  letter-spacing: 0.3px;
  margin-bottom: 6px;
}
.section-header .section-title { margin-bottom: 0; }

.section-status {
  font-size: 10px; font-weight: 700;
  display: flex; align-items: center; gap: 4px;
}
.section-status.success { color: var(--accent-green); }
.status-dot-sm { width: 5px; height: 5px; border-radius: 50%; background: currentColor; }

/* ═══════════════ Inputs ═══════════════ */
.geo-anchor-box {
  display: flex; align-items: center;
  border: 1px solid var(--border-light);
  border-radius: 8px; overflow: hidden;
}
.geo-input {
  flex: 1; border: none; padding: 12px;
  font-size: 14px; font-family: var(--font-sans); color: var(--text-main);
  background: #fff;
}
.geo-input:focus { outline: none; }
.geo-tag {
  background: var(--bg-app);
  padding: 12px 14px;
  font-size: 12px; font-weight: 600; color: var(--primary);
  border-left: 1px solid var(--border-light);
}

.standard-input, .select-wrapper select, .standard-textarea {
  width: 100%;
  border: 1px solid var(--border-light);
  border-radius: 8px;
  padding: 12px 14px;
  font-family: var(--font-sans);
  font-size: 14px; font-weight: 500;
  color: var(--text-main);
  background: #fff;
  transition: border-color 0.2s;
  outline: none;
}
.standard-input:focus, .select-wrapper select:focus, .standard-textarea:focus {
  border-color: var(--primary);
}
.standard-textarea { resize: vertical; min-height: 80px; }

.select-wrapper { position: relative; }
.select-wrapper::after {
  content: '▼'; position: absolute; right: 14px; top: 14px;
  font-size: 10px; color: var(--text-muted); pointer-events: none;
}
.select-wrapper select { appearance: none; -webkit-appearance: none; padding-right: 32px; }

/* ═══════════════ Asset Taxonomy (Pills) ═══════════════ */
.taxonomy-grid {
  display: flex; flex-wrap: wrap; gap: 8px;
}
.taxo-btn {
  background: #fff;
  border: 1px solid var(--border-light);
  color: var(--text-label);
  padding: 8px 16px;
  border-radius: 20px;
  font-family: var(--font-sans);
  font-size: 12px; font-weight: 600;
  cursor: pointer;
  transition: all 0.2s;
}
.taxo-btn.active {
  background: var(--primary);
  border-color: var(--primary);
  color: #fff;
}

/* ═══════════════ Rating ═══════════════ */
.rating-block {
  background: var(--bg-app);
  border-radius: 8px; padding: 14px;
}
.rating-value {
  font-size: 12px; font-weight: 700;
}
.rating-row {
  display: flex; align-items: center; gap: 12px;
}
.stars { display: flex; gap: 2px; }
.star-btn {
  background: none; border: none; padding: 2px;
  font-size: 24px; color: #d1d5db;
  cursor: pointer; line-height: 1; transition: color 0.15s;
}
.star-btn.active { color: var(--accent-yellow); }

.issue-short-input {
  flex: 1; border: none; background: transparent;
  font-size: 13px; color: var(--text-muted);
  border-bottom: 1px dashed var(--border-light);
  padding: 4px 0; outline: none;
}
.issue-short-input:focus { border-bottom-color: var(--primary); }

/* ═══════════════ Photo Upload ═══════════════ */
.photo-block {
  background: var(--primary-light);
  border-radius: 12px;
  padding: 16px;
}
.photo-header {
  display: flex; justify-content: space-between; align-items: center;
  margin-bottom: 12px;
}
.photo-title {
  display: flex; align-items: center; gap: 6px;
  font-size: 13px; font-weight: 600; color: var(--primary-dark);
}
.photo-meta { font-size: 10px; color: var(--primary); font-weight: 500; }

.photo-capture-area {
  position: relative;
  background: linear-gradient(180deg, #d3e3f3 0%, #b8cde2 100%);
  border-radius: 8px; height: 160px;
  overflow: hidden;
}
.photo-file-input {
  position: absolute; inset: 0; width: 100%; height: 100%;
  opacity: 0; cursor: pointer; z-index: 10;
}
.photo-placeholder {
  position: absolute; inset: 0;
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  pointer-events: none;
}
.photo-instruction {
  margin-top: 8px; font-size: 12px; font-weight: 600; color: var(--primary);
}
.photo-preview {
  position: absolute; inset: 0; z-index: 5; background: #000;
}
.photo-preview img {
  width: 100%; height: 100%; object-fit: cover; opacity: 0.8;
}
.photo-overlay-text {
  position: absolute; bottom: 8px; left: 8px;
  color: var(--accent-green); font-size: 10px; font-weight: 700;
  text-shadow: 0 1px 2px rgba(0,0,0,0.8);
}
.photo-remove-btn {
  position: absolute; top: 8px; right: 8px; z-index: 15;
  background: rgba(0,0,0,0.5); color: #fff; border: none;
  width: 28px; height: 28px; border-radius: 50%; font-size: 16px;
  display: flex; align-items: center; justify-content: center;
}

/* ═══════════════ Buttons ═══════════════ */
.submit-action { margin-top: 32px; }
.btn-submit {
  width: 100%; height: 50px;
  background: var(--accent-yellow); color: #000;
  border: none; border-radius: 8px;
  font-family: var(--font-sans); font-size: 14px; font-weight: 700; letter-spacing: 0.5px;
  cursor: pointer; box-shadow: 0 4px 12px rgba(246, 183, 20, 0.3);
  transition: transform 0.1s;
}
.btn-submit:active { transform: scale(0.98); }
.btn-submit:disabled { opacity: 0.6; pointer-events: none; }

.btn-secondary {
  height: 44px; background: var(--bg-app); border: 1px solid var(--border-light);
  border-radius: 8px; font-size: 12px; font-weight: 700; color: var(--text-main);
  cursor: pointer;
}
.btn-danger {
  height: 44px; background: #fff0f0; border: 1px solid #ffcccc;
  border-radius: 8px; font-size: 12px; font-weight: 700; color: var(--accent-red);
  cursor: pointer;
}

/* ═══════════════ Bottom Navigation ═══════════════ */
.bottom-nav {
  position: fixed; bottom: 0; left: 0; right: 0; z-index: 90;
  height: 60px; background: var(--primary-dark);
  display: flex;
}
.nav-btn {
  flex: 1; border: none; background: transparent; color: #8da1b5;
  display: flex; align-items: center; justify-content: center;
  position: relative; transition: color 0.2s;
}
.nav-btn.active { color: var(--accent-yellow); }
.nav-badge {
  position: absolute; top: 12px; right: calc(50% - 18px);
  background: var(--accent-red); color: #fff;
  font-size: 9px; font-weight: 700;
  min-width: 16px; height: 16px; border-radius: 8px;
  display: flex; align-items: center; justify-content: center; padding: 0 4px;
}

/* ═══════════════ Toast ═══════════════ */
.toast-container {
  position: fixed; bottom: 80px; left: 16px; right: 16px; z-index: 300;
  display: flex; flex-direction: column; gap: 8px; pointer-events: none;
}
.toast {
  background: #333; color: #fff; padding: 12px 16px; border-radius: 8px;
  font-size: 13px; font-weight: 500; display: flex; align-items: center; gap: 8px;
  box-shadow: 0 4px 12px rgba(0,0,0,0.15);
}
.toast.success { border-left: 4px solid var(--accent-green); }
.toast.error { border-left: 4px solid var(--accent-red); }
.toast.warning { border-left: 4px solid var(--accent-yellow); color: #000; background: #fff; }
.toast.info { border-left: 4px solid var(--primary); }

/* ═══════════════ Modals ═══════════════ */
.modal-overlay {
  position: fixed; inset: 0; z-index: 200;
  background: rgba(0,0,0,0.6); backdrop-filter: blur(2px);
  display: flex; flex-direction: column; justify-content: flex-end;
}
.modal-overlay.hidden { display: none; }
.modal-sheet {
  background: var(--bg-app); border-radius: 16px 16px 0 0;
  max-height: 85dvh; display: flex; flex-direction: column;
}
.modal-handle {
  width: 40px; height: 4px; background: #ccc; border-radius: 2px;
  margin: 12px auto; flex-shrink: 0;
}
.modal-header {
  display: flex; justify-content: space-between; align-items: center;
  padding: 0 20px 16px; border-bottom: 1px solid var(--border-light);
}
.modal-title { font-family: var(--font-serif); font-size: 16px; font-weight: 600; color: var(--primary-dark); }
.modal-close { background: none; border: none; font-size: 24px; color: var(--text-muted); cursor: pointer; }
.modal-body { padding: 16px 20px; overflow-y: auto; }

/* Tabs & Records */
.tab-bar {
  display: flex; background: #fff; border: 1px solid var(--border-light); border-radius: 8px;
  padding: 4px; margin-bottom: 16px;
}
.tab-btn {
  flex: 1; height: 32px; border: none; background: transparent;
  font-size: 11px; font-weight: 700; color: var(--text-muted); border-radius: 6px;
}
.tab-btn.active { background: var(--primary-light); color: var(--primary); }

.records-list { display: flex; flex-direction: column; gap: 12px; }
.record-card {
  background: #fff; border: 1px solid var(--border-light); border-radius: 8px;
  padding: 12px; position: relative;
}
.record-title { font-size: 13px; font-weight: 600; margin-bottom: 4px; }
.record-meta { font-size: 11px; color: var(--text-muted); margin-bottom: 2px; }
.record-status {
  position: absolute; top: 12px; right: 12px;
  font-size: 10px; font-weight: 700; padding: 2px 6px; border-radius: 4px;
}
.record-status.PENDING_SYNC, .record-status.ERROR { background: #fff3cd; color: #856404; }
.record-status.SYNCED { background: #d4edda; color: #155724; }

.empty-state { text-align: center; padding: 40px 20px; color: var(--text-muted); }
.empty-state-icon { font-size: 32px; margin-bottom: 12px; opacity: 0.5; }

/* Settings */
.settings-section { margin-bottom: 24px; }
.settings-title { font-size: 11px; font-weight: 700; color: var(--text-label); margin-bottom: 8px; }
.settings-item { background: #fff; border: 1px solid var(--border-light); border-radius: 8px; padding: 16px; }

/* Utils */
.hidden { display: none !important; }
.spinner {
  display: inline-block; width: 16px; height: 16px;
  border: 2px solid currentColor; border-top-color: transparent;
  border-radius: 50%; animation: spin 0.8s linear infinite; vertical-align: middle;
}
@keyframes spin { to { transform: rotate(360deg); } }
