/* ============================================================
   MAULANA GROUP - PRODUCT & CATEGORY MODAL DIALOGS
   Modern, Interactive, High-Converting Pop-ups
============================================================ */

/* Modal Backdrop */
.mg-modal-backdrop {
  position: fixed;
  inset: 0;
  z-index: 99999;
  background: rgba(4, 15, 12, 0.72);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 18px;
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.25s cubic-bezier(0.16, 1, 0.3, 1), visibility 0.25s ease;
}

.mg-modal-backdrop.is-active {
  opacity: 1;
  visibility: visible;
}

/* Modal Window */
.mg-modal-dialog {
  position: relative;
  background: #ffffff;
  width: 100%;
  max-width: 860px;
  max-height: 90vh;
  border-radius: 24px;
  box-shadow: 0 24px 60px rgba(0, 0, 0, 0.35), 0 0 0 1px rgba(255, 255, 255, 0.1);
  overflow: hidden;
  display: flex;
  flex-direction: column;
  transform: scale(0.92) translateY(16px);
  transition: transform 0.3s cubic-bezier(0.16, 1, 0.3, 1);
}

.mg-modal-backdrop.is-active .mg-modal-dialog {
  transform: scale(1) translateY(0);
}

/* Close Button */
.mg-modal-close {
  position: absolute;
  top: 16px;
  right: 16px;
  width: 40px;
  height: 40px;
  border-radius: 50%;
  border: 1px solid #e2e8f0;
  background: #ffffff;
  color: #475569;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 20px;
  font-weight: 700;
  cursor: pointer;
  z-index: 10;
  transition: all 0.2s ease;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
}

.mg-modal-close:hover {
  background: #f1f5f9;
  color: #0f172a;
  transform: rotate(90deg);
}

/* Modal Scroll Body */
.mg-modal-body {
  overflow-y: auto;
  padding: 32px;
  display: flex;
  flex-direction: column;
  gap: 24px;
}

/* ============================================================
   1. PRODUCT DETAIL MODAL
============================================================ */
.mg-product-detail-grid {
  display: grid;
  grid-template-columns: 320px 1fr;
  gap: 32px;
  align-items: start;
}

