/* ===== GEARS Mobile App — lynk.international ===== */
:root {
  --gold: #D4A017;
  --gold-bright: #F2C94C;
  --gold-dark: #6B5220;
  --navy: #1a1a2e;
  --navy-light: #252542;
  --red: #C41E3A;
  --green: #2D5A3B;
  --green-light: #e8f5e9;
  --cream: #FFFDF5;
  --sand: #FFF8E7;
  --bronze: #6B5220;
  --warm-gray: #5C5447;
  --light-gray: #f0ede8;
  --border: #e5e0d5;
  --white: #ffffff;
  --danger: #dc2626;
  --success: #16a34a;
  --info: #2563eb;
  --safe-top: env(safe-area-inset-top, 0px);
  --safe-bottom: env(safe-area-inset-bottom, 0px);
}

* { margin: 0; padding: 0; box-sizing: border-box; -webkit-tap-highlight-color: transparent; }

html, body, #root {
  height: 100%;
  width: 100%;
  overflow: hidden;
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
  background: var(--cream);
  color: var(--warm-gray);
  -webkit-font-smoothing: antialiased;
}

h1, h2, h3, h4, h5, h6 { font-family: 'Sora', sans-serif; color: var(--bronze); }

/* === App Layout === */
.app-container {
  display: flex;
  flex-direction: column;
  height: 100%;
  max-width: 480px;
  margin: 0 auto;
  background: var(--cream);
  position: relative;
}

/* === Header === */
.app-header {
  background: var(--navy);
  color: white;
  padding: calc(var(--safe-top) + 12px) 16px 12px;
  display: flex;
  align-items: center;
  gap: 12px;
  flex-shrink: 0;
  z-index: 100;
}
.app-header .logo-icon { width: 28px; height: 28px; }
.app-header h1 { font-size: 18px; font-weight: 600; color: white; flex: 1; }
.app-header .header-badge {
  background: var(--gold);
  color: var(--navy);
  font-size: 10px;
  font-weight: 700;
  padding: 2px 8px;
  border-radius: 10px;
  font-family: 'Sora', sans-serif;
}
.header-btn {
  background: none;
  border: none;
  color: white;
  width: 36px;
  height: 36px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 8px;
  cursor: pointer;
}
.header-btn:active { background: rgba(255,255,255,0.1); }
.header-back { margin-right: 4px; }

/* === Content Area === */
.app-content {
  flex: 1;
  overflow-y: auto;
  overflow-x: hidden;
  -webkit-overflow-scrolling: touch;
  padding: 16px;
  padding-bottom: calc(72px + var(--safe-bottom));
}
.app-content.no-padding { padding: 0; padding-bottom: calc(72px + var(--safe-bottom)); }
.app-content.full-height { padding-bottom: 0; }

/* === Bottom Navigation === */
.bottom-nav {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  background: white;
  border-top: 1px solid var(--border);
  display: flex;
  padding: 4px 0 calc(4px + var(--safe-bottom));
  z-index: 100;
}
.nav-item {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  padding: 8px 4px;
  border: none;
  background: none;
  cursor: pointer;
  color: var(--warm-gray);
  font-size: 10px;
  font-family: 'Inter', sans-serif;
  font-weight: 500;
  transition: color 0.15s;
}
.nav-item.active { color: var(--gold); }
.nav-item svg { width: 22px; height: 22px; }
.nav-item:active { transform: scale(0.95); }

/* === Cards === */
.card {
  background: var(--white);
  border-radius: 12px;
  padding: 16px;
  margin-bottom: 12px;
  border: 1px solid var(--border);
  box-shadow: 0 1px 3px rgba(0,0,0,0.04);
}
.card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 12px;
}
.card-title { font-size: 14px; font-weight: 600; }

