/* ===== MODAL ===== */
.modal-overlay {
  display:none; position:fixed; inset:0; background:rgba(0,0,0,.5);
  z-index:3000; justify-content:center; align-items:center;
  backdrop-filter:blur(4px); animation:fadeIn .2s;
}
.modal-overlay.open { display:flex; }
.modal {
  background:#fff; border-radius:var(--radius-lg); width:420px; max-width:92vw;
  max-height:90vh; overflow-y:auto; box-shadow:var(--shadow-xl);
  animation:slideUp .3s cubic-bezier(.4,0,.2,1);
}
.modal-header {
  padding:20px 24px 16px; display:flex; justify-content:space-between; align-items:center;
  border-bottom:1px solid var(--gray-100);
}
.modal-header h2 { font-size:20px; font-weight:700; }
.modal-close {
  width:32px; height:32px; border-radius:50%; display:grid; place-items:center;
  color:var(--gray-400); transition:var(--transition);
}
.modal-close:hover { background:var(--gray-100); color:var(--gray-700); }
.modal-body { padding:24px; }
.form-group { margin-bottom:16px; }
.form-group label { display:block; font-size:13px; font-weight:600; color:var(--gray-700); margin-bottom:6px; }
.form-input {
  width:100%; height:44px; border:1.5px solid var(--gray-200); border-radius:var(--radius-sm);
  padding:0 14px; font-size:14px; transition:var(--transition); background:#fff;
}
.form-input:focus { outline:none; border-color:var(--green-500); box-shadow:0 0 0 3px rgba(3,172,14,.1); }
.btn-primary {
  width:100%; height:46px; background:var(--green-500); color:#fff; border:none;
  border-radius:var(--radius-sm); font-size:15px; font-weight:700;
  cursor:pointer; transition:var(--transition);
}
.btn-primary:hover { background:var(--green-600); }
.btn-outline {
  width:100%; height:46px; border:1.5px solid var(--green-500); color:var(--green-500);
  background:#fff; border-radius:var(--radius-sm); font-size:15px; font-weight:700;
  cursor:pointer; transition:var(--transition);
}
.btn-outline:hover { background:var(--green-50); }
.modal-divider { text-align:center; margin:16px 0; color:var(--gray-400); font-size:12px; position:relative; }
.modal-divider::before,.modal-divider::after {
  content:''; position:absolute; top:50%; width:40%; height:1px; background:var(--gray-200);
}
.modal-divider::before { left:0; }
.modal-divider::after { right:0; }
.modal-switch { text-align:center; font-size:13px; color:var(--gray-500); margin-top:16px; }
.modal-switch a { color:var(--green-500); font-weight:600; cursor:pointer; }
.modal-switch a:hover { text-decoration:underline; }

/* ===== TOAST ===== */
.toast-container { position:fixed; top:70px; right:20px; z-index:4000; display:flex; flex-direction:column; gap:8px; }
.toast {
  background:#fff; border-radius:var(--radius-md); padding:14px 20px;
  box-shadow:var(--shadow-xl); display:flex; align-items:center; gap:12px;
  min-width:0; max-width:92vw; width:auto; animation:slideIn .3s cubic-bezier(.4,0,.2,1);
  border-left:4px solid var(--green-500);
}
.toast.error { border-left-color:var(--red-500); }
.toast.info { border-left-color:var(--blue-500); }
.toast-icon { font-size:20px; flex-shrink:0; }
.toast-text { flex:1; font-size:13px; color:var(--gray-700); }
.toast-text strong { display:block; font-size:14px; color:var(--gray-900); margin-bottom:2px; }
.toast-close { color:var(--gray-400); cursor:pointer; padding:4px; }
.toast.out { animation:slideOut .3s forwards; }

