:root {
  --bg-0: #05060f;
  --bg-1: #0a0e1f;
  --panel: rgba(255, 255, 255, 0.05);
  --panel-border: rgba(255, 255, 255, 0.09);
  --accent: #8b5cf6;
  --accent-2: #38bdf8;
  --accent-3: #f472b6;
  --text-hi: #f4f6ff;
  --text-lo: #9aa3c0;
  --radius: 18px;
  font-size: 16px;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  min-height: 100%;
  overflow-x: hidden;
  background: radial-gradient(ellipse 120% 80% at 50% -10%, #1a1042 0%, var(--bg-0) 55%), var(--bg-0);
  color: var(--text-hi);
  font-family: "Inter", system-ui, sans-serif;
}

#stars {
  position: fixed;
  inset: 0;
  z-index: -1;
  display: block;
}

h1, h2 { font-family: "Space Grotesk", "Inter", sans-serif; margin: 0; }

/* ---------- Header ---------- */
.site-header {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  gap: 0.4rem;
  padding: 2rem clamp(1.25rem, 5vw, 4rem) 1rem;
}

.brand { display: flex; flex-direction: column; align-items: center; gap: 0.3rem; }

.logo {
  height: 46px;
  width: auto;
  filter: drop-shadow(0 0 14px rgba(139, 92, 246, 0.45));
}

.tagline {
  margin: 0;
  color: var(--text-lo);
  font-size: 0.88rem;
  letter-spacing: 0.02em;
}

.header-actions {
  position: absolute;
  top: 2rem;
  right: clamp(1.25rem, 5vw, 4rem);
  display: flex;
  align-items: center;
  gap: 0.7rem;
}

.btn-primary {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  border: none;
  cursor: pointer;
  color: #0a0e1f;
  font-weight: 600;
  font-family: inherit;
  font-size: 0.95rem;
  padding: 0.75rem 1.3rem;
  border-radius: 999px;
  background: linear-gradient(120deg, var(--accent-2), var(--accent));
  box-shadow: 0 8px 30px -8px rgba(139, 92, 246, 0.65);
  transition: transform 0.15s ease, box-shadow 0.15s ease;
}
.btn-primary:hover { transform: translateY(-2px); box-shadow: 0 12px 34px -6px rgba(139, 92, 246, 0.8); }
.btn-primary:active { transform: translateY(0); }
.btn-primary .plus { font-size: 1.1rem; line-height: 1; }

.btn-outline {
  font-family: inherit;
  font-size: 0.88rem;
  font-weight: 500;
  color: var(--text-lo);
  background: transparent;
  border: 1px solid var(--panel-border);
  border-radius: 999px;
  padding: 0.65rem 1.1rem;
  cursor: pointer;
  transition: all 0.15s ease;
}
.btn-outline:hover {
  color: var(--text-hi);
  border-color: rgba(255,255,255,0.3);
  background: rgba(255,255,255,0.05);
}

.active-visitors {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  font-size: 0.82rem;
  color: var(--text-lo);
  padding: 0.5rem 0.9rem;
  border-radius: 999px;
  border: 1px solid var(--panel-border);
  background: rgba(255,255,255,0.03);
  white-space: nowrap;
}

.active-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #34d399;
  box-shadow: 0 0 6px rgba(52, 211, 153, 0.9);
  animation: pulse-dot 2s ease-in-out infinite;
}

@keyframes pulse-dot {
  0%, 100% { opacity: 1; transform: scale(1); }
  50% { opacity: 0.5; transform: scale(0.8); }
}

/* ---------- Empty state ---------- */
.empty-state {
  text-align: center;
  padding: 5rem 1.5rem 6rem;
  color: var(--text-lo);
}
.empty-glyph {
  font-size: 2.5rem;
  color: var(--accent-2);
  margin-bottom: 0.75rem;
  animation: twinkle 2.4s ease-in-out infinite;
}
.empty-state h2 { color: var(--text-hi); font-size: 1.3rem; margin-bottom: 0.4rem; }
.hidden { display: none !important; }

