* {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: Arial, Helvetica, sans-serif;
  background: #efe7d8;
  color: #1f2933;
}

button,
.admin-back-link {
  border: none;
  border-radius: 12px;
  padding: 11px 16px;
  cursor: pointer;
  background: #1f2933;
  color: #ffffff;
  font-weight: 700;
  text-decoration: none;
}

button:hover,
.admin-back-link:hover {
  opacity: 0.9;
}

button:disabled {
  opacity: 0.55;
  cursor: not-allowed;
}

input {
  width: 100%;
  border: 1px solid #d6c8b2;
  border-radius: 12px;
  padding: 13px 14px;
  font-size: 15px;
  background: #fffdf8;
  color: #1f2933;
}

header,
.admin-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 24px 36px;
  background: #fffaf0;
  border-bottom: 1px solid #d8cab5;
}

header h1,
.admin-header h1 {
  margin: 0;
  font-size: 34px;
  letter-spacing: 0.4px;
}

.admin-header p {
  margin: 7px 0 0;
  color: #6b7280;
}

.admin-shell {
  padding: 30px 36px 80px;
}

.admin-stats {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 18px;
  margin-bottom: 24px;
}

.stat-card,
.admin-card,
.photo-card {
  background: #fffaf0;
  border: 1px solid #d8cab5;
  border-radius: 20px;
  box-shadow: 0 12px 30px rgba(60, 45, 25, 0.08);
}

.stat-card {
  padding: 22px;
}

.stat-card span {
  display: block;
  color: #7c6f5c;
  font-size: 13px;
  font-weight: 700;
  text-transform: uppercase;
  margin-bottom: 8px;
}

.stat-card strong {
  font-size: 22px;
}

.admin-grid-layout {
  display: grid;
  grid-template-columns: 1fr 1.2fr;
  gap: 22px;
  margin-bottom: 24px;
}

.admin-card {
  padding: 24px;
  margin-bottom: 24px;
}

.admin-card h2 {
  margin: 0 0 8px;
  font-size: 24px;
}

.admin-card p {
  margin: 0 0 18px;
  color: #6b7280;
  line-height: 1.45;
}

.admin-form-row {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 12px;
  align-items: center;
}

.upload-card {
  background: #fff7e8;
}

.upload-zone {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  min-height: 150px;
  border: 2px dashed #c8b28f;
  border-radius: 18px;
  background: #fffdf8;
  cursor: pointer;
  text-align: center;
  padding: 22px;
  margin-bottom: 14px;
}

.upload-zone input {
  display: none;
}

.upload-zone span {
  font-size: 18px;
  font-weight: 800;
  margin-bottom: 6px;
}

.upload-zone small {
  color: #7c6f5c;
}

.primary-wide {
  width: 100%;
  font-size: 16px;
  padding: 14px;
}

.upload-status {
  margin-top: 14px;
}

.progress-bar {
  width: 100%;
  height: 12px;
  background: #e5dcc8;
  border-radius: 999px;
  overflow: hidden;
  margin-top: 8px;
  border: 1px solid #d8cab5;
}

#progressFill {
  height: 100%;
  width: 0%;
  background: linear-gradient(90deg, #1f2933, #7c6f5c);
  transition: width 0.3s ease;
}

.admin-gallery-list > div {
  background: #fffdf8 !important;
  border: 1px solid #d8cab5 !important;
  border-radius: 16px !important;
  padding: 18px !important;
  margin-bottom: 14px !important;
}

.photo-grid,
#galleryGrid,
#adminPhotoGrid {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 18px;
  padding: 28px 36px;
}

#adminPhotoGrid {
  padding: 0;
}

.photo-card {
  overflow: hidden;
  padding: 10px;
}

.photo-card img {
  width: 100%;
  height: 210px;
  object-fit: cover;
  display: block;
  border-radius: 14px;
  cursor: pointer;
}

.photo-card-footer {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 10px;
  margin-top: 10px;
}

.photo-card-footer span {
  font-size: 14px;
  font-weight: 700;
}

.photo-card-footer button {
  padding: 8px 10px;
  font-size: 13px;
}

#cartPanel {
  position: fixed;
  top: 0;
  right: -380px;
  width: 360px;
  height: 100vh;
  background: #fffaf0;
  border-left: 1px solid #d8cab5;
  padding: 22px;
  transition: right 0.25s ease;
  z-index: 20;
  box-shadow: -8px 0 25px rgba(0, 0, 0, 0.12);
  overflow-y: auto;
}

#cartPanel.open {
  right: 0;
}

.cart-item {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  border-bottom: 1px solid #e5e7eb;
  padding: 10px 0;
  font-size: 14px;
}

.cart-item button {
  background: #8b1e1e;
  padding: 6px 8px;
  font-size: 12px;
}

#lightbox {
  position: fixed;
  inset: 0;
  background: rgba(20, 20, 20, 0.82);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 30;
  padding: 30px;
}

#lightbox.hidden {
  display: none;
}

.lightbox-card {
  max-width: 1000px;
  width: 100%;
  background: #111827;
  border-radius: 18px;
  overflow: hidden;
}

#lightboxImage,
.lightbox-card img {
  width: 100%;
  max-height: 78vh;
  object-fit: contain;
  display: block;
  background: #000000;
}

.action-banner {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 12px;
  padding: 14px;
  background: #fffaf0;
}

.admin-link {
  position: fixed;
  right: 16px;
  bottom: 16px;
  background: rgba(255, 250, 240, 0.7);
  color: #1f2933;
  text-decoration: none;
  border: 1px solid #d8cab5;
  border-radius: 999px;
  padding: 8px 12px;
  font-size: 12px;
  font-weight: 700;
  z-index: 10;
}

@media (max-width: 1100px) {
  .photo-grid,
  #galleryGrid,
  #adminPhotoGrid {
    grid-template-columns: repeat(5, 1fr);
  }

  .photo-card img {
    height: 160px;
  }

  .admin-stats,
  .admin-grid-layout {
    grid-template-columns: 1fr;
  }
}

/* ===== MOBILE GRID FIX ===== */

@media (max-width: 768px) {
  header,
  .admin-header {
    padding: 16px 14px;
  }

  header h1,
  .admin-header h1 {
    font-size: 26px;
  }

  #galleryGrid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 14px;
    padding: 12px;
  }

  .photo-card img {
    width: 100%;
    height: auto;
    aspect-ratio: 4 / 3;
    object-fit: cover;
  }

  .photo-card {
    padding: 8px;
  }

  .photo-card-footer {
    flex-direction: column;
    align-items: stretch;
  }

  .photo-card-footer button {
    width: 100%;
    min-height: 44px;
  }

  #cartPanel {
    right: -100%;
    width: 100%;
    max-width: 100%;
    padding: 18px;
    border-left: none;
  }

  #cartPanel.open {
    right: 0;
  }

  #cartPanel button,
  #paypal-button-container button {
    width: 100%;
    min-height: 46px;
    font-size: 15px;
  }

  #paypal-button-container {
    padding-bottom: 28px;
  }

  .cart-item {
    align-items: center;
  }

  .cart-item button {
    width: auto;
    min-width: 44px;
  }

  .action-banner {
    grid-template-columns: 1fr;
  }

  #lightbox {
    padding: 12px;
  }
}