/* ============= SIMONTAP Mobile PWA ============= */
:root {
    --navy: #003566;
    --blue: #005B99;
    --blue-light: #0077CC;
    --orange: #FF6B00;
    --orange-light: #FF8A33;
    --green: #0FAA5C;
    --green-pale: #E6F9F0;
    --red: #E53E3E;
    --red-pale: #FFF1F0;
    --yellow: #F5A623;
    --bg: #F4F7FA;
    --card: #FFFFFF;
    --border: rgba(0,53,102,0.08);
    --text: #1A2B3F;
    --text-s: #4A6785;
    --text-m: #7A8FA6;
    --font: 'Inter', -apple-system, sans-serif;
    --radius: 16px;
    --radius-sm: 12px;
    --safe-bottom: env(safe-area-inset-bottom, 0px);
}

* { margin: 0; padding: 0; box-sizing: border-box; }
body { font-family: var(--font); background: var(--bg); color: var(--text); -webkit-font-smoothing: antialiased; overflow-x: hidden; }

/* ============= LOGIN ============= */
.screen { min-height: 100vh; display: flex; align-items: center; justify-content: center; }
.screen.hidden, .hidden { display: none !important; }

.login-container {
    width: 100%; max-width: 400px; padding: 32px 24px;
}

.login-brand { text-align: center; margin-bottom: 40px; }
.login-brand svg { width: 64px; height: 64px; }
.login-brand h1 { font-size: 28px; font-weight: 900; color: var(--navy); margin-top: 12px; letter-spacing: -0.5px; }
.login-brand p { font-size: 14px; color: var(--text-m); margin-top: 4px; }

.form-group { margin-bottom: 16px; }
.form-group label { display: block; font-size: 13px; font-weight: 600; color: var(--text-s); margin-bottom: 6px; }
.form-group input, .form-group textarea, .form-select {
    width: 100%; padding: 14px 16px; border: 1.5px solid var(--border); border-radius: var(--radius-sm);
    font-family: var(--font); font-size: 15px; color: var(--text); background: var(--card); outline: none;
    transition: border-color 0.3s;
}
.form-group input:focus, .form-group textarea:focus, .form-select:focus { border-color: var(--orange); }
.form-group textarea { resize: none; }

.login-error { padding: 10px 14px; background: var(--red-pale); color: var(--red); border-radius: var(--radius-sm); font-size: 13px; font-weight: 600; margin-bottom: 12px; }

.btn-login {
    width: 100%; padding: 16px; background: linear-gradient(135deg, var(--orange), var(--orange-light));
    color: white; border: none; border-radius: var(--radius-sm); font-family: var(--font); font-size: 16px;
    font-weight: 700; cursor: pointer; transition: all 0.3s; margin-top: 8px;
}
.btn-login:hover { transform: translateY(-2px); box-shadow: 0 8px 24px rgba(255,107,0,0.3); }

.login-hint { text-align: center; margin-top: 24px; font-size: 12px; color: var(--text-m); }
.login-hint strong { color: var(--navy); }

/* ============= APP SHELL ============= */
.app-shell { min-height: 100vh; background: var(--bg); padding-bottom: calc(72px + var(--safe-bottom)); }

.app-header {
    display: flex; align-items: center; justify-content: space-between;
    padding: 12px 16px; background: var(--navy); color: white; position: sticky; top: 0; z-index: 50;
}
.app-header-left { display: flex; align-items: center; gap: 8px; }
.app-logo { font-size: 24px; }
.app-title { font-size: 18px; font-weight: 800; letter-spacing: -0.3px; }
.app-header-right { display: flex; align-items: center; gap: 10px; }
.user-greeting { font-size: 13px; font-weight: 500; opacity: 0.8; }

.gps-badge {
    font-size: 11px; background: rgba(255,255,255,0.15); padding: 4px 8px; border-radius: 100px;
    font-weight: 600; animation: gpsPulse 2s infinite;
}
@keyframes gpsPulse { 0%,100% { opacity: 1; } 50% { opacity: 0.6; } }

.app-content { padding: 16px; }

