* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
  font-family: sans-serif;
}

body {
  background: #f4f4f4;
  color: #333;
  transition: background 0.3s, color 0.3s;
}

header {
  text-align: center;
  padding: 20px;
}

h1 {
  color: crimson;
}

h2 {
  color: teal;
  margin-bottom: 10px;
}

.controls {
  display: flex;
  justify-content: center;
  gap: 10px;
}

#search {
  padding: 8px;
  width: 200px;
  border: 1px solid #ccc;
  border-radius: 5px;
}

#themeToggle {
  padding: 8px 12px;
  border: none;
  background: crimson;
  color: white;
  border-radius: 5px;
  cursor: pointer;
}

.image-container {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 15px;
  padding: 20px;
}

.image-container img {
  width: 100%;
  height: 200px;
  object-fit: cover;
  border-radius: 8px;
  transition: transform 0.3s ease;
  cursor: pointer;
}

.image-container img:hover {
  transform: scale(1.05);
}

/* Modal Styles */
.image-modal {
  position: fixed;
  top: 0; left: 0;
  width: 100%; height: 100%;
  background: rgba(0,0,0,0.9);
  display: none;
  align-items: center;
  justify-content: center;
  flex-direction: column;
  z-index: 10;
  color: white;
}

.image-modal img {
  max-width: 80%;
  max-height: 70%;
  border-radius: 10px;
}

.caption {
  margin-top: 15px;
  font-size: 1.2rem;
}

.close-btn, .prev-btn, .next-btn {
  position: absolute;
  color: white;
  font-size: 2rem;
  background: rgba(0,0,0,0.5);
  border: none;
  padding: 10px;
  cursor: pointer;
  border-radius: 50%;
}

.close-btn {
  top: 20px;
  right: 30px;
}

.prev-btn {
  left: 20px;
}

.next-btn {
  right: 20px;
}

body.dark {
  background: #222;
  color: white;
}
