* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

html, body, #map {
  margin: 0;
  padding: 0;
  height: 100%;
  width: 100%;
  position: relative;
  z-index: 10;
  font-family: 'Roboto', 'Arial', sans-serif;
}
/* Ẩn copyright text của Google Maps */
.gmnoprint .gm-style-cc {
  display: none !important;
}

/* Ẩn tất cả các elements có class gmnoprint */
.gmnoprint {
  display: none !important;
}

/* Ẩn copyright cụ thể */
[class*="copyright"] {
  display: none !important;
}

/* Ẩn các text liên quan đến Google Maps attribution */
.gm-style .gm-style-cc {
  display: none !important;
}

.gm-style-cc {
  display: none !important;
}

/* Ẩn Terms of Use link */
.gm-style .gm-style-cc a {
  display: none !important;
}

.gmnoprint {
  display: none !important;
}

.container {
  display: flex;
  height: 100vh;
  position: relative;
}

/* Sidebar bên trái */
.sidebar {
  width: 315px;
  background: #ffffff;
  border-right: 1px solid #e8eaed;
  display: flex;
  flex-direction: column;
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
  flex-shrink: 0;
  transition: all 0.3s ease;
  position: absolute;
  z-index: 1000;
  height: 100vh; /* Chiều cao cố định */
  overflow: hidden; /* Ẩn overflow */
}

/* COLLAPSED STATE */
.sidebar.collapsed {
  width: 80px;
  height: 80px; /* Chiều cao cố định khi collapsed */
}

.sidebar.collapsed .sidebar-header {
  padding: 15px 10px;
  justify-content: center;
}

.sidebar.collapsed .header-content,
.sidebar.collapsed .close-btn {
  display: none;
}

.sidebar.collapsed .logo {
  margin: 0;
  cursor: pointer;
}

.sidebar.collapsed .city-info,
.sidebar.collapsed .search-section,
.sidebar.collapsed .commune-list {
  display: none;
}

.sidebar.collapsed .expand-btn {
  display: flex !important;
}

/* Map container */
.map-container {
  flex: 1;
  position: relative;
  height: 100vh;
}

#map {
  width: 100%;
  height: 100%;
}

/* Header của sidebar */
.sidebar-header {
  background: linear-gradient(135deg, #e74c3c 0%, #c0392b 100%);
  color: white;
  padding: 20px;
  display: flex;
  align-items: center;
  gap: 15px;
  position: relative;
  flex-shrink: 0;
}

.sidebar-header .logo {
  width: 50px;
  height: 50px;
  background: #fff;
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  cursor: pointer;
}

.sidebar-header .logo img {
  width: 40px;
  height: 40px;
  object-fit: contain;
}

.sidebar-header .header-content h1 {
  font-size: 20px;
  font-weight: 700;
  margin: 0;
  color: white;
}

.sidebar-header .close-btn {
  position: absolute;
  top: 29px;
  right: 15px;
  width: 30px;
  height: 30px;
  background: rgba(255, 255, 255, 0.2);
  border: none;
  border-radius: 50%;
  color: white;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background-color 0.2s;
}

.sidebar-header .close-btn:hover {
  background: rgba(255, 255, 255, 0.3);
}

/* Expand button */
.expand-btn {
  display: none;
  position: absolute;
  top: 29px;
  right: 15px;
  width: 30px;
  height: 30px;
  background: rgba(255, 255, 255, 0.2);
  border: none;
  border-radius: 50%;
  color: white;
  cursor: pointer;
  align-items: center;
  justify-content: center;
  transition: background-color 0.2s;
}

.expand-btn:hover {
  background: rgba(255, 255, 255, 0.3);
}

/* Thông tin cơ bản Hà Nội */
.city-info {
  background: #f8f9fa;
  padding: 16px;
  margin: 0 8px;
  border-radius: 0 0 8px 8px;
  border-top: 1px solid #e8eaed;
  flex-shrink: 0;
}

.city-info-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 8px 12px;
  margin-bottom: 8px;
  background: white;
  border-radius: 6px;
  border-left: 3px solid #1a73e8;
  font-size: 18px;
}

.city-info-item:last-child {
  margin-bottom: 0;
}