/* ============= GPS INFO BAR ============= */
.gps-info-bar {
    display: flex; align-items: center; gap: 12px;
    padding: 12px 16px; background: linear-gradient(135deg, #E8F4FD, #F0F7FF);
    border-radius: var(--radius-sm); border: 1px solid rgba(0,91,153,0.1);
    margin-bottom: 16px;
}
.gps-info-icon { font-size: 24px; }
.gps-info-label { font-size: 11px; color: var(--text-m); font-weight: 500; }
.gps-info-coords { font-size: 13px; font-weight: 700; color: var(--navy); font-family: monospace; }
.gps-info-accuracy { font-size: 11px; font-weight: 700; color: var(--green); background: var(--green-pale); padding: 4px 10px; border-radius: 100px; white-space: nowrap; }

/* ============= SUMMARY CARD ============= */
.summary-card {
    background: var(--card); border-radius: var(--radius); padding: 20px; margin-bottom: 16px;
    box-shadow: 0 2px 12px rgba(0,53,102,0.06); border: 1px solid var(--border);
}
.summary-card h3 { font-size: 15px; font-weight: 700; color: var(--navy); margin-bottom: 16px; }

.summary-ring-wrap { display: flex; align-items: center; gap: 24px; }
.summary-ring { width: 100px; height: 100px; position: relative; flex-shrink: 0; }
.summary-ring svg { width: 100%; height: 100%; }
.ring-text { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; font-size: 22px; font-weight: 900; color: var(--orange); }

.summary-stats { display: flex; flex-direction: column; gap: 10px; flex: 1; }
.summary-stat { display: flex; align-items: center; justify-content: space-between; }
.ss-value { font-size: 22px; font-weight: 900; color: var(--navy); }
.ss-value.green { color: var(--green); }
.ss-value.orange { color: var(--orange); }
.ss-label { font-size: 12px; color: var(--text-m); font-weight: 500; }

/* ============= QUICK ACTIONS ============= */
.quick-actions { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; margin-bottom: 20px; }
.quick-btn {
    display: flex; flex-direction: column; align-items: center; gap: 6px;
    padding: 16px 8px; background: var(--card); border: 1px solid var(--border);
    border-radius: var(--radius-sm); cursor: pointer; transition: all 0.2s; font-family: var(--font);
}
.quick-btn:hover, .quick-btn:active { transform: scale(0.97); background: #F8FAFC; }
.quick-btn-icon { font-size: 28px; }
.quick-btn span { font-size: 12px; font-weight: 600; color: var(--text-s); }

/* ============= SECTION TITLE ============= */
.section-title { display: flex; align-items: center; justify-content: space-between; margin-bottom: 12px; }
.section-title h3 { font-size: 16px; font-weight: 700; color: var(--navy); }
.task-count { font-size: 12px; color: var(--text-m); font-weight: 600; background: #F0F3F8; padding: 4px 12px; border-radius: 100px; }

/* ============= TASK LIST ============= */
.task-list { display: flex; flex-direction: column; gap: 10px; }
.task-card {
    background: var(--card); border-radius: var(--radius-sm); padding: 14px 16px;
    border: 1px solid var(--border); display: flex; align-items: center; gap: 12px;
    cursor: pointer; transition: all 0.2s;
}
.task-card:active { transform: scale(0.98); background: #F8FAFC; }
.task-card-status {
    width: 8px; height: 8px; border-radius: 50%; flex-shrink: 0;
}
.task-card-status.green { background: var(--green); }
.task-card-status.orange { background: var(--orange); }
.task-card-status.red { background: var(--red); }

.task-card-body { flex: 1; min-width: 0; }
.task-card-name { font-size: 14px; font-weight: 700; color: var(--text); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.task-card-location { font-size: 12px; color: var(--text-m); margin-top: 2px; }
.task-card-badge {
    font-size: 10px; font-weight: 700; padding: 3px 8px; border-radius: 100px; white-space: nowrap;
}
.task-card-badge.selesai { background: var(--green-pale); color: var(--green); }
.task-card-badge.proses { background: #FFF3E8; color: var(--orange); }
.task-card-badge.belum { background: var(--red-pale); color: var(--red); }
.task-card-progress { font-size: 13px; font-weight: 800; color: var(--navy); min-width: 36px; text-align: right; }

/* ============= UPDATE FORM ============= */
.update-header { display: flex; align-items: center; gap: 12px; margin-bottom: 16px; }
.update-header h3 { font-size: 17px; font-weight: 700; color: var(--navy); }
.btn-back { background: none; border: none; font-family: var(--font); font-size: 14px; font-weight: 600; color: var(--blue); cursor: pointer; padding: 4px 0; }

.update-huntap-info {
    background: linear-gradient(135deg, var(--navy), #005B99); border-radius: var(--radius-sm);
    padding: 16px; margin-bottom: 16px; color: white;
}

.update-form { display: flex; flex-direction: column; gap: 4px; }

.progress-slider {
    -webkit-appearance: none; appearance: none; width: 100%; height: 8px; border-radius: 100px;
    background: linear-gradient(to right, var(--orange) 0%, var(--orange) 50%, #EDF2F7 50%);
    outline: none;
}
.progress-slider::-webkit-slider-thumb {
    -webkit-appearance: none; width: 24px; height: 24px; border-radius: 50%;
    background: var(--orange); border: 3px solid white; box-shadow: 0 2px 8px rgba(0,0,0,0.15);
    cursor: pointer;
}
.range-value { display: block; text-align: center; font-size: 20px; font-weight: 900; color: var(--orange); margin-top: 4px; }

/* ============= CAMERA SECTION ============= */
.camera-section { display: flex; gap: 10px; margin-bottom: 8px; }
.btn-camera {
    flex: 1; display: flex; align-items: center; justify-content: center; gap: 10px;
    padding: 16px; background: linear-gradient(135deg, var(--navy), var(--blue));
    color: white; border: none; border-radius: var(--radius-sm); font-family: var(--font);
    font-size: 15px; font-weight: 700; cursor: pointer; transition: all 0.3s;
}
.btn-camera:active { transform: scale(0.97); }

.photos-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(100px, 1fr)); gap: 8px; margin-top: 8px; }
.photo-thumb {
    position: relative; border-radius: 10px; overflow: hidden; aspect-ratio: 1;
    border: 2px solid var(--border);
}
.photo-thumb img { width: 100%; height: 100%; object-fit: cover; }
.photo-thumb-badge {
    position: absolute; bottom: 0; left: 0; right: 0;
    background: rgba(0,0,0,0.65); color: white; font-size: 9px; font-weight: 600;
    padding: 3px 6px; text-align: center; font-family: monospace;
}
.photo-thumb-remove {
    position: absolute; top: 4px; right: 4px; width: 22px; height: 22px;
    background: rgba(229,62,62,0.9); color: white; border: none; border-radius: 50%;
    font-size: 12px; cursor: pointer; display: flex; align-items: center; justify-content: center;
}

/* ============= GPS CAPTURE INFO ============= */
.gps-capture-info {
    background: #F8FAFC; border-radius: var(--radius-sm); padding: 12px 16px;
    border: 1px solid var(--border); margin-bottom: 16px;
}
.gps-capture-row {
    display: flex; justify-content: space-between; align-items: center;
    padding: 4px 0; font-size: 13px;
}
.gps-capture-row span { color: var(--text-m); }
.gps-capture-row strong { color: var(--navy); font-family: monospace; font-size: 12px; }

/* ============= SUBMIT BUTTON ============= */
.btn-submit {
    width: 100%; padding: 16px; background: linear-gradient(135deg, var(--green), #0CC95E);
    color: white; border: none; border-radius: var(--radius-sm); font-family: var(--font);
    font-size: 16px; font-weight: 700; cursor: pointer; display: flex; align-items: center;
    justify-content: center; gap: 10px; transition: all 0.3s; margin-top: 8px;
}
.btn-submit:active { transform: scale(0.97); }

/* ============= SUCCESS MODAL ============= */
.success-modal {
    position: fixed; inset: 0; z-index: 200; background: rgba(0,0,0,0.5);
    display: flex; align-items: center; justify-content: center; padding: 24px;
    backdrop-filter: blur(4px);
}
.success-content {
    background: white; border-radius: var(--radius); padding: 32px; text-align: center;
    width: 100%; max-width: 340px; animation: modalPop 0.3s ease;
}
@keyframes modalPop { from { transform: scale(0.8); opacity: 0; } to { transform: scale(1); opacity: 1; } }
.success-icon { font-size: 56px; margin-bottom: 12px; }
.success-content h3 { font-size: 20px; font-weight: 800; color: var(--navy); margin-bottom: 6px; }
.success-content p { font-size: 14px; color: var(--text-m); margin-bottom: 12px; }
.success-detail { font-size: 12px; color: var(--text-s); background: #F8FAFC; border-radius: 8px; padding: 10px; margin-bottom: 16px; text-align: left; }
.btn-ok {
    padding: 12px 40px; background: var(--green); color: white; border: none;
    border-radius: var(--radius-sm); font-family: var(--font); font-size: 15px; font-weight: 700; cursor: pointer;
}

/* ============= CAMERA FULLSCREEN ============= */
.camera-fullscreen {
    position: fixed; inset: 0; z-index: 100; background: #000; display: flex;
    flex-direction: column;
}
.camera-header {
    display: flex; align-items: center; gap: 12px; padding: 12px 16px;
    background: rgba(0,0,0,0.8); color: white; font-size: 16px; font-weight: 700;
}
.btn-back-cam {
    background: none; border: none; color: white; font-size: 22px; cursor: pointer;
    width: 36px; height: 36px; display: flex; align-items: center; justify-content: center;
}
.camera-preview-container {
    flex: 1; display: flex; align-items: center; justify-content: center;
    position: relative; overflow: hidden;
}
.camera-preview-container img { max-width: 100%; max-height: 100%; object-fit: contain; }
.watermark-overlay {
    position: absolute; bottom: 16px; left: 16px; right: 16px;
    background: rgba(0,0,0,0.65); backdrop-filter: blur(4px);
    padding: 12px 16px; border-radius: 10px; color: white;
}
.watermark-line { font-size: 11px; font-family: monospace; font-weight: 600; padding: 2px 0; }
.camera-actions {
    display: flex; gap: 12px; padding: 16px; background: rgba(0,0,0,0.8);
    padding-bottom: calc(16px + var(--safe-bottom));
}
.btn-retake, .btn-save-photo {
    flex: 1; padding: 14px; border: none; border-radius: var(--radius-sm);
    font-family: var(--font); font-size: 15px; font-weight: 700; cursor: pointer;
}
.btn-retake { background: #333; color: white; }
.btn-save-photo { background: var(--green); color: white; }

/* ============= MAP HEADER ============= */
.map-header {
    display: flex; align-items: center; gap: 12px; padding: 14px 16px;
    background: var(--card); border-bottom: 1px solid var(--border);
}
.map-header h3 { font-size: 16px; font-weight: 700; color: var(--navy); }

/* ============= HISTORY LIST ============= */
.history-list { display: flex; flex-direction: column; gap: 10px; }
.history-card {
    background: var(--card); border-radius: var(--radius-sm); padding: 14px 16px;
    border: 1px solid var(--border); border-left: 4px solid var(--green);
}
.history-card-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 6px; }
.history-card-name { font-size: 14px; font-weight: 700; color: var(--text); }
.history-card-date { font-size: 11px; color: var(--text-m); }
.history-card-desc { font-size: 13px; color: var(--text-s); line-height: 1.5; }
.history-card-gps { font-size: 11px; color: var(--text-m); font-family: monospace; margin-top: 4px; }
.history-card-photos { display: flex; gap: 6px; margin-top: 8px; }
.history-card-photos img { width: 60px; height: 60px; object-fit: cover; border-radius: 8px; border: 1px solid var(--border); }

/* ============= PROFILE ============= */
.profile-card {
    background: var(--card); border-radius: var(--radius); padding: 24px;
    text-align: center; border: 1px solid var(--border); margin-bottom: 20px;
}
.profile-avatar {
    width: 72px; height: 72px; border-radius: 50%; background: linear-gradient(135deg, var(--orange), var(--orange-light));
    display: flex; align-items: center; justify-content: center; font-size: 28px; font-weight: 900;
    color: white; margin: 0 auto 12px;
}
.profile-name { font-size: 18px; font-weight: 800; color: var(--navy); }
.profile-role { font-size: 13px; color: var(--text-m); margin-top: 2px; }
.profile-stats { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; margin-top: 20px; }
.profile-stat { text-align: center; }
.profile-stat-val { font-size: 22px; font-weight: 900; color: var(--navy); }
.profile-stat-label { font-size: 11px; color: var(--text-m); font-weight: 500; }

.btn-logout {
    width: 100%; padding: 14px; background: var(--red-pale); color: var(--red);
    border: 1px solid rgba(229,62,62,0.2); border-radius: var(--radius-sm);
    font-family: var(--font); font-size: 15px; font-weight: 700; cursor: pointer;
}

/* ============= BOTTOM NAV ============= */
.bottom-nav {
    position: fixed; bottom: 0; left: 0; right: 0;
    display: flex; align-items: center; justify-content: space-around;
    background: var(--card); border-top: 1px solid var(--border);
    padding: 6px 8px; padding-bottom: calc(6px + var(--safe-bottom));
    z-index: 50;
}
.bottom-nav-item {
    display: flex; flex-direction: column; align-items: center; gap: 2px;
    background: none; border: none; cursor: pointer; font-family: var(--font);
    color: var(--text-m); padding: 4px 8px; transition: color 0.2s; position: relative;
}
.bottom-nav-item span { font-size: 10px; font-weight: 600; }
.bottom-nav-item.active { color: var(--orange); }

.camera-nav { margin-top: -16px; }
.camera-fab {
    width: 52px; height: 52px; border-radius: 50%;
    background: linear-gradient(135deg, var(--orange), var(--orange-light));
    display: flex; align-items: center; justify-content: center; color: white;
    box-shadow: 0 4px 16px rgba(255,107,0,0.35);
}

/* ============= LEAFLET OVERRIDES ============= */
.leaflet-container { font-family: var(--font) !important; }
.leaflet-popup-content-wrapper { border-radius: var(--radius-sm) !important; }
.leaflet-popup-content { margin: 12px 14px !important; font-size: 13px !important; }

/* ============= PWA INSTALL BANNER ============= */
#pwaInstallBanner {
    position: fixed;
    bottom: calc(72px + var(--safe-bottom));
    left: 0; right: 0;
    z-index: 999;
    padding: 12px 16px;
    transform: translateY(120%);
    transition: transform 0.4s cubic-bezier(0.34, 1.56, 0.64, 1);
}
#pwaInstallBanner.show {
    transform: translateY(0);
}

.pwa-install-banner {
    background: var(--card);
    border-radius: var(--radius);
    padding: 16px;
    box-shadow: 0 8px 32px rgba(0, 53, 102, 0.18), 0 2px 8px rgba(0, 0, 0, 0.08);
    border: 1px solid var(--border);
    display: flex;
    flex-direction: column;
    gap: 14px;
}

.pwa-install-content {
    display: flex;
    align-items: center;
    gap: 14px;
}

.pwa-install-icon {
    flex-shrink: 0;
    width: 48px;
    height: 48px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, rgba(255, 107, 0, 0.1), rgba(255, 138, 51, 0.1));
    border-radius: 14px;
    padding: 6px;
}

.pwa-install-text {
    flex: 1;
    min-width: 0;
}

.pwa-install-title {
    font-size: 15px;
    font-weight: 800;
    color: var(--navy);
    letter-spacing: -0.3px;
}

.pwa-install-desc {
    font-size: 12px;
    color: var(--text-m);
    margin-top: 2px;
    line-height: 1.4;
}

.pwa-install-actions {
    display: flex;
    gap: 10px;
}

.pwa-install-btn {
    flex: 1;
    padding: 12px 20px;
    background: linear-gradient(135deg, var(--orange), var(--orange-light));
    color: white;
    border: none;
    border-radius: var(--radius-sm);
    font-family: var(--font);
    font-size: 14px;
    font-weight: 700;
    cursor: pointer;
    transition: all 0.3s;
    box-shadow: 0 4px 12px rgba(255, 107, 0, 0.25);
}
.pwa-install-btn:active {
    transform: scale(0.97);
}

.pwa-install-dismiss {
    padding: 12px 16px;
    background: #F0F3F8;
    color: var(--text-s);
    border: none;
    border-radius: var(--radius-sm);
    font-family: var(--font);
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
}
.pwa-install-dismiss:active {
    background: #E2E8F0;
}

