* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  background: #f5f5f5;
  color: #222;
}

/* Banner */
.banner {
  background: #111;
  color: #fff;
  text-align: center;
  padding: 1.5rem;
  font-size: 1.8rem;
  font-weight: 700;
  letter-spacing: 4px;
}

/* Menu */
.menu {
  background: #222;
}

.menu ul {
  list-style: none;
  display: flex;
  justify-content: center;
  gap: 2rem;
  padding: 0.8rem;
}

.menu a {
  color: #ccc;
  text-decoration: none;
  font-size: 0.95rem;
  letter-spacing: 1px;
  text-transform: uppercase;
  transition: color 0.2s;
}

.menu a:hover,
.menu a.active {
  color: #fff;
}

/* Product Grid (storefront) */
.grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
  gap: 1.5rem;
  max-width: 1100px;
  margin: 2rem auto;
  padding: 0 1.5rem;
}

.card {
  background: #fff;
  border-radius: 8px;
  overflow: hidden;
  box-shadow: 0 1px 4px rgba(0,0,0,0.08);
  transition: transform 0.2s, box-shadow 0.2s;
  text-decoration: none;
  color: inherit;
  display: block;
}

.card:hover {
  transform: translateY(-4px);
  box-shadow: 0 6px 16px rgba(0,0,0,0.12);
}

.card img {
  width: 100%;
  height: 220px;
  object-fit: cover;
  background: #e0e0e0;
}

.card h3 {
  padding: 0.8rem 1rem 0.2rem;
  font-size: 1.1rem;
}

.card .desc {
  padding: 0 1rem;
  font-size: 0.85rem;
  color: #666;
}

.card .price {
  padding: 0.6rem 1rem 1rem;
  font-weight: 600;
  font-size: 1.05rem;
}

/* Footer */
footer {
  text-align: center;
  padding: 2rem;
  color: #999;
  font-size: 0.85rem;
}

/* ===== Product Detail ===== */
.product-detail {
  max-width: 1000px;
  margin: 2rem auto;
  padding: 0 1.5rem;
}

.back-link {
  display: inline-block;
  margin-bottom: 1.5rem;
  color: #555;
  text-decoration: none;
  font-size: 0.9rem;
}

.back-link:hover {
  color: #111;
}

.detail-layout {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 2.5rem;
  background: #fff;
  border-radius: 10px;
  overflow: hidden;
  box-shadow: 0 1px 6px rgba(0,0,0,0.08);
}

.detail-images {
  padding: 1.5rem;
}

.main-image {
  position: relative;
  cursor: pointer;
}

.main-media {
  width: 100%;
  aspect-ratio: 1;
  object-fit: cover;
  border-radius: 8px;
  background: #e0e0e0;
  display: block;
}

.zoom-hint {
  position: absolute;
  bottom: 12px;
  right: 12px;
  background: rgba(0,0,0,0.5);
  color: #fff;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.85rem;
  opacity: 0;
  transition: opacity 0.2s;
  pointer-events: none;
}

.main-image:hover .zoom-hint {
  opacity: 1;
}

.gallery-thumbs {
  display: flex;
  gap: 0.6rem;
  margin-top: 0.8rem;
  overflow-x: auto;
}

.gallery-thumb {
  width: 64px;
  height: 64px;
  object-fit: cover;
  border-radius: 6px;
  cursor: pointer;
  border: 2px solid transparent;
  opacity: 0.6;
  transition: opacity 0.2s, border-color 0.2s;
  flex-shrink: 0;
}

.gallery-thumb:hover {
  opacity: 0.85;
}

.gallery-thumb.active {
  opacity: 1;
  border-color: #111;
}

/* Lightbox */
.lightbox {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.92);
  z-index: 200;
  justify-content: center;
  align-items: center;
}

.lightbox.open {
  display: flex;
}

.lightbox-content {
  max-width: 90vw;
  max-height: 90vh;
  display: flex;
  align-items: center;
  justify-content: center;
}

.lightbox-media {
  max-width: 90vw;
  max-height: 90vh;
  object-fit: contain;
  border-radius: 4px;
}

.lightbox-close {
  position: absolute;
  top: 1rem;
  right: 1.5rem;
  background: none;
  border: none;
  color: #fff;
  font-size: 2.5rem;
  cursor: pointer;
  z-index: 201;
  line-height: 1;
  opacity: 0.7;
  transition: opacity 0.2s;
}

.lightbox-close:hover {
  opacity: 1;
}

.lightbox-prev,
.lightbox-next {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  background: rgba(255,255,255,0.1);
  border: none;
  color: #fff;
  font-size: 3rem;
  cursor: pointer;
  z-index: 201;
  padding: 0.5rem 1rem;
  line-height: 1;
  opacity: 0.7;
  transition: opacity 0.2s, background 0.2s;
  border-radius: 4px;
}