.city-info-label {
  font-weight: 500;
  color: #202124;
}

.city-info-value {
  color: #5f6368;
  font-weight: 400;
}

/* Search section */
.search-section {
  padding: 16px;
  background: white;
  margin: 8px;
  border-radius: 8px;
  border: 1px solid #e8eaed;
  flex-shrink: 0;
}

.search-section h3 {
  font-size: 23px;
  color: #202124;
  margin-bottom: 12px;
  text-align: center;
  font-weight: 500;
}

.search-box {
  position: relative;
}

.search-input {
  width: 100%;
  padding: 12px 16px;
  border: 1px solid #dadce0;
  border-radius: 8px;
  outline: none;
  transition: border-color 0.2s;
  font-size: 17px;
}

.search-input:focus {
  border-color: #1a73e8;
  box-shadow: 0 0 0 2px rgba(26, 115, 232, 0.1);
}

/* Danh sách phường/xã */
.commune-list {
  flex: 1; /* Chiếm toàn bộ không gian còn lại */
  overflow-y: auto; /* Chỉ có scroll dọc */
  margin: 0 8px 8px 8px;
  background: white;
  border-radius: 8px;
  border: 1px solid #e8eaed;
}

.commune-item {
  padding: 12px 16px;
  border-bottom: 1px solid #f1f3f4;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 12px;
  transition: background-color 0.2s;
}

.commune-item:hover {
  background-color: #f8f9fa;
}

.commune-item.selected {
  background-color: #e8f0fe;
  border-left: 4px solid #1a73e8;
}

.commune-item:first-child {
  border-radius: 8px 8px 0 0;
}

.commune-item:last-child {
  border-bottom: none;
  border-radius: 0 0 8px 8px;
}

.commune-dot {
  width: 12px;
  height: 12px;
  border-radius: 50%;
  flex-shrink: 0;
  border: 1px solid rgba(0, 0, 0, 0.1);
}

.commune-name {
  font-size: 18px;
  color: #202124;
  font-weight: 400;
}

/* Panel chi tiết bên phải */
.detail-panel {
  position: absolute;
  top: 85px;
  right: 20px;
  width: 360px;
  background: white;
  border-radius: 8px;
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.12);
  z-index: 10000;
  max-height: calc(100vh - 105px);
  overflow: hidden;
  transition: all 0.3s ease;
  visibility: hidden;
  opacity: 0;
  pointer-events: none;
}

.detail-panel.show {
  visibility: visible;
  opacity: 1;
  pointer-events: auto;
}

.detail-panel-header {
  padding: 20px;
  border-bottom: 1px solid #e8eaed;
  position: relative;
}

.detail-panel-title {
  font-size: 24px;
  font-weight: 400;
  color: #202124;
  margin: 0 40px 0 0;
  line-height: 1.3;
}

.detail-panel-close {
  position: absolute;
  top: 20px;
  right: 20px;
  width: 32px;
  height: 32px;
  border: none;
  background: none;
  cursor: pointer;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background-color 0.2s;
}

.detail-panel-close:hover {
  background-color: #f1f3f4;
}

.detail-panel-content {
  padding: 20px;
  overflow-y: auto;
  max-height: calc(100vh - 185px);
}

.detail-info {
  display: flex;
  justify-content: space-between;
  margin-bottom: 24px;
  gap: 10px;
}

.detail-info-item {
  text-align: center;
  flex: 1;
}

.detail-info-value {
  font-size: 20px;
  font-weight: 500;
  color: #202124;
  margin-bottom: 4px;
}

.detail-info-label {
  font-size: 14px;
  color: #5f6368;
  font-weight: 500;
}

.detail-section {
  margin-bottom: 24px;
}

.detail-section-title {
  font-size: 18px;
  font-weight: 500;
  color: #202124;
  margin-bottom: 12px;
  display: flex;
  align-items: center;
  gap: 8px;
}

.detail-section-content {
  color: #5f6368;
  font-size: 16px;
  line-height: 1.5;
}
.detail-section .etail-section-title a {
  text-decoration: none;
}

.detail-contact {
  background: #f8f9fa;
  border-radius: 8px;
  padding: 16px;
}

