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

body {
  font-family: Arial, sans-serif;
  background-color: #ffffff;
  display: flex;
  color: #333;
  font-size: 16px;
  line-height: 1.5;
}

.menu-toggle {
  position: fixed;
  top: 20px;
  left: 20px;
  z-index: 1000;
  cursor: pointer;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  width: 30px;
  height: 21px;
}

.menu-toggle .bar {
  height: 3px;
  width: 100%;
  background-color: #333;
  border-radius: 10px;
}

.side-menu {
  width: 250px;
  height: 100vh;
  background-color: #f0f0f0;
  position: fixed;
  left: -250px;
  top: 0;
  transition: left 0.3s ease;
  z-index: 999;
  box-shadow: 2px 0 5px rgba(0, 0, 0, 0.1);
}

.side-menu.open {
  left: 0;
}

.close-menu {
  position: absolute;
  top: 10px;
  right: 10px;
  background: none;
  border: none;
  font-size: 24px;
  cursor: pointer;
  color: #333;
}

.side-menu ul {
  list-style-type: none;
  padding: 50px 0 0 0;
}

.side-menu ul li a {
  display: block;
  padding: 15px 25px;
  color: #333;
  text-decoration: none;
  transition: background-color 0.3s ease;
}

.side-menu ul li a:hover,
.side-menu ul li a.active {
  background-color: #e0e0e0;
}

main {
  flex-grow: 1;
  padding: 2rem;
  margin-left: 60px;
  transition: margin-left 0.3s ease;
}

main.menu-open {
  margin-left: 250px;
}

main > section {
  padding-top: 40px;
}

.gallery {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 1rem;
  max-width: 1200px;
  margin: 0 auto 2rem;
}

.gallery-item {
  position: relative;
  overflow: hidden;
  border-radius: 8px;
  box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
  transition: transform 0.3s ease, box-shadow 0.3s ease;
  aspect-ratio: 1 / 1;
  cursor: pointer;
  background-color: #f0f0f0;
}

.gallery-item img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  transition: transform 0.3s ease;
}

.gallery-item:hover {
  transform: translateY(-5px);
  box-shadow: 0 6px 12px rgba(0, 0, 0, 0.15);
}

.gallery-item:hover img {
  transform: scale(1.05);
}

.gallery-item-caption {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  background-color: rgba(255, 255, 255, 0.8);
  color: #333;
  padding: 0.5rem;
  transform: translateY(100%);
  transition: transform 0.3s ease;
}

.gallery-item:hover .gallery-item-caption {
  transform: translateY(0);
}

.loading {
  text-align: center;
  padding: 1rem;
  font-size: 1.2rem;
  color: #666;
}

.refresh-button {
  background-color: #4CAF50;
  border: none;
  color: white;
  padding: 15px 32px;
  text-align: center;
  text-decoration: none;
  display: inline-block;
  font-size: 16px;
  margin: 4px 2px;
  cursor: pointer;
  border-radius: 4px;
  transition: background-color 0.3s ease;
}

.refresh-button:hover {
  background-color: #45a049;
}

.refresh-button:active {
  background-color: #3e8e41;
}

section {
  display: none;
}

section.active {
  display: block;
}

img.lazy {
  opacity: 0;
  transition: opacity 0.3s;
}

img:not(.lazy) {
  opacity: 1;
}

.modal-overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background-color: rgba(0, 0, 0, 0.9);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.3s ease, visibility 0.3s ease;
}

.modal-overlay.active {
  opacity: 1;
  visibility: visible;
}

.modal-content {
  position: relative;
  background-color: transparent;
  overflow: auto;
  max-width: 90vw;
  max-height: 90vh;
  display: flex;
  justify-content: center;
  align-items: center;
}

.modal-overlay.active .modal-content {
  transform: scale(1);
}

.modal-image {
  display: block;
  max-width: none;
  max-height: none;
  width: auto;
  height: auto;
  object-fit: contain;
}

.modal-close {
  position: absolute;
  top: -40px;
  right: -40px;
  background-color: rgba(0, 0, 0, 0.5);
  color: #fff;
  border: none;
  border-radius: 50%;
  width: 40px;
  height: 40px;
  font-size: 24px;
  line-height: 40px;
  text-align: center;
  cursor: pointer;
  transition: background-color 0.3s ease;
}

.modal-close:hover {
  background-color: rgba(0, 0, 0, 0.7);
}

.nav-indicator {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  background-color: rgba(0, 0, 0, 0.5);
  color: white;
  width: 50px;
  height: 50px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  font-size: 24px;
  transition: all 0.3s ease;
  opacity: 0;
  box-shadow: 0 0 10px rgba(255, 255, 255, 0.5);
}