/* === Buttons === */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 12px 24px;
  border-radius: 10px;
  border: none;
  font-family: 'Inter', sans-serif;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.15s;
  min-height: 48px;
}
.btn:active { transform: scale(0.97); }
.btn-primary { background: var(--gold); color: var(--navy); }
.btn-primary:hover { background: var(--gold-bright); }
.btn-secondary { background: var(--sand); color: var(--bronze); border: 1px solid var(--border); }
.btn-danger { background: var(--red); color: white; }
.btn-success { background: var(--green); color: white; }
.btn-outline { background: transparent; color: var(--gold); border: 1.5px solid var(--gold); }
.btn-full { width: 100%; }
.btn-sm { min-height: 36px; padding: 8px 16px; font-size: 13px; }
.btn-lg { min-height: 54px; font-size: 16px; }
.btn:disabled { opacity: 0.5; cursor: not-allowed; }
.btn-icon { width: 44px; height: 44px; padding: 0; border-radius: 10px; }
.btn-ghost { background: none; border: none; color: var(--warm-gray); }

/* === Form Elements === */
.form-group { margin-bottom: 16px; }
.form-label {
  display: block;
  font-size: 13px;
  font-weight: 500;
  color: var(--bronze);
  margin-bottom: 6px;
}
.form-label .required { color: var(--red); margin-left: 2px; }
.form-input, .form-select, .form-textarea {
  width: 100%;
  padding: 12px 14px;
  border: 1.5px solid var(--border);
  border-radius: 10px;
  font-family: 'Inter', sans-serif;
  font-size: 15px;
  color: var(--warm-gray);
  background: var(--white);
  transition: border-color 0.15s;
  -webkit-appearance: none;
}
.form-input:focus, .form-select:focus, .form-textarea:focus {
  outline: none;
  border-color: var(--gold);
  box-shadow: 0 0 0 3px rgba(212,160,23,0.1);
}
.form-textarea { min-height: 100px; resize: vertical; }
.form-select { background-image: url("data:image/svg+xml,%3Csvg width='12' height='8' viewBox='0 0 12 8' fill='none' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M1 1L6 6L11 1' stroke='%235C5447' stroke-width='2' stroke-linecap='round'/%3E%3C/svg%3E"); background-repeat: no-repeat; background-position: right 14px center; padding-right: 36px; }
.form-hint { font-size: 12px; color: var(--warm-gray); margin-top: 4px; opacity: 0.7; }
.form-error { font-size: 12px; color: var(--danger); margin-top: 4px; }
.form-row { display: flex; gap: 12px; }
.form-row > * { flex: 1; }

/* === Radio & Checkbox === */
.radio-group, .check-group { display: flex; flex-direction: column; gap: 8px; }
.radio-option, .check-option {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 14px 16px;
  background: var(--white);
  border: 1.5px solid var(--border);
  border-radius: 10px;
  cursor: pointer;
  transition: all 0.15s;
  font-size: 14px;
}
.radio-option.selected, .check-option.selected {
  border-color: var(--gold);
  background: var(--sand);
}
.radio-dot {
  width: 20px;
  height: 20px;
  border-radius: 50%;
  border: 2px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  transition: all 0.15s;
}
.radio-option.selected .radio-dot {
  border-color: var(--gold);
}
.radio-dot-inner {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: var(--gold);
  opacity: 0;
  transition: opacity 0.15s;
}
.radio-option.selected .radio-dot-inner { opacity: 1; }

/* === Badge/Chip === */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 4px 10px;
  border-radius: 20px;
  font-size: 11px;
  font-weight: 600;
  font-family: 'Inter', sans-serif;
}
.badge-gold { background: rgba(212,160,23,0.15); color: var(--gold-dark); }
.badge-red { background: rgba(196,30,58,0.1); color: var(--red); }
.badge-green { background: var(--green-light); color: var(--green); }
.badge-blue { background: rgba(37,99,235,0.1); color: var(--info); }
.badge-gray { background: var(--light-gray); color: var(--warm-gray); }

