/* ==========================================================================
   ScentCity — store extensions (cart, dynamic products, admin)
   Builds on design tokens from style.css
   ========================================================================== */

/* ---------------------------------------------------------------- cart toggle */

.cart-toggle {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  font-family: var(--font-body);
  font-weight: 600;
  font-size: 0.92rem;
  color: var(--plum-950);
  background: transparent;
  border: 1.5px solid var(--plum-300);
  border-radius: 999px;
  padding: 0.5rem 1rem 0.5rem 0.8rem;
  cursor: pointer;
  transition: border-color 0.25s var(--ease), background 0.25s var(--ease);
  position: relative;
}
.cart-toggle:hover { border-color: var(--plum-900); background: var(--plum-050); }
.cart-toggle svg { width: 18px; height: 18px; display: block; }
.cart-toggle .cart-txt { display: inline; }
@media (max-width: 480px) { .cart-toggle .cart-txt { display: none; } }
@media (min-width: 881px) { .cart-toggle { margin-left: 0.4rem; } }
.cart-toggle .cart-count {
  background: var(--plum-900);
  color: var(--white);
  border-radius: 999px;
  min-width: 20px;
  height: 20px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 0.72rem;
  font-weight: 700;
  padding: 0 5px;
}
.cart-toggle .cart-count.is-zero { background: var(--plum-300); }

/* ---------------------------------------------------------------- drawer + overlay */

.cart-overlay {
  position: fixed;
  inset: 0;
  background: rgba(20, 12, 34, 0.5);
  backdrop-filter: blur(2px);
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.3s var(--ease), visibility 0.3s;
  z-index: 90;
}
.cart-overlay.is-open { opacity: 1; visibility: visible; }

.cart-drawer {
  position: fixed;
  top: 0;
  right: 0;
  bottom: 0;
  width: min(430px, 100vw);
  background: var(--white);
  z-index: 95;
  transform: translateX(105%);
  transition: transform 0.36s var(--ease);
  display: flex;
  flex-direction: column;
  box-shadow: -24px 0 60px -30px rgba(36, 26, 59, 0.45);
}
.cart-drawer.is-open { transform: translateX(0); }

.cart-drawer-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 1.2rem 1.5rem;
  border-bottom: 1px solid rgba(36, 26, 59, 0.08);
}
.cart-drawer-header h3 { margin: 0; font-size: 1.25rem; }
.drawer-close {
  background: none;
  border: none;
  cursor: pointer;
  color: var(--ink-soft);
  font-size: 1.6rem;
  line-height: 1;
  padding: 4px 8px;
}
.drawer-close:hover { color: var(--plum-950); }

.cart-drawer-body {
  flex: 1;
  overflow-y: auto;
  padding: 1.2rem 1.5rem 1.6rem;
}

/* ---------------------------------------------------------------- cart items */

.cart-item {
  display: grid;
  grid-template-columns: auto 1fr auto;
  gap: 0.9rem;
  align-items: center;
  padding: 0.9rem 0;
  border-bottom: 1px dashed rgba(36, 26, 59, 0.12);
}
.cart-item .ci-art svg { width: 34px; height: auto; color: var(--plum-900); }
.cart-item .ci-info h4 { font-size: 0.98rem; margin: 0 0 0.15em; }
.cart-item .ci-info span { font-size: 0.84rem; color: var(--ink-soft); }
.cart-item .ci-foot {
  display: flex;
  align-items: center;
  gap: 0.9rem;
  font-weight: 700;
  color: var(--plum-950);
}

.qty-stepper {
  display: inline-flex;
  align-items: center;
  border: 1px solid rgba(36, 26, 59, 0.18);
  border-radius: 999px;
}
.qty-stepper button {
  background: none;
  border: none;
  cursor: pointer;
  width: 28px;
  height: 28px;
  font-size: 1rem;
  color: var(--plum-900);
  border-radius: 50%;
}
.qty-stepper button:hover { background: var(--plum-050); }
.qty-stepper span { min-width: 24px; text-align: center; font-weight: 600; font-size: 0.92rem; }

