/* ==========================================================================
   India Pet Shop — Cart drawer (every page) and /cart page
   Tokens come from ui-kit.css.
   ========================================================================== */

html.cd-lock,
html.cd-lock body {
    overflow: hidden;
}

.cd {
    position: fixed;
    inset: 0;
    z-index: 10050;
    visibility: hidden;
    pointer-events: none;
    font-family: var(--hm-font);
    color: var(--hm-ink);
}

.cd.is-open {
    visibility: visible;
    pointer-events: auto;
}

.cd *,
.cd *::before,
.cd *::after {
    box-sizing: border-box;
}

.cd :where(h2, h3, h4, p, ul, dl, dd) {
    margin: 0;
}

.cd :where(ul) {
    padding: 0;
    list-style: none;
}

.cd :where(a) {
    color: inherit;
    text-decoration: none;
}

.cd :where(img) {
    display: block;
    max-width: 100%;
}

.cd :where(button, input, textarea) {
    font-family: inherit;
}

.cd-overlay {
    position: absolute;
    inset: 0;
    background: rgba(29, 27, 47, 0.5);
    opacity: 0;
    transition: opacity 0.3s ease;
}

.cd.is-open .cd-overlay {
    opacity: 1;
}

.cd-panel {
    position: absolute;
    top: 0;
    right: 0;
    bottom: 0;
    width: min(440px, 100%);
    background: #f7f6fb;
    display: flex;
    flex-direction: column;
    box-shadow: -20px 0 50px rgba(29, 27, 47, 0.25);
    transform: translateX(100%);
    transition: transform 0.35s cubic-bezier(0.32, 0.72, 0, 1);
    outline: 0;
}

.cd.is-open .cd-panel {
    transform: translateX(0);
}

.cd-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 18px 20px;
    background: var(--hm-white);
    border-bottom: 1px solid var(--hm-line);
}

.cd-head h2 {
    font-size: 19px;
    font-weight: 700;
    display: flex;
    align-items: center;
    gap: 10px;
}

.cd-head h2 i {
    color: var(--hm-primary);
}

.cd-head__count {
    font-size: 15px;
    font-weight: 500;
    color: var(--hm-muted);
}

.cd-head__count[hidden] {
    display: none;
}

.cd-icon-btn {
    width: 38px;
    height: 38px;
    border-radius: 50%;
    border: 0;
    background: #f3f1f9;
    color: var(--hm-ink);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    flex-shrink: 0;
    transition: background-color 0.2s ease, color 0.2s ease;
}

.cd-icon-btn:hover {
    background: #ffe4ec;
    color: var(--hm-pink);
}

.cd-icon-btn--sm {
    width: 32px;
    height: 32px;
    font-size: 13px;
    background: transparent;
}

.cd-content {
    flex: 1;
    min-height: 0;
    display: flex;
    flex-direction: column;
    transition: opacity 0.2s ease;
}

.cd-content.is-loading {
    opacity: 0.55;
    pointer-events: none;
}

.cd-loading {
    margin: auto;
    display: flex;
    gap: 8px;
}

.cd-loading span {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    background: var(--hm-primary);
    animation: cd-bounce 0.9s infinite ease-in-out;
}

.cd-loading span:nth-child(2) { animation-delay: 0.15s; }
.cd-loading span:nth-child(3) { animation-delay: 0.3s; }

@keyframes cd-bounce {
    0%, 80%, 100% { transform: scale(0.5); opacity: 0.4; }
    40% { transform: scale(1); opacity: 1; }
}

.cd-body {
    flex: 1;
    min-height: 0;
    overflow-y: auto;
    overscroll-behavior: contain;
    padding: 14px;
    display: flex;
    flex-direction: column;
    gap: 12px;
}

/* ---------- Empty ---------- */

.cd-empty {
    margin: auto;
    padding: 30px 28px;
    text-align: center;
}

