/* ============ DMDC Shop UI: Search + Mini Cart ============ */

/* ---------- SEARCH ---------- */
.dmdc-search-trigger-wrap { position: relative; display: inline-flex; align-items: center; }
.dmdc-search-trigger { background: none; border: 0; cursor: pointer; padding: 6px; line-height: 1; display: inline-flex; }
.dmdc-search-inner { display: flex; width: 100%; }
.dmdc-search-overlay { position: fixed; inset: 0; background: rgba(0,0,0,.45); opacity: 0; visibility: hidden; transition: opacity .25s ease; z-index: 1090; }
.dmdc-search-pop-close { position: absolute; background: none; border: 0; font-size: 28px; line-height: 1; color: #888; cursor: pointer; }

/* base hidden state for popup/dropdown/slide */
.dmdc-search-pop { position: absolute; z-index: 1100; background: #fff; box-shadow: 0 12px 40px rgba(0,0,0,.18);
  opacity: 0; visibility: hidden; transition: opacity .25s ease, transform .25s ease; }
.dmdc-search-pop-inner { display: inline-flex; width: 100%; border: 1px solid var(--sf-border, #dadce0); border-radius: var(--sf-radius, 8px); overflow: hidden; }
.dmdc-search-pop-inner .dmdc-search-inner { width: 100%; }

/* --- Slide (trượt ngang cạnh icon) --- */
.dmdc-search-mode-slide .dmdc-search-pop { top: 50%; right: calc(100% + 8px); transform: translateY(-50%) scaleX(.2); transform-origin: right center; width: 300px; padding: 0; }
.dmdc-search-mode-slide .dmdc-search-pop.is-open { opacity: 1; visibility: visible; transform: translateY(-50%) scaleX(1); }
.dmdc-search-mode-slide .dmdc-search-pop-close { display: none; }

/* --- Dropdown (xổ xuống) --- */
.dmdc-search-mode-dropdown .dmdc-search-pop { top: calc(100% + 10px); right: 0; width: 340px; transform: translateY(-8px); padding: 0; }
.dmdc-search-mode-dropdown .dmdc-search-pop.is-open { opacity: 1; visibility: visible; transform: translateY(0); }
.dmdc-search-mode-dropdown .dmdc-search-pop-close { display: none; }

/* --- Popup giữa màn hình --- */
.dmdc-search-mode-popup .dmdc-search-pop { position: fixed; top: 42%; left: 50%; width: min(620px, 92vw); transform: translate(-50%, -50%) scale(.92); padding: 28px 24px 24px; border-radius: 14px; }
.dmdc-search-mode-popup .dmdc-search-pop.is-open { opacity: 1; visibility: visible; transform: translate(-50%, -50%) scale(1); }
.dmdc-search-mode-popup .dmdc-search-pop-close { top: 8px; right: 12px; }

/* --- Fullscreen --- */
.dmdc-search-mode-fullscreen .dmdc-search-pop { position: fixed; inset: 0; width: 100%; display: flex; align-items: center; justify-content: center; flex-direction: column; transform: scale(1); background: rgba(255,255,255,.98); padding: 0 5vw; }
.dmdc-search-mode-fullscreen .dmdc-search-pop .dmdc-search-pop-inner { max-width: 720px; }
.dmdc-search-mode-fullscreen .dmdc-search-pop.is-open { opacity: 1; visibility: visible; }
.dmdc-search-mode-fullscreen .dmdc-search-pop-close { top: 28px; right: 36px; font-size: 40px; }

@media (prefers-reduced-motion: reduce) { .dmdc-search-pop { transition: none; } }

/* ---------- MINI CART ---------- */
.dmdc-mini-cart { position: relative; display: inline-block; }
.dmdc-cart-trigger { display: inline-flex; align-items: center; gap: 8px; text-decoration: none; color: var(--mc-icon-color, #333); }
.dmdc-cart-icon-wrap { position: relative; display: inline-flex; }
.dmdc-cart-text { font-weight: 600; font-size: .95em; }
.dmdc-cart-total { font-weight: 700; }
.dmdc-cart-btn { padding: 9px 20px; border-radius: 999px; }
.dmdc-cart-badge { position: absolute; top: -9px; right: -12px; min-width: 18px; height: 18px; padding: 0 5px; border-radius: 9px;
  font-size: 11px; font-weight: 700; line-height: 18px; text-align: center; }
.dmdc-cart-badge.is-empty { display: none; }

/* Badge "pop" khi số thay đổi */
@keyframes dmdc-badge-pop { 0% { transform: scale(0); } 60% { transform: scale(1.35); } 100% { transform: scale(1); } }
.dmdc-cart-badge.bump { animation: dmdc-badge-pop .4s ease; }

/* Hiệu ứng thêm vào giỏ trên icon */
@keyframes dmdc-bounce { 0%,100% { transform: translateY(0);} 30% { transform: translateY(-9px);} 60% { transform: translateY(-3px);} }
@keyframes dmdc-shake { 0%,100%{transform:rotate(0);} 20%{transform:rotate(-14deg);} 40%{transform:rotate(12deg);} 60%{transform:rotate(-8deg);} 80%{transform:rotate(5deg);} }
@keyframes dmdc-pulse { 0%,100%{transform:scale(1);} 50%{transform:scale(1.28);} }
.dmdc-cart-icon-wrap.anim-bounce { animation: dmdc-bounce .6s ease; }
.dmdc-cart-icon-wrap.anim-shake { animation: dmdc-shake .6s ease; }
.dmdc-cart-icon-wrap.anim-pulse { animation: dmdc-pulse .5s ease; }

/* Ảnh bay vào giỏ (fly to cart) */
.dmdc-fly-img { position: fixed; z-index: 2000; border-radius: 8px; object-fit: cover; pointer-events: none;
  box-shadow: 0 6px 18px rgba(0,0,0,.25); transition: all .8s cubic-bezier(.2,.7,.3,1); }

/* Panel chung */
.dmdc-cart-overlay { position: fixed; inset: 0; background: rgba(0,0,0,.4); opacity: 0; visibility: hidden; transition: opacity .25s; z-index: 1190; }
.dmdc-cart-panel { background: #fff; z-index: 1200; opacity: 0; visibility: hidden; transition: all .28s ease; }
.dmdc-cart-panel-head { display: flex; justify-content: space-between; align-items: center; padding: 16px 18px; border-bottom: 1px solid #eee; font-weight: 700; }
.dmdc-cart-close { background: none; border: 0; font-size: 24px; line-height: 1; color: #888; cursor: pointer; }
.dmdc-cart-items { max-height: 320px; overflow-y: auto; }
.dmdc-cart-item { display: flex; gap: 12px; padding: 12px 18px; border-bottom: 1px solid #f3f3f3; align-items: center; }
.dmdc-cart-item img { width: 54px; height: 54px; object-fit: cover; border-radius: 8px; flex-shrink: 0; }
.dmdc-cart-item .ci-info { flex: 1; min-width: 0; }
.dmdc-cart-item .ci-title { font-size: 14px; font-weight: 600; color: #333; display: block; }
.dmdc-cart-item .ci-meta { font-size: 13px; color: #1A5FAB; font-weight: 600; display: block; margin: 2px 0 6px; }
.dmdc-cart-item .ci-qty { display: inline-flex; align-items: center; border: 1px solid #e2e6ea; border-radius: 8px; overflow: hidden; }
.dmdc-cart-item .ci-qty-btn { width: 26px; height: 26px; border: 0; background: #f5f7fa; color: #333; cursor: pointer; font-size: 15px; line-height: 1; display: flex; align-items: center; justify-content: center; }
.dmdc-cart-item .ci-qty-btn:hover { background: #1A5FAB; color: #fff; }
.dmdc-cart-item .ci-qty-val { min-width: 30px; text-align: center; font-size: 13px; font-weight: 600; }
.dmdc-cart-item .ci-remove { background: none; border: 0; color: #bbb; cursor: pointer; align-self: flex-start; }
.dmdc-cart-item .ci-remove:hover { color: #e23; }
.dmdc-cart-empty { padding: 36px 18px; text-align: center; color: #999; }
.dmdc-cart-empty i { font-size: 34px; opacity: .3; display: block; margin-bottom: 10px; }
.dmdc-cart-foot { padding: 16px 18px; border-top: 1px solid #eee; }
.dmdc-cart-subtotal-row { display: flex; justify-content: space-between; margin-bottom: 12px; }
.dmdc-cart-checkout { display: block; text-align: center; background: #1A5FAB; color: #fff; padding: 11px; border-radius: 8px; text-decoration: none; font-weight: 600; }
.dmdc-cart-checkout:hover { background: #14497F; color: #fff; }

/* Dropdown */
.dmdc-cart-panel--dropdown { position: absolute; top: calc(100% + 12px); right: 0; width: 340px; border-radius: 12px; box-shadow: 0 12px 40px rgba(0,0,0,.16); transform: translateY(-8px); }
.dmdc-cart-panel--dropdown.is-open { opacity: 1; visibility: visible; transform: translateY(0); }

/* Off-canvas bên phải */
.dmdc-cart-panel--side { position: fixed; top: 0; right: 0; height: 100vh; width: min(380px, 92vw); display: flex; flex-direction: column; box-shadow: -8px 0 30px rgba(0,0,0,.18); transform: translateX(100%); }
.dmdc-cart-panel--side.is-open { opacity: 1; visibility: visible; transform: translateX(0); }
.dmdc-cart-panel--side .dmdc-cart-items { flex: 1; max-height: none; }
.dmdc-cart-overlay.is-open { opacity: 1; visibility: visible; }