.cart-remove {
  background: none;
  border: none;
  color: rgba(36, 26, 59, 0.35);
  cursor: pointer;
  font-size: 0.78rem;
  text-decoration: underline;
  padding: 2px 0;
}
.cart-remove:hover { color: #b3261e; }

.cart-empty {
  text-align: center;
  padding: 3rem 1rem;
  color: var(--ink-soft);
}
.cart-empty svg { width: 54px; height: auto; color: var(--plum-300); margin-bottom: 1rem; }

.cart-subtotal {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-family: var(--font-display);
  color: var(--plum-950);
  font-size: 1.3rem;
  font-weight: 600;
  padding: 1.2rem 0 0.4rem;
}

.cart-drawer-footer {
  padding: 1.1rem 1.5rem 1.5rem;
  border-top: 1px solid rgba(36, 26, 59, 0.08);
}
.cart-drawer-footer .btn { width: 100%; justify-content: center; font-size: 1.02rem; padding: 1em 1.6em; }
.cart-drawer-footer .hint {
  font-size: 0.8rem;
  color: var(--ink-soft);
  text-align: center;
  margin: 0.8rem 0 0;
}

.cart-toast {
  position: fixed;
  left: 50%;
  bottom: 28px;
  transform: translateX(-50%) translateY(20px);
  background: var(--plum-950);
  color: var(--white);
  padding: 0.8rem 1.3rem;
  border-radius: 999px;
  font-size: 0.92rem;
  font-weight: 600;
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.3s var(--ease), transform 0.3s var(--ease), visibility 0.3s;
  z-index: 98;
  box-shadow: 0 12px 30px -12px rgba(20, 12, 34, 0.6);
}
.cart-toast.is-visible { opacity: 1; visibility: visible; transform: translateX(-50%) translateY(0); }

/* ---------------------------------------------------------------- checkout / success */

.checkout-pane h4 { margin: 1.1rem 0 0.5rem; font-size: 1.02rem; }
.checkout-pane .back-link {
  font-size: 0.86rem;
  color: var(--plum-900);
  border-bottom: 1px solid var(--plum-900);
  cursor: pointer;
  background: none;
  border-top: none; border-left: none; border-right: none;
  font-family: var(--font-body);
  font-weight: 600;
  padding: 0;
  margin-bottom: 0.8rem;
}

.order-success { text-align: center; padding: 2.4rem 0.6rem 1rem; }
.order-success .tick {
  width: 64px; height: 64px;
  border-radius: 50%;
  background: var(--plum-050);
  border: 1px solid var(--plum-300);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 1.1rem;
}
.order-success h4 { font-size: 1.25rem; }
.order-success .btn { margin-top: 0.4rem; }

.store-btn-row { display: flex; gap: 0.6rem; margin-top: 0.7rem; }
.store-btn-row .btn { flex: 1; }

/* ---------------------------------------------------------------- product card actions */

.product-actions {
  display: flex;
  align-items: center;
  gap: 0.7rem;
  margin-top: 1rem;
  flex-wrap: wrap;
}
.product-actions .btn { padding: 0.6em 1.15em; font-size: 0.86rem; }
.product-actions .wa-link {
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--plum-900);
  border-bottom: 1px solid var(--plum-900);
}

