:root {
  --primary: #059669;
  --primary-dark: #047857;
  --primary-light: #d1fae5;
  --accent-blue: #0284c7;
  --accent-amber: #d97706;
  --accent-red: #dc2626;
  --bg-dark: #0f172a;
  --bg-card: #ffffff;
  --text-main: #1e293b;
  --text-muted: #64748b;
  --border-color: #e2e8f0;
  --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
  --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
  --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05);
  --radius: 16px;
  --safe-bottom: env(safe-area-inset-bottom, 16px);
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  -webkit-tap-highlight-color: transparent;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
}

body {
  background-color: #f8fafc;
  color: var(--text-main);
  overflow: hidden;
  height: 100vh;
  width: 100vw;
  display: flex;
  flex-direction: column;
}

/* Header & Search Bar */
.top-header {
  position: absolute;
  top: 12px;
  left: 12px;
  right: 12px;
  z-index: 1000;
  display: flex;
  flex-direction: column;
  gap: 8px;
  pointer-events: none;
}

.search-box {
  pointer-events: auto;
  background: rgba(255, 255, 255, 0.95);
  backdrop-filter: blur(10px);
  border-radius: 28px;
  padding: 8px 16px;
  display: flex;
  align-items: center;
  box-shadow: var(--shadow-lg);
  border: 1px solid rgba(255, 255, 255, 0.8);
}

.search-box input {
  border: none;
  background: transparent;
  outline: none;
  font-size: 14px;
  flex: 1;
  padding: 6px 8px;
  color: var(--text-main);
}

.brand-badge {
  display: flex;
  align-items: center;
  gap: 6px;
  background: #ecfdf5;
  color: var(--primary-dark);
  font-weight: 700;
  font-size: 11px;
  padding: 4px 10px;
  border-radius: 20px;
  border: 1px solid #a7f3d0;
  letter-spacing: 0.5px;
}

/* Filter Chips Bar */
.filter-container {
  pointer-events: auto;
  display: flex;
  gap: 8px;
  overflow-x: auto;
  padding-bottom: 4px;
  scrollbar-width: none;
}
.filter-container::-webkit-scrollbar {
  display: none;
}

.filter-chip {
  white-space: nowrap;
  background: rgba(255, 255, 255, 0.92);
  backdrop-filter: blur(8px);
  padding: 6px 14px;
  border-radius: 20px;
  font-size: 12px;
  font-weight: 600;
  color: var(--text-main);
  border: 1px solid rgba(226, 232, 240, 0.8);
  box-shadow: var(--shadow-sm);
  cursor: pointer;
  transition: all 0.2s ease;
  display: flex;
  align-items: center;
  gap: 5px;
}

.filter-chip.active {
  background: var(--primary);
  color: white;
  border-color: var(--primary);
  box-shadow: 0 4px 12px rgba(5, 150, 105, 0.3);
}

/* Map Container */
#map {
  flex: 1;
  width: 100%;
  height: 100%;
  z-index: 1;
}

/* Floating Controls (GPS, List Toggle) */
.floating-actions {
  position: absolute;
  right: 16px;
  bottom: 84px;
  z-index: 1000;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.fab-btn {
  width: 46px;
  height: 46px;
  border-radius: 50%;
  background: white;
  border: none;
  outline: none;
  box-shadow: var(--shadow-lg);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-main);
  cursor: pointer;
  transition: transform 0.15s ease, background-color 0.2s ease;
}
.fab-btn:active {
  transform: scale(0.92);
}
.fab-btn.active {
  background: var(--primary);
  color: white;
}

/* Custom Marker Styling */
.custom-marker {
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
}

.marker-pin {
  width: 38px;
  height: 38px;
  border-radius: 50% 50% 50% 0;
  position: absolute;
  transform: rotate(-45deg);
  left: 50%;
  top: 50%;
  margin: -24px 0 0 -19px;
  box-shadow: 0 4px 8px rgba(0,0,0,0.3);
  display: flex;
  align-items: center;
  justify-content: center;
  transition: transform 0.2s;
}

.marker-pin.available {
  background: #10b981;
}

.marker-pin.occupied {
  background: #f59e0b;
}

.marker-pin.charging {
  background: #0284c7;
}

.marker-icon {
  transform: rotate(45deg);
  color: white;
  font-size: 15px;
}

.marker-pulse {
  background: rgba(16, 185, 129, 0.4);
  border-radius: 50%;
  height: 20px;
  width: 20px;
  position: absolute;
  left: 50%;
  top: 50%;
  margin: -10px 0 0 -10px;
  animation: pulsate 1.8s ease-out infinite;
  opacity: 0;
}

