* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  font-family: Inter, system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  color: #e2e8f0;
  background: radial-gradient(circle at 20% 10%, rgba(96, 165, 250, 0.18) 0%, transparent 22%), radial-gradient(circle at 80% 20%, rgba(168, 85, 247, 0.15) 0%, transparent 18%), radial-gradient(circle at 50% 40%, rgba(59, 130, 246, 0.12) 0%, transparent 20%), #050816;
  background-attachment: fixed;
}

a {
  color: inherit;
  text-decoration: none;
}

button,
input,
textarea {
  font: inherit;
}

.topbar {
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: flex-start;
  gap: 1rem;
  padding: 1rem;
  background: rgba(10, 15, 31, 0.9);
  color: #f8fafc;
  border-bottom: 1px solid rgba(148, 163, 184, 0.12);
  backdrop-filter: blur(10px);
}

.topbar > div:first-child {
  width: 100%;
}

.topbar h1 {
  margin: 0 0 0.25rem;
  font-size: 1.5rem;
}

.topbar p {
  margin: 0;
  max-width: 100%;
  color: #cbd5e1;
  font-size: 0.85rem;
}

.topbar-buttons {
  display: flex;
  gap: 0.5rem;
  align-items: center;
  width: 100%;
  flex-wrap: wrap;
}

@media (min-width: 768px) {
  .topbar {
    flex-direction: row;
    justify-content: space-between;
    padding: 1.5rem;
    gap: 1rem;
  }

  .topbar > div:first-child {
    width: auto;
  }

  .topbar h1 {
    font-size: clamp(1.6rem, 2vw, 2.2rem);
  }

  .topbar p {
    font-size: 1rem;
    max-width: 38rem;
  }

  .topbar-buttons {
    gap: 0.75rem;
    width: auto;
  }
}

.page-body {
  width: min(1120px, calc(100% - 2rem));
  margin: 2rem auto 3rem;
}

.search-panel {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  margin-bottom: 1.5rem;
}

.search-panel input {
  width: 100%;
  padding: 0.95rem 1.1rem;
  border: 1px solid rgba(148, 163, 184, 0.24);
  border-radius: 14px;
  background: rgba(15, 23, 42, 0.95);
  color: #e2e8f0;
  outline: none;
  box-shadow: inset 0 0 0 1px rgba(148, 163, 184, 0.08);
  font-size: 1rem;
}

@media (min-width: 640px) {
  .search-panel {
    flex-direction: row;
    align-items: center;
    gap: 1rem;
  }

  .search-panel input {
    flex: 1;
    min-width: 220px;
  }
}

.upload-panel {
  margin-bottom: 1.8rem;
  padding: 1.75rem;
  border-radius: 28px;
  background: rgba(8, 13, 28, 0.92);
  border: 1px solid rgba(148, 163, 184, 0.12);
  box-shadow: 0 24px 60px rgba(15, 23, 42, 0.35);
}

.upload-panel h2 {
  margin: 0 0 0.5rem;
  color: #f8fafc;
}

.upload-panel p {
  margin: 0 0 1rem;
  color: #94a3b8;
}

.upload-form {
  display: grid;
  gap: 0.9rem;
  grid-template-columns: 1fr;
}

.upload-form input,
.upload-form input[type='file'] {
  width: 100%;
  border: 1px solid rgba(148, 163, 184, 0.16);
  border-radius: 14px;
  padding: 0.95rem 1rem;
  background: rgba(15, 23, 42, 0.95);
  color: #e2e8f0;
  font-size: 1rem;
}

.upload-form button {
  white-space: nowrap;
  align-self: stretch;
  padding: 1rem;
}

@media (min-width: 768px) {
  .upload-form {
    grid-template-columns: minmax(140px, 1fr) minmax(180px, 1fr) minmax(180px, 1fr) auto;
  }
}