.contact-item {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  margin-bottom: 12px;
  font-size: 16px;
  line-height: 1.4;
}

.contact-item:last-child {
  margin-bottom: 0;
}

.contact-icon {
  width: 20px;
  height: 20px;
  color: #5f6368;
}

.contact-text {
  font-size: 14px;
  color: #202124;
}

.contact-link {
  color: #1a73e8;
  text-decoration: none;
}

.contact-link:hover {
  text-decoration: underline;
}

/* Custom labels trên map - Zoom responsive */
.custom-label {
  font-family: 'Roboto', sans-serif;
  font-weight: 700;
  background: transparent;
  padding: 0;
  border-radius: 0;
  white-space: nowrap;
  box-shadow: none;
  border: none;
  color: #000000;
  pointer-events: none;
  user-select: none;
  text-align: center;
  line-height: 1.2;
  transition: none;
  text-shadow: 1px 1px 2px rgba(255, 255, 255, 0.8), 
               -1px -1px 2px rgba(255, 255, 255, 0.8),
               1px -1px 2px rgba(255, 255, 255, 0.8),
               -1px 1px 2px rgba(255, 255, 255, 0.8);
  opacity: 1;
  transform-origin: center center;
  will-change: transform;
}

/* Zoom level classes */
.custom-label.zoom-small {
  font-size: 0px;
  opacity: 0.7;
  max-width: 80px;
  overflow: hidden;
  text-overflow: ellipsis;
}

.custom-label.zoom-medium {
  font-size: 11px;
  opacity: 0.85;
  max-width: 140px;
  overflow: hidden;
  text-overflow: ellipsis;
}

.custom-label.zoom-large {
  font-size: 18px;
  opacity: 1;
  max-width: none;
  overflow: visible;
}

.custom-label.zoom-xlarge {
  font-size: 22px;
  opacity: 1;
  max-width: none;
  overflow: visible;
}

/* Toggle buttons */
.toggle-buttons {
  position: absolute;
  top: 20px;
  right: 20px;
  z-index: 1002;
  display: flex;
  gap: 8px;
}

.toggle-btn {
  width: 40px;
  height: 40px;
  background: white;
  border: none;
  border-radius: 8px;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s;
  position: relative;
  top: 35px;
  right: -10px;
}

.toggle-btn:hover {
  background-color: #f8f9fa;
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
}

.toggle-btn svg {
  width: 20px;
  height: 20px;
  color: #5f6368;
}

.toggle-btn.active {
  background: #1a73e8;
  color: white;
}

.toggle-btn.active svg {
  color: white;
}

/* Mobile Toggle Button */
.mobile-toggle {
  display: none;
  position: fixed;
  top: 15px;
  left: 15px;
  z-index: 1005;
  width: 45px;
  height: 45px;
  background: white;
  border: none;
  border-radius: 8px;
  box-shadow: 0 2px 12px rgba(0, 0, 0, 0.2);
  cursor: pointer;
  align-items: center;
  justify-content: center;
  transition: all 0.2s;
}

.mobile-toggle:hover {
  background-color: #f8f9fa;
  transform: scale(1.05);
}

.mobile-toggle svg {
  color: #202124;
}

/* Overlay cho mobile */
.mobile-overlay {
  display: none;
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.5);
  z-index: 1003;
  backdrop-filter: blur(2px);
}

.mobile-overlay.active {
  display: block;
}

/* Responsive Design */
@media (max-width: 1200px) {
  .sidebar {
    width: 330px;
  }
  
  .sidebar.collapsed {
    width: 80px;
  }
  
  .detail-panel {
    width: 320px;
  }
}