@keyframes twinkle {
  0%, 100% { opacity: 0.5; transform: scale(0.9); }
  50% { opacity: 1; transform: scale(1.1); }
}

/* ---------- Filter bar ---------- */
.filter-bar {
  display: flex;
  flex-direction: column;
  gap: 0.9rem;
  padding: 0 clamp(1.25rem, 5vw, 4rem);
  margin-top: 0.5rem;
}

.filter-row {
  display: flex;
  flex-wrap: wrap;
  gap: 0.7rem;
}

#searchInput {
  font-family: inherit;
  font-size: 0.92rem;
  color: var(--text-hi);
  background: rgba(255,255,255,0.05);
  border: 1px solid var(--panel-border);
  border-radius: 999px;
  padding: 0.6rem 1.1rem;
  outline: none;
  max-width: 320px;
  flex: 1;
  min-width: 180px;
  transition: border-color 0.15s ease, background 0.15s ease;
}
#searchInput::placeholder { color: var(--text-lo); }
#searchInput:focus { border-color: var(--accent-2); background: rgba(255,255,255,0.08); }

.sort-dropdown { position: relative; }

.select-control {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  font-family: inherit;
  font-size: 0.92rem;
  font-weight: 500;
  color: var(--text-lo);
  background-color: rgba(255,255,255,0.04);
  border: 1px solid var(--panel-border);
  border-radius: 999px;
  padding: 0.6rem 1.1rem;
  outline: none;
  cursor: pointer;
  white-space: nowrap;
  transition: all 0.15s ease;
}
.select-control:hover { color: var(--text-hi); background-color: rgba(255,255,255,0.09); }
.select-control:focus,
.select-control[aria-expanded="true"] { border-color: var(--accent-2); color: var(--text-hi); }

.chevron-icon {
  width: 13px;
  height: 13px;
  flex-shrink: 0;
  color: var(--text-lo);
  transition: transform 0.15s ease, color 0.15s ease;
}
.select-control:hover .chevron-icon,
.select-control[aria-expanded="true"] .chevron-icon { color: var(--text-hi); }
.select-control[aria-expanded="true"] .chevron-icon { transform: rotate(180deg); }

.sort-options {
  position: absolute;
  top: calc(100% + 0.5rem);
  left: 0;
  min-width: 200px;
  margin: 0;
  padding: 0.4rem;
  list-style: none;
  background: #14172c;
  border: 1px solid var(--panel-border);
  border-radius: 14px;
  box-shadow: 0 20px 50px -12px rgba(0,0,0,0.6);
  z-index: 20;
}

.sort-options li {
  font-size: 0.85rem;
  color: var(--text-lo);
  padding: 0.55rem 0.8rem;
  border-radius: 9px;
  cursor: pointer;
  transition: background 0.15s ease, color 0.15s ease;
}
.sort-options li:hover { background: rgba(255,255,255,0.08); color: var(--text-hi); }
.sort-options li[aria-selected="true"] {
  color: var(--text-hi);
  font-weight: 600;
  background: linear-gradient(120deg, rgba(56,189,248,0.18), rgba(139,92,246,0.18));
}

.category-pills {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
}

.pill {
  font-family: inherit;
  font-size: 0.82rem;
  font-weight: 500;
  color: var(--text-lo);
  background: rgba(255,255,255,0.04);
  border: 1px solid var(--panel-border);
  border-radius: 999px;
  padding: 0.4rem 0.85rem;
  cursor: pointer;
  transition: all 0.15s ease;
  white-space: nowrap;
}
.pill:hover { color: var(--text-hi); background: rgba(255,255,255,0.09); }
.pill.active {
  color: #0a0e1f;
  font-weight: 600;
  border-color: transparent;
  background: linear-gradient(120deg, var(--accent-2), var(--accent));
}

.no-results {
  text-align: center;
  color: var(--text-lo);
  padding: 2.5rem 1rem;
}

.tag-category {
  align-self: flex-start;
  background: rgba(139, 92, 246, 0.25);
  border-color: rgba(139, 92, 246, 0.4);
}