/* ===== CART DRAWER ===== */
.cart-overlay {
  display:none; position:fixed; inset:0; background:rgba(0,0,0,.5);
  z-index:2500; backdrop-filter:blur(2px);
}
.cart-overlay.open { display:block; }
.cart-drawer {
  position:fixed; top:0; right:0; width: min(420px, 100%); max-width:100vw; height:100%;
  background:#fff; z-index:2501; transition:transform .3s cubic-bezier(.4,0,.2,1);
  transform: translateX(100%);
  display:flex; flex-direction:column; box-shadow:var(--shadow-xl);
}
.cart-drawer.open { transform: translateX(0); }
.cart-header {
  padding:20px 24px; display:flex; justify-content:space-between; align-items:center;
  border-bottom:1px solid var(--gray-100); flex-shrink:0;
}
.cart-header h2 { font-size:18px; font-weight:700; }
.cart-body { flex:1; overflow-y:auto; padding:16px 24px; }
.cart-empty { text-align:center; padding:60px 20px; color:var(--gray-400); }
.cart-empty-icon { font-size:64px; margin-bottom:12px; }
.cart-empty p { font-size:14px; }
.cart-item {
  display:flex; gap:14px; padding:16px 0;
  border-bottom:1px solid var(--gray-100);
}
.cart-item-img {
  width:72px; height:72px; border-radius:var(--radius-sm);
  background:var(--gray-50); display:grid; place-items:center; font-size:36px; flex-shrink:0;
}
.cart-item-info { flex:1; min-width:0; }
.cart-item-name { font-size:13px; color:var(--gray-700); margin-bottom:4px;
  display:-webkit-box; -webkit-line-clamp:2; -webkit-box-orient:vertical; overflow:hidden;
}
.cart-item-price { font-size:15px; font-weight:700; color:var(--gray-900); margin-bottom:8px; }
.cart-qty {
  display:inline-flex; align-items:center; border:1px solid var(--gray-200);
  border-radius:var(--radius-sm); overflow:hidden;
}
.cart-qty button {
  width:32px; height:32px; display:grid; place-items:center;
  font-size:16px; font-weight:700; color:var(--gray-600); transition:var(--transition);
}
.cart-qty button:hover { background:var(--gray-100); }
.cart-qty span { width:40px; text-align:center; font-size:14px; font-weight:600; }
.cart-item-remove {
  font-size:12px; color:var(--red-500); cursor:pointer; margin-left:12px;
  background:none; border:none; font-family:inherit; font-weight:600;
}
.cart-item-remove:hover { text-decoration:underline; }
.cart-footer {
  padding:20px 24px; border-top:1px solid var(--gray-100); flex-shrink:0;
  background:#fff;
}
.cart-total {
  display:flex; justify-content:space-between; margin-bottom:14px;
  font-size:16px; font-weight:700;
}
.cart-total span:last-child { color:var(--green-600); }
.cart-checkout {
  width:100%; height:48px; background:var(--green-500); color:#fff;
  border:none; border-radius:var(--radius-sm); font-size:15px; font-weight:700;
  cursor:pointer; transition:var(--transition);
}
.cart-checkout:hover { background:var(--green-600); }

