* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

:root {
  --primary: #e63946;
  --secondary: #c1121f;
  --success: #e76f51;
  --danger: #e63946;
  --warning: #f4a261;
  --dark: #2b2d42;
  --light: #fff5f5;
  --gray-soft: #f0c0c0;
  --text-muted: #b87373;
  --navbar-color: #000000;
}

body {
  font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
  line-height: 1.6;
  color: var(--dark);
  background-color: var(--light);
}

header {
  background: linear-gradient(135deg, var(--primary), var(--secondary));
  color: white;
  padding: 1rem;
  text-align: center;
}

nav {
  margin-top: 1rem;
}

nav a {
  color: var(--navbar-color);
  text-decoration: none;
  margin: 0 1rem;
  padding: 0.5rem 1rem;
  border-radius: 5px;
  transition: all 0.3s ease;
  position: relative;
  overflow: hidden;
  display: inline-block;
}

/* Efek animasi merah saat diklik */
nav a:active {
  animation: clickRedEffect 0.3s ease-out;
}

@keyframes clickRedEffect {
  0% {
    background-color: transparent;
    color: var(--navbar-color);
  }
  50% {
    background-color: var(--primary);
    color: white;
    transform: scale(0.95);
  }
  100% {
    background-color: transparent;
    color: var(--navbar-color);
  }
}

/* Hover effect untuk semua link navbar */
nav a:hover {
  background: rgba(230, 57, 70, 0.1);
  transform: translateY(-2px);
}

/* Khusus untuk admin link - tetap dengan warna putih */
.admin-nav a {
  color: white !important;
}

.admin-nav a:hover {
  background: rgba(255, 255, 255, 0.2) !important;
}

.admin-nav a:active {
  animation: clickRedEffectAdmin 0.3s ease-out !important;
}

@keyframes clickRedEffectAdmin {
  0% {
    background-color: rgba(255, 255, 255, 0.2);
    color: white;
  }
  50% {
    background-color: var(--primary);
    color: white;
    transform: scale(0.95);
  }
  100% {
    background-color: rgba(255, 255, 255, 0.2);
    color: white;
  }
}

.container {
  display: grid;
  grid-template-columns: 2fr 1fr;
  gap: 1rem;
  padding: 1rem;
  max-width: 1200px;
  margin: 0 auto;
}

.map-container {
  grid-column: 1;
  grid-row: 1;
}

#map {
  height: 500px;
  width: 100%;
  border-radius: 8px;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
}

.controls {
  grid-column: 2;
  grid-row: 1;
  background: white;
  padding: 1rem;
  border-radius: 8px;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.05);
  border-top: 3px solid var(--primary);
}

.results {
  grid-column: 1 / -1;
  grid-row: 2;
}

.form-group {
  margin-bottom: 1rem;
}

.form-group label {
  display: block;
  margin-bottom: 0.5rem;
  font-weight: bold;
  color: var(--dark);
}

.form-group input {
  width: 100%;
  padding: 0.5rem;
  border: 1px solid var(--gray-soft);
  border-radius: 4px;
  transition: all 0.3s;
}

.form-group input:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(230, 57, 70, 0.1);
}

button {
  background: linear-gradient(135deg, var(--primary), var(--secondary));
  color: white;
  padding: 0.5rem 1rem;
  border: none;
  border-radius: 4px;
  cursor: pointer;
  margin-right: 0.5rem;
  transition: all 0.3s;
}

button:hover {
  background: linear-gradient(135deg, var(--secondary), #9b2226);
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(230, 57, 70, 0.3);
}

button:active {
  transform: translateY(0);
}

button:focus {
  outline: none;
  box-shadow: 0 0 0 3px rgba(230, 57, 70, 0.2);
}

.facilities-list {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
  gap: 1rem;
  margin-top: 1rem;
}

.facility-card {
  background: white;
  border: 1px solid var(--gray-soft);
  border-radius: 8px;
  padding: 1rem;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.05);
  transition: transform 0.2s, box-shadow 0.2s;
}

.facility-card:hover {
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
}

.facility-card h4 {
  color: var(--primary);
  margin-bottom: 0.5rem;
}

.login-container {
  max-width: 400px;
  margin: 2rem auto;
  padding: 2rem;
  background: white;
  border-radius: 8px;
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
  border-top: 4px solid var(--primary);
}

.admin-nav {
  background: linear-gradient(135deg, var(--primary), var(--secondary));
  padding: 1rem;
}

.admin-nav a {
  color: white;
  text-decoration: none;
  margin-right: 1rem;
  padding: 0.5rem 1rem;
  border-radius: 5px;
  transition: background 0.3s;
}

.admin-nav a:hover {
  background: rgba(255, 255, 255, 0.2);
}

.table {
  width: 100%;
  border-collapse: collapse;
  margin-top: 1rem;
}

.table th,
.table td {
  padding: 0.75rem;
  border: 1px solid var(--gray-soft);
  text-align: left;
}

.table th {
  background: var(--light);
  color: var(--dark);
  font-weight: 600;
}

