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

body {
  font-family: Arial, sans-serif;
  background-color: #f4f6f8;
  color: #333;
  line-height: 1.6;
}

.container {
  max-width: 1000px;
  margin: 20px; /* PWA specific styles */
}

.pwa-mode {
  padding-top: env(safe-area-inset-top);
  padding-bottom: env(safe-area-inset-bottom);
}

/* Install button styling */
#btnInstall {
  position: fixed;
  top: 10px;
  right: 10px;
  z-index: 1000;
  background: linear-gradient(45deg, #4caf50, #45a049);
  color: white;
  border: none;
  border-radius: 8px;
  padding: 12px 16px;
  font-size: 14px;
  font-weight: bold;
  cursor: pointer;
  box-shadow: 0 4px 8px rgba(0, 0, 0, 0.2);
  transition: all 0.3s ease;
}

#btnInstall:hover {
  background: linear-gradient(45deg, #45a049, #4caf50);
  transform: translateY(-2px);
  box-shadow: 0 6px 12px rgba(0, 0, 0, 0.3);
}

#btnInstall:active {
  transform: translateY(0);
}

/* Responsive PWA layout */
@media (max-width: 768px) {
  .pwa-mode .container {
    margin: 10px;
    padding: 16px;
  }

  #btnInstall {
    position: relative;
    top: auto;
    right: auto;
    margin: 10px auto;
    display: block;
    width: fit-content;
  }
}

/* Loading states for PWA */
.loading {
  opacity: 0.7;
  pointer-events: none;
}

.loading::after {
  content: "";
  position: absolute;
  top: 50%;
  left: 50%;
  width: 20px;
  height: 20px;
  margin: -10px 0 0 -10px;
  border: 2px solid #f3f3f3;
  border-top: 2px solid #1976d2;
  border-radius: 50%;
  animation: spin 1s linear infinite;
}

@keyframes spin {
  0% {
    transform: rotate(0deg);
  }
  100% {
    transform: rotate(360deg);
  }
}

.container {
  max-width: 1000px;
  margin: 20px auto;
  padding: 20px;
  background: white;
  border-radius: 8px;
  box-shadow: 0 0 10px rgba(0, 0, 0, 0.1);
}

h1 {
  text-align: center;
  color: #1976d2;
}

form label {
  display: block;
  margin-bottom: 5px;
  font-weight: bold;
}

form input[type="text"],
form input[type="date"],
form select {
  width: 100%;
  padding: 10px;
  margin-bottom: 15px;
  border: 1px solid #ccc;
  border-radius: 4px;
}

.spk-row {
  display: flex;
  gap: 15px;
}

.spk-col {
  flex: 1;
}

button {
  cursor: pointer;
}

#koordinat-container button {
  margin: 5px;
  padding: 8px 12px;
  background: #1976d2;
  color: white;
  border: none;
  border-radius: 4px;
}

#listKoordinat {
  margin: 10px 0;
  padding-left: 20px;
}

#listKoordinat li {
  margin: 5px 0;
  color: #333;
}

#modalPeta,
#modalAkurasi {
  display: none;
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  background: rgba(0, 0, 0, 0.5);
  z-index: 999;
  align-items: center;
  justify-content: center;
}

#map {
  width: 100%;
  height: 300px;
  border: 1px solid #ccc;
  border-radius: 4px;
}

#notification {
  text-align: center;
  padding: 10px;
  border-radius: 4px;
}

#notification.success {
  background-color: #d4edda;
  color: #155724;
}

#notification.error {
  background-color: #f8d7da;
  color: #721c24;
}

/* Tabel View Data */
table {
  width: 100%;
  border-collapse: collapse;
  margin-top: 20px;
}

th,
td {
  border: 1px solid #ddd;
  padding: 8px;
  text-align: left;
}

th {
  background-color: #f2f2f2;
}

tr:nth-child(even) {
  background-color: #f9f9f9;
}

a {
  color: #1976d2;
  text-decoration: underline;
  cursor: pointer;
}

#map-container {
  width: 60%;
  float: right;
  height: 600px;
  overflow: hidden;
}

#filter-kecamatan {
  margin-bottom: 10px;
}

@media (max-width: 768px) {
  #map-container {
    width: 100%;
    float: none;
  }
}

/* Notification styles */
#notification {
  margin-top: 20px;
  padding: 10px;
  border-radius: 4px;
  display: none;
}

#notification.success {
  background-color: #d4edda;
  color: #155724;
  border: 1px solid #c3e6cb;
}

#notification.error {
  background-color: #f8d7da;
  color: #721c24;
  border: 1px solid #f5c6cb;
}

#notification.info {
  background-color: #d1ecf1;
  color: #0c5460;
  border: 1px solid #bee5eb;
}