.nav-indicator:hover {
  background-color: rgba(0, 0, 0, 0.7);
  box-shadow: 0 0 15px rgba(255, 255, 255, 0.7);
}

.nav-indicator-left {
  left: 20px;
}

.nav-indicator-right {
  right: 20px;
}

.modal-content:hover .nav-indicator {
  opacity: 1;
}

.nav-indicator::before {
  content: '';
  display: block;
  width: 15px;
  height: 15px;
  border-top: 3px solid white;
  border-right: 3px solid white;
}

.nav-indicator-left::before {
  transform: rotate(-135deg);
  margin-left: 5px;
}

.nav-indicator-right::before {
  transform: rotate(45deg);
  margin-right: 5px;
}

.toast-container {
  position: fixed;
  top: 20px;
  right: 20px;
  z-index: 1000;
}

.toast {
  background-color: #333;
  color: #fff;
  padding: 12px 20px;
  border-radius: 4px;
  margin-bottom: 10px;
  opacity: 0;
  transition: opacity 0.3s ease;
}

.toast.show {
  opacity: 1;
}

.toast.error {
  background-color: #d9534f;
}

.toast.success {
  background-color: #5cb85c;
}

.toast.info {
  background-color: #5bc0de;
}

.gallery-error {
  text-align: center;
  padding: 20px;
  color: #d9534f;
}

.retry-button {
  background-color: #5cb85c;
  color: white;
  border: none;
  padding: 10px 20px;
  border-radius: 4px;
  cursor: pointer;
  font-size: 16px;
  margin-top: 10px;
}

.retry-button:hover {
  background-color: #4cae4c;
}

.loading-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background-color: rgba(0, 0, 0, 0.5);
  display: flex;
  justify-content: center;
  align-items: center;
  z-index: 1001;
}

.loading-spinner {
  width: 50px;
  height: 50px;
  border: 5px solid #f3f3f3;
  border-top: 5px solid #3498db;
  border-radius: 50%;
  animation: spin 1s linear infinite;
}

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

/* Responsive design improvements */
@media (max-width: 1024px) {
  .gallery {
    grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
  }

  main {
    padding: 1rem;
  }
}

@media (max-width: 768px) {
  body {
    font-size: 14px;
  }

  .menu-toggle {
    top: 10px;
    left: 10px;
  }

  main {
    margin-left: 0;
    padding: 1rem;
  }

  main.menu-open {
    margin-left: 0;
  }

  .side-menu {
    width: 100%;
    left: -100%;
  }

  .side-menu.open {
    left: 0;
  }

  .gallery {
    grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
    gap: 0.5rem;
  }

  .modal-close {
    top: 10px;
    right: 10px;
    width: 30px;
    height: 30px;
    font-size: 20px;
    line-height: 30px;
  }

  .nav-indicator {
    width: 40px;
    height: 40px;
  }

  .nav-indicator-left {
    left: 10px;
  }

  .nav-indicator-right {
    right: 10px;
  }

  .nav-indicator::before {
    width: 12px;
    height: 12px;
  }

  .toast-container {
    top: 10px;
    right: 10px;
    left: 10px;
  }

  .toast {
    font-size: 14px;
    padding: 10px 15px;
  }
}

@media (max-width: 480px) {
  .gallery {
    grid-template-columns: repeat(auto-fill, minmax(100px, 1fr));
  }

  .modal-content {
    max-width: 95vw;
    max-height: 95vh;
  }

  .nav-indicator {
    width: 30px;
    height: 30px;
  }

  .nav-indicator::before {
    width: 10px;
    height: 10px;
  }
}

/* Improve readability on larger screens */
@media (min-width: 1440px) {
  body {
    font-size: 18px;
  }

  .gallery {
    grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
  }
}

/* Dark mode support */
@media (prefers-color-scheme: dark) {
  body {
    background-color: #1a1a1a;
    color: #f0f0f0;
  }

  .side-menu {
    background-color: #2a2a2a;
  }

  .side-menu ul li a {
    color: #f0f0f0;
  }

  .side-menu ul li a:hover,
  .side-menu ul li a.active {
    background-color: #3a3a3a;
  }

  .gallery-item {
    background-color: #2a2a2a;
  }

  .gallery-item-caption {
    background-color: rgba(40, 40, 40, 0.8);
    color: #f0f0f0;
  }

  .modal-overlay {
    background-color: rgba(0, 0, 0, 0.95);
  }

  .toast {
    background-color: #2a2a2a;
  }

  .loading-spinner {
    border-color: #3a3a3a;
    border-top-color: #3498db;
  }
}
