/* Base layout */
*,
*::before,
*::after {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  font-family: "Inter", system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI",
    sans-serif;
  background: radial-gradient(circle at top, #ffe4e6 0, #fdf2f8 30%, #fdf2f8 60%, #f5f5f5 100%);
  color: #1f2933;
}

.page {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

.header {
  padding: 1.25rem 1.5rem;
}

.header-inner {
  max-width: 960px;
  margin: 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
}

.brand {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.brand-circle {
  width: 44px;
  height: 44px;
  border-radius: 999px;
  background: #fdf2f8;
  border: 2px solid #fbb6ce;
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: "Playfair Display", "Times New Roman", serif;
  font-size: 1.1rem;
  color: #b7791f;
}

.brand-text {
  display: flex;
  flex-direction: column;
  gap: 0.125rem;
}

.brand-title {
  font-family: "Playfair Display", "Times New Roman", serif;
  font-size: 1.1rem;
}

.brand-subtitle {
  font-size: 0.85rem;
  color: #6b7280;
}

.back-link {
  font-size: 0.9rem;
  color: #be123c;
  text-decoration: none;
  padding: 0.4rem 0.75rem;
  border-radius: 999px;
  background-color: rgba(254, 226, 226, 0.8);
  border: 1px solid rgba(248, 113, 113, 0.3);
  transition: background-color 0.15s ease, transform 0.1s ease,
    box-shadow 0.1s ease;
}

.back-link:hover {
  background-color: rgba(254, 202, 202, 0.9);
  transform: translateY(-1px);
  box-shadow: 0 4px 10px rgba(248, 113, 113, 0.25);
}

.main {
  flex: 1;
  padding: 0 1.5rem 1.5rem;
}

.card {
  max-width: 960px;
  margin: 0 auto 1.25rem;
  background: rgba(255, 255, 255, 0.9);
  border-radius: 1.25rem;
  padding: 1.5rem;
  border: 1px solid rgba(251, 207, 232, 0.7);
  box-shadow: 0 18px 45px rgba(244, 114, 182, 0.15);
}

.upload-card {
  margin-top: 0.5rem;
}

.card-title {
  margin: 0 0 0.5rem;
  font-family: "Playfair Display", "Times New Roman", serif;
  font-size: 1.6rem;
}

.card-text {
  margin: 0 0 1.25rem;
  color: #4b5563;
  font-size: 0.97rem;
}

.upload-form {
  display: flex;
  flex-wrap: wrap;
  gap: 1rem;
  align-items: center;
}

.file-input-label {
  flex: 1 1 220px;
  border-radius: 0.9rem;
  padding: 0.9rem 1.1rem;
  border: 1px dashed rgba(248, 113, 113, 0.5);
  background: rgba(254, 242, 242, 0.8);
  cursor: pointer;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
}

.file-input-title {
  display: block;
  font-weight: 600;
  margin-bottom: 0.15rem;
}

.file-input-subtitle {
  display: block;
  font-size: 0.85rem;
  color: #6b7280;
}

.file-input-label input[type="file"] {
  display: none;
}

.dropzone {
  flex: 1 1 auto;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  min-height: 140px;
}

.dropzone-hint {
  font-size: 0.8rem;
  color: #6b7280;
}

.dropzone-active .file-input-label {
  border-style: solid;
  border-color: rgba(248, 113, 113, 0.9);
  background: rgba(254, 242, 242, 1);
  box-shadow: 0 0 0 2px rgba(248, 113, 113, 0.15);
}

.preview-list {
  margin-top: 0.4rem;
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(80px, 1fr));
  gap: 0.4rem;
}

.preview-item {
  display: flex;
  flex-direction: column;
  gap: 0.15rem;
  align-items: flex-start;
}

.preview-thumb {
  width: 100%;
  height: 64px;
  border-radius: 0.5rem;
  object-fit: cover;
  background-color: #f9fafb;
}

.preview-name {
  font-size: 0.7rem;
  color: #4b5563;
  word-break: break-all;
}

.btn-primary {
  flex: 0 0 auto;
  padding: 0.8rem 1.4rem;
  border-radius: 0.9rem;
  border: none;
  background: linear-gradient(90deg, #fb7185, #ec4899);
  color: white;
  font-weight: 600;
  font-size: 0.95rem;
  cursor: pointer;
  box-shadow: 0 14px 30px rgba(244, 114, 182, 0.4);
  transition: transform 0.1s ease, box-shadow 0.1s ease,
    filter 0.1s ease;
}

.btn-primary:hover {
  transform: translateY(-1px);
  box-shadow: 0 18px 40px rgba(244, 114, 182, 0.5);
  filter: brightness(1.03);
}

.btn-primary:active {
  transform: translateY(0);
  box-shadow: 0 8px 18px rgba(244, 114, 182, 0.3);
}

.alert {
  border-radius: 0.9rem;
  padding: 0.75rem 1rem;
  font-size: 0.9rem;
  margin-bottom: 1rem;
}

.alert-error {
  background: #fef2f2;
  border: 1px solid #fecaca;
  color: #b91c1c;
}

.gallery-card {
  margin-top: 0.5rem;
}

.gallery-header {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  justify-content: space-between;
  gap: 0.5rem;
}

.gallery-count {
  font-size: 0.9rem;
  color: #6b7280;
}

.admin-filters {
  margin-top: 0.75rem;
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  align-items: center;
  font-size: 0.85rem;
  color: #6b7280;
}

.chip {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0.25rem 0.7rem;
  border-radius: 999px;
  border: 1px solid rgba(248, 113, 113, 0.35);
  background-color: rgba(254, 242, 242, 0.9);
  color: #b91c1c;
  text-decoration: none;
  font-size: 0.8rem;
}

.chip-active {
  background: linear-gradient(90deg, #fb7185, #ec4899);
  border-color: transparent;
  color: #fff;
}

.gallery-grid {
  margin-top: 1.25rem;
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
  gap: 0.75rem;
}

.gallery-item {
  margin: 0;
  border-radius: 0.9rem;
  overflow: hidden;
  background: #f9fafb;
  border: 1px solid rgba(229, 231, 235, 0.9);
  display: flex;
  flex-direction: column;
}

.gallery-item a {
  display: block;
  overflow: hidden;
}

.gallery-item img {
  display: block;
  width: 100%;
  height: 170px;
  object-fit: cover;
  transition: transform 0.3s ease;
}

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

.gallery-item-video .gallery-video {
  display: block;
  width: 100%;
  height: 170px;
  object-fit: cover;
}

.gallery-meta {
  padding: 0.5rem 0.7rem 0.6rem;
  display: flex;
  justify-content: flex-end;
}

.gallery-date {
  font-size: 0.8rem;
  color: #6b7280;
}

.gallery-empty {
  margin-top: 0.75rem;
}

.admin-grid .gallery-item {
  position: relative;
}

.gallery-item-hidden {
  opacity: 0.6;
}

.admin-thumb-wrapper {
  position: relative;
}

.admin-thumb-actions {
  position: absolute;
  top: 0.4rem;
  right: 0.4rem;
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
}

.thumb-icon-btn {
  width: 26px;
  height: 26px;
  border-radius: 999px;
  border: none;
  background: rgba(15, 23, 42, 0.75);
  color: #e5e7eb;
  font-size: 0.75rem;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
}

.thumb-icon-active {
  background: rgba(251, 191, 36, 0.95);
  color: #78350f;
}

.thumb-icon-danger {
  background: rgba(248, 113, 113, 0.95);
  color: #f9fafb;
}

.admin-meta {
  flex-direction: column;
  gap: 0.4rem;
}

.admin-meta-main {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 0.35rem;
}

.badge {
  padding: 0.15rem 0.5rem;
  border-radius: 999px;
  font-size: 0.75rem;
}

.badge-muted {
  background-color: #e5e7eb;
  color: #4b5563;
}

.badge-favorite {
  background-color: #fef3c7;
  color: #b45309;
}

.admin-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.3rem;
  justify-content: flex-end;
}

.inline-form {
  display: inline-block;
  margin: 0;
}

.btn-chip {
  border-radius: 999px;
  border: 1px solid rgba(148, 163, 184, 0.9);
  background-color: #f9fafb;
  padding: 0.25rem 0.6rem;
  font-size: 0.75rem;
  cursor: pointer;
}

.btn-chip-danger {
  border-color: rgba(248, 113, 113, 0.9);
  color: #b91c1c;
}

.btn-secondary {
  padding: 0.4rem 0.85rem;
  border-radius: 999px;
  border: 1px solid rgba(148, 163, 184, 0.9);
  background-color: #f9fafb;
  font-size: 0.85rem;
  cursor: pointer;
}

.header-actions {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.login-form {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  max-width: 320px;
}

.field {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
}

.field-label {
  font-size: 0.9rem;
  color: #4b5563;
}

.field input {
  padding: 0.55rem 0.7rem;
  border-radius: 0.7rem;
  border: 1px solid #e5e7eb;
  font-size: 0.95rem;
}

.footer {
  padding: 1.25rem 1.5rem 1.75rem;
  font-size: 0.8rem;
  color: #9ca3af;
  text-align: center;
}

/* Lightbox */
.lightbox {
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 42, 0.75);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s ease;
  z-index: 40;
}

.lightbox-open {
  opacity: 1;
  pointer-events: auto;
}

.lightbox-overlay {
  position: relative;
  width: 100%;
  height: 100%;
  display: flex;
  flex-direction: column;
}

.lightbox-body {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 240px;
}

.lightbox-media {
  max-width: 100%;
  max-height: calc(100vh - 160px);
  border-radius: 0.5rem;
}

.lightbox-topbar {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 56px;
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0 0.75rem;
  background: linear-gradient(to bottom, rgba(15, 23, 42, 0.9), transparent);
  z-index: 2;
}

.lightbox-nav {
  border: none;
  background: rgba(15, 23, 42, 0.7);
  color: #f9fafb;
  width: 40px;
  height: 40px;
  border-radius: 999px;
  cursor: pointer;
  font-size: 1.1rem;
}

.lightbox-center {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.75rem;
  padding: 3.5rem 0.75rem 3rem;
}

.lightbox-prev {
  margin-right: 0.25rem;
}

.lightbox-next {
  margin-left: 0.25rem;
}

.lightbox-bottombar {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  height: 52px;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0 0.75rem 0.75rem;
  background: linear-gradient(to top, rgba(15, 23, 42, 0.9), transparent);
  color: #e5e7eb;
  font-size: 0.8rem;
  z-index: 2;
}

.lightbox-media-wrapper {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
}

.lightbox-icon-btn {
  border: none;
  background: rgba(15, 23, 42, 0.7);
  color: #f9fafb;
  width: 36px;
  height: 36px;
  border-radius: 999px;
  cursor: pointer;
  font-size: 1.15rem;
}

.lightbox-download {
  display: block;
  padding: 0.3rem 0.9rem;
  border-radius: 0.6rem;
  background: transparent;
  color: #e5e7eb;
  font-size: 0.8rem;
  text-decoration: none;
}

.lightbox-menu {
  position: relative;
}

.lightbox-menu a {
  display: none;
}

.lightbox-menu.lightbox-menu-open a {
  display: block;
}

.lightbox-menu.lightbox-menu-open {
  position: absolute;
  right: 0;
  top: 42px;
  background: rgba(15, 23, 42, 0.95);
  border-radius: 0.6rem;
  padding: 0.25rem 0;
  box-shadow: 0 16px 40px rgba(15, 23, 42, 0.9);
}

.lightbox-menu.lightbox-menu-open a {
  padding: 0.35rem 0.9rem;
  white-space: nowrap;
}


@media (max-width: 640px) {
  .header-inner {
    flex-direction: column;
    align-items: flex-start;
  }

  .back-link {
    align-self: stretch;
    text-align: center;
  }

  .upload-form {
    flex-direction: column;
    align-items: stretch;
  }

  .btn-primary {
    width: 100%;
    text-align: center;
    justify-content: center;
  }

  .card {
    padding: 1.1rem 1rem;
    margin-bottom: 1rem;
  }

  .main {
    padding: 0 1rem 1.25rem;
  }

  .card-title {
    font-size: 1.4rem;
  }

  .gallery-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 0.5rem;
  }

  .gallery-item img,
  .gallery-item-video .gallery-video {
    height: 130px;
  }

  .lightbox-dialog {
    margin: 0 0.75rem;
  }

  .lightbox-body {
    padding: 0.5rem;
  }

  .lightbox-close {
    top: -2rem;
    right: 0.25rem;
  }

  .lightbox-nav {
    width: 32px;
    height: 32px;
  }
}