@media (max-width: 768px) {
  .container {
    flex-direction: row;
  }

  .sidebar {
    position: fixed;
    top: 0;
    left: 0;
    height: 100vh;
    width: 85%;
    max-width: 380px;
    transform: translateX(-100%);
    transition: transform 0.3s ease;
    z-index: 1004;
    border-radius: 0 15px 15px 0;
    box-shadow: 0 0 20px rgba(0, 0, 0, 0.15);
    overflow: auto;
  }
  
  .sidebar.active {
    transform: translateX(0);
  }

  .sidebar.collapsed {
    width: 85%;
    max-width: 380px;
    transform: translateX(-100%);
    height: 100vh;
  }

  .sidebar.collapsed.active {
    transform: translateX(0);
  }

  .sidebar .close-btn,
  .sidebar .expand-btn {
    display: none !important;
  }

  .mobile-toggle {
    display: flex;
  }
  
  .map-container {
    width: 100%;
    margin-left: 0;
  }
  
  .detail-panel {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    top: auto;
    width: 100%;
    max-height: 70vh;
    border-radius: 16px 16px 0 0;
    transform: translateY(100%);
    visibility: visible;
    opacity: 1;
    pointer-events: auto;
    z-index: 1002;
  }
  
  .detail-panel.show {
    transform: translateY(0);
  }

  .detail-panel-content {
    max-height: calc(70vh - 80px);
    padding: 15px;
  }

  .detail-panel-header {
    padding: 15px;
  }

  .detail-panel-title {
    font-size: 22px;
  }

  .detail-info {
    flex-direction: column;
    gap: 15px;
    margin-bottom: 20px;
  }

  .detail-info-item {
    text-align: left;
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px;
    background: #f8f9fa;
    border-radius: 8px;
  }

  .detail-info-value {
    font-size: 18px;
    margin-bottom: 0;
  }

  .detail-info-label {
    font-size: 16px;
  }

  .detail-section-title {
    font-size: 16px;
  }

  .detail-section-content {
    font-size: 15px;
  }

  .contact-item {
    font-size: 15px;
    flex-wrap: wrap;
  }

  .toggle-buttons {
    top: 80px;
    right: 15px;
  }

  .toggle-btn {
    top: 0;
    right: -5px;
  }
  .sidebar-header {
    display: flex;
    align-items: center;
    justify-content: center;
  }

  /* Mobile label adjustments */
  .custom-label.zoom-small {
    font-size: 8px;
    max-width: 60px;
  }
  
  .custom-label.zoom-medium {
    font-size: 11px;
    max-width: 100px;
  }
  
  .custom-label.zoom-large {
    font-size: 14px;
  }
  
  .custom-label.zoom-xlarge {
    font-size: 16px;
  }
  .detail-panel-close{
    top: 13px;
  }
}

@media (max-width: 480px) {
  .sidebar {
    width: 90%;
    max-width: none;
  }

  .sidebar-header {
    padding: 15px;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 15px;
    position: relative;
  }

  .sidebar-header .header-content h1 {
    font-size: 18px;
  }
  
  .sidebar.collapsed {
    width: 90%;
    transform: translateX(-100%);
  }

  .city-info {
    padding: 12px;
    margin: 0 6px;
    }

 .city-info-item {
   font-size: 18px;
   padding: 6px 10px;
 }
 
 .search-section {
   padding: 12px;
   margin: 6px;
 }

 .search-section h3 {
   font-size: 20px;
 }

 .search-input {
   font-size: 16px;
   padding: 10px 14px;
 }
 
 .commune-list {
   margin: 0 6px 6px 6px;
 }
 
 .commune-item {
   padding: 12px 14px;
 }

 .commune-name {
   font-size: 16px;
 }
 
 .detail-panel {
   max-height: 75vh;
 }

 .detail-panel-content {
   max-height: calc(75vh - 70px);
   padding: 12px;
 }

 .detail-panel-header {
   padding: 12px;
 }

 .detail-panel-title {
   font-size: 20px;
 }

 .detail-info-item {
   padding: 10px;
 }

 .detail-info-value {
   font-size: 16px;
 }

 .detail-info-label {
   font-size: 14px;
 }

 .detail-section-title {
   font-size: 15px;
 }

 .detail-section-content {
   font-size: 14px;
 }

 .contact-item {
   font-size: 14px;
 }

 .sidebar .close-btn {
   display: none !important;
 }

 /* Smaller mobile label adjustments */
 .custom-label.zoom-small {
   font-size: 7px;
   max-width: 50px;
 }
 
 .custom-label.zoom-medium {
   font-size: 10px;
   max-width: 80px;
 }
 
 .custom-label.zoom-large {
   font-size: 13px;
 }
 
 .custom-label.zoom-xlarge {
   font-size: 15px;
 }
 .detail-panel-close {
   top: 10px;
 }
 .detail-panel-header {
   display: flex;
   align-items: center;
   padding: 15px;
 }
}