/* === Wizard / Stepper === */
.wizard-steps {
  display: flex;
  align-items: center;
  padding: 12px 16px;
  background: var(--white);
  border-bottom: 1px solid var(--border);
  overflow-x: auto;
  gap: 4px;
  flex-shrink: 0;
}
.wizard-step {
  display: flex;
  align-items: center;
  gap: 4px;
  flex-shrink: 0;
}
.step-num {
  width: 24px;
  height: 24px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 11px;
  font-weight: 700;
  font-family: 'Sora', sans-serif;
  background: var(--light-gray);
  color: var(--warm-gray);
  transition: all 0.2s;
}
.step-num.active { background: var(--gold); color: var(--navy); }
.step-num.done { background: var(--green); color: white; }
.step-label {
  font-size: 11px;
  font-weight: 500;
  color: var(--warm-gray);
  display: none;
}
.wizard-step.active .step-label { display: block; color: var(--bronze); }
.step-line {
  width: 16px;
  height: 2px;
  background: var(--border);
  flex-shrink: 0;
}
.step-line.done { background: var(--green); }

.wizard-footer {
  padding: 12px 16px;
  background: var(--white);
  border-top: 1px solid var(--border);
  display: flex;
  gap: 12px;
  flex-shrink: 0;
}
.wizard-footer .btn { flex: 1; }
.wizard-content { flex: 1; overflow-y: auto; padding: 16px; -webkit-overflow-scrolling: touch; }