@keyframes pulsate {
  0% { transform: scale(0.1); opacity: 0; }
  50% { opacity: 0.8; }
  100% { transform: scale(2.2); opacity: 0; }
}

/* User Location Marker */
.user-marker {
  width: 18px;
  height: 18px;
  background: #2563eb;
  border: 3px solid white;
  border-radius: 50%;
  box-shadow: 0 0 12px rgba(37, 99, 235, 0.6);
}

/* Bottom Sheet Modal */
.bottom-sheet {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  background: white;
  border-radius: 24px 24px 0 0;
  box-shadow: 0 -4px 25px rgba(0, 0, 0, 0.18);
  z-index: 1050;
  transform: translateY(105%);
  transition: transform 0.3s cubic-bezier(0.16, 1, 0.3, 1);
  max-height: 85vh;
  display: flex;
  flex-direction: column;
}

@media (min-width: 768px) {
  .bottom-sheet {
    max-width: 440px;
    left: 20px;
    right: auto;
    bottom: 24px;
    border-radius: 20px;
    transform: translateX(-120%);
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.2);
    border: 1px solid rgba(226, 232, 240, 0.8);
  }
  .bottom-sheet.open {
    transform: translateX(0);
  }
  .top-header {
    max-width: 520px;
  }
}

.bottom-sheet.open {
  transform: translateY(0);
}

.sheet-drag-handle {
  width: 44px;
  height: 5px;
  background: #cbd5e1;
  border-radius: 3px;
  margin: 10px auto 4px;
}

.sheet-content {
  padding: 12px 20px 24px;
  overflow-y: auto;
}

.sheet-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  margin-bottom: 12px;
}

.sheet-title {
  font-size: 18px;
  font-weight: 700;
  color: #0f172a;
}

.sheet-subtitle {
  font-size: 13px;
  color: var(--text-muted);
  margin-top: 2px;
  display: flex;
  align-items: center;
  gap: 6px;
}

.close-btn {
  background: #f1f5f9;
  border: none;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  color: #64748b;
}

.status-badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-size: 12px;
  font-weight: 600;
  padding: 4px 10px;
  border-radius: 12px;
  margin-bottom: 14px;
}

.status-badge.available {
  background: #d1fae5;
  color: #065f46;
}
.status-badge.occupied {
  background: #fef3c7;
  color: #92400e;
}
.status-badge.charging {
  background: #e0f2fe;
  color: #075985;
}

/* Station Details Grid */
.amenities-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 10px;
  margin-bottom: 16px;
}

.amenity-card {
  background: #f8fafc;
  border: 1px solid #e2e8f0;
  border-radius: 12px;
  padding: 10px;
  display: flex;
  align-items: center;
  gap: 10px;
}

.amenity-icon {
  width: 36px;
  height: 36px;
  border-radius: 10px;
  background: white;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 16px;
  box-shadow: var(--shadow-sm);
}

.amenity-info h4 {
  font-size: 12px;
  font-weight: 600;
  color: #334155;
}
.amenity-info p {
  font-size: 11px;
  color: var(--text-muted);
}

/* OCOP & Ev Section */
.info-section {
  background: #f0fdf4;
  border: 1px dashed #86efac;
  border-radius: 12px;
  padding: 12px;
  margin-bottom: 16px;
}
.info-section h3 {
  font-size: 13px;
  font-weight: 700;
  color: #166534;
  margin-bottom: 6px;
  display: flex;
  align-items: center;
  gap: 6px;
}
.info-section p {
  font-size: 12px;
  color: #15803d;
  line-height: 1.4;
}

/* Action Buttons */
.action-buttons {
  display: flex;
  gap: 10px;
  margin-top: 8px;
}

.btn-primary {
  flex: 2;
  background: var(--primary);
  color: white;
  border: none;
  border-radius: 14px;
  padding: 12px;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  box-shadow: 0 4px 12px rgba(5, 150, 105, 0.3);
}

.btn-secondary {
  flex: 1;
  background: #f1f5f9;
  color: #334155;
  border: 1px solid #cbd5e1;
  border-radius: 14px;
  padding: 12px;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
}

/* Bottom Navigation Bar */
.bottom-nav {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  height: 64px;
  background: rgba(255, 255, 255, 0.96);
  backdrop-filter: blur(12px);
  border-top: 1px solid #e2e8f0;
  display: flex;
  align-items: center;
  justify-content: space-around;
  z-index: 1000;
  padding-bottom: env(safe-area-inset-bottom, 0px);
}

.nav-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 3px;
  color: #64748b;
  font-size: 10px;
  font-weight: 600;
  cursor: pointer;
  border: none;
  background: transparent;
}
.nav-item.active {
  color: var(--primary);
}
.nav-item i {
  font-size: 18px;
}