@media (max-width: 425px) {
 .commune-item .commune-name{
   font-size: 15px;
 }
 .sidebar {
   width: 95%;
 }

 .sidebar.collapsed {
   width: 95%;
   transform: translateX(-100%);
 }

 .mobile-toggle {
   width: 48px;
   height: 48px;
   top: 16px;
   left: 12px;
 }

 .sidebar-header {
   padding: 15px;
   display: flex;
   align-items: center;
   justify-content:center;
   gap: 15px;
   position: relative;
 }

 .sidebar-header .header-content h1 {
   font-size: 16px;
 }

 .city-info-item {
   font-size: 16px;
 }

 .search-section h3 {
   font-size: 18px;
 }

 .commune-name {
   font-size: 15px;
 }

 .toggle-buttons {
   top: 65px;
   right: 10px;
 }

 .toggle-btn {
   width: 35px;
   height: 35px;
 }

 .toggle-btn svg {
   width: 18px;
   height: 18px;
 }

 .sidebar .close-btn {
   display: none !important;
 }

 .detail-panel {
   max-height: 80vh;
 }

 .detail-panel-content {
   max-height: calc(80vh - 60px);
   padding: 10px;
 }

 .detail-panel-header {
   padding: 16px;
 }

 .detail-panel-title {
   font-size: 18px;
 }
}

@media (max-width: 375px) {
 .sidebar {
   width: 100%;
 }

 .sidebar.collapsed {
   width: 100%;
   transform: translateX(-100%);
 }

 .sidebar-header {
   padding: 12px;
   display: flex;
   align-items: center;
   gap: 12px;
   position: relative;
 }

 .sidebar-header .header-content h1 {
   font-size: 15px;
 }

 .city-info {
   padding: 10px;
   margin: 0 4px;
 }

 .city-info-item {
   font-size: 15px;
   padding: 5px 8px;
 }

 .search-section {
   padding: 10px;
   margin: 4px;
 }

 .search-section h3 {
   font-size: 17px;
 }

 .search-input {
   font-size: 15px;
   padding: 8px 12px;
 }

 .commune-list {
   margin: 0 4px 4px 4px;
 }

 .commune-item {
   padding: 10px 12px;
 }

 .commune-name {
   font-size: 14px;
 }

 .detail-panel {
   max-height: 85vh;
 }

 .detail-panel-content {
   max-height: calc(85vh - 50px);
   padding: 8px;
 }

 .detail-panel-header {
   padding: 8px;
 }

 .detail-panel-title {
   font-size: 16px;
 }
}

/* Scrollbar styling */
.commune-list::-webkit-scrollbar,
.detail-panel-content::-webkit-scrollbar {
 width: 6px;
}

.commune-list::-webkit-scrollbar-track,
.detail-panel-content::-webkit-scrollbar-track {
 background: transparent;
}

.commune-list::-webkit-scrollbar-thumb,
.detail-panel-content::-webkit-scrollbar-thumb {
 background: #dadce0;
 border-radius: 3px;
}

.commune-list::-webkit-scrollbar-thumb:hover,
.detail-panel-content::-webkit-scrollbar-thumb:hover {
 background: #bdc1c6;
}

/* Loading animation */
.loading {
 display: flex;
 align-items: center;
 justify-content: center;
 padding: 40px;
 color: #5f6368;
}

.loading::after {
 content: '';
 width: 20px;
 height: 20px;
 border: 2px solid #e8eaed;
 border-top: 2px solid #1a73e8;
 border-radius: 50%;
 animation: spin 1s linear infinite;
 margin-left: 12px;
}

@keyframes spin {
 0% { transform: rotate(0deg); }
 100% { transform: rotate(360deg); }
}

/* Animation cho các elements */
.commune-item {
 animation: fadeInUp 0.3s ease;
}

@keyframes fadeInUp {
 from {
   opacity: 0;
   transform: translateY(10px);
 }
 to {
   opacity: 1;
   transform: translateY(0);
 }
}