.lightbox-prev:hover,
.lightbox-next:hover {
  opacity: 1;
  background: rgba(255,255,255,0.2);
}

.lightbox-prev {
  left: 1rem;
}

.lightbox-next {
  right: 1rem;
}

.detail-info {
  padding: 2rem 2rem 2rem 0;
  display: flex;
  flex-direction: column;
  justify-content: center;
}

.detail-info h1 {
  font-size: 1.8rem;
  margin-bottom: 0.5rem;
}

.detail-price {
  font-size: 1.4rem;
  font-weight: 700;
  margin-bottom: 1rem;
  color: #111;
}

.detail-desc {
  color: #555;
  line-height: 1.6;
  margin-bottom: 1.5rem;
}

.btn-lg {
  padding: 0.8rem 2rem;
  font-size: 1rem;
  align-self: flex-start;
}

.detail-loading {
  text-align: center;
  padding: 4rem;
  color: #999;
}

/* ===== Dashboard ===== */
.dashboard {
  max-width: 1100px;
  margin: 2rem auto;
  padding: 0 1.5rem;
}

.dash-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 1.5rem;
}

.dash-header h2 {
  font-size: 1.4rem;
}

.dash-section {
  margin-top: 3rem;
}

/* Buttons */
.btn {
  border: none;
  border-radius: 6px;
  cursor: pointer;
  font-size: 0.9rem;
  padding: 0.55rem 1.1rem;
  transition: background 0.2s, transform 0.1s;
}

.btn:active {
  transform: scale(0.97);
}

.btn-add {
  background: #111;
  color: #fff;
}

.btn-add:hover {
  background: #333;
}

.btn-sm {
  padding: 0.35rem 0.7rem;
  font-size: 0.8rem;
}

.btn-edit {
  background: #e8e8e8;
  color: #333;
}

.btn-edit:hover {
  background: #d0d0d0;
}

.btn-unlist {
  background: #fff3cd;
  color: #856404;
}

.btn-unlist:hover {
  background: #ffe69c;
}

.btn-delete {
  background: #f8d7da;
  color: #842029;
}

.btn-delete:hover {
  background: #f1aeb5;
}

.btn-save {
  background: #111;
  color: #fff;
}

.btn-save:hover {
  background: #333;
}

.btn-cancel {
  background: #e8e8e8;
  color: #333;
}

.btn-cancel:hover {
  background: #d0d0d0;
}

.upload-btn {
  cursor: pointer;
}

/* Table */
.product-table {
  width: 100%;
  border-collapse: collapse;
  background: #fff;
  border-radius: 8px;
  overflow: hidden;
  box-shadow: 0 1px 4px rgba(0,0,0,0.08);
}

.product-table th,
.product-table td {
  padding: 0.75rem 1rem;
  text-align: left;
  border-bottom: 1px solid #eee;
}

.product-table th {
  background: #111;
  color: #fff;
  font-weight: 600;
  font-size: 0.85rem;
  letter-spacing: 0.5px;
  text-transform: uppercase;
}

.product-table tbody tr:hover {
  background: #fafafa;
}

.product-table tbody tr.unlisted {
  opacity: 0.5;
}

.product-table img {
  width: 50px;
  height: 50px;
  object-fit: cover;
  border-radius: 4px;
  background: #e0e0e0;
}

.actions {
  display: flex;
  gap: 0.4rem;
  white-space: nowrap;
}

/* Drag Handle */
.drag-handle {
  cursor: grab;
  color: #bbb;
  font-size: 1.1rem;
  user-select: none;
  text-align: center;
  width: 30px;
}

.drag-handle:active {
  cursor: grabbing;
}

.draggable-row.dragging {
  opacity: 0.4;
  background: #f0f0f0;
}

.draggable-row.drag-over {
  border-top: 2px solid #111;
}

/* Badges */
.badge {
  display: inline-block;
  padding: 0.2rem 0.6rem;
  border-radius: 4px;
  font-size: 0.75rem;
  font-weight: 600;
  text-transform: uppercase;
}

.badge-on {
  background: #d1e7dd;
  color: #0f5132;
}

.badge-off {
  background: #e2e3e5;
  color: #41464b;
}

/* Modal */
.modal-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.5);
  justify-content: center;
  align-items: center;
  z-index: 100;
}

.modal-overlay.open {
  display: flex;
}

.modal {
  background: #fff;
  border-radius: 10px;
  padding: 2rem;
  width: 100%;
  max-width: 460px;
  box-shadow: 0 12px 40px rgba(0,0,0,0.2);
  max-height: 90vh;
  overflow-y: auto;
}

