/* ODE Driver App — Mobile-first Design System */
:root {
  --primary: #2563eb;
  --primary-dark: #1d4ed8;
  --success: #16a34a;
  --warning: #f59e0b;
  --danger: #dc2626;
  --bg: #f8fafc;
  --card: #ffffff;
  --text: #1e293b;
  --text-muted: #64748b;
  --border: #e2e8f0;
  --radius: 12px;
  --shadow: 0 1px 3px rgba(0,0,0,0.1);
}

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

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  background: var(--bg);
  color: var(--text);
  max-width: 430px;
  margin: 0 auto;
  min-height: 100vh;
  position: relative;
  overflow-x: hidden;
}

.screen { display: none; min-height: 100vh; padding-bottom: 80px; }
.screen.active { display: block; }
.camera-screen { padding-bottom: 0; }

/* Install Banner */
.install-banner {
  position: fixed; bottom: 60px; left: 50%; transform: translateX(-50%);
  width: calc(100% - 32px); max-width: 400px; background: var(--primary);
  color: white; border-radius: var(--radius); padding: 12px 16px;
  box-shadow: 0 4px 20px rgba(37,99,235,0.4); z-index: 30;
  animation: slideUp 0.3s ease-out;
}
.install-content { display: flex; align-items: center; gap: 10px; }
.install-icon { font-size: 24px; }
.install-text { flex: 1; }
.install-text strong { display: block; font-size: 14px; }
.install-text span { font-size: 12px; opacity: 0.9; }
.btn-install {
  background: white; color: var(--primary); border: none; padding: 8px 16px;
  border-radius: 8px; font-size: 13px; font-weight: 600; cursor: pointer;
}
.btn-dismiss {
  background: none; border: none; color: white; font-size: 18px;
  cursor: pointer; opacity: 0.7; padding: 4px;
}
@keyframes slideUp { from { transform: translateX(-50%) translateY(20px); opacity: 0; } to { transform: translateX(-50%) translateY(0); opacity: 1; } }