.photo-card {
  display: block;
  width: 100%;
  border: 1px solid rgba(148, 163, 184, 0.15);
  padding: 0;
  text-align: left;
  border-radius: 24px;
  overflow: hidden;
  background: rgba(12, 18, 35, 0.92);
  backdrop-filter: blur(8px);
  box-shadow: 0 20px 40px rgba(15, 23, 42, 0.32);
  cursor: pointer;
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.photo-card:hover,
.photo-card:focus-visible {
  transform: translateY(-3px);
  box-shadow: 0 28px 60px rgba(15, 23, 42, 0.44);
}

.photo-card img {
  width: 100%;
  display: block;
  aspect-ratio: 4 / 3;
  object-fit: cover;
}

.photo-name {
  padding: 0.95rem 1rem 1.1rem;
  font-weight: 600;
  color: #f8fafc;
}

.gallery {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
  gap: 0.9rem;
}

@media (min-width: 640px) {
  .gallery {
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 1rem;
  }
}

@media (min-width: 1024px) {
  .gallery {
    grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
    gap: 1.2rem;
  }
}

.modal {
  position: fixed;
  inset: 0;
  display: grid;
  place-items: center;
  background: rgba(15, 23, 42, 0.7);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s ease;
}

.modal.visible {
  opacity: 1;
  pointer-events: auto;
}

.modal-content {
  width: min(92vw, 820px);
  max-height: 92vh;
  overflow: auto;
  background: rgba(8, 12, 23, 0.98);
  border-radius: 20px;
  padding: 1rem;
  position: relative;
  border: 1px solid rgba(148, 163, 184, 0.15);
}

@media (min-width: 640px) {
  .modal-content {
    border-radius: 24px;
    padding: 1.25rem;
  }
}

.close-button {
  position: absolute;
  top: 1rem;
  right: 1rem;
  border: none;
  width: 2.5rem;
  height: 2.5rem;
  border-radius: 50%;
  background: rgba(15, 23, 42, 0.95);
  color: #fff;
  cursor: pointer;
  font-size: 1.3rem;
}

.modal-content img {
  width: 100%;
  border-radius: 18px;
  display: block;
  margin-bottom: 1rem;
}

.modal-content p {
  margin: 0 0 1rem;
  font-weight: 700;
  color: #f8fafc;
}

.download-button,
.button,
.link-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  padding: 0.9rem 1.3rem;
  border-radius: 999px;
  border: none;
  cursor: pointer;
  transition: transform 0.15s ease, background-color 0.15s ease, box-shadow 0.15s ease;
  text-decoration: none;
}

.download-button,
.button {
  background: linear-gradient(135deg, #4f46e5, #2563eb);
  color: #fff;
  box-shadow: 0 12px 30px rgba(37, 99, 235, 0.28);
}

.download-button:hover,
.button:hover,
.link-button:hover {
  transform: translateY(-1px);
}

.button.secondary,
.link-button {
  background: rgba(255, 255, 255, 0.06);
  color: #e2e8f0;
  border: 1px solid rgba(148, 163, 184, 0.18);
}

.button.danger {
  background: #dc2626;
  color: #fff;
}

@media (max-width: 480px) {
  .upload-panel {
    margin-bottom: 1.5rem;
    padding: 1.25rem;
    border-radius: 20px;
  }

  .button,
  .download-button {
    padding: 0.85rem 1.2rem;
    font-size: 0.95rem;
  }

  .modal-content {
    width: 95vw;
  }
}

.admin-page {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 2rem;
  background: radial-gradient(circle at 10% 10%, rgba(168, 85, 247, 0.12) 0%, transparent 20%), #050816;
}

.admin-card {
  width: min(760px, 100%);
  background: rgba(8, 12, 23, 0.96);
  border-radius: 28px;
  padding: 2rem;
  box-shadow: 0 24px 60px rgba(15, 23, 42, 0.32);
  border: 1px solid rgba(148, 163, 184, 0.14);
}

.admin-card h1,
.admin-card h2 {
  margin-top: 0;
}

.admin-form,
.admin-section {
  display: grid;
  gap: 0.9rem;
}

.admin-form input,
.admin-section input,
.admin-section textarea {
  width: 100%;
  border: 1px solid #cbd5e1;
  border-radius: 14px;
  padding: 0.95rem 1rem;
  background: #fff;
  color: #111827;
}

textarea {
  resize: vertical;
  min-height: 120px;
}

.admin-photo-list {
  list-style: none;
  padding: 0;
  margin: 0;
  display: grid;
  gap: 0.9rem;
}

.admin-photo-item {
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  align-items: center;
  padding: 1rem 1.1rem;
  border-radius: 18px;
  border: 1px solid #e2e8f0;
  background: #f8fafc;
}

.admin-photo-item span {
  font-weight: 600;
}

.admin-photo-item a,
.admin-photo-item button {
  margin-left: 0.75rem;
}

.admin-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.9rem;
  margin-top: 1rem;
}

.status-message {
  margin: 0.75rem 0 0;
  color: #2563eb;
}

.small-note {
  margin: 0.5rem 0 0;
  color: #475569;
}

.empty-state {
  padding: 2rem;
  text-align: center;
  color: #64748b;
  background: #f8fafc;
  border-radius: 20px;
}

.page-body {
  width: min(1120px, calc(100% - 2rem));
  margin: 1rem auto 2rem;
}

@media (min-width: 640px) {
  .page-body {
    margin: 2rem auto 3rem;
  }
}

@media (max-width: 480px) {
  .upload-panel {
    margin-bottom: 1.5rem;
    padding: 1.25rem;
    border-radius: 20px;
  }

  .modal-content {
    border-radius: 20px;
    padding: 1rem;
  }

  .button,
  .download-button {
    padding: 0.85rem 1.2rem;
    font-size: 0.95rem;
  }
}