.cd-empty__icon {
    width: 96px;
    height: 96px;
    margin: 0 auto 18px;
    border-radius: 50%;
    background: var(--hm-primary-soft);
    color: var(--hm-primary);
    font-size: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.cd-empty h3 {
    font-size: 20px;
    font-weight: 700;
    margin-bottom: 8px;
}

.cd-empty p {
    color: var(--hm-muted);
    font-size: 14px;
    margin-bottom: 22px;
}

/* ---------- Free gift ---------- */

.cd-gift {
    background: linear-gradient(135deg, #fff6e5, #ffeef4);
    border: 1px solid #ffe0b8;
    border-radius: 14px;
    padding: 12px 14px;
    font-size: 13px;
}

.cd-gift p i {
    color: var(--hm-pink);
    margin-right: 4px;
}

.cd-gift__bar {
    height: 6px;
    margin-top: 10px;
    border-radius: 6px;
    background: rgba(255, 255, 255, 0.8);
    overflow: hidden;
}

.cd-gift__bar span {
    display: block;
    height: 100%;
    border-radius: 6px;
    background: linear-gradient(90deg, var(--hm-accent), var(--hm-pink));
    transition: width 0.4s ease;
}

.cd-gift.is-unlocked .cd-gift__bar {
    display: none;
}

.cd-gift__list {
    display: flex;
    flex-direction: column;
    gap: 8px;
    margin-top: 10px;
}

.cd-gift__item {
    display: flex;
    align-items: center;
    gap: 10px;
    background: var(--hm-white);
    border-radius: 10px;
    padding: 8px;
}

.cd-gift__item img {
    width: 40px;
    height: 40px;
    object-fit: contain;
    border-radius: 8px;
}

.cd-gift__item span {
    flex: 1;
    font-weight: 500;
}

/* ---------- Items ---------- */

.cd-items {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.cd-item {
    display: flex;
    gap: 12px;
    background: var(--hm-white);
    border: 1px solid var(--hm-line);
    border-radius: 14px;
    padding: 10px;
}

.cd-item.has-problem {
    border-color: #f5b3a8;
    background: #fff8f6;
}

.cd-item__img {
    width: 78px;
    height: 78px;
    flex-shrink: 0;
    border-radius: 10px;
    background: #faf9fd;
    overflow: hidden;
}

.cd-item__img img {
    width: 100%;
    height: 100%;
    object-fit: contain;
}

.cd-item__info {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.cd-item__top {
    display: flex;
    gap: 6px;
    align-items: flex-start;
}

.cd-item__title {
    flex: 1;
    font-size: 13.5px;
    font-weight: 500;
    line-height: 1.4;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

a.cd-item__title:hover {
    color: var(--hm-primary);
}

.cd-item__top .cd-icon-btn {
    margin: -4px -4px 0 0;
}

.cd-item__tags {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
}

.cd-item__tags:empty {
    display: none;
}

.cd-tag {
    font-size: 11px;
    font-weight: 500;
    color: var(--hm-muted);
    background: #f3f1f9;
    padding: 3px 8px;
    border-radius: 6px;
}

.cd-tag--gift {
    color: var(--hm-pink);
    background: #ffe4ec;
}

.cd-item__warn {
    font-size: 12px;
    font-weight: 500;
    color: #b42318;
}

.cd-item__bottom {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    margin-top: auto;
}

.cd-item__price {
    text-align: right;
    line-height: 1.2;
}

.cd-item__price strong {
    display: block;
    font-size: 15px;
    font-weight: 700;
}

strong.cd-item__price {
    color: #138a52;
    font-size: 14px;
}

.cd-item__price del {
    font-size: 12px;
    color: var(--hm-muted);
}

.cd-stepper {
    display: inline-flex;
    align-items: center;
    border: 1px solid var(--hm-line);
    border-radius: 10px;
    overflow: hidden;
    background: var(--hm-white);
}

.cd-stepper button {
    width: 32px;
    height: 32px;
    border: 0;
    background: transparent;
    color: var(--hm-ink);
    font-size: 11px;
    cursor: pointer;
}

.cd-stepper button:hover:not(:disabled) {
    background: var(--hm-primary-soft);
    color: var(--hm-primary);
}

.cd-stepper button:disabled {
    opacity: 0.35;
    cursor: not-allowed;
}

.cd-stepper span {
    min-width: 28px;
    text-align: center;
    font-weight: 700;
    font-size: 14px;
}

/* ---------- Boxes ---------- */

.cd-box {
    background: var(--hm-white);
    border: 1px solid var(--hm-line);
    border-radius: 14px;
    padding: 14px;
}

.cd-box h4 {
    font-size: 14px;
    font-weight: 600;
    margin-bottom: 10px;
    display: flex;
    align-items: center;
    gap: 8px;
}

.cd-box h4 i,
.cd-note summary i {
    color: var(--hm-primary);
}

.cd-inline-form {
    display: flex;
    border: 1px solid var(--hm-line);
    border-radius: 10px;
    overflow: hidden;
    background: var(--hm-white);
}

.cd-inline-form:focus-within {
    border-color: var(--hm-primary);
}

.cd-inline-form input {
    flex: 1;
    min-width: 0;
    border: 0;
    outline: 0;
    padding: 10px 12px;
    font-size: 14px;
    background: transparent;
}

.cd-inline-form input.is-upper {
    text-transform: uppercase;
}

.cd-inline-form input::placeholder {
    text-transform: none;
}

.cd-inline-form button {
    border: 0;
    background: transparent;
    color: var(--hm-primary);
    font-weight: 700;
    font-size: 14px;
    padding: 0 16px;
    cursor: pointer;
}

.cd-msg {
    font-size: 12.5px;
    margin-top: 8px !important;
}

.cd-msg:empty {
    display: none;
}

.cd-msg.is-ok { color: #138a52; }
.cd-msg.is-error { color: #b42318; }

.cd-offers {
    display: flex;
    flex-direction: column;
    gap: 8px;
    margin-top: 10px !important;
}

.cd-offers li {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    border: 1px dashed #cbbcf6;
    border-radius: 10px;
    padding: 8px 10px;
    font-size: 12px;
}

.cd-offers li strong {
    display: block;
    font-size: 13px;
    color: var(--hm-primary);
    letter-spacing: 0.04em;
}

.cd-offers li span {
    color: var(--hm-muted);
}

.cd-offers li em {
    font-style: normal;
    font-size: 11px;
    color: var(--hm-muted);
    white-space: nowrap;
}

.cd-offers li.is-locked {
    opacity: 0.7;
    border-color: var(--hm-line);
}

.cd-chip-btn {
    border: 0;
    background: var(--hm-primary);
    color: var(--hm-white);
    font-size: 12px;
    font-weight: 600;
    padding: 6px 12px;
    border-radius: 999px;
    cursor: pointer;
    white-space: nowrap;
}

.cd-chip-btn:hover {
    background: var(--hm-primary-dark);
}

.cd-coupon-applied {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    background: #e5f7ee;
    border: 1px dashed #66c296;
    border-radius: 10px;
    padding: 10px 12px;
}

.cd-coupon-applied strong {
    display: block;
    color: #138a52;
    letter-spacing: 0.04em;
}

.cd-coupon-applied span {
    font-size: 12px;
    color: #138a52;
}

.cd-link {
    border: 0;
    background: transparent;
    color: var(--hm-pink);
    font-weight: 600;
    font-size: 13px;
    cursor: pointer;
}

.cd-note summary {
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    list-style: none;
    display: flex;
    align-items: center;
    gap: 8px;
}

.cd-note summary::-webkit-details-marker {
    display: none;
}

.cd-note summary::after {
    content: '\f078';
    font-family: 'Font Awesome 6 Free';
    font-weight: 900;
    font-size: 10px;
    margin-left: auto;
    color: var(--hm-muted);
    transition: transform 0.2s ease;
}

.cd-note[open] summary::after {
    transform: rotate(180deg);
}

.cd-note textarea {
    width: 100%;
    margin-top: 10px;
    border: 1px solid var(--hm-line);
    border-radius: 10px;
    padding: 10px 12px;
    font-size: 14px;
    resize: vertical;
    outline: 0;
}

.cd-note textarea:focus {
    border-color: var(--hm-primary);
}

/* Bill */

.cd-bill dl {
    display: flex;
    flex-direction: column;
    gap: 9px;
}

.cd-bill dl > div {
    display: flex;
    justify-content: space-between;
    font-size: 14px;
}

.cd-bill dt {
    font-weight: 400;
    color: #4a4860;
}

.cd-bill .is-green,
.cd-bill .is-green dt {
    color: #138a52;
}

.cd-bill__total {
    border-top: 1px dashed var(--hm-line);
    padding-top: 10px;
    font-weight: 700;
    font-size: 16px !important;
}

.cd-bill__total dt {
    font-weight: 700 !important;
    color: var(--hm-ink) !important;
}

.cd-bill__saved {
    margin-top: 12px !important;
    background: #e5f7ee;
    color: #138a52;
    font-size: 13px;
    font-weight: 600;
    border-radius: 10px;
    padding: 8px 12px;
}

.cd-help {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    font-size: 13px;
    color: var(--hm-muted) !important;
    padding: 6px 0 10px;
}

.cd-help i {
    color: #25d366;
    font-size: 17px;
}

/* ---------- Footer ---------- */

.cd-foot {
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 14px 18px calc(14px + env(safe-area-inset-bottom));
    background: var(--hm-white);
    border-top: 1px solid var(--hm-line);
    box-shadow: 0 -8px 24px rgba(29, 27, 47, 0.06);
}

.cd-foot__total {
    flex: 1;
    display: flex;
    flex-direction: column;
    line-height: 1.2;
}

.cd-foot__total strong {
    font-size: 20px;
    font-weight: 800;
}

.cd-foot__total span {
    font-size: 12px;
    color: var(--hm-muted);
}

.cd-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    border: 0;
    border-radius: 14px;
    padding: 14px 26px;
    font-weight: 600;
    font-size: 15px;
    cursor: pointer;
    transition: background-color 0.2s ease, transform 0.15s ease;
}

.cd-btn--primary {
    background: var(--hm-primary);
    color: var(--hm-white) !important;
    box-shadow: 0 10px 24px rgba(91, 47, 214, 0.28);
}

.cd-btn--primary:hover {
    background: var(--hm-primary-dark);
}

.cd-btn:active {
    transform: scale(0.98);
}

.cd-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    box-shadow: none;
}

/* ---------- Toast ---------- */

.cd-toast {
    position: absolute;
    left: 50%;
    bottom: 96px;
    transform: translate(-50%, 16px);
    background: var(--hm-ink);
    color: var(--hm-white);
    font-size: 13.5px;
    font-weight: 500;
    padding: 10px 18px;
    border-radius: 12px;
    white-space: nowrap;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.25s ease, transform 0.25s ease;
    box-shadow: 0 10px 30px rgba(29, 27, 47, 0.3);
}

.cd-toast.is-visible {
    opacity: 1;
    transform: translate(-50%, 0);
}

.cd-toast.is-error {
    background: #b42318;
    white-space: normal;
    width: max-content;
    max-width: 90%;
    text-align: center;
}

@media (max-width: 575px) {
    .cd-panel {
        width: 100%;
    }

    .cd-item__img {
        width: 68px;
        height: 68px;
    }
}

/* ---------- /cart page (same content, full page) ---------- */

.ips-cartpage {
    font-family: var(--hm-font);
    background: #f7f6fb;
    padding: calc(var(--hm-header-h, 120px) + 24px) 0 60px;
}

.ips-cartpage__inner {
    max-width: 760px;
    margin: 0 auto;
    padding: 0 16px;
}

.ips-cartpage h1 {
    font-size: 28px;
    font-weight: 800;
    margin: 0 0 18px;
}

.ips-cartpage .cd-content {
    background: var(--hm-white);
    border: 1px solid var(--hm-line);
    border-radius: 20px;
    overflow: hidden;
    min-height: 320px;
}

@media (prefers-reduced-motion: reduce) {
    .cd *,
    .cd-panel,
    .cd-overlay {
        transition: none !important;
        animation: none !important;
    }
}

.ips-cartpage .cd-toast {
    position: fixed;
    bottom: 32px;
}