/* Login */
.login-container {
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  min-height: 100vh; padding: 24px;
}
.login-logo { text-align: center; margin-bottom: 40px; }
.logo-icon { font-size: 64px; margin-bottom: 12px; }
.login-logo h1 { font-size: 28px; font-weight: 700; }
.login-subtitle { color: var(--text-muted); margin-top: 4px; }
.login-form { width: 100%; max-width: 320px; }
.form-group { margin-bottom: 16px; }
.form-group label { display: block; font-size: 14px; font-weight: 500; margin-bottom: 6px; }
.form-group input {
  width: 100%; padding: 14px 16px; border: 1px solid var(--border); border-radius: var(--radius);
  font-size: 16px; background: var(--card); transition: border-color 0.2s;
}
.form-group input:focus { outline: none; border-color: var(--primary); box-shadow: 0 0 0 3px rgba(37,99,235,0.1); }
.btn-primary {
  width: 100%; padding: 14px; background: var(--primary); color: white; border: none;
  border-radius: var(--radius); font-size: 16px; font-weight: 600; cursor: pointer;
  transition: background 0.2s;
}
.btn-primary:hover { background: var(--primary-dark); }
.btn-primary:disabled { background: #94a3b8; cursor: not-allowed; }
.login-help { text-align: center; margin-top: 16px; color: var(--text-muted); font-size: 14px; }

/* Header */
.app-header {
  display: flex; align-items: center; gap: 12px; padding: 16px 20px;
  background: var(--card); border-bottom: 1px solid var(--border);
  position: sticky; top: 0; z-index: 10;
}
.app-header h2 { flex: 1; font-size: 18px; }
.btn-back {
  background: none; border: none; font-size: 20px; cursor: pointer; padding: 4px 8px;
  color: var(--primary); font-weight: 600;
}
.status-dot { width: 8px; height: 8px; border-radius: 50%; display: inline-block; margin-right: 4px; }
.status-dot.online { background: var(--success); }
.status-dot.gps-active { background: var(--success); animation: pulse-dot 2s infinite; }
.status-text { font-size: 12px; color: var(--success); font-weight: 500; }

/* Sync Bar */
.sync-bar {
  background: #fef3c7; padding: 8px 20px; font-size: 13px; color: #92400e;
  display: flex; align-items: center; gap: 8px;
}

/* DO Cards */
.do-list { padding: 16px 20px; }
.do-card {
  background: var(--card); border-radius: var(--radius); box-shadow: var(--shadow);
  margin-bottom: 12px; overflow: hidden; cursor: pointer; transition: transform 0.15s;
  border: 2px solid transparent;
}
.do-card:active { transform: scale(0.98); }
.do-card.active-do { border-color: var(--primary); }
.do-card.completed { opacity: 0.7; }
.do-card-header {
  display: flex; justify-content: space-between; align-items: center;
  padding: 14px 16px 0;
}
.do-number { font-weight: 700; font-size: 15px; }
.do-status {
  font-size: 11px; font-weight: 600; padding: 3px 10px; border-radius: 20px;
  text-transform: uppercase; letter-spacing: 0.5px;
}
.status-active { background: #dbeafe; color: #1e40af; }
.status-pending { background: #fef3c7; color: #92400e; }
.status-done { background: #d1fae5; color: #065f46; }
.do-card-body { padding: 10px 16px; }
.do-info { display: flex; justify-content: space-between; padding: 4px 0; }
.do-label { font-size: 13px; color: var(--text-muted); }
.do-value { font-size: 13px; font-weight: 500; }
.do-card-footer { padding: 10px 16px 14px; border-top: 1px solid var(--border); }

/* Checkpoint Progress */
.checkpoint-progress { display: flex; gap: 4px; }
.cp {
  flex: 1; text-align: center; padding: 6px 2px; font-size: 11px; font-weight: 600;
  border-radius: 6px; background: #f1f5f9; color: #94a3b8;
}
.cp.done { background: #d1fae5; color: #065f46; }
.cp.current { background: #dbeafe; color: #1e40af; animation: pulse-bg 2s infinite; }
.cp.locked { background: #f1f5f9; color: #cbd5e1; }

/* Detail Screen */
.detail-section { padding: 16px 20px; }
.detail-section h3 { font-size: 16px; margin-bottom: 12px; }
.detail-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.detail-item { background: var(--card); padding: 12px; border-radius: 8px; border: 1px solid var(--border); }
.detail-label { display: block; font-size: 12px; color: var(--text-muted); margin-bottom: 2px; }
.detail-value { font-size: 14px; font-weight: 500; }

/* Uang Jalan */
.uj-status {
  background: var(--card); border-radius: var(--radius); padding: 20px; text-align: center;
  border: 1px solid var(--border);
}
.uj-amount { font-size: 28px; font-weight: 700; color: var(--primary); }
.uj-label { font-size: 13px; color: var(--text-muted); margin: 4px 0 8px; }

/* Badge */
.badge { font-size: 11px; font-weight: 600; padding: 3px 10px; border-radius: 20px; }
.badge-green { background: #d1fae5; color: #065f46; }
.badge-yellow { background: #fef3c7; color: #92400e; }
.badge-red { background: #fee2e2; color: #991b1b; }

/* Checkpoint Timeline */
.checkpoint-timeline { padding-left: 20px; }
.cp-item { display: flex; gap: 16px; padding: 12px 0; position: relative; }
.cp-item:not(:last-child)::after {
  content: ''; position: absolute; left: 11px; top: 36px; bottom: -12px;
  width: 2px; background: var(--border);
}
.cp-item.done:not(:last-child)::after { background: var(--success); }
.cp-dot {
  width: 24px; height: 24px; border-radius: 50%; display: flex; align-items: center;
  justify-content: center; font-size: 12px; font-weight: 700; flex-shrink: 0;
}
.cp-item.done .cp-dot { background: var(--success); color: white; }
.cp-item.current .cp-dot { background: var(--primary); color: white; animation: pulse-dot 2s infinite; }
.cp-item.locked .cp-dot { background: #e2e8f0; color: #94a3b8; }
.cp-name { font-size: 14px; font-weight: 500; }
.cp-time { font-size: 12px; color: var(--text-muted); }

/* Bottom Action */
.bottom-action { padding: 16px 20px; position: sticky; bottom: 0; background: var(--bg); }
.btn-large { padding: 16px; font-size: 17px; }
.action-hint { text-align: center; font-size: 12px; color: var(--text-muted); margin-top: 8px; }

/* Bottom Nav */
.bottom-nav {
  position: fixed; bottom: 0; left: 50%; transform: translateX(-50%);
  width: 100%; max-width: 430px; background: var(--card); border-top: 1px solid var(--border);
  display: flex; padding: 8px 0; z-index: 20;
}
.nav-item {
  flex: 1; display: flex; flex-direction: column; align-items: center; gap: 2px;
  background: none; border: none; cursor: pointer; padding: 6px; color: var(--text-muted);
}
.nav-item.active { color: var(--primary); }
.nav-icon { font-size: 20px; }
.nav-label { font-size: 11px; font-weight: 500; }

/* Geofence Bar */
.geofence-bar {
  padding: 10px 20px; display: flex; justify-content: space-between; align-items: center;
  font-size: 13px;
}
.geofence-status.inside { color: var(--success); font-weight: 600; }
.geofence-status.outside { color: var(--danger); font-weight: 600; }
.geofence-detail { color: var(--text-muted); font-size: 12px; }

/* Evidence */
.evidence-section { padding: 16px 20px; }
.evidence-section h3 { font-size: 16px; margin-bottom: 12px; }
.evidence-list { display: flex; flex-direction: column; gap: 10px; }
.evidence-item {
  display: flex; align-items: center; gap: 14px; padding: 14px;
  background: var(--card); border-radius: var(--radius); border: 1px solid var(--border);
}
.evidence-item.captured { border-color: var(--success); background: #f0fdf4; }
.evidence-item.pending { border-color: var(--warning); background: #fffbeb; }
.evidence-item.required { border-color: var(--danger); background: #fef2f2; cursor: pointer; }
.evidence-thumb {
  width: 48px; height: 48px; border-radius: 8px; background: #f1f5f9;
  display: flex; align-items: center; justify-content: center; font-size: 20px; flex-shrink: 0;
}
.evidence-item.required .evidence-thumb {
  background: var(--danger); color: white; font-size: 24px; font-weight: 700;
}
.evidence-name { font-size: 14px; font-weight: 500; }
.evidence-status { font-size: 12px; color: var(--text-muted); }
.required-text { color: var(--danger) !important; font-weight: 500; }

/* Location */
.location-section { padding: 0 20px 16px; }
.location-section h3 { font-size: 16px; margin-bottom: 12px; }
.location-card {
  background: var(--card); padding: 14px; border-radius: var(--radius);
  border: 1px solid var(--border); display: flex; flex-direction: column; gap: 4px;
}
.location-name { font-weight: 500; }
.location-coords { font-size: 12px; color: var(--text-muted); font-family: monospace; }
.location-accuracy { font-size: 12px; color: var(--success); }

/* Camera Screen */
.camera-viewfinder { position: relative; width: 100%; height: 70vh; background: #000; }
.camera-placeholder {
  position: absolute; inset: 0; display: flex; flex-direction: column;
  align-items: center; justify-content: center; color: white;
}
.camera-icon { font-size: 64px; opacity: 0.3; margin-bottom: 12px; }
.camera-overlay { position: absolute; inset: 0; z-index: 2; }
.camera-guide {
  position: absolute; top: 15%; left: 10%; right: 10%; bottom: 25%;
}
.guide-corner {
  position: absolute; width: 30px; height: 30px; border-color: white; border-style: solid;
}
.guide-corner.tl { top: 0; left: 0; border-width: 3px 0 0 3px; }
.guide-corner.tr { top: 0; right: 0; border-width: 3px 3px 0 0; }
.guide-corner.bl { bottom: 0; left: 0; border-width: 0 0 3px 3px; }
.guide-corner.br { bottom: 0; right: 0; border-width: 0 3px 3px 0; }
.camera-label {
  position: absolute; bottom: 40px; left: 50%; transform: translateX(-50%);
  background: rgba(0,0,0,0.6); color: white; padding: 8px 20px; border-radius: 20px;
  font-size: 14px; font-weight: 500;
}
.camera-controls {
  display: flex; justify-content: space-around; align-items: center;
  padding: 20px; background: #000;
}
.btn-shutter {
  width: 72px; height: 72px; border-radius: 50%; border: 4px solid white;
  background: rgba(255,255,255,0.2); color: white; font-size: 32px; cursor: pointer;
  transition: transform 0.1s;
}
.btn-shutter:active { transform: scale(0.9); }
.btn-secondary {
  background: none; border: 1px solid rgba(255,255,255,0.3); color: white;
  padding: 10px 20px; border-radius: var(--radius); font-size: 14px; cursor: pointer;
}
.btn-secondary:disabled { opacity: 0.3; }
.btn-danger {
  width: 100%; padding: 14px; background: var(--danger); color: white; border: none;
  border-radius: var(--radius); font-size: 16px; font-weight: 600; cursor: pointer;
}

/* Tracking Screen */
.tracking-status { padding: 20px; text-align: center; }
.tracking-indicator {
  display: inline-flex; align-items: center; gap: 10px; padding: 12px 24px;
  background: #dcfce7; border-radius: 30px; margin-bottom: 20px;
}
.tracking-indicator.active { background: #dcfce7; }
.tracking-label { font-weight: 700; color: var(--success); letter-spacing: 1px; }
.tracking-info {
  display: grid; grid-template-columns: 1fr 1fr; gap: 10px; text-align: left;
}
.tracking-item { background: var(--card); padding: 12px; border-radius: 8px; border: 1px solid var(--border); }
.tracking-label-sm { display: block; font-size: 11px; color: var(--text-muted); margin-bottom: 2px; }
.tracking-value { font-size: 15px; font-weight: 600; }
.tracking-map-placeholder {
  margin: 16px 20px; height: 200px; background: #e2e8f0; border-radius: var(--radius);
  display: flex; align-items: center; justify-content: center;
}
.map-placeholder-content { text-align: center; color: var(--text-muted); }
.map-icon { font-size: 40px; }

/* Completion Screen */
.completion-content { padding: 40px 20px; text-align: center; }
.completion-icon { font-size: 64px; margin-bottom: 16px; }
.completion-content h2 { font-size: 22px; margin-bottom: 4px; }
.completion-subtitle { color: var(--text-muted); margin-bottom: 24px; }
.completion-summary {
  background: var(--card); border-radius: var(--radius); padding: 16px;
  margin-bottom: 20px; border: 1px solid var(--border); text-align: left;
}
.summary-item {
  display: flex; justify-content: space-between; padding: 8px 0;
  border-bottom: 1px solid var(--border);
}
.summary-item:last-child { border-bottom: none; }
.summary-label { color: var(--text-muted); font-size: 14px; }
.summary-value { font-weight: 500; font-size: 14px; }
.uj-summary {
  background: var(--card); border-radius: var(--radius); padding: 16px;
  border: 1px solid var(--border); text-align: left;
}
.uj-summary h3 { margin-bottom: 12px; font-size: 16px; }
.uj-row {
  display: flex; justify-content: space-between; padding: 8px 0;
  border-bottom: 1px solid var(--border);
}
.uj-row:last-child { border-bottom: none; }

/* GPS Status */
.gps-status { display: flex; align-items: center; gap: 6px; font-size: 12px; color: var(--success); }

/* Pulse Animation */
@keyframes pulse-dot {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.4; }
}
@keyframes pulse-bg {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.7; }
}
.pulse {
  width: 12px; height: 12px; border-radius: 50%; background: var(--success);
  animation: pulse-dot 2s infinite;
}