/* ---------- Footer ---------- */
.site-footer {
  text-align: center;
  padding: 2rem 1.5rem 2.5rem;
  margin-top: 1.5rem;
  border-top: 1px solid var(--panel-border);
  color: var(--text-lo);
  font-size: 0.8rem;
}
.site-footer p { margin: 0; }

/* ---------- Gallery ---------- */
.gallery {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  gap: 1.6rem;
  padding: 1.5rem clamp(1.25rem, 5vw, 4rem) 4rem;
}

.card {
  position: relative;
  border-radius: var(--radius);
  overflow: hidden;
  background: var(--panel);
  border: 1px solid var(--panel-border);
  backdrop-filter: blur(6px);
  cursor: zoom-in;
  aspect-ratio: 4 / 3;
  animation: rise 0.5s ease both;
}

@keyframes rise {
  from { opacity: 0; transform: translateY(14px); }
  to { opacity: 1; transform: translateY(0); }
}

.card img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  transition: transform 0.5s ease;
}
.card:hover img { transform: scale(1.06); }

.card-caption {
  position: absolute;
  top: 0; left: 0; right: 0;
  padding: 0.85rem 1rem 1.6rem;
  background: linear-gradient(180deg, rgba(5,6,15,0.88) 10%, rgba(5,6,15,0.55) 60%, transparent 100%);
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
  pointer-events: none;
}

.card-object {
  font-family: "Space Grotesk", sans-serif;
  font-weight: 600;
  font-size: 1.02rem;
  color: var(--text-hi);
  text-shadow: 0 2px 10px rgba(0,0,0,0.6);
}

.card-meta {
  display: flex;
  gap: 0.5rem;
  flex-wrap: wrap;
}

.tag {
  font-size: 0.72rem;
  font-weight: 500;
  padding: 0.22rem 0.6rem;
  border-radius: 999px;
  background: rgba(255,255,255,0.1);
  border: 1px solid rgba(255,255,255,0.14);
  color: var(--text-hi);
  backdrop-filter: blur(4px);
  white-space: nowrap;
}
.tag-date::before { content: "📅 "; }
.tag-exposure::before { content: "⏱ "; }
.tag-views::before { content: "👁 "; }

.card-actions {
  position: absolute;
  top: 0.7rem;
  right: 0.7rem;
  display: flex;
  gap: 0.4rem;
  opacity: 0;
  transition: opacity 0.2s ease;
}
.card:hover .card-actions { opacity: 1; }

