body, html {
  margin: 0; padding: 0;
  width: 100vw; height: 100vh;
  font-family: 'Inter', sans-serif;
  background: #ffffff;
  overflow: hidden;
  color: #333;
}

header {
  position: fixed;
  top: 0; left: 0;
  width: 100%;
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 20px 40px;
  background: rgba(255,255,255,0.95);
  z-index: 10;
  box-shadow: 0 1px 3px rgba(0,0,0,0.05);
}

.logo {
  font-size: 18px;
  font-weight: 600;
  letter-spacing: 0.3px;
}

nav ul {
  display: flex;
  list-style: none;
  margin: 0;
  padding: 0;
}

nav ul li {
  margin-left: 30px;
}

nav ul li a {
  text-decoration: none;
  color: #333;
  font-size: 16px;
  font-weight: 500;
  transition: color 0.2s;
}

nav ul li a:hover {
  color: #666;
}

nav ul li a.active {
  font-weight: 600;
}

#icon-grid-viewport {
  position: absolute; 
  inset: 0;
  overflow: hidden;
  width: 100vw; 
  height: 100vh;
  user-select: none;
  touch-action: none;
  padding-top: 80px;
}

#icon-grid {
  position: absolute;
  left: 0; top: 80px;
  display: grid;
  grid-gap: 20px;
  padding: 20px;
  background: none;
  will-change: transform;
  transition: transform 0.05s linear; /* Small transition for smoother movement */
  /* Dynamically set width/height via JS */
}

.icon-tile {
  width: 200px; 
  height: 200px;
  display: flex;
  flex-direction: column;
  align-items: center; 
  justify-content: center;
  opacity: 0.1;
  border-radius: 4px;
  transition: transform 0.3s, box-shadow 0.3s;
}

.icon-tile.show {
  opacity: 1;
  animation: fade-in 0.5s ease-out;
}

.icon-tile:hover {
  transform: translateY(-5px);
  cursor: pointer;
}

/* Add loading animation for images */
.icon-tile img {
  width: 100%; 
  height: 100%;
  border-radius: 4px;
  background: #fff;
  box-shadow: 0 4px 12px rgba(0,0,0,0.05);
  object-fit: cover;
  opacity: 1;
  transform: scale(1);
  transition: all 0.3s ease;
  user-select: none;
  pointer-events: none;
}

/* Add loading animation */
@keyframes pulse {
  0% { opacity: 0.6; }
  50% { opacity: 0.8; }
  100% { opacity: 0.6; }
}

.icon-tile img[src^="data:image/svg+xml"] {
  animation: pulse 1.5s infinite;
}

.icon-tile .caption {
  margin-top: 12px;
  font-size: 14px;
  font-weight: 500;
  color: #333;
  text-align: center;
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

@keyframes fade-in {
  0% { opacity: 0; transform: translateY(10px);}
  100% { opacity: 1; transform: translateY(0);}
}

@media (max-width: 768px) {
  header {
    padding: 15px 20px;
  }
  
  .logo {
    font-size: 16px;
  }
  
  nav ul li {
    margin-left: 15px;
  }
  
  nav ul li a {
    font-size: 14px;
  }
  
  .icon-tile {
    width: 150px;
    height: 150px;
  }
}

/* Add this new class for when the grid is being dragged */
#icon-grid.dragging {
  transition: none; /* No transition during drag for immediate response */
}

/* Pop-in animation */
.icon-tile.pop-in {
  animation: pop-in 1s cubic-bezier(0.175, 0.885, 0.32, 1.275) forwards;
}

/* Pop-out animation */
.icon-tile.pop-out {
  animation: pop-out 0.5s cubic-bezier(0.6, -0.28, 0.735, 0.045) forwards;
}

@keyframes pop-in {
  0% { 
    opacity: 0; 
    transform: scale(0.8) translateY(10px);
  }
  100% { 
    opacity: 1; 
    transform: scale(1) translateY(0);
  }
}

@keyframes pop-out {
  0% { 
    opacity: 1; 
    transform: scale(1) translateY(0);
  }
  100% { 
    opacity: 0; 
    transform: scale(0.8) translateY(10px);
  }
}

/* Remove the existing fade-in animation as we're replacing it */
.icon-tile.show {
  opacity: 1;
  /* Remove the animation property as we're using pop-in instead */
}

/* Lightbox Styles */
.lightbox {
  display: none;
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background-color: rgba(0, 0, 0, 0.8);
  z-index: 100;
  justify-content: center;
  align-items: center;
}