.product-loading, .products-error {
  text-align: center;
  padding: 3rem 0;
  color: var(--ink-soft);
}
.products-error { color: #b3261e; }

/* ---------------------------------------------------------------- admin shell */

.admin-shell {
  --side-w: 236px;
  min-height: 100vh;
  display: grid;
  grid-template-columns: var(--side-w) 1fr;
}
.admin-side {
  background: var(--plum-950);
  color: var(--white);
  padding: 1.6rem 1rem;
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
}
.admin-side .admin-brand {
  font-family: var(--font-display);
  font-size: 1.25rem;
  font-weight: 600;
  padding: 0 0.8rem 1.2rem;
  border-bottom: 1px solid rgba(255,255,255,0.12);
  margin-bottom: 1rem;
  display: flex; align-items: center; gap: 10px;
}
.admin-side .admin-brand img { width: 26px; height: auto; }
.admin-side button {
  background: none; border: none; cursor: pointer;
  color: rgba(255,255,255,0.72);
  font-family: var(--font-body);
  font-size: 0.96rem;
  font-weight: 600;
  text-align: left;
  padding: 0.7rem 0.8rem;
  border-radius: var(--radius-s);
  transition: background 0.2s, color 0.2s;
}
.admin-side button:hover { background: rgba(255,255,255,0.08); color: var(--white); }
.admin-side button.is-active { background: var(--brass); color: var(--plum-950); }
.admin-side .logout { margin-top: auto; }

.admin-main {
  background: var(--plum-050);
  padding: 2rem clamp(1rem, 3vw, 2.5rem) 3rem;
  overflow-x: hidden;
}
.admin-main h1 { font-size: clamp(1.7rem, 2.4vw, 2.3rem); margin-bottom: 1.4rem; }

.stats-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 1rem;
  margin-bottom: 2rem;
}
.stat-card {
  background: var(--white);
  border: 1px solid rgba(36,26,59,0.08);
  border-radius: var(--radius-m);
  padding: 1.15rem 1.3rem;
}
.stat-card .stat-label { font-size: 0.8rem; font-weight: 600; color: var(--ink-soft); text-transform: uppercase; letter-spacing: 0.05em; }
.stat-card .stat-value { font-family: var(--font-display); font-size: 1.55rem; font-weight: 600; color: var(--plum-950); margin-top: 0.2rem; }

@media (max-width: 960px) {
  .stats-grid { grid-template-columns: 1fr 1fr; }
  .admin-shell { grid-template-columns: 1fr; }
  .admin-side { flex-direction: row; align-items: center; flex-wrap: wrap; padding: 0.9rem 1rem; }
  .admin-side .admin-brand { border-bottom: none; margin-bottom: 0; padding: 0 0.6rem 0 0; }
  .admin-side .logout { margin-top: 0; margin-left: auto; }
  .admin-side button { padding: 0.5rem 0.7rem; }
}

