/* ===========================================================
   My Strand — components layer
   Reusable UI: buttons, form controls, status badges,
   product cards, and the product/inquire modal.
   =========================================================== */

/* Buttons */
.btn { display: inline-flex; align-items: center; justify-content: center; padding: 12px 24px; border-radius: var(--radius-sm); font-weight: 600; font-size: 0.9rem; border: none; cursor: pointer; transition: var(--transition); }
.btn-primary { background: var(--accent-leather); color: var(--text-light); }
.btn-primary:hover { background: var(--accent-leather-hover); }
.btn:disabled { opacity: 0.6; cursor: not-allowed; }

/* High-contrast crisp form inputs */
.form-group { margin-bottom: 18px; }
.form-label { display: block; font-size: 0.85rem; font-weight: 700; color: var(--text-main); margin-bottom: 6px; }
.form-input, .form-textarea, .form-select {
  width: 100%;
  background: var(--bg-card) !important;
  color: var(--text-main) !important;
  border: 1px solid var(--border-input) !important;
  padding: 10px 14px;
  font-size: 0.95rem;
  border-radius: var(--radius-sm);
  outline: none;
  transition: var(--transition);
}
.form-input:focus, .form-textarea:focus, .form-select:focus {
  border-color: var(--accent-leather) !important;
  box-shadow: 0 0 0 2px rgba(140, 78, 40, 0.15);
}
.form-input::placeholder, .form-textarea::placeholder {
  color: var(--text-placeholder) !important;
  opacity: 1;
}
.form-select option {
  background: var(--bg-input);
  color: var(--text-main);
}
.form-row-split { display: grid; grid-template-columns: 1fr 1.3fr; gap: 14px; align-items: end; }

/* Status badges (product cards + modal) */
.status-badge { display: inline-flex; align-items: center; justify-content: center; padding: 4px 10px; border-radius: 4px; font-size: 0.75rem; font-weight: 700; text-transform: uppercase; letter-spacing: 0.05em; color: var(--white); }
.status-in_stock { background: var(--badge-instock); }
.status-made_to_order { background: var(--badge-order); }

/* Product card */
.product-card { background: var(--bg-card); border: 1px solid var(--border-color); border-radius: var(--radius-md); overflow: hidden; transition: var(--transition); display: flex; flex-direction: column; cursor: pointer; position: relative; }
.product-card:hover { transform: translateY(-4px); box-shadow: var(--shadow-hover); border-color: var(--accent-leather); }
.product-card.product-card-custom { border: 1px solid var(--border-color); }

.product-card-thumb { position: relative; width: 100%; aspect-ratio: 1 / 1; background: var(--bg-subtle); overflow: hidden; }
.product-card-thumb img { width: 100%; height: 100%; object-fit: cover; transition: transform 0.4s ease; }
.product-card:hover .product-card-thumb img { transform: scale(1.04); }

.custom-thumb-placeholder { width: 100%; height: 100%; background: linear-gradient(135deg, var(--thumb-grad-a) 0%, var(--thumb-grad-b) 100%); display: flex; align-items: center; justify-content: center; font-size: 2.8rem; }

.product-card .status-badge { position: absolute; top: 12px; left: 12px; }

.product-card-body { padding: 18px 20px 16px; display: flex; flex-direction: column; flex-grow: 1; }
.product-card-title { font-family: var(--font-serif); font-size: 1.15rem; font-weight: 700; color: var(--text-main); line-height: 1.3; margin-bottom: 20px; min-height: 2.6em; }
.product-card-footer { margin-top: auto; padding-top: 12px; border-top: 1px solid var(--border-color); display: flex; align-items: center; justify-content: space-between; }
.product-card-price { font-size: 1.15rem; font-weight: 700; color: var(--accent-leather); }
.product-card.product-card-custom .product-card-price { font-size: 0.95rem; }
.product-card-link { font-size: 0.85rem; font-weight: 600; color: var(--text-muted); }
.product-card.product-card-custom .product-card-link { color: var(--text-main); font-weight: 700; }

/* Modal */
.modal-overlay { position: fixed; inset: 0; background: rgba(22, 16, 12, 0.75); backdrop-filter: blur(6px); z-index: 200; display: flex; align-items: center; justify-content: center; padding: 20px; opacity: 0; visibility: hidden; transition: opacity 0.3s ease, visibility 0.3s ease; }
.modal-overlay.active { opacity: 1; visibility: visible; }
.modal-content { background: var(--bg-card); border-radius: var(--radius-lg); width: 100%; max-width: 1140px; max-height: 92vh; overflow-y: auto; position: relative; box-shadow: var(--shadow-modal); display: grid; grid-template-columns: 1.35fr 1fr; gap: 40px; padding: 40px; }
#inquire-modal .modal-content { max-width: 600px; display: block; }