.card-icon-btn {
  width: 30px;
  height: 30px;
  border-radius: 50%;
  border: 1px solid rgba(255,255,255,0.18);
  background: rgba(5,6,15,0.55);
  color: var(--text-hi);
  cursor: pointer;
  transition: background 0.2s ease;
  pointer-events: auto;
  font-size: 0.85rem;
}
.card-edit:hover { background: var(--accent); }
.card-delete:hover { background: #e11d48; }

/* ---------- Modal ---------- */
.modal-overlay {
  position: fixed; inset: 0;
  background: rgba(3, 4, 10, 0.72);
  backdrop-filter: blur(6px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 50;
  padding: 1.5rem;
  animation: fadeIn 0.18s ease;
}
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }

.modal.modal-sm { width: min(360px, 100%); }

.login-error {
  color: #f87171;
  font-size: 0.85rem;
  margin: -0.4rem 0 0.9rem;
}

.modal {
  position: relative;
  width: min(480px, 100%);
  max-height: 90vh;
  overflow-y: auto;
  background: linear-gradient(160deg, #14172c, #0a0d1c);
  border: 1px solid var(--panel-border);
  border-radius: 22px;
  padding: 1.8rem;
  box-shadow: 0 30px 80px -20px rgba(0,0,0,0.6);
}

.modal h2 {
  font-size: 1.25rem;
  margin-bottom: 1.2rem;
}

.modal-close {
  position: absolute;
  top: 1rem; right: 1rem;
  width: 34px; height: 34px;
  border-radius: 50%;
  border: 1px solid var(--panel-border);
  background: rgba(255,255,255,0.06);
  color: var(--text-hi);
  cursor: pointer;
  font-size: 0.9rem;
}
.modal-close:hover { background: rgba(255,255,255,0.14); }

.dropzone {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 170px;
  border-radius: 14px;
  border: 1.5px dashed rgba(255,255,255,0.22);
  background: rgba(255,255,255,0.03);
  margin-bottom: 1.1rem;
  cursor: pointer;
  overflow: hidden;
  transition: border-color 0.2s ease, background 0.2s ease;
}
.dropzone.dragover {
  border-color: var(--accent-2);
  background: rgba(56, 189, 248, 0.08);
}
.dropzone-empty {
  text-align: center;
  color: var(--text-lo);
  padding: 1.5rem;
}
.dropzone-icon { font-size: 1.8rem; display: block; margin-bottom: 0.4rem; }
.dropzone-empty p { margin: 0 0 0.2rem; color: var(--text-hi); }
.dropzone-hint { font-size: 0.78rem; }
.dropzone-preview {
  width: 100%;
  height: 170px;
  object-fit: cover;
}

.field { display: flex; flex-direction: column; gap: 0.35rem; margin-bottom: 1rem; flex: 1; }
.field-row { display: flex; gap: 0.9rem; }

.field label {
  font-size: 0.78rem;
  font-weight: 500;
  color: var(--text-lo);
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.field input,
.field select {
  font-family: inherit;
  font-size: 0.92rem;
  color: var(--text-hi);
  background: rgba(255,255,255,0.05);
  border: 1px solid var(--panel-border);
  border-radius: 10px;
  padding: 0.65rem 0.8rem;
  outline: none;
  transition: border-color 0.15s ease, background 0.15s ease;
}
.field input:focus,
.field select:focus {
  border-color: var(--accent-2);
  background: rgba(255,255,255,0.08);
}
.field input::-webkit-calendar-picker-indicator { filter: invert(1); opacity: 0.7; cursor: pointer; }

.field select {
  appearance: none;
  -webkit-appearance: none;
  -moz-appearance: none;
  cursor: pointer;
  padding-right: 2.3rem;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 20 20' fill='none' stroke='%239aa3c0' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='5 7.5 10 12.5 15 7.5'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 0.75rem center;
  background-size: 14px;
}
.field select option {
  background: #14172c;
  color: var(--text-hi);
}

.btn-submit { width: 100%; justify-content: center; margin-top: 0.4rem; padding: 0.85rem; }

/* ---------- Lightbox ---------- */
.lightbox {
  position: fixed; inset: 0;
  background: rgba(2, 3, 8, 0.92);
  z-index: 60;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 3rem 1.5rem;
  animation: fadeIn 0.18s ease;
}
.lightbox figure {
  margin: 0;
  max-width: 1100px;
  width: 100%;
}
.lightbox img {
  width: 100%;
  max-height: 74vh;
  object-fit: contain;
  border-radius: 12px;
  box-shadow: 0 30px 90px -20px rgba(0,0,0,0.7);
}
.lightbox figcaption {
  display: flex;
  gap: 0.6rem;
  flex-wrap: wrap;
  justify-content: center;
  margin-top: 1rem;
}
.tag-object {
  font-family: "Space Grotesk", sans-serif;
  font-weight: 600;
  font-size: 1rem;
  padding: 0.3rem 0.9rem;
  border-radius: 999px;
  background: linear-gradient(120deg, rgba(139,92,246,0.35), rgba(56,189,248,0.35));
  border: 1px solid rgba(255,255,255,0.16);
}
.lightbox .tag-date, .lightbox .tag-exposure {
  font-size: 0.8rem;
  padding: 0.3rem 0.8rem;
  border-radius: 999px;
  background: rgba(255,255,255,0.08);
  border: 1px solid rgba(255,255,255,0.14);
  align-self: center;
}

@media (max-width: 640px) {
  .header-actions {
    position: static;
    margin-top: 0.9rem;
    justify-content: center;
  }
}

@media (max-width: 560px) {
  .field-row { flex-direction: column; gap: 0; }
  .site-header { padding-top: 1.5rem; }
}