/* ===== PRODUCT DETAIL PAGE ===== */
.page-detail { display:none; }
.page-detail.active { display:block; }
.detail-back {
  display:inline-flex; align-items:center; gap:6px;
  font-size:14px; font-weight:600; color:var(--green-500);
  margin-bottom:16px; cursor:pointer; padding:8px 0;
}
.detail-back:hover { gap:10px; }
.detail-grid { display:grid; grid-template-columns:1fr 1fr; gap:32px; }
.detail-image {
  background:#fff; border-radius:var(--radius-lg); padding:40px;
  display:grid; place-items:center; font-size:120px; aspect-ratio:1;
  box-shadow:var(--shadow-sm);
}
.detail-info { padding:8px 0; }
.detail-info h1 { font-size:22px; font-weight:700; color:var(--gray-900); line-height:1.4; margin-bottom:12px; }
.detail-rating { display:flex; align-items:center; gap:8px; margin-bottom:16px; }
.detail-rating .stars { display:flex; gap:2px; }
.detail-rating .stars svg { width:18px; height:18px; }
.detail-rating span { font-size:14px; color:var(--gray-500); }
.detail-price-box {
  background:var(--gray-50); border-radius:var(--radius-md); padding:20px; margin-bottom:20px;
}
.detail-price { font-size:28px; font-weight:800; color:var(--gray-900); }
.detail-original { font-size:16px; color:var(--gray-400); text-decoration:line-through; margin-left:12px; }
.detail-discount-tag {
  display:inline-block; background:#FFF0F0; color:var(--red-500);
  font-size:13px; font-weight:700; padding:4px 10px; border-radius:6px; margin-left:8px;
}
.detail-section { margin-bottom:20px; }
.detail-section h3 { font-size:14px; font-weight:700; color:var(--gray-900); margin-bottom:8px; }
.detail-section p { font-size:14px; color:var(--gray-600); line-height:1.7; }
.detail-meta { display:flex; flex-wrap:wrap; gap:12px; }
.detail-meta-item {
  display:flex; align-items:center; gap:6px; font-size:13px; color:var(--gray-500);
  background:#fff; padding:8px 14px; border-radius:var(--radius-sm);
  border:1px solid var(--gray-200);
}
.detail-actions { display:flex; gap:10px; margin-top:24px; }
.detail-actions .btn-cart {
  flex:1; height:48px; background:var(--green-500); color:#fff; border:none;
  border-radius:var(--radius-sm); font-size:15px; font-weight:700;
  cursor:pointer; transition:var(--transition); display:flex; align-items:center;
  justify-content:center; gap:8px;
}
.detail-actions .btn-cart:hover { background:var(--green-600); transform:translateY(-1px); }
.detail-actions .btn-wishlist {
  width:48px; height:48px; border:1.5px solid var(--gray-200); background:#fff;
  border-radius:var(--radius-sm); display:grid; place-items:center;
  font-size:20px; cursor:pointer; transition:var(--transition);
}
.detail-actions .btn-wishlist:hover { border-color:var(--red-500); background:#FFF0F0; }
.detail-actions .btn-wishlist.liked { background:#FFF0F0; border-color:var(--red-500); }


/* ===== SEARCH RESULTS / CATEGORY PAGE ===== */
.page-results { display:none; }
.page-results.active { display:block; }
.results-header { margin-bottom:20px; }
.results-header h1 { font-size:20px; font-weight:700; color:var(--gray-900); }
.results-header p { font-size:14px; color:var(--gray-500); }
.results-filters {
  display:flex; gap:8px; margin-bottom:16px; flex-wrap:wrap;
}
.filter-chip {
  padding:8px 16px; border-radius:99px; font-size:13px; font-weight:500;
  border:1px solid var(--gray-200); background:#fff; color:var(--gray-600);
  cursor:pointer; transition:var(--transition);
}
.filter-chip:hover, .filter-chip.active {
  border-color:var(--green-500); background:var(--green-50); color:var(--green-600);
}

/* ===== NOTIFICATION PANEL ===== */
.notif-panel {
  position:absolute; top:calc(var(--header-h) + 4px); right:0; width: min(360px, 92vw);
  background:#fff; border-radius:var(--radius-md); box-shadow:var(--shadow-xl);
  z-index:1500; display:none; max-height:480px; overflow-y:auto;
}
.notif-panel.open { display:block; animation:slideUp .2s; }
.notif-header { padding:16px 20px; border-bottom:1px solid var(--gray-100); font-weight:700; font-size:16px; }
.notif-item {
  padding:14px 20px; display:flex; gap:12px; border-bottom:1px solid var(--gray-50);
  transition:var(--transition); cursor:pointer;
}
.notif-item:hover { background:var(--gray-50); }
.notif-item.unread { background:var(--green-50); }
.notif-icon { width:40px; height:40px; border-radius:50%; display:grid; place-items:center; font-size:18px; flex-shrink:0; }
.notif-text { flex:1; }
.notif-text strong { font-size:13px; display:block; color:var(--gray-900); }
.notif-text span { font-size:12px; color:var(--gray-400); }
.notif-empty { text-align:center; padding:40px; color:var(--gray-400); font-size:14px; }

/* ===== PRODUCT BOTTOM SHEET (Shopee-style) ===== */
.pbs-overlay {
  display:none; position:fixed; inset:0; background:rgba(0,0,0,.55);
  z-index:3500; backdrop-filter:blur(3px);
  transition: opacity .3s; opacity:0;
}
.pbs-overlay.open { display:block; opacity:1; }

.pbs-sheet {
  position:fixed; bottom:0; left:0; right:0;
  background:#fff; z-index:3501;
  border-radius:20px 20px 0 0;
  transform:translateY(100%);
  transition:transform .35s cubic-bezier(.4,0,.2,1);
  max-height:85vh; overflow-y:auto;
  box-shadow:0 -8px 30px rgba(0,0,0,.15);
}
.pbs-sheet.open { transform:translateY(0); }

.pbs-close {
  position:absolute; top:12px; right:14px;
  width:32px; height:32px; border-radius:50%;
  display:grid; place-items:center;
  background:var(--gray-100); color:var(--gray-500);
  font-size:18px; cursor:pointer; border:none;
  transition:var(--transition); z-index:2;
}
.pbs-close:hover { background:var(--gray-200); color:var(--gray-700); }

.pbs-product {
  display:flex; gap:14px; padding:20px 20px 16px;
  border-bottom:1px solid var(--gray-100);
}
.pbs-product-img {
  width:110px; height:110px; border-radius:12px;
  background:var(--gray-100); overflow:hidden; flex-shrink:0;
  display:grid; place-items:center;
}
.pbs-product-img img { width:100%; height:100%; object-fit:cover; }
.pbs-product-img .pbs-emoji { font-size:48px; }

.pbs-product-info { flex:1; min-width:0; padding-top:4px; }
.pbs-product-name {
  font-size:14px; font-weight:600; color:var(--gray-800);
  line-height:1.4; margin-bottom:6px;
  display:-webkit-box; -webkit-line-clamp:2; -webkit-box-orient:vertical; overflow:hidden;
}
.pbs-product-price {
  font-size:22px; font-weight:800; color:var(--red-500);
}
.pbs-product-stock {
  font-size:12px; color:var(--gray-400); margin-top:4px;
}

/* Variant / Option Section */
.pbs-section {
  padding:16px 20px;
  border-bottom:1px solid var(--gray-100);
}
.pbs-section-title {
  font-size:13px; font-weight:700; color:var(--gray-700);
  margin-bottom:10px; text-transform:uppercase; letter-spacing:.3px;
}
.pbs-variants {
  display:flex; flex-wrap:wrap; gap:8px;
}
.pbs-variant {
  padding:8px 16px; border:1.5px solid var(--gray-200);
  border-radius:8px; font-size:13px; font-weight:500;
  color:var(--gray-600); cursor:pointer; background:#fff;
  transition:var(--transition); font-family:inherit;
}
.pbs-variant:hover { border-color:var(--green-400); color:var(--green-600); }
.pbs-variant.selected {
  border-color:var(--green-500); background:var(--green-50);
  color:var(--green-600); font-weight:600;
}
.pbs-variant.disabled {
  opacity:.4; cursor:not-allowed; pointer-events:none;
}

/* Quantity Selector */
.pbs-qty-row {
  display:flex; align-items:center; justify-content:space-between;
  padding:16px 20px; border-bottom:1px solid var(--gray-100);
}
.pbs-qty-label { font-size:14px; font-weight:600; color:var(--gray-700); }
.pbs-qty-controls {
  display:flex; align-items:center;
  border:1.5px solid var(--gray-200); border-radius:10px; overflow:hidden;
}
.pbs-qty-btn {
  width:40px; height:40px; display:grid; place-items:center;
  font-size:18px; font-weight:700; color:var(--gray-500);
  cursor:pointer; background:#fff; border:none;
  transition:var(--transition); font-family:inherit;
}
.pbs-qty-btn:hover { background:var(--gray-50); color:var(--green-500); }
.pbs-qty-btn:disabled { opacity:.3; cursor:not-allowed; }
.pbs-qty-value {
  width:50px; text-align:center; font-size:16px; font-weight:700;
  color:var(--gray-800); border-left:1px solid var(--gray-200);
  border-right:1px solid var(--gray-200); padding:8px 0;
  background:#fff;
}

/* Notes input */
.pbs-notes {
  padding:12px 20px; border-bottom:1px solid var(--gray-100);
}
.pbs-notes input {
  width:100%; padding:10px 14px; border:1.5px solid var(--gray-200);
  border-radius:8px; font-size:13px; font-family:inherit;
  color:var(--gray-700); transition:var(--transition);
}
.pbs-notes input::placeholder { color:var(--gray-400); }
.pbs-notes input:focus { outline:none; border-color:var(--green-500); box-shadow:0 0 0 3px rgba(3,172,14,.08); }

/* Action Buttons */
.pbs-actions {
  padding:16px 20px; display:flex; gap:10px;
  background:#fff;
}
.pbs-actions {
  display:flex; gap:10px; margin-top:20px;
  position: sticky; bottom: -24px; padding: 16px 0 24px; background: #fff; z-index: 10;
  border-top: 1px solid var(--gray-100);
}
.pbs-btn {
  flex:1; height:50px; border:none; border-radius:12px;
  font-size:15px; font-weight:700; cursor:pointer;
  display:flex; align-items:center; justify-content:center; gap:8px;
  transition:var(--transition); font-family:inherit;
}
.pbs-btn-cart {
  background:#fff; color:var(--green-500);
  border:2px solid var(--green-500);
}
.pbs-btn-cart:hover { background:var(--green-50); }
.pbs-btn-buy {
  background:var(--green-500); color:#fff;
}
.pbs-btn-buy:hover { background:var(--green-600); transform:translateY(-1px); }
.pbs-btn:disabled { opacity:.5; cursor:not-allowed; transform:none; }

/* Subtotal display */
.pbs-subtotal {
  padding:12px 20px; background:var(--gray-50);
  display:flex; justify-content:space-between; align-items:center;
  border-bottom:1px solid var(--gray-100);
}
.pbs-subtotal-label { font-size:13px; color:var(--gray-500); }
.pbs-subtotal-value { font-size:18px; font-weight:800; color:var(--green-600); }

@keyframes fadeIn { from{opacity:0}to{opacity:1} }
@keyframes slideUp { from{opacity:0;transform:translateY(12px)}to{opacity:1;transform:none} }
@keyframes slideIn { from{opacity:0;transform:translateX(100%)}to{opacity:1;transform:none} }
@keyframes slideOut { from{opacity:1;transform:none}to{opacity:0;transform:translateX(100%)} }

@media(max-width:768px){
  .detail-grid{grid-template-columns:1fr}
  .detail-image{font-size:80px;padding:24px;aspect-ratio:auto}
  .cart-drawer{width:100%}
  .notif-panel{width:100%;right:0;left:0;top:var(--header-h);border-radius:0 0 var(--radius-md) var(--radius-md);max-width:100vw}
  .modal{width:100%;max-width:100%;border-radius:var(--radius-lg) var(--radius-lg) 0 0;align-self:flex-end}
  .toast-container{left:12px;right:12px;top:60px}
  .toast{min-width:auto;max-width:92vw}
  .pbs-product-img { width:90px; height:90px; }
  .pbs-product-price { font-size:20px; }
  .pbs-btn { height:46px; font-size:14px; }
}
