/* ========================================
   Cart, Checkout & Orders Styles
   ======================================== */

/* ---- Alerts ---- */
.cart-alert {
    padding: 12px 20px;
    border-radius: 8px;
    margin-bottom: 20px;
    font-size: 14px;
}
.cart-alert--error { background: #fef2f2; color: #dc2626; border: 1px solid #fecaca; }
.cart-alert--success { background: #f0fdf4; color: #16a34a; border: 1px solid #bbf7d0; }

/* ========== CART PAGE ========== */
.cart-page { padding: 30px 0 70px; }
.cart-page__title { margin-bottom: 30px; }

.cart-page__content {
    display: grid;
    grid-template-columns: 1fr 380px;
    gap: 40px;
    align-items: start;
}

/* Cart Table */
.cart-table__wrapper { overflow-x: auto; }
.cart-table {
    width: 100%;
    border-collapse: collapse;
}
.cart-table thead { border-bottom: 1px solid rgba(var(--color-foreground), .1); }
.cart-table__heading {
    padding: 12px 10px;
    font-size: 12px;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: rgba(var(--color-foreground), .5);
    font-weight: 400;
    text-align: left;
}

.cart-item td { padding: 20px 10px; border-bottom: 1px solid rgba(var(--color-foreground), .06); vertical-align: middle; }
.cart-item__media { width: 90px; }
.cart-item__media img { width: 80px; height: 80px; object-fit: cover; border-radius: 8px; }
.cart-item__details { min-width: 150px; }
.cart-item__name { display: block; font-weight: 600; color: rgb(var(--color-foreground)); text-decoration: none; margin-bottom: 4px; }
.cart-item__name:hover { color: rgb(var(--color-button)); }
.cart-item__variant { display: block; font-size: 13px; color: rgba(var(--color-foreground), .5); }
.cart-item__price { font-size: 14px; }
.cart-item__total { font-weight: 700; white-space: nowrap; }
.cart-item__remove { width: 40px; text-align: center; }

/* Cart Quantity */
.cart-qty {
    display: inline-flex;
    align-items: center;
    border: 1px solid rgba(var(--color-foreground), .15);
    border-radius: 4px;
}
.cart-qty__btn {
    width: 36px; height: 36px; border: none; background: transparent;
    cursor: pointer; font-size: 16px; display: flex; align-items: center; justify-content: center;
    color: rgb(var(--color-foreground));
}
.cart-qty__btn:hover { background: rgba(var(--color-foreground), .05); }
.cart-qty__input {
    width: 40px; height: 36px; border: none; text-align: center; font-size: 14px;
    border-left: 1px solid rgba(var(--color-foreground), .1);
    border-right: 1px solid rgba(var(--color-foreground), .1);
    -moz-appearance: textfield;
    background: transparent;
}
.cart-qty__input::-webkit-inner-spin-button { -webkit-appearance: none; }

/* Remove Button */
.cart-remove-btn {
    background: none; border: none; cursor: pointer; padding: 8px;
    color: rgba(var(--color-foreground), .4); transition: color .2s;
}
.cart-remove-btn:hover { color: #ef4444; }

/* Cart Summary */
.cart-summary__inner {
    background: rgba(var(--color-foreground), .02);
    border: 1px solid rgba(var(--color-foreground), .1);
    border-radius: 12px;
    padding: 25px;
    position: sticky;
    top: 100px;
}
.cart-summary__subtotal {
    display: flex; justify-content: space-between; align-items: center;
    font-size: 18px; font-weight: 700;
    padding-bottom: 15px; border-bottom: 1px solid rgba(var(--color-foreground), .1);
}
.cart-summary__note {
    font-size: 13px; color: rgba(var(--color-foreground), .5);
    margin: 12px 0 20px;
}
.cart-summary__checkout-btn {
    display: block; width: 100%; padding: 14px; text-align: center;
    background: rgb(var(--color-button)); color: rgb(var(--color-button-text));
    text-decoration: none; border-radius: 6px; font-weight: 600; font-size: 15px;
    transition: opacity .2s; margin-bottom: 10px;
}
.cart-summary__checkout-btn:hover { opacity: .9; }
.cart-summary__continue-btn {
    display: block; width: 100%; padding: 12px; text-align: center;
    border: 1px solid rgba(var(--color-foreground), .2); color: rgb(var(--color-foreground));
    text-decoration: none; border-radius: 6px; font-size: 14px;
    transition: border-color .2s;
}
.cart-summary__continue-btn:hover { border-color: rgb(var(--color-foreground)); }

/* Empty Cart */
.cart-empty {
    text-align: center; padding: 60px 20px;
}
.cart-empty svg { margin-bottom: 20px; }
.cart-empty h2 { margin-bottom: 8px; font-size: 22px; }
.cart-empty p { color: rgba(var(--color-foreground), .5); margin-bottom: 25px; }
.cart-empty__btn {
    display: inline-block; padding: 13px 35px;
    background: rgb(var(--color-button)); color: rgb(var(--color-button-text));
    text-decoration: none; border-radius: 6px; font-weight: 600;
    transition: opacity .2s;
}
.cart-empty__btn:hover { opacity: .9; }

/* ========== CHECKOUT PAGE ========== */
.checkout-page { padding: 30px 0 70px; }
.checkout-page__title { margin-bottom: 30px; }

.checkout-layout {
    display: grid;
    grid-template-columns: 1fr 420px;
    gap: 40px;
    align-items: start;
}

.checkout-section { margin-bottom: 30px; }
.checkout-section__title {
    font-size: 18px; font-weight: 700; margin-bottom: 18px;
    padding-bottom: 12px; border-bottom: 1px solid rgba(var(--color-foreground), .1);
}

.checkout-field { margin-bottom: 15px; }
.checkout-field label {
    display: block; margin-bottom: 6px; font-size: 14px; font-weight: 500;
}
.checkout-field input,
.checkout-field textarea,
.checkout-field select {
    width: 100%; padding: 12px 15px; border: 1px solid rgba(var(--color-foreground), .15);
    border-radius: 6px; font-size: 14px; font-family: inherit;
    background: rgb(var(--color-background));
    color: rgb(var(--color-foreground));
    transition: border-color .2s;
}
.checkout-field input:focus,
.checkout-field textarea:focus {
    outline: none; border-color: rgb(var(--color-button));
}

/* Payment Methods */
.payment-methods { display: flex; flex-direction: column; gap: 10px; }
.payment-method {
    cursor: pointer; border: 1px solid rgba(var(--color-foreground), .15);
    border-radius: 8px; padding: 14px 18px; transition: all .2s;
}
.payment-method:hover { border-color: rgba(var(--color-foreground), .3); }
.payment-method.active { border-color: rgb(var(--color-button)); background: rgba(var(--color-button), .04); }
.payment-method input { display: none; }
.payment-method__inner { display: flex; align-items: center; gap: 12px; font-size: 14px; }

/* Checkout Summary */
.checkout-summary__inner {
    background: rgba(var(--color-foreground), .02);
    border: 1px solid rgba(var(--color-foreground), .1);
    border-radius: 12px;
    padding: 25px;
    position: sticky;
    top: 100px;
}
.checkout-summary__title {
    font-size: 18px; font-weight: 700; margin-bottom: 20px;
}

.checkout-items { margin-bottom: 20px; padding-bottom: 15px; border-bottom: 1px solid rgba(var(--color-foreground), .1); }
.checkout-item { display: flex; align-items: center; gap: 12px; margin-bottom: 12px; }
.checkout-item__image {
    width: 55px; height: 55px; border-radius: 8px; overflow: hidden; position: relative; flex-shrink: 0;
    border: 1px solid rgba(var(--color-foreground), .1);
}
.checkout-item__image img { width: 100%; height: 100%; object-fit: cover; }
.checkout-item__qty {
    position: absolute; top: -6px; right: -6px;
    width: 20px; height: 20px; border-radius: 50%;
    background: rgb(var(--color-button)); color: rgb(var(--color-button-text));
    font-size: 11px; display: flex; align-items: center; justify-content: center;
}
.checkout-item__info { flex: 1; min-width: 0; }
.checkout-item__name { display: block; font-size: 14px; font-weight: 500; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.checkout-item__variant { display: block; font-size: 12px; color: rgba(var(--color-foreground), .5); }
.checkout-item__price { font-weight: 600; font-size: 14px; white-space: nowrap; }

/* Coupon */
.checkout-coupon { margin-bottom: 20px; padding-bottom: 15px; border-bottom: 1px solid rgba(var(--color-foreground), .1); }
.checkout-coupon__form { display: flex; gap: 8px; }
.checkout-coupon__form input {
    flex: 1; padding: 10px 14px; border: 1px solid rgba(var(--color-foreground), .15);
    border-radius: 6px; font-size: 14px; font-family: inherit;
    background: rgb(var(--color-background));
}
.checkout-coupon__form input:focus { outline: none; border-color: rgb(var(--color-button)); }
.checkout-coupon__btn {
    padding: 10px 18px; border: 1px solid rgba(var(--color-foreground), .15);
    background: transparent; cursor: pointer; border-radius: 6px;
    font-size: 14px; font-weight: 500; white-space: nowrap; transition: all .2s;
}
.checkout-coupon__btn:hover { border-color: rgb(var(--color-foreground)); }
.checkout-coupon__btn--remove { color: #ef4444; border-color: #ef4444; }
.checkout-coupon__error { color: #ef4444; font-size: 13px; margin-top: 8px; }
.checkout-coupon__success { color: #16a34a; font-size: 13px; margin-top: 8px; }

/* Totals */
.checkout-totals__row { display: flex; justify-content: space-between; padding: 8px 0; font-size: 14px; }
.checkout-totals__total { font-size: 18px; font-weight: 700; border-top: 1px solid rgba(var(--color-foreground), .1); padding-top: 12px; margin-top: 4px; }
.checkout-totals__discount { color: #16a34a; }
.checkout-totals__shipping-note { font-size: 12px; color: rgba(var(--color-foreground), .4); margin: 0; padding-bottom: 4px; }

.checkout-submit-btn {
    width: 100%; padding: 15px; border: none; border-radius: 6px;
    background: rgb(var(--color-button)); color: rgb(var(--color-button-text));
    font-size: 16px; font-weight: 700; cursor: pointer; margin-top: 15px;
    transition: opacity .2s;
}
.checkout-submit-btn:hover { opacity: .9; }
.checkout-submit-btn:disabled { opacity: .6; cursor: not-allowed; }

.checkout-back-link {
    display: block; text-align: center; margin-top: 15px;
    font-size: 14px; color: rgba(var(--color-foreground), .6);
    text-decoration: none; transition: color .2s;
}
.checkout-back-link:hover { color: rgb(var(--color-foreground)); }

/* ========== ORDER SUCCESS ========== */
.order-success { padding: 60px 0 80px; }
.order-success__inner { text-align: center; max-width: 550px; margin: 0 auto; }
.order-success__icon { margin-bottom: 20px; }
.order-success__title { font-size: 28px; margin-bottom: 8px; }
.order-success__subtitle { color: rgba(var(--color-foreground), .5); margin-bottom: 30px; font-size: 16px; }

.order-success__details {
    background: rgba(var(--color-foreground), .02);
    border: 1px solid rgba(var(--color-foreground), .1);
    border-radius: 12px;
    padding: 25px;
    margin-bottom: 30px;
    text-align: left;
}
.order-success__detail {
    display: flex; justify-content: space-between; align-items: center;
    padding: 10px 0;
    border-bottom: 1px solid rgba(var(--color-foreground), .06);
}
.order-success__detail:last-child { border-bottom: none; }
.order-success__detail span:first-child { color: rgba(var(--color-foreground), .5); font-size: 14px; }

.order-success__actions { display: flex; gap: 12px; justify-content: center; flex-wrap: wrap; }
.order-success__btn {
    padding: 13px 30px; border-radius: 6px; text-decoration: none;
    font-weight: 600; font-size: 14px; transition: opacity .2s;
}
.order-success__btn--primary { background: rgb(var(--color-button)); color: rgb(var(--color-button-text)); }
.order-success__btn--secondary { border: 1px solid rgba(var(--color-foreground), .2); color: rgb(var(--color-foreground)); }
.order-success__btn:hover { opacity: .85; }

/* ========== ORDERS LIST ========== */
.orders-page { padding: 30px 0 70px; }
.orders-page__title { margin-bottom: 30px; }

.orders-list { display: flex; flex-direction: column; gap: 12px; }
.order-card {
    display: grid; grid-template-columns: 1fr auto;
    gap: 10px; align-items: center;
    padding: 20px 24px;
    border: 1px solid rgba(var(--color-foreground), .1);
    border-radius: 10px;
    text-decoration: none;
    color: rgb(var(--color-foreground));
    transition: border-color .2s, box-shadow .2s;
    position: relative;
}
.order-card:hover {
    border-color: rgba(var(--color-foreground), .2);
    box-shadow: 0 2px 12px rgba(0,0,0,.04);
}
.order-card__header { display: flex; justify-content: space-between; align-items: center; grid-column: 1 / -1; }
.order-card__number { font-weight: 700; font-size: 15px; margin-right: 12px; }
.order-card__date { font-size: 13px; color: rgba(var(--color-foreground), .4); }
.order-card__body { display: flex; justify-content: space-between; align-items: center; grid-column: 1 / -1; }
.order-card__info { font-size: 14px; color: rgba(var(--color-foreground), .5); }
.order-card__divider { margin: 0 8px; }
.order-card__total { font-size: 18px; font-weight: 700; }
.order-card__arrow {
    position: absolute; right: 20px; top: 50%; transform: translateY(-50%);
    color: rgba(var(--color-foreground), .3);
}

/* Status Badge */
.order-status-badge {
    display: inline-block; padding: 4px 12px; border-radius: 20px;
    font-size: 12px; font-weight: 600; color: #fff;
    text-transform: capitalize;
}
.order-status-badge--lg { font-size: 14px; padding: 6px 16px; }

/* ========== ORDER DETAIL ========== */
.order-detail { padding: 30px 0 70px; }
.order-detail__header { display: flex; justify-content: space-between; align-items: flex-start; margin-bottom: 30px; flex-wrap: wrap; gap: 15px; }
.order-detail__title { margin-bottom: 5px; }
.order-detail__date { font-size: 14px; color: rgba(var(--color-foreground), .5); }

.order-detail__content {
    display: grid;
    grid-template-columns: 1fr 340px;
    gap: 30px;
    align-items: start;
}
.order-detail__section-title { font-size: 16px; font-weight: 700; margin-bottom: 15px; }

/* Order Items List */
.order-items-list { display: flex; flex-direction: column; gap: 0; }
.order-item {
    display: flex; align-items: center; gap: 15px;
    padding: 15px 0;
    border-bottom: 1px solid rgba(var(--color-foreground), .06);
}
.order-item:last-child { border-bottom: none; }
.order-item__image { width: 65px; height: 65px; border-radius: 8px; overflow: hidden; flex-shrink: 0; }
.order-item__image img { width: 100%; height: 100%; object-fit: cover; }
.order-item__info { flex: 1; }
.order-item__name { display: block; font-weight: 600; font-size: 14px; margin-bottom: 4px; }
.order-item__variant { display: block; font-size: 13px; color: rgba(var(--color-foreground), .5); }
.order-item__qty { font-size: 13px; color: rgba(var(--color-foreground), .5); }
.order-item__prices { text-align: right; }
.order-item__unit { display: block; font-size: 12px; color: rgba(var(--color-foreground), .4); }
.order-item__total { font-weight: 700; font-size: 15px; }

/* Order Detail Sidebar Boxes */
.order-detail__box {
    background: rgba(var(--color-foreground), .02);
    border: 1px solid rgba(var(--color-foreground), .08);
    border-radius: 10px;
    padding: 20px;
    margin-bottom: 15px;
}
.order-detail__box-title { font-size: 14px; font-weight: 700; margin-bottom: 12px; }
.order-detail__box p { font-size: 14px; margin: 4px 0; color: rgba(var(--color-foreground), .7); }

/* ========== ORDER TRACKING ========== */
.order-tracking {
    background: rgba(var(--color-foreground), .02);
    border: 1px solid rgba(var(--color-foreground), .08);
    border-radius: 12px;
    padding: 30px;
    margin-bottom: 30px;
}
.order-tracking__steps {
    display: flex;
    align-items: center;
    justify-content: center;
}
.tracking-step { display: flex; flex-direction: column; align-items: center; gap: 8px; position: relative; }
.tracking-step__dot {
    width: 32px; height: 32px; border-radius: 50%;
    border: 2px solid rgba(var(--color-foreground), .15);
    display: flex; align-items: center; justify-content: center;
    background: rgb(var(--color-background));
    transition: all .3s;
    position: relative;
}
.tracking-step--active .tracking-step__dot {
    border-color: rgb(var(--color-button));
    background: rgb(var(--color-button));
    color: rgb(var(--color-button-text));
}
.tracking-step__label {
    font-size: 12px; color: rgba(var(--color-foreground), .4);
    white-space: nowrap;
}
.tracking-step--active .tracking-step__label { color: rgb(var(--color-foreground)); font-weight: 600; }
.tracking-step__line {
    flex: 1; height: 2px; background: rgba(var(--color-foreground), .1);
    min-width: 40px; margin: 0 4px; align-self: flex-start; margin-top: 16px;
}
.tracking-step__line--active { background: rgb(var(--color-button)); }

.tracking-step__pulse {
    width: 10px; height: 10px; border-radius: 50%;
    background: rgb(var(--color-button-text));
    animation: pulse 2s infinite;
}
@keyframes pulse {
    0%, 100% { transform: scale(1); opacity: 1; }
    50% { transform: scale(1.4); opacity: .6; }
}

.order-tracking__cancelled {
    display: flex; align-items: center; justify-content: center;
    gap: 10px; font-size: 16px; font-weight: 600; color: #ef4444;
}

/* ========== TRACK ORDER PAGE ========== */
.track-page { padding: 60px 0 80px; }
.track-page__inner { max-width: 500px; margin: 0 auto; text-align: center; }
.track-page__title { margin-bottom: 10px; }
.track-page__subtitle { color: rgba(var(--color-foreground), .5); margin-bottom: 30px; }

.track-form__field {
    display: flex; gap: 10px;
}
.track-form__field input {
    flex: 1; padding: 14px 18px;
    border: 1px solid rgba(var(--color-foreground), .15);
    border-radius: 8px; font-size: 15px; font-family: inherit;
    background: rgb(var(--color-background));
}
.track-form__field input:focus { outline: none; border-color: rgb(var(--color-button)); }
.track-form__btn {
    display: flex; align-items: center; gap: 8px;
    padding: 14px 24px; border: none; border-radius: 8px;
    background: rgb(var(--color-button)); color: rgb(var(--color-button-text));
    font-size: 15px; font-weight: 600; cursor: pointer; white-space: nowrap;
    transition: opacity .2s;
}
.track-form__btn:hover { opacity: .9; }

/* ========== MINI CART DRAWER ITEMS ========== */
.mini-cart-item {
    display: flex; gap: 12px; padding: 12px 0;
    border-bottom: 1px solid rgba(var(--color-foreground), .06);
}
.mini-cart-item__image { width: 60px; height: 60px; border-radius: 6px; overflow: hidden; flex-shrink: 0; }
.mini-cart-item__image img { width: 100%; height: 100%; object-fit: cover; }
.mini-cart-item__info { flex: 1; min-width: 0; }
.mini-cart-item__name {
    display: block; font-size: 13px; font-weight: 600; margin-bottom: 4px;
    white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
    color: rgb(var(--color-foreground)); text-decoration: none;
}
.mini-cart-item__variant { font-size: 12px; color: rgba(var(--color-foreground), .5); }
.mini-cart-item__price { font-size: 13px; font-weight: 600; }
.mini-cart-item__qty { font-size: 12px; color: rgba(var(--color-foreground), .5); }
.mini-cart-item__remove {
    background: none; border: none; cursor: pointer; padding: 4px;
    color: rgba(var(--color-foreground), .3); align-self: flex-start;
}
.mini-cart-item__remove:hover { color: #ef4444; }

.mini-cart-subtotal {
    display: flex; justify-content: space-between; padding: 15px 0;
    font-weight: 700; font-size: 15px;
    border-top: 1px solid rgba(var(--color-foreground), .1);
}
.mini-cart-empty {
    text-align: center; padding: 40px 20px; color: rgba(var(--color-foreground), .4);
}

/* ========== RESPONSIVE ========== */
@media (max-width: 991px) {
    .cart-page__content { grid-template-columns: 1fr; gap: 30px; }
    .checkout-layout { grid-template-columns: 1fr; gap: 30px; }
    .order-detail__content { grid-template-columns: 1fr; }
    .checkout-summary__inner { position: static; }
    .cart-summary__inner { position: static; }
}

@media (max-width: 767px) {
    .cart-table thead { display: none; }
    .cart-item { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; }
    .cart-item td { border: none; padding: 8px 5px; display: block; }
    .cart-item td:first-child { padding-top: 20px; }
    .cart-item { border-bottom: 1px solid rgba(var(--color-foreground), .06); padding: 10px 0; }
    .cart-item__price::before,
    .cart-item__total::before {
        content: attr(data-label) ": ";
        font-weight: 400;
        color: rgba(var(--color-foreground), .5);
        font-size: 12px;
    }
    .order-tracking__steps { flex-wrap: wrap; gap: 4px; }
    .tracking-step__line { min-width: 20px; }
    .order-success__actions { flex-direction: column; }
    .order-card__header { flex-direction: column; align-items: flex-start; gap: 8px; }
    .order-detail__header { flex-direction: column; }
}
