/* ============================================================
   SPACE CAMP — layout polish (desktop + mobile)
   Load after theme styles.
   ============================================================ */

/* ---- Product cards: center + with title/price ---- */
.drop-card-bottom {
  align-items: center !important;
  min-height: auto !important;
}

.drop-card-bottom > div:first-child {
  flex: 1;
  min-width: 0;
}

.add-circle {
  display: inline-grid !important;
  place-items: center !important;
  align-self: center !important;
  flex: 0 0 36px !important;
  width: 36px !important;
  height: 36px !important;
  min-width: 36px !important;
  min-height: 36px !important;
  margin: 0 !important;
  padding: 0 !important;
  font-size: 20px !important;
  font-weight: 400 !important;
  line-height: 1 !important;
  letter-spacing: 0 !important;
  text-align: center !important;
  box-sizing: border-box !important;
  -webkit-font-smoothing: antialiased;
}

button.add-circle {
  cursor: pointer;
}

span.add-circle,
.add-circle[disabled] {
  pointer-events: none;
}

.preview-card .add-circle {
  opacity: 0.85;
}

/* ---- Admin: Add product button ---- */
#openAddProduct {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  white-space: nowrap;
}

/* ---- Admin: product editor modal ---- */
.product-editor-modal {
  width: min(960px, calc(100vw - 24px)) !important;
  max-height: min(92vh, 900px) !important;
}

.product-editor-layout {
  gap: var(--space-4, 20px);
}

.product-editor-footer {
  flex-wrap: wrap;
}

.product-editor-footer .btn {
  min-height: 44px;
}

.media-url-row {
  grid-template-columns: 1fr;
}

@media (min-width: 520px) {
  .media-url-row {
    grid-template-columns: 1fr auto auto;
  }
}

/* ---- Admin: section headers ---- */
.admin-card-head-row {
  align-items: center;
}

.admin-card-head-row > .btn,
.admin-invoice-actions {
  flex-shrink: 0;
}

/* ---- Storefront: order drawer ---- */
.order-drawer {
  width: min(440px, 100%) !important;
  padding: clamp(16px, 4vw, 24px) !important;
  box-sizing: border-box;
}

.order-head {
  align-items: center !important;
}

.order-close {
  flex-shrink: 0;
  width: 44px;
  height: 44px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

/* ---- Storefront: product detail ---- */
.detail-shell {
  gap: clamp(20px, 4vw, 40px);
  padding: clamp(16px, 3vw, 24px);
  box-sizing: border-box;
}

.detail-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
}

.detail-add,
.detail-secondary {
  flex: 1 1 auto;
  min-height: 48px;
}

/* ---- Storefront: sticky filter bars ---- */
.global-vendor-tabs,
.global-type-tabs {
  -webkit-overflow-scrolling: touch;
  scrollbar-width: thin;
}

/* ---- Touch targets on cards ---- */
@media (hover: none) {
  .drop-card:hover {
    transform: none;
  }
}

/* ---- Tablet ---- */
@media (max-width: 900px) {
  .admin-card-head-row {
    flex-direction: column;
    align-items: stretch;
  }

  .admin-card-head-row > .btn,
  .admin-invoice-actions {
    width: 100%;
    justify-content: center;
  }

  .admin-invoice-actions .btn {
    flex: 1 1 auto;
  }

  .product-editor-footer {
    justify-content: stretch;
  }

  .product-editor-footer .btn {
    flex: 1 1 45%;
  }

  .detail-shell {
    grid-template-columns: 1fr !important;
  }

  .order-item {
    grid-template-columns: 52px 1fr;
    grid-template-rows: auto auto;
  }

  .order-item .order-price {
    grid-column: 1 / -1;
    display: flex;
    align-items: center;
    justify-content: space-between;
    text-align: left;
    margin-top: 4px;
    padding-top: 8px;
    border-top: 1px solid rgba(255, 255, 255, 0.1);
  }
}

/* ---- Mobile ---- */
@media (max-width: 640px) {
  .nav {
    width: min(94vw, 100%) !important;
    height: auto !important;
    min-height: 56px;
    padding: 10px 14px !important;
    top: 16px !important;
    gap: 8px;
    flex-wrap: wrap;
  }

  .nav-actions {
    gap: 8px;
    width: 100%;
    justify-content: flex-end;
  }

  .nav .order-btn {
    min-width: 0 !important;
    flex: 1 1 auto;
    max-width: 100%;
    padding: 0 12px !important;
    font-size: 11px !important;
  }

  .nav .access {
    flex: 0 1 auto;
    min-height: 40px;
    padding: 0 14px;
  }

  .logo.logo-img img {
    height: 32px !important;
    max-width: 140px !important;
  }

  .drop-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
    gap: 10px !important;
  }

  .drop-card-bottom {
    padding: 12px !important;
    gap: 10px !important;
  }

  .drop-card-bottom h3 {
    font-size: 13px !important;
  }

  .drop-card-bottom p {
    font-size: 12px !important;
    margin-top: 4px !important;
  }

  .add-circle {
    width: 32px !important;
    height: 32px !important;
    min-width: 32px !important;
    min-height: 32px !important;
    flex: 0 0 32px !important;
    font-size: 18px !important;
  }

  .order-drawer {
    max-width: 100% !important;
  }

  .order-head h2 {
    font-size: 22px !important;
  }

  .order-items {
    max-height: min(36vh, 240px);
  }

  .qty-stepper {
    flex-wrap: wrap;
  }

  .qty-slider-wrap {
    width: 100%;
    order: 3;
    flex: 1 1 100%;
  }

  .media-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .admin-savebar-inner {
    justify-content: center;
  }

  .admin-savebar-actions {
    width: 100%;
    justify-content: center;
  }

  .admin-savebar-actions .btn {
    flex: 1 1 auto;
    min-width: 0;
  }

  .preview-card {
    max-width: 100% !important;
  }

  .back-button {
    top: 12px;
    left: 12px;
  }

  #detailModal.product-detail {
    padding: 72px 12px 24px !important;
  }
}

@media (max-width: 380px) {
  .drop-grid {
    grid-template-columns: 1fr !important;
  }

  .nav-links {
    display: none;
  }
}