/* === Report List === */
.report-card {
  background: var(--white);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 14px;
  margin-bottom: 10px;
  display: flex;
  gap: 12px;
  cursor: pointer;
  transition: all 0.15s;
}
.report-card:active { background: var(--sand); }
.report-icon {
  width: 44px;
  height: 44px;
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}
.report-info { flex: 1; min-width: 0; }
.report-info h4 { font-size: 14px; font-weight: 600; margin-bottom: 4px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.report-info p { font-size: 12px; color: var(--warm-gray); }
.report-meta { display: flex; align-items: center; gap: 8px; margin-top: 6px; }

/* === Photo Grid === */
.photo-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.photo-thumb {
  aspect-ratio: 1;
  border-radius: 10px;
  overflow: hidden;
  position: relative;
  border: 1px solid var(--border);
}
.photo-thumb img { width: 100%; height: 100%; object-fit: cover; }
.photo-thumb .stamp {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  background: linear-gradient(transparent, rgba(0,0,0,0.7));
  color: white;
  font-size: 8px;
  padding: 12px 4px 4px;
  font-family: monospace;
}
.photo-add {
  aspect-ratio: 1;
  border: 2px dashed var(--border);
  border-radius: 10px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 4px;
  cursor: pointer;
  color: var(--warm-gray);
  font-size: 11px;
  background: var(--sand);
  transition: all 0.15s;
}
.photo-add:active { background: var(--light-gray); }
.photo-delete {
  position: absolute;
  top: 4px;
  right: 4px;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background: var(--red);
  color: white;
  border: none;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 14px;
  cursor: pointer;
  z-index: 5;
}

/* === Sketch Canvas === */
.sketch-container {
  position: relative;
  background: white;
  border: 1.5px solid var(--border);
  border-radius: 12px;
  overflow: hidden;
  touch-action: none;
}
.sketch-toolbar {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 8px 12px;
  background: var(--light-gray);
  border-bottom: 1px solid var(--border);
  overflow-x: auto;
}
.sketch-toolbar button {
  min-width: 36px;
  height: 36px;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: white;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  flex-shrink: 0;
  font-size: 12px;
}
.sketch-toolbar button.active { border-color: var(--gold); background: var(--sand); }
.color-dot {
  width: 20px;
  height: 20px;
  border-radius: 50%;
  border: 2px solid var(--border);
}
.color-dot.active { border-color: var(--gold); box-shadow: 0 0 0 2px var(--gold); }

/* === Map Container === */
.map-container {
  height: 280px;
  border-radius: 12px;
  overflow: hidden;
  border: 1.5px solid var(--border);
  margin-bottom: 12px;
}
.map-container .leaflet-container { height: 100%; width: 100%; }
.map-search {
  display: flex;
  gap: 8px;
  margin-bottom: 12px;
}
.map-search .form-input { flex: 1; }

/* === Status Tags === */
.status-tag {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 4px 10px;
  border-radius: 6px;
  font-size: 11px;
  font-weight: 600;
}
.status-draft { background: #fef3c7; color: #92400e; }
.status-open { background: #dbeafe; color: #1e40af; }
.status-submitted { background: var(--green-light); color: var(--green); }

/* === Floating Action Button === */
.fab {
  position: absolute;
  bottom: calc(80px + var(--safe-bottom));
  right: 16px;
  width: 56px;
  height: 56px;
  border-radius: 16px;
  background: var(--gold);
  color: var(--navy);
  border: none;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 4px 12px rgba(212,160,23,0.4);
  cursor: pointer;
  z-index: 50;
  transition: all 0.15s;
}
.fab:active { transform: scale(0.92); }
.fab svg { width: 26px; height: 26px; }

/* === Settings === */
.settings-group { margin-bottom: 20px; }
.settings-group-title {
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--warm-gray);
  padding: 0 4px 8px;
}
.settings-item {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 14px 16px;
  background: var(--white);
  border-bottom: 1px solid var(--border);
  cursor: pointer;
}
.settings-item:first-of-type { border-radius: 12px 12px 0 0; }
.settings-item:last-of-type { border-radius: 0 0 12px 12px; border-bottom: none; }
.settings-item:only-of-type { border-radius: 12px; }
.settings-icon {
  width: 36px;
  height: 36px;
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}
.settings-item-info { flex: 1; }
.settings-item-info h4 { font-size: 14px; font-weight: 500; color: var(--bronze); }
.settings-item-info p { font-size: 12px; color: var(--warm-gray); margin-top: 2px; }
.settings-arrow { color: var(--border); }

/* === Tab Bar === */
.tab-bar {
  display: flex;
  background: var(--white);
  border-bottom: 1px solid var(--border);
  padding: 0 16px;
  overflow-x: auto;
  flex-shrink: 0;
}
.tab-item {
  padding: 12px 16px;
  font-size: 13px;
  font-weight: 500;
  color: var(--warm-gray);
  border: none;
  background: none;
  cursor: pointer;
  border-bottom: 2px solid transparent;
  white-space: nowrap;
  font-family: 'Inter', sans-serif;
}
.tab-item.active { color: var(--gold); border-bottom-color: var(--gold); }

/* === Empty State === */
.empty-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 48px 24px;
  text-align: center;
}
.empty-state svg { width: 64px; height: 64px; color: var(--border); margin-bottom: 16px; }
.empty-state h3 { font-size: 16px; margin-bottom: 8px; }
.empty-state p { font-size: 13px; color: var(--warm-gray); margin-bottom: 20px; }

/* === Utilities === */
.text-gold { color: var(--gold); }
.text-red { color: var(--red); }
.text-green { color: var(--green); }
.text-muted { color: var(--warm-gray); opacity: 0.7; }
.text-sm { font-size: 12px; }
.text-xs { font-size: 11px; }
.text-center { text-align: center; }
.mt-4 { margin-top: 16px; }
.mb-4 { margin-bottom: 16px; }
.mb-2 { margin-bottom: 8px; }
.flex { display: flex; }
.gap-2 { gap: 8px; }
.gap-3 { gap: 12px; }
.items-center { align-items: center; }
.justify-between { justify-content: space-between; }
.flex-1 { flex: 1; }
.w-full { width: 100%; }
.hidden { display: none !important; }

/* === KPI Bar === */
.kpi-row { display: flex; gap: 8px; margin-bottom: 16px; overflow-x: auto; }
.kpi-card {
  flex: 1;
  min-width: 90px;
  background: var(--white);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 12px;
  text-align: center;
}
.kpi-value { font-size: 22px; font-weight: 700; font-family: 'Sora', sans-serif; color: var(--bronze); }
.kpi-label { font-size: 10px; color: var(--warm-gray); margin-top: 2px; }

/* === Toggle Switch === */
.toggle-wrap { display: flex; align-items: center; gap: 10px; }
.toggle {
  width: 48px;
  height: 28px;
  border-radius: 14px;
  background: var(--light-gray);
  border: none;
  cursor: pointer;
  position: relative;
  transition: background 0.2s;
}
.toggle.on { background: var(--gold); }
.toggle::after {
  content: '';
  position: absolute;
  top: 3px;
  left: 3px;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background: white;
  box-shadow: 0 1px 3px rgba(0,0,0,0.15);
  transition: transform 0.2s;
}
.toggle.on::after { transform: translateX(20px); }

/* === File Upload === */
.upload-zone {
  border: 2px dashed var(--border);
  border-radius: 12px;
  padding: 24px;
  text-align: center;
  cursor: pointer;
  transition: all 0.15s;
  background: var(--sand);
}
.upload-zone:active { background: var(--light-gray); border-color: var(--gold); }
.upload-file {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px;
  background: var(--white);
  border: 1px solid var(--border);
  border-radius: 10px;
  margin-top: 8px;
}
.upload-file-info { flex: 1; min-width: 0; }
.upload-file-info h5 { font-size: 13px; font-weight: 500; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.upload-file-info p { font-size: 11px; color: var(--warm-gray); }

/* === Modal / Overlay === */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.5);
  z-index: 200;
  display: flex;
  align-items: flex-end;
  justify-content: center;
}
.modal-sheet {
  background: var(--white);
  border-radius: 20px 20px 0 0;
  width: 100%;
  max-width: 480px;
  max-height: 80vh;
  overflow-y: auto;
  padding: 20px 16px calc(16px + var(--safe-bottom));
}
.modal-handle {
  width: 36px;
  height: 4px;
  border-radius: 2px;
  background: var(--border);
  margin: 0 auto 16px;
}