/* Modal styling */
.modal {
  display: none;
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  background: rgba(0, 0, 0, 0.5);
  z-index: 999;
  align-items: center;
  justify-content: center;
}

.modal-content {
  background: #fff;
  padding: 16px;
  border-radius: 8px;
  max-width: 90vw;
  max-height: 90vh;
  overflow: auto;
  position: relative;
}

/* Custom marker styling */
.custom-marker {
  display: flex;
  align-items: center;
  justify-content: center;
}

/* Loading animation untuk GPS */
.gps-loading {
  animation: pulse 2s infinite;
}

@keyframes pulse {
  0% {
    opacity: 1;
  }
  50% {
    opacity: 0.5;
  }
  100% {
    opacity: 1;
  }
}

/* Styling untuk accuracy status */
.accuracy-good {
  color: #4caf50 !important;
  font-weight: bold;
}

.accuracy-poor {
  color: #ff9800 !important;
  font-weight: bold;
}

/* Photo input container styling */
.photo-input-container {
  margin-bottom: 15px;
}

.camera-btn {
  background: linear-gradient(45deg, #2196f3, #1976d2);
  color: white;
  border: none;
  border-radius: 8px;
  padding: 10px 15px;
  font-size: 14px;
  cursor: pointer;
  margin-top: 8px;
  margin-left: 5px;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
  transition: all 0.3s ease;
}

.camera-btn:hover {
  background: linear-gradient(45deg, #1976d2, #2196f3);
  transform: translateY(-1px);
  box-shadow: 0 4px 8px rgba(0, 0, 0, 0.3);
}

.camera-btn:active {
  transform: translateY(0);
}

.selected-photos {
  margin-top: 10px;
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(100px, 1fr));
  gap: 10px;
}

.photo-preview {
  position: relative;
  border-radius: 8px;
  overflow: hidden;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.photo-preview img {
  width: 100%;
  height: 80px;
  object-fit: cover;
  display: block;
}

.photo-preview .remove-btn {
  position: absolute;
  top: 4px;
  right: 4px;
  background: rgba(244, 67, 54, 0.9);
  color: white;
  border: none;
  border-radius: 50%;
  width: 24px;
  height: 24px;
  font-size: 12px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 10;
  line-height: 1;
  font-weight: bold;
}

.photo-preview .remove-btn:hover {
  background: rgba(244, 67, 54, 1);
}

/* Sequence status styling */
.sequence-status {
  background: #f5f5f5;
  border: 1px solid #ddd;
  border-radius: 8px;
  padding: 8px 12px;
  margin-bottom: 10px;
  font-size: 13px;
  text-align: center;
  transition: all 0.3s ease;
}

.sequence-status.not-started {
  background: #f5f5f5;
  color: #666;
  border-color: #ddd;
}

.sequence-status.in-progress {
  background: #e3f2fd;
  color: #1976d2;
  border-color: #2196f3;
}

.sequence-status.completed {
  background: #e8f5e8;
  color: #2e7d32;
  border-color: #4caf50;
}

/* Coordinate delete button styling */
.coord-delete-btn {
  background: #f44336 !important;
  color: white !important;
  border: none !important;
  border-radius: 50% !important;
  width: 20px !important;
  height: 20px !important;
  font-size: 12px !important;
  cursor: pointer !important;
  margin-left: 10px !important;
  display: flex !important;
  align-items: center !important;
  justify-content: center !important;
  transition: background-color 0.3s ease !important;
}

.coord-delete-btn:hover {
  background: #d32f2f !important;
  transform: scale(1.1);
}

.coord-delete-btn:active {
  transform: scale(0.95);
}

/* Sequence delete button styling */
.sequence-delete-btn {
  background: #f44336 !important;
  color: white !important;
  border: none !important;
  border-radius: 4px !important;
  padding: 2px 8px !important;
  font-size: 10px !important;
  cursor: pointer !important;
  transition: background-color 0.3s ease !important;
}

.sequence-delete-btn:hover {
  background: #d32f2f !important;
  transform: scale(1.05);
}

.sequence-delete-btn:active {
  transform: scale(0.95);
}

/* Saving animation for save button */
#btnSimpan.saving {
  position: relative;
  pointer-events: none;
}

#btnSimpan.saving::after {
  content: "";
  position: absolute;
  width: 16px;
  height: 16px;
  top: 50%;
  left: 50%;
  margin-top: -8px;
  margin-left: -8px;
  border: 2px solid #ffffff;
  border-radius: 50%;
  border-top-color: transparent;
  animation: savingSpin 1s linear infinite;
}

#btnSimpan.saving span {
  visibility: hidden;
}

@keyframes savingSpin {
  to {
    transform: rotate(360deg);
  }
}