/* Left Column: Visual & Badges */
.mg-product-left {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.mg-product-visual-box {
  position: relative;
  width: 100%;
  height: 300px;
  background: linear-gradient(135deg, #f0fdf4 0%, #e6f7ef 100%);
  border: 1.5px solid #d1fae5;
  border-radius: 20px;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  box-shadow: inset 0 2px 8px rgba(16, 185, 129, 0.06);
}

.mg-product-visual-box img {
  width: 85%;
  height: 85%;
  object-fit: contain;
  transition: transform 0.3s ease;
}

.mg-product-visual-box:hover img {
  transform: scale(1.06);
}

.mg-product-visual-box .sprite {
  width: 140px;
  height: 180px;
  background-size: 800% 200%;
  background-repeat: no-repeat;
  display: block;
}

.mg-product-badge-tag {
  position: absolute;
  top: 14px;
  left: 14px;
  padding: 6px 12px;
  border-radius: 8px;
  font-size: 11.5px;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: #ffffff;
  background: #ef4444;
  box-shadow: 0 4px 10px rgba(239, 68, 68, 0.3);
}

.mg-product-badge-tag.favorit {
  background: #f59e0b;
  box-shadow: 0 4px 10px rgba(245, 158, 11, 0.3);
}

.mg-product-badge-tag.promo {
  background: #10b981;
  box-shadow: 0 4px 10px rgba(16, 185, 129, 0.3);
}

/* Quality Guarantee Banner */
.mg-quality-box {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 16px;
  border-radius: 12px;
  background: #f8fafc;
  border: 1px solid #e2e8f0;
}

.mg-quality-icon {
  font-size: 24px;
}

.mg-quality-text strong {
  display: block;
  font-size: 12.5px;
  color: #0f172a;
}

.mg-quality-text p {
  margin: 2px 0 0;
  font-size: 11.5px;
  color: #64748b;
}

/* Right Column: Info & Actions */
.mg-product-right {
  display: flex;
  flex-direction: column;
  gap: 18px;
}

.mg-product-meta-header {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

.mg-product-id-pill {
  padding: 4px 10px;
  background: #eff6ff;
  color: #2563eb;
  border: 1px solid #bfdbfe;
  border-radius: 6px;
  font-size: 11.5px;
  font-weight: 800;
  font-family: monospace;
}

.mg-product-category-pill {
  padding: 4px 10px;
  background: #f1f5f9;
  color: #475569;
  border: 1px solid #cbd5e1;
  border-radius: 6px;
  font-size: 11.5px;
  font-weight: 700;
}

.mg-product-stock-pill {
  padding: 4px 10px;
  background: #ecfdf5;
  color: #059669;
  border: 1px solid #a7f3d0;
  border-radius: 6px;
  font-size: 11.5px;
  font-weight: 700;
}

.mg-product-expiry-pill {
  padding: 4px 10px;
  background: #fff7ed;
  color: #c2410c;
  border: 1px solid #fed7aa;
  border-radius: 6px;
  font-size: 11.5px;
  font-weight: 700;
}

/* Modal Thumbnail Gallery Row */
.mg-modal-thumbs-row {
  display: flex;
  align-items: center;
  gap: 8px;
  overflow-x: auto;
  padding: 4px 2px;
}

.mg-modal-thumb {
  width: 54px;
  height: 54px;
  border-radius: 10px;
  border: 2px solid #e2e8f0;
  background: #f8fafc;
  padding: 2px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s ease;
  flex-shrink: 0;
}

.mg-modal-thumb img {
  width: 100%;
  height: 100%;
  object-fit: contain;
}

.mg-modal-thumb.active,
.mg-modal-thumb:hover {
  border-color: #008a4b;
  transform: translateY(-2px);
  box-shadow: 0 4px 10px rgba(0, 138, 75, 0.2);
}

/* Make cards clickable */
.product-card,
.catalog-product {
  cursor: pointer;
}

.mg-product-title {
  margin: 0;
  font-size: 24px;
  font-weight: 800;
  color: #0f172a;
  line-height: 1.25;
}

.mg-product-rating-row {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 13.5px;
  color: #d97706;
  font-weight: 700;
}

.mg-product-rating-row span {
  color: #64748b;
  font-weight: 500;
}

/* Price Box */
.mg-product-price-box {
  display: flex;
  align-items: baseline;
  gap: 12px;
  padding: 14px 18px;
  background: #f8fafc;
  border: 1px solid #e2e8f0;
  border-radius: 14px;
}

.mg-product-price-main {
  font-size: 26px;
  font-weight: 900;
  color: #008a4b;
}

.mg-product-price-strike {
  font-size: 15px;
  color: #94a3b8;
  text-decoration: line-through;
  font-weight: 600;
}

.mg-product-price-unit {
  font-size: 13px;
  color: #64748b;
  font-weight: 600;
}

/* Description Details Box */
.mg-product-desc-box {
  display: flex;
  flex-direction: column;
  gap: 12px;
  padding: 16px 20px;
  background: #ffffff;
  border: 1px solid #e2e8f0;
  border-radius: 14px;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.02);
}

.mg-product-desc-box h4 {
  margin: 0;
  font-size: 14px;
  font-weight: 800;
  color: #1e293b;
  display: flex;
  align-items: center;
  gap: 8px;
}

.mg-product-desc-box p {
  margin: 0;
  font-size: 13.5px;
  color: #475569;
  line-height: 1.6;
}

.mg-product-specs-list {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  margin-top: 6px;
  padding-top: 10px;
  border-top: 1px dashed #e2e8f0;
  font-size: 12.5px;
}

.mg-spec-item {
  color: #64748b;
}

.mg-spec-item b {
  color: #1e293b;
}

/* Quantity & Subtotal Row */
.mg-qty-subtotal-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding-top: 8px;
  border-top: 1px solid #f1f5f9;
  flex-wrap: wrap;
}

.mg-qty-wrap {
  display: flex;
  align-items: center;
  gap: 12px;
}

.mg-qty-label {
  font-size: 13px;
  font-weight: 700;
  color: #334155;
}

.mg-qty-selector {
  display: inline-flex;
  align-items: center;
  border: 1.5px solid #cbd5e1;
  border-radius: 10px;
  background: #ffffff;
  overflow: hidden;
}

.mg-qty-btn {
  width: 36px;
  height: 36px;
  border: none;
  background: #f8fafc;
  color: #1e293b;
  font-size: 16px;
  font-weight: 800;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.15s ease;
}

.mg-qty-btn:hover {
  background: #e2e8f0;
  color: #008a4b;
}

.mg-qty-input {
  width: 44px;
  height: 36px;
  border: none;
  text-align: center;
  font-size: 14px;
  font-weight: 800;
  color: #0f172a;
  outline: none;
  background: transparent;
}

.mg-subtotal-box {
  text-align: right;
}

.mg-subtotal-box span {
  font-size: 12px;
  color: #64748b;
  display: block;
}

.mg-subtotal-amount {
  font-size: 18px;
  font-weight: 900;
  color: #008a4b;
}

/* Action Buttons */
.mg-product-actions-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  margin-top: 6px;
}