/* admin tables */
.admin-card {
  background: var(--white);
  border: 1px solid rgba(36,26,59,0.08);
  border-radius: var(--radius-m);
  overflow: hidden;
  margin-bottom: 1.6rem;
}
.admin-card .card-head {
  display: flex; align-items: center; justify-content: space-between; gap: 1rem;
  padding: 1rem 1.3rem;
  border-bottom: 1px solid rgba(36,26,59,0.08);
  flex-wrap: wrap;
}
.admin-card .card-head h2 { font-size: 1.15rem; margin: 0; }
.admin-toolbar { display: flex; gap: 0.6rem; align-items: center; flex-wrap: wrap; }
.admin-toolbar select, .admin-toolbar input {
  font-family: var(--font-body);
  font-size: 0.9rem;
  padding: 0.5rem 0.7rem;
  border: 1px solid rgba(36,26,59,0.2);
  border-radius: var(--radius-s);
  background: var(--white);
}
.data-table { width: 100%; border-collapse: collapse; font-size: 0.92rem; }
.data-table th, .data-table td { text-align: left; padding: 0.8rem 1rem; border-bottom: 1px solid rgba(36,26,59,0.07); vertical-align: middle; }
.data-table th { font-size: 0.72rem; text-transform: uppercase; letter-spacing: 0.06em; color: var(--ink-soft); }
.data-table tr:hover td { background: var(--plum-050); }
.data-table .row-actions { display: flex; gap: 0.5rem; }
.data-table .row-actions button {
  background: none; border: none; cursor: pointer;
  font-size: 0.82rem; font-weight: 600;
  color: var(--plum-900);
  padding: 2px 0;
}
.data-table .row-actions button.danger { color: #b3261e; }
.status-pill { display: inline-block; padding: 0.2rem 0.65rem; border-radius: 999px; font-size: 0.75rem; font-weight: 700; }
.status-new        { background: #EEDEFF; color: #5B2A9E; }
.status-confirmed  { background: #FFE9C9; color: #8A5A00; }
.status-packed     { background: #E3F2FD; color: #0B5C8A; }
.status-shipped    { background: #E0F2F1; color: #0A6C5E; }
.status-delivered  { background: #DFF5E1; color: #1B6B2A; }
.status-cancelled  { background: #FDE0E0; color: #A11B1B; }
.status-select {
  font-family: var(--font-body);
  font-size: 0.84rem;
  padding: 0.28rem 0.5rem;
  border: 1px solid rgba(36,26,59,0.2);
  border-radius: var(--radius-s);
}

.tag-row { display: flex; gap: 0.45rem; flex-wrap: wrap; }
.mini-flag { font-size: 0.7rem; font-weight: 700; padding: 0.15rem 0.5rem; border-radius: 6px; background: var(--plum-050); color: var(--plum-900); }
.mini-flag.off { background: #2A2138; color: rgba(255,255,255,0.7); }

.admin-empty { text-align: center; padding: 3rem 1rem; color: var(--ink-soft); }

/* orders detail */
.order-detail {
  border-top: 1px dashed rgba(36,26,59,0.18);
  background: var(--plum-050);
  padding: 1.1rem 1.3rem;
  font-size: 0.92rem;
}
.order-detail dl { display: grid; grid-template-columns: 130px 1fr; gap: 0.35rem 0.8rem; margin: 0; }
.order-detail dt { font-weight: 700; color: var(--plum-950); }
.order-detail dd { margin: 0; color: var(--ink); }

/* modal */
.modal-backdrop {
  position: fixed; inset: 0;
  background: rgba(20,12,34,0.55);
  display: flex; align-items: center; justify-content: center;
  z-index: 96; padding: 1rem;
}
.modal {
  background: var(--white);
  border-radius: var(--radius-l);
  width: min(560px, 100%);
  max-height: 92vh;
  overflow-y: auto;
  padding: 1.6rem 1.8rem;
}
.modal h2 { font-size: 1.4rem; }
.modal .form-row { margin-bottom: 1rem; }
.modal .switches { display: flex; gap: 1.6rem; flex-wrap: wrap; }
.modal .switches label { display: flex; gap: 0.4rem; align-items: center; font-size: 0.92rem; }

.admin-btn {
  font-family: var(--font-body);
  font-weight: 600;
  font-size: 0.9rem;
  border: 1px solid var(--plum-900);
  background: var(--plum-900);
  color: var(--white);
  border-radius: 999px;
  padding: 0.55em 1.2em;
  cursor: pointer;
}
.admin-btn.ghost { background: var(--white); color: var(--plum-900); }
.admin-btn.small { padding: 0.4em 0.9em; font-size: 0.82rem; }
.admin-btn.danger { border-color: #b3261e; background: #b3261e; }
.admin-btn:hover { transform: translateY(-1px); }

/* login view */
.login-wrap {
  min-height: 100vh;
  display: grid;
  place-items: center;
  background: var(--plum-050);
  padding: 1.5rem;
}
.login-card {
  width: min(400px, 100%);
  background: var(--white);
  border: 1px solid rgba(36,26,59,0.08);
  border-radius: var(--radius-l);
  padding: 2.2rem 2.2rem 2rem;
  box-shadow: 0 30px 60px -40px rgba(36,26,59,0.5);
}
.login-card .login-brand { display: flex; align-items: center; gap: 10px; margin-bottom: 1.4rem; }
.login-card .login-brand img { width: 30px; }
.login-card .login-brand span { font-family: var(--font-display); font-size: 1.35rem; font-weight: 600; color: var(--plum-950); }
.inline-error { background: #FDE0E0; color: #A11B1B; border-radius: var(--radius-s); padding: 0.6rem 0.9rem; font-size: 0.86rem; margin-bottom: 1rem; }

/* small utilities (inherit existing .form-row styles where present) */
.form-row input, .form-row select, .form-row textarea {
  font-family: var(--font-body);
  padding: 0.7rem 0.9rem;
  border: 1px solid rgba(36,26,59,0.22);
  border-radius: var(--radius-s);
  width: 100%;
  background: var(--white);
  font-size: 0.95rem;
  transition: border-color 0.2s;
}
.form-row input:focus, .form-row select:focus, .form-row textarea:focus {
  outline: none;
  border-color: var(--plum-700);
  box-shadow: 0 0 0 3px rgba(105, 72, 168, 0.12);
}
.form-row label { display: block; font-weight: 600; font-size: 0.86rem; margin-bottom: 0.35rem; color: var(--plum-950); }
.form-row .required::after { content: " *"; color: #b3261e; }

canvas-recaptcha { display: none; }

/* ==========================================================================
   Premium layer — real photography + sophisticated motion
   ========================================================================== */

/* ------- product cards: image-first, cinematic hover ------- */

.product-art {
  position: relative;
  overflow: hidden;
  background: linear-gradient(160deg, var(--plum-050) 0%, #F3EEFB 55%, #E7DDF6 100%);
  min-height: 220px;
  padding: 0;
}
.product-art img.product-img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  transform: scale(1.001);
  filter: saturate(1.04);
  transition: transform 0.9s cubic-bezier(0.22, 1, 0.36, 1), filter 0.6s ease;
}
.product-card:hover .product-art img.product-img {
  transform: scale(1.07) rotate(0.4deg);
  filter: saturate(1.12);
}
.product-art.art-empty { background: linear-gradient(160deg, var(--plum-050), #EAE0F8); }
.product-art svg { color: var(--plum-900); width: 64px; height: auto; }
.product-art svg.art-fallback { margin: 64px 0; }

/* soft inner vignette + reveal on hover for depth */
.product-art::after {
  content: "";
  position: absolute;
  inset: 0;
  pointer-events: none;
  background:
    radial-gradient(120% 90% at 50% 0%, transparent 62%, rgba(28, 15, 46, 0.18) 100%),
    linear-gradient(to bottom, rgba(28, 15, 46, 0) 70%, rgba(28, 15, 46, 0.12) 100%);
  opacity: 0.5;
  transition: opacity 0.5s ease;
}
.product-card:hover .product-art::after { opacity: 0.85; }

.product-card {
  position: relative;
  transition: transform 0.5s cubic-bezier(0.22, 1, 0.36, 1), box-shadow 0.5s cubic-bezier(0.22, 1, 0.36, 1);
}
.product-card:hover {
  transform: translateY(-8px);
  box-shadow: 0 34px 60px -30px rgba(36, 26, 59, 0.5);
}

/* ------- cart thumbnails ------- */

.ci-art {
  grid-area: art;
  width: 56px;
  height: 70px;
  border-radius: 12px;
  overflow: hidden;
  background: linear-gradient(160deg, var(--plum-050), #EFE7FA);
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 8px 20px -8px rgba(36, 26, 59, 0.45);
}
.ci-art svg { color: var(--plum-900); width: 22px; height: auto; }
.ci-img { width: 100%; height: 100%; object-fit: cover; display: block; }
.ci-art-ph { width: 100%; height: 100%; display: grid; place-items: center; font-size: 1.2rem; color: var(--plum-400); }

/* ------- scroll reveal ------- */

.reveal-init { opacity: 0; transform: translateY(26px); }
.reveal-in   { opacity: 1; transform: translateY(0); transition: opacity 0.8s cubic-bezier(0.22, 1, 0.36, 1), transform 0.8s cubic-bezier(0.22, 1, 0.36, 1); }
@media (prefers-reduced-motion: reduce) {
  .reveal-init { opacity: 1; transform: none; }
  .product-card, .product-card:hover { transform: none; }
}

/* ------- card body polish ------- */

.product-body h3 { transition: color 0.3s ease; }
.product-card:hover .product-body h3 { color: var(--plum-800); }
.product-tag { letter-spacing: 0.02em; }

/* ==========================================================================
   Mobile refinements (store + admin)
   ========================================================================== */

@media (max-width: 760px) {
  /* Admin data tables: keep columns intact, scroll the table itself */
  .data-table { display: block; overflow-x: auto; }
  .data-table th, .data-table td { white-space: nowrap; padding: 0.7rem 0.8rem; }
  .order-detail dl { grid-template-columns: 1fr; gap: 0.1rem 0; }
  .order-detail dt { margin-top: 0.55rem; }
  .order-detail dt:first-child { margin-top: 0; }
}

@media (max-width: 560px) {
  .stats-grid { grid-template-columns: 1fr; }
  .admin-toolbar { width: 100%; }
  .admin-toolbar select, .admin-toolbar input { flex: 1; min-width: 0; }
}

@media (max-width: 480px) {
  .cart-drawer-header, .cart-drawer-body, .cart-drawer-footer {
    padding-left: 1.1rem;
    padding-right: 1.1rem;
  }
  .checkout-pane .btn, .store-btn-row .btn { padding-top: 0.7em; padding-bottom: 0.7em; }
}