* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
  font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
}

body {
  background: radial-gradient(circle at top, #1e293b 0%, #0f172a 100%);
  color: #f8fafc;
  min-height: 100vh;
  display: flex;
  justify-content: center;
  align-items: flex-start;
  padding: 40px 20px;
}

.container {
  width: 100%;
  max-width: 1200px;
  text-align: center;
}

h1 {
  font-size: 2.6rem;
  font-weight: 800;
  margin-bottom: 25px;
  background: linear-gradient(90deg, #38bdf8, #818cf8, #c084fc);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}

#search-form {
  display: flex;
  justify-content: center;
  gap: 12px;
  margin-bottom: 40px;
  max-width: 650px;
  margin-left: auto;
  margin-right: auto;
}

#search-box {
  flex: 1;
  padding: 14px 22px;
  font-size: 1rem;
  border-radius: 14px;
  border: 1px solid #334155;
  background: rgba(30, 41, 59, 0.8);
  backdrop-filter: blur(10px);
  color: #fff;
  outline: none;
  transition: all 0.3s ease;
}

#search-box:focus {
  border-color: #38bdf8;
  box-shadow: 0 0 20px rgba(56, 189, 248, 0.3);
  background: #1e293b;
}

#search-form button {
  padding: 14px 28px;
  font-size: 1rem;
  font-weight: 600;
  border-radius: 14px;
  border: none;
  background: linear-gradient(135deg, #2563eb, #38bdf8);
  color: #fff;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 8px;
  transition: all 0.3s ease;
}

#search-form button:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 20px rgba(37, 99, 235, 0.4);
}

/* Gallery Grid */
.image-results {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 22px;
  margin-top: 20px;
}

.image-card {
  position: relative;
  overflow: hidden;
  border-radius: 16px;
  border: 1px solid #334155;
  background: #1e293b;
  cursor: pointer;
  height: 250px;
  transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1), box-shadow 0.3s ease, border-color 0.3s ease;
}

.image-card img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  transition: transform 0.4s ease;
}

.image-card:hover {
  transform: translateY(-5px);
  box-shadow: 0 12px 30px rgba(0, 0, 0, 0.6);
  border-color: #38bdf8;
}

.image-card:hover img {
  transform: scale(1.08);
}

.image-overlay {
  position: absolute;
  inset: 0;
  background: linear-gradient(to top, rgba(15, 23, 42, 0.8) 0%, transparent 60%);
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  padding: 14px 18px;
  opacity: 0;
  transition: opacity 0.3s ease;
}

.image-card:hover .image-overlay {
  opacity: 1;
}

.overlay-text {
  font-size: 0.85rem;
  color: #e2e8f0;
  font-weight: 500;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.overlay-icon {
  color: #38bdf8;
  font-size: 1.1rem;
}

/* Modal / Lightbox */
.modal {
  display: none;
  position: fixed;
  inset: 0;
  z-index: 1000;
  justify-content: center;
  align-items: center;
  padding: 20px;
}

.modal.active {
  display: flex;
  animation: fadeIn 0.25s ease-out;
}

.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 42, 0.85);
  backdrop-filter: blur(8px);
}

.modal-content {
  position: relative;
  background: #1e293b;
  border: 1px solid #334155;
  border-radius: 20px;
  max-width: 900px;
  width: 100%;
  max-height: 90vh;
  display: flex;
  flex-direction: column;
  box-shadow: 0 25px 60px rgba(0, 0, 0, 0.7);
  z-index: 1001;
  overflow: hidden;
  animation: scaleUp 0.3s cubic-bezier(0.16, 1, 0.3, 1);
}

.close-btn {
  position: absolute;
  top: 14px;
  right: 14px;
  background: rgba(15, 23, 42, 0.7);
  border: 1px solid rgba(255, 255, 255, 0.1);
  color: #fff;
  width: 38px;
  height: 38px;
  border-radius: 50%;
  cursor: pointer;
  font-size: 1.1rem;
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1002;
  transition: all 0.2s ease;
}

.close-btn:hover {
  background: #ef4444;
  transform: rotate(90deg);
}

.modal-image-wrapper {
  flex: 1;
  min-height: 250px;
  max-height: calc(90vh - 120px);
  display: flex;
  justify-content: center;
  align-items: center;
  background: #0b1120;
  overflow: hidden;
}

.modal-image-wrapper img {
  max-width: 100%;
  max-height: calc(90vh - 120px);
  object-fit: contain;
  display: block;
}

.modal-footer {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 16px 24px;
  background: #1e293b;
  border-top: 1px solid #334155;
  gap: 15px;
}

.modal-info p {
  font-size: 0.95rem;
  color: #94a3b8;
}

.modal-info span {
  color: #f8fafc;
  font-weight: 600;
}

.download-btn {
  background: linear-gradient(135deg, #10b981, #059669);
  color: #ffffff;
  border: none;
  padding: 10px 22px;
  font-size: 0.95rem;
  font-weight: 600;
  border-radius: 10px;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  transition: all 0.2s ease;
  text-decoration: none;
}

.download-btn:hover {
  background: linear-gradient(135deg, #34d399, #10b981);
  transform: translateY(-2px);
  box-shadow: 0 5px 15px rgba(16, 185, 129, 0.4);
}

@keyframes fadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

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

@media (max-width: 650px) {
  #search-form {
    flex-direction: column;
  }
  
  h1 {
    font-size: 2rem;
  }
  
  .modal-footer {
    flex-direction: column;
    text-align: center;
  }
  
  .download-btn {
    width: 100%;
    justify-content: center;
  }
}