.mg-btn-add-cart {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  height: 48px;
  padding: 0 20px;
  border: 1.5px solid #008a4b;
  border-radius: 12px;
  background: #ecfdf5;
  color: #008a4b;
  font-size: 14px;
  font-weight: 800;
  cursor: pointer;
  transition: all 0.2s ease;
}

.mg-btn-add-cart:hover {
  background: #d1fae5;
  transform: translateY(-1px);
}

.mg-btn-buy-now {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  height: 48px;
  padding: 0 20px;
  border: none;
  border-radius: 12px;
  background: linear-gradient(135deg, #008a4b 0%, #00703c 100%);
  color: #ffffff;
  font-size: 14px;
  font-weight: 800;
  cursor: pointer;
  box-shadow: 0 4px 14px rgba(0, 138, 75, 0.35);
  transition: all 0.2s ease;
}

.mg-btn-buy-now:hover {
  background: linear-gradient(135deg, #007b42 0%, #006033 100%);
  transform: translateY(-1px);
  box-shadow: 0 6px 18px rgba(0, 138, 75, 0.45);
}

/* ============================================================
   2. ALL CATEGORIES MODAL (GRID POP-UP)
============================================================ */
.mg-category-modal-header {
  text-align: center;
  padding-bottom: 20px;
  border-bottom: 1px solid #e2e8f0;
}

.mg-category-modal-header h2 {
  margin: 0 0 6px;
  font-size: 22px;
  font-weight: 800;
  color: #0f172a;
}

.mg-category-modal-header p {
  margin: 0;
  font-size: 13.5px;
  color: #64748b;
}

.mg-category-search-bar {
  margin: 16px auto 0;
  max-width: 460px;
  position: relative;
}

.mg-category-search-bar input {
  width: 100%;
  height: 44px;
  padding: 0 16px 0 42px;
  border: 1px solid #cbd5e1;
  border-radius: 12px;
  font-size: 13.5px;
  outline: none;
  background: #f8fafc;
  box-sizing: border-box;
  transition: all 0.2s ease;
}

.mg-category-search-bar input:focus {
  border-color: #008a4b;
  background: #fff;
  box-shadow: 0 0 0 3px rgba(0, 138, 75, 0.12);
}

.mg-category-search-bar span {
  position: absolute;
  left: 14px;
  top: 50%;
  transform: translateY(-50%);
  font-size: 16px;
  color: #94a3b8;
  pointer-events: none;
}

/* Category Grid */
.mg-categories-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 16px;
  margin-top: 8px;
}

.mg-category-card {
  position: relative;
  display: flex;
  flex-direction: column;
  padding: 20px;
  border: 1px solid #e2e8f0;
  border-radius: 16px;
  background: #ffffff;
  cursor: pointer;
  transition: all 0.2s cubic-bezier(0.16, 1, 0.3, 1);
  text-decoration: none;
  color: inherit;
  box-sizing: border-box;
}

.mg-category-card:hover {
  border-color: #a7f3d0;
  background: #f0fdf4;
  transform: translateY(-3px);
  box-shadow: 0 10px 24px rgba(0, 138, 75, 0.08);
}

.mg-category-card-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 12px;
}

.mg-category-icon-wrap {
  width: 48px;
  height: 48px;
  border-radius: 12px;
  background: #ecfdf5;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 24px;
  border: 1px solid #a7f3d0;
}

.mg-category-badge {
  padding: 3px 8px;
  border-radius: 6px;
  font-size: 11px;
  font-weight: 800;
  background: #f1f5f9;
  color: #475569;
}

.mg-category-card h3 {
  margin: 0 0 6px;
  font-size: 16px;
  font-weight: 800;
  color: #0f172a;
}

.mg-category-card p {
  margin: 0 0 14px;
  font-size: 12.5px;
  color: #64748b;
  line-height: 1.45;
  flex: 1;
}

.mg-category-card-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 12.5px;
  font-weight: 700;
  color: #008a4b;
  padding-top: 10px;
  border-top: 1px solid #f1f5f9;
}

.mg-category-card:hover .mg-category-card-footer {
  border-top-color: #d1fae5;
}

/* ============================================================
   RESPONSIVE MODAL
============================================================ */
@media (max-width: 800px) {
  .mg-product-detail-grid {
    grid-template-columns: 1fr;
    gap: 20px;
  }
  .mg-product-visual-box {
    height: 240px;
  }
  .mg-categories-grid {
    grid-template-columns: repeat(2, 1fr);
  }
}

@media (max-width: 540px) {
  .mg-modal-body {
    padding: 22px 18px;
  }
  .mg-categories-grid {
    grid-template-columns: 1fr;
  }
  .mg-product-actions-row {
    grid-template-columns: 1fr;
  }
  .mg-product-title {
    font-size: 20px;
  }
  .mg-product-specs-list {
    grid-template-columns: 1fr;
  }
}