.modal-close { position: absolute; top: 18px; right: 18px; width: 36px; height: 36px; border-radius: 50%; background: var(--bg-subtle); border: none; font-size: 1.1rem; display: flex; align-items: center; justify-content: center; color: var(--text-main); cursor: pointer; transition: var(--transition); }
.modal-close:hover { background: var(--accent-leather); color: var(--white); }

.modal-gallery { display: flex; flex-direction: column; gap: 14px; }
.modal-main-img { width: 100%; aspect-ratio: 4 / 5; object-fit: cover; border-radius: var(--radius-md); border: 1px solid var(--border-color); }
.modal-thumbnails { display: flex; gap: 10px; flex-wrap: wrap; }
.modal-thumb { width: 70px; height: 70px; object-fit: cover; border-radius: var(--radius-sm); border: 2px solid transparent; cursor: pointer; }
.modal-thumb.active { border-color: var(--accent-leather); }

.modal-details { display: flex; flex-direction: column; }
.modal-title { font-family: var(--font-serif); font-size: 1.8rem; margin-bottom: 12px; line-height: 1.25; }

/* Price row with side-by-side status badge */
.modal-price-row { display: flex; align-items: center; gap: 14px; margin-bottom: 20px; }
.modal-price { font-size: 1.8rem; font-weight: 700; color: var(--accent-leather); }
.modal-price-row .status-badge { position: static; font-size: 0.8rem; padding: 5px 12px; border-radius: 4px; }

.modal-desc { font-size: 0.95rem; color: var(--text-muted); margin-bottom: 24px; line-height: 1.7; text-align: justify; }
.modal-desc p { margin: 0 0 1.1em; }
.modal-desc p:last-child { margin-bottom: 0; }
.modal-specs-table { width: 100%; border-collapse: collapse; font-size: 0.85rem; }
.modal-specs-table tr { border-bottom: 1px solid var(--border-color); }
.modal-specs-table td { padding: 8px 0; }
.modal-specs-table td:first-child { color: var(--text-muted); width: 40%; }
.modal-specs-table td:last-child { font-weight: 600; }

.modal-actions { display: flex; flex-direction: column; gap: 8px; margin-top: auto; }
.modal-actions-row { display: flex; gap: 8px; align-items: stretch; }
.modal-actions-row .btn-primary { flex: 1; min-width: 0; }
/* Square share button, same height as the order button (row stretches both).
   Icon tinted with the leather accent to match the order button. */
.btn-share { flex: 0 0 auto; aspect-ratio: 1 / 1; padding: 0; background: var(--bg-card); border: 1px solid var(--border-color); color: var(--accent-leather); }
.btn-share:hover { border-color: var(--accent-leather); }
.btn-share .share-icon { width: 20px; height: 20px; background-color: currentColor;
  -webkit-mask: url(/assets/images/icons/share.svg) center / contain no-repeat;
          mask: url(/assets/images/icons/share.svg) center / contain no-repeat; }
/* Floating "copied" toast, centred near the bottom of the viewport, under the modal. */
.share-toast { position: fixed; left: 50%; bottom: 40px; transform: translate(-50%, 8px); z-index: 300;
  background: var(--bg-card); color: var(--text-main); border: 1px solid var(--border-color);
  border-radius: var(--radius-md); padding: 10px 20px; font-size: 0.9rem; font-weight: 600;
  box-shadow: var(--shadow-modal); opacity: 0; pointer-events: none;
  transition: opacity 0.2s ease, transform 0.2s ease; }
.share-toast.is-visible { opacity: 1; transform: translate(-50%, 0); }

/* Notice (e.g. deep-link item not found): centred at the top under the header, auto-fades.
   `top` is set inline from the measured header height; the value here is a fallback. */
.notice-toast { position: fixed; left: 50%; top: 80px; transform: translate(-50%, -8px); z-index: 300;
  max-width: min(420px, calc(100vw - 32px)); text-align: center;
  background: var(--bg-card); color: var(--text-main); border: 1px solid var(--border-color);
  border-radius: var(--radius-md); padding: 12px 20px; font-size: 0.9rem; font-weight: 600;
  box-shadow: var(--shadow-modal); opacity: 0; pointer-events: none;
  transition: opacity 0.2s ease, transform 0.2s ease; }
.notice-toast.is-visible { opacity: 1; transform: translate(-50%, 0); }

@media (max-width: 900px) {
  .modal-content { grid-template-columns: 1fr; padding: 24px; }
}