/* === Loading === */
.spinner {
  width: 24px;
  height: 24px;
  border: 3px solid var(--border);
  border-top-color: var(--gold);
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* === Divider === */
.divider { height: 1px; background: var(--border); margin: 16px 0; }

/* === Scrollbar (mobile-like) === */
::-webkit-scrollbar { width: 0; height: 0; }

/* === Section title === */
.section-title {
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--warm-gray);
  margin-bottom: 12px;
  padding: 0 2px;
}

/* === File choose button overrides === */
input[type="file"] { display: none; }

/* === Camera overlay === */
.camera-overlay {
  position: fixed;
  inset: 0;
  background: black;
  z-index: 300;
  display: flex;
  flex-direction: column;
}
.camera-video { flex: 1; object-fit: cover; width: 100%; }
.camera-controls {
  display: flex;
  align-items: center;
  justify-content: space-around;
  padding: 16px;
  background: rgba(0,0,0,0.8);
}
.camera-shutter {
  width: 64px;
  height: 64px;
  border-radius: 50%;
  border: 4px solid white;
  background: transparent;
  cursor: pointer;
  position: relative;
}
.camera-shutter::after {
  content: '';
  position: absolute;
  inset: 4px;
  border-radius: 50%;
  background: white;
  transition: all 0.1s;
}
.camera-shutter:active::after { background: var(--gold); }

/* === Animations === */
@keyframes slideUp {
  from { transform: translateY(100%); }
  to { transform: translateY(0); }
}
.modal-sheet { animation: slideUp 0.3s ease-out; }

@keyframes fadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}
.fade-in { animation: fadeIn 0.2s ease-out; }