/* List Drawer Modal */
.list-modal {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 64px;
  background: #f8fafc;
  z-index: 1060; /* Phủ lên top-header để tiêu đề và nút đóng không bị che */
  display: none;
  flex-direction: column;
}

@media (min-width: 768px) {
  .list-modal {
    max-width: 440px;
    right: auto;
    border-right: 1px solid #e2e8f0;
    box-shadow: 4px 0 20px rgba(0,0,0,0.08);
  }
}

.list-modal.open {
  display: flex;
}

.list-header {
  padding: 18px 20px 14px;
  background: white;
  border-bottom: 1px solid #e2e8f0;
  display: flex;
  justify-content: space-between;
  align-items: center;
}
.list-header h2 {
  font-size: 16px;
  font-weight: 700;
}

.station-list-container {
  flex: 1;
  overflow-y: auto;
  padding: 16px 20px 80px;
  padding: 12px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.station-card {
  background: white;
  border-radius: 14px;
  padding: 14px;
  box-shadow: var(--shadow-sm);
  border: 1px solid #e2e8f0;
  cursor: pointer;
  transition: transform 0.15s;
}
.station-card:active {
  transform: scale(0.98);
}
.station-card-title {
  font-size: 14px;
  font-weight: 700;
  color: #0f172a;
}
.station-card-desc {
  font-size: 12px;
  color: #64748b;
  margin: 4px 0 8px;
}
.card-tags {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
}
.card-tag {
  font-size: 11px;
  padding: 2px 8px;
  border-radius: 8px;
  background: #f1f5f9;
  color: #475569;
}

/* Citizen Feedback Modal */
.feedback-modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.5);
  backdrop-filter: blur(4px);
  z-index: 2000;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 16px;
}
.feedback-modal-overlay.open {
  display: flex;
}

.feedback-card {
  background: white;
  border-radius: 20px;
  width: 100%;
  max-width: 400px;
  padding: 20px;
  box-shadow: var(--shadow-lg);
  animation: popIn 0.25s ease;
}

@keyframes popIn {
  from { transform: scale(0.92); opacity: 0; }
  to { transform: scale(1); opacity: 1; }
}

.rating-stars {
  display: flex;
  justify-content: center;
  gap: 8px;
  margin: 14px 0;
  font-size: 28px;
  color: #cbd5e1;
  cursor: pointer;
}
.rating-stars span.active {
  color: #f59e0b;
}

.tag-cloud {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 16px;
}
.feedback-tag-chip {
  padding: 6px 12px;
  border-radius: 16px;
  border: 1px solid #cbd5e1;
  font-size: 12px;
  background: #f8fafc;
  color: #475569;
  cursor: pointer;
}
.feedback-tag-chip.selected {
  background: #ecfdf5;
  border-color: #059669;
  color: #059669;
  font-weight: 600;
}

.photo-upload-placeholder {
  border: 2px dashed #cbd5e1;
  border-radius: 12px;
  padding: 12px;
  text-align: center;
  color: #64748b;
  font-size: 12px;
  cursor: pointer;
  margin-bottom: 16px;
  background: #f8fafc;
}

/* PWA Install Banner */
.pwa-banner {
  position: absolute;
  bottom: 76px;
  left: 12px;
  right: 68px; /* Tránh đè lên cụm nút FAB bên phải */
  background: linear-gradient(135deg, #059669 0%, #047857 100%);
  color: white;
  padding: 10px 14px;
  border-radius: 14px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  box-shadow: 0 8px 16px rgba(5, 150, 105, 0.35);
  z-index: 1000;
  animation: slideUp 0.3s ease;
}

@media (min-width: 768px) {
  .pwa-banner {
    max-width: 440px;
    left: 20px;
    right: auto;
    bottom: 84px;
  }
}

@keyframes slideUp {
  from { transform: translateY(20px); opacity: 0; }
  to { transform: translateY(0); opacity: 1; }
}

.pwa-banner-text h4 {
  font-size: 13px;
  font-weight: 700;
}
.pwa-banner-text p {
  font-size: 11px;
  opacity: 0.9;
}
.pwa-btn-install {
  background: white;
  color: #059669;
  border: none;
  font-size: 12px;
  font-weight: 700;
  padding: 6px 12px;
  border-radius: 20px;
  cursor: pointer;
}

/* Toast message */
.toast {
  position: fixed;
  top: 20px;
  left: 50%;
  transform: translateX(-50%) translateY(-100px);
  background: #0f172a;
  color: white;
  padding: 10px 20px;
  border-radius: 30px;
  font-size: 13px;
  font-weight: 600;
  box-shadow: var(--shadow-lg);
  z-index: 3000;
  transition: transform 0.3s ease;
}
.toast.show {
  transform: translateX(-50%) translateY(0);
}