.lightbox.active {
  display: flex;
}

.lightbox-content {
  position: relative;
  background-color: white;
  padding: 20px;
  border-radius: 8px;
  max-width: 80%;
  max-height: 80%;
  display: flex;
  flex-direction: column;
  align-items: center;
}

.close-btn {
  position: absolute;
  top: 10px;
  right: 15px;
  font-size: 24px;
  cursor: pointer;
  color: #333;
}

#lightbox-img {
  max-width: 100%;
  max-height: 60vh;
  object-fit: contain;
  margin-bottom: 15px;
  border-radius: 4px;
}

.lightbox-caption {
  font-size: 18px;
  font-weight: 500;
  margin-top: 10px;
  margin-bottom: 10px;
  text-align: center;
  color: #333;
}

.lightbox-buttons {
  display: flex;
  gap: 15px;
  margin-top: 10px;
}

.buy-btn, .copy-btn {
  padding: 10px 15px;
  border: none;
  border-radius: 4px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s ease;
}

.buy-btn {
  background-color: #4CAF50; /* Green */
  color: white;
}

.copy-btn {
  background-color: #2196F3; /* Blue */
  color: white;
}

/* Style for disabled button */
.copy-btn.disabled {
  background-color: #cccccc !important;
  color: #666666 !important;
  cursor: not-allowed !important;
  transform: none !important;
  box-shadow: none !important;
  pointer-events: none;
}

.copy-btn.disabled:hover {
  transform: none !important;
  box-shadow: none !important;
}

/* Style for close button */
.copy-btn.close-btn-style {
  background-color: #ff3333; /* Red */
  color: white;
}
.buy-btn:hover, .copy-btn:hover {
  transform: translateY(-2px);
  box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1);
}

@media (max-width: 768px) {
  .lightbox-content {
    max-width: 95%;
    padding: 15px;
  }
  
  .lightbox-buttons {
    flex-direction: column;
    width: 100%;
  }
  
  .buy-btn, .copy-btn {
    width: 100%;
  }
}

/* Ad Container Styles */
.ad-container {
  position: fixed;
  bottom: 0;
  left: 0;
  width: 728px; /* Chính xác bằng chiều rộng của banner desktop */
  display: flex;
  justify-content: center;
  align-items: center;
  background: none;
  z-index: 50;
  box-shadow: 0 -2px 5px rgba(0, 0, 0, 0.1);
  height: 90px; /* Chính xác bằng chiều cao của banner desktop */
  margin: 0 auto; /* Căn giữa container */
  left: 50%; /* Đặt vị trí bắt đầu ở giữa */
  transform: translateX(-50%); /* Dịch chuyển ngược lại 50% chiều rộng để căn giữa */
}

.ad-element {
  width: 728px; /* Chính xác bằng chiều rộng của banner desktop */
  height: 90px; /* Chính xác bằng chiều cao của banner desktop */
}

/* Ensure ad container is visible on all devices */
@media (max-width: 768px) {
  .ad-container {
    width: 468px; /* Chính xác bằng chiều rộng của banner mobile */
    height: 60px; /* Chính xác bằng chiều cao của banner mobile */
  }
  
  .ad-element {
    width: 468px; /* Chính xác bằng chiều rộng của banner mobile */
    height: 60px; /* Chính xác bằng chiều cao của banner mobile */
  }
}

/* Lightbox caption styles for countdown and success */
.lightbox-caption.countdown {
  color: #ff0000;
  font-weight: bold;
}

.lightbox-caption.success {
  color: #00aa00;
  font-weight: bold;
}

/* Style for the ad container that will replace the image */
.lightbox-ad-container {
  width: 300px !important;
  height: 250px !important;
  margin: 0 auto;
  background-color: #f0f0f0;
  display: block !important;
  align-items: center;
  justify-content: center;
  overflow: hidden !important; /* Prevent content from spilling out */
  position: relative;
  z-index: 10;
  visibility: visible !important;
  opacity: 1 !important;
}

/* Make sure iframe inside the ad container fits properly */
.lightbox-ad-container iframe {
  width: 300px !important;
  height: 250px !important;
  max-width: 300px !important;
  max-height: 250px !important;
  border: none;
  margin: 0;
  padding: 0;
  display: block !important; /* Prevent inline display issues */
  overflow: hidden !important;
  visibility: visible !important;
  opacity: 1 !important;
}
  