.table tr:hover {
  background: var(--light);
}

.alert {
  padding: 1rem;
  border-radius: 4px;
  margin-bottom: 1rem;
}

.alert-success {
  background: rgba(231, 111, 81, 0.12);
  color: #8b3a1c;
  border: 1px solid rgba(231, 111, 81, 0.3);
  border-left: 4px solid var(--success);
}

.alert-error {
  background: rgba(230, 57, 70, 0.12);
  color: #c1121f;
  border: 1px solid rgba(230, 57, 70, 0.3);
  border-left: 4px solid var(--danger);
}

/* Popup Styling */
.popup-content {
  max-width: 250px;
}

.popup-content h3 {
  color: var(--primary);
  margin-bottom: 0.5rem;
  font-size: 1.1em;
}

.popup-content p {
  margin: 0.3rem 0;
  font-size: 0.9em;
}

.popup-photo {
  margin: 0.5rem 0;
  text-align: center;
}

.popup-photo img {
  max-width: 100%;
  height: auto;
  border-radius: 5px;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
}

/* Leaflet Popup Customization */
.leaflet-popup-content-wrapper {
  border-radius: 8px;
  box-shadow: 0 3px 10px rgba(0, 0, 0, 0.2);
  border-top: 3px solid var(--primary);
}

.leaflet-popup-content {
  margin: 15px;
  line-height: 1.4;
}

/* Form styling untuk file upload */
input[type="file"] {
  padding: 0.5rem;
  border: 1px solid var(--gray-soft);
  border-radius: 4px;
  background: white;
}

input[type="file"]:hover {
  border-color: var(--primary);
}

/* Buat folder uploads */
.upload-info {
  background: var(--light);
  padding: 0.5rem;
  border-radius: 4px;
  margin: 0.5rem 0;
  font-size: 0.9em;
  color: var(--primary);
  border-left: 3px solid var(--primary);
}

/* Filter Controls */
.form-buttons {
  display: flex;
  gap: 0.5rem;
  margin-top: 1rem;
}

.form-buttons button {
  flex: 1;
}

select {
  width: 100%;
  padding: 0.5rem;
  border: 1px solid var(--gray-soft);
  border-radius: 4px;
  background: white;
  transition: all 0.3s;
}

select:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(230, 57, 70, 0.1);
}

/* Category Badges */
.kategori-badge {
  padding: 0.3rem 0.8rem;
  border-radius: 20px;
  font-size: 0.8em;
  font-weight: bold;
  color: white;
}

.rumah-sakit {
  background: linear-gradient(135deg, #e63946, #c1121f);
}

.puskesmas {
  background: linear-gradient(135deg, #e76f51, #c1121f);
}

.klinik {
  background: linear-gradient(135deg, #f4a261, #e76f51);
}

.apotek {
  background: linear-gradient(135deg, #e63946, #f4a261);
}

/* Facility Card Styling */
.facility-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  margin-bottom: 0.5rem;
}

.facility-header h4 {
  margin: 0;
  flex: 1;
  margin-right: 1rem;
  color: var(--primary);
}

.facility-photo {
  margin-top: 0.5rem;
  text-align: center;
}

.facility-photo img {
  max-width: 100%;
  max-height: 150px;
  border-radius: 5px;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.distance {
  color: var(--primary);
  font-weight: bold;
}

/* No Results Styling */
.no-results {
  text-align: center;
  padding: 2rem;
  background: white;
  border-radius: 8px;
  color: var(--text-muted);
  border: 1px dashed var(--gray-soft);
}

/* Category Filter Stats */
.category-stats {
  display: flex;
  gap: 0.5rem;
  margin-bottom: 1rem;
  flex-wrap: wrap;
}

.category-filter {
  padding: 0.5rem 1rem;
  background: #e9ecef;
  border: none;
  border-radius: 20px;
  cursor: pointer;
  transition: all 0.3s;
}

.category-filter:hover {
  background: var(--gray-soft);
}

.category-filter.active {
  background: linear-gradient(135deg, var(--primary), var(--secondary));
  color: white;
}

/* Route Button Styling */
.route-btn {
  background: linear-gradient(135deg, #2ecc71, #27ae60);
  color: white;
  border: none;
  padding: 0.5rem 1rem;
  border-radius: 4px;
  cursor: pointer;
  margin-top: 0.5rem;
  width: 100%;
  font-size: 0.9em;
  transition: all 0.3s;
}

.route-btn:hover:not(:disabled) {
  background: linear-gradient(135deg, #27ae60, #1e8449);
  transform: translateY(-1px);
}

.route-btn:disabled {
  background: #bdc3c7;
  cursor: not-allowed;
  opacity: 0.6;
}

/* Responsive */
@media (max-width: 768px) {
  .container {
    grid-template-columns: 1fr;
  }
  
  .map-container {
    grid-column: 1;
  }
  
  .controls {
    grid-column: 1;
  }
  
  nav a {
    display: inline-block;
    margin: 0.5rem;
  }
}