.modal-lg {
  max-width: 700px;
}

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

.modal h4 {
  margin: 1.2rem 0 0.5rem;
  font-size: 0.95rem;
  color: #444;
}

.modal label {
  display: block;
  margin-bottom: 0.8rem;
  font-size: 0.85rem;
  font-weight: 600;
  color: #555;
}

.modal input,
.modal textarea {
  display: block;
  width: 100%;
  margin-top: 0.3rem;
  padding: 0.55rem 0.7rem;
  border: 1px solid #ccc;
  border-radius: 6px;
  font-size: 0.95rem;
  font-family: inherit;
}

.modal input:focus,
.modal textarea:focus {
  outline: none;
  border-color: #111;
}

.modal-actions {
  display: flex;
  justify-content: flex-end;
  gap: 0.6rem;
  margin-top: 1.2rem;
}

/* Photo Library */
.photo-library {
  display: flex;
  flex-wrap: wrap;
  gap: 0.8rem;
  padding: 1rem;
  background: #fff;
  border-radius: 8px;
  box-shadow: 0 1px 4px rgba(0,0,0,0.08);
  min-height: 80px;
}

.lib-photo {
  position: relative;
  width: 100px;
  height: 100px;
}

.lib-photo img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  border-radius: 6px;
  background: #e0e0e0;
}

.lib-delete {
  position: absolute;
  top: -6px;
  right: -6px;
  width: 22px;
  height: 22px;
  padding: 0;
  font-size: 0.7rem;
  line-height: 1;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
}

.no-photo {
  color: #aaa;
  font-size: 0.85rem;
  font-style: italic;
}

/* Photo Manager in Modal */
.current-thumb {
  display: flex;
  align-items: center;
  gap: 0.8rem;
  padding: 0.5rem;
  background: #fafafa;
  border-radius: 6px;
  min-height: 60px;
}

.current-thumb img {
  width: 60px;
  height: 60px;
  object-fit: cover;
  border-radius: 4px;
}

.supp-photos {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  padding: 0.5rem;
  background: #fafafa;
  border-radius: 6px;
  min-height: 50px;
}

.supp-photo {
  position: relative;
  width: 60px;
  height: 60px;
}

.supp-photo img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  border-radius: 4px;
}

.supp-photo .btn-delete {
  position: absolute;
  top: -5px;
  right: -5px;
  width: 20px;
  height: 20px;
  padding: 0;
  font-size: 0.65rem;
  line-height: 1;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
}

.assign-library {
  display: flex;
  flex-wrap: wrap;
  gap: 0.6rem;
  max-height: 250px;
  overflow-y: auto;
  padding: 0.5rem;
  background: #fafafa;
  border-radius: 6px;
}

.assign-photo {
  width: 80px;
  text-align: center;
}

.assign-photo img {
  width: 80px;
  height: 80px;
  object-fit: cover;
  border-radius: 4px;
  border: 2px solid transparent;
}

.assign-photo.is-thumb img {
  border-color: #f0ad4e;
}

.assign-photo.is-added img {
  border-color: #5cb85c;
}

.assign-actions {
  display: flex;
  flex-direction: column;
  gap: 2px;
  margin-top: 3px;
}

.assign-actions .btn {
  padding: 2px 4px;
  font-size: 0.65rem;
}

/* ===== Contact Page ===== */
.contact-page {
  max-width: 600px;
  margin: 3rem auto;
  padding: 0 1.5rem;
}

.contact-card {
  background: #fff;
  border-radius: 10px;
  padding: 2.5rem;
  text-align: center;
  box-shadow: 0 1px 6px rgba(0,0,0,0.08);
}

.contact-avatar {
  width: 160px;
  height: 160px;
  border-radius: 50%;
  object-fit: cover;
  margin-bottom: 1.2rem;
  border: 3px solid #eee;
}

.contact-name {
  font-size: 1.6rem;
  margin-bottom: 0.4rem;
}

.contact-bio {
  color: #666;
  font-size: 0.95rem;
  margin-bottom: 2rem;
}

.social-links {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 1rem;
}

.social-link {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.7rem 1.2rem;
  background: #111;
  color: #fff;
  border-radius: 8px;
  text-decoration: none;
  font-size: 0.9rem;
  font-weight: 500;
  transition: background 0.2s, transform 0.15s;
}

.social-link:hover {
  background: #333;
  transform: translateY(-2px);
}

.social-icon {
  width: 20px;
  height: 20px;
  flex-shrink: 0;
}

/* Responsive */
@media (max-width: 768px) {
  .detail-layout {
    grid-template-columns: 1fr;
  }

  .detail-info {
    padding: 1.5rem;
  }
}
