/**
 * Alixa Cart styles — div-based card layout (RTL, mobile-first, responsive).
 * Rewritten from the old <table> approach so items render reliably on every
 * width without table linearization quirks.
 */

/* ---------- Active-prescription cross-link banner ---------- */
.alixa-rxbanner {
    direction: rtl;
    max-width: 760px;
    margin: 1.2rem auto 0;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    flex-wrap: wrap;
    background: #e6f6fc;
    border: 1px solid #b9e7f7;
    border-radius: 12px;
    padding: 12px 16px;
    color: #0f172a;
    font-size: 0.92rem;
}
.alixa-rxbanner__cta {
    background: #0096c7;
    color: #fff !important;
    text-decoration: none;
    font-weight: 700;
    border-radius: 9px;
    padding: 7px 14px;
    white-space: nowrap;
    font-size: 0.88rem;
}
.alixa-rxbanner__cta:hover { background: #0077a8; }

/* ---------- Container ---------- */
.alixa-cart,
.alixa-cart-empty {
    direction: rtl;
    text-align: right;
    font-family: inherit;
    max-width: 760px;
    margin: 2rem auto;
    padding: 1.5rem;
    background: #ffffff;
    border-radius: 12px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.06);
}

.alixa-cart-title {
    font-size: 1.4rem;
    font-weight: 700;
    margin: 0 0 1.25rem;
    color: #1a1a1a;
    border-bottom: 2px solid #0096c7;
    padding-bottom: 0.7rem;
}

/* ---------- Groups (دارو / فروشگاه) ---------- */
.alixa-cart-group { margin-bottom: 1.1rem; }
.alixa-cart-group__head {
    display: flex;
    align-items: baseline;
    gap: 0.6rem;
    flex-wrap: wrap;
    margin: 0 0 0.6rem;
    padding-inline-start: 0.6rem;
    border-inline-start: 4px solid #94a3b8;
}
.alixa-cart-group.is-drug .alixa-cart-group__head { border-inline-start-color: #0096c7; }
.alixa-cart-group.is-shop .alixa-cart-group__head { border-inline-start-color: #2563eb; }
.alixa-cart-group__title { font-weight: 700; font-size: 1rem; color: #1a1a1a; }
.alixa-cart-group__note { font-size: 0.8rem; color: #6b7280; }

/* ---------- Item list / cards ---------- */
.alixa-cart-items {
    display: flex;
    flex-direction: column;
    gap: 0.85rem;
}

.alixa-cart-item {
    position: relative;
    border: 1px solid #e5e7eb;
    border-radius: 12px;
    padding: 0.9rem 0.95rem;
    background: #fff;
}

.alixa-cart-item__name {
    font-size: 1.02rem;
    font-weight: 700;
    line-height: 1.7;
    color: #1a1a1a;
    padding-left: 2.2rem; /* room for the remove button (top-left) */
}

.alixa-cart-item__row {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 0.75rem 1rem;
    margin-top: 0.7rem;
}

.alixa-cart-item__prices {
    display: flex;
    flex-direction: column;
    gap: 0.2rem;
    min-width: 9rem;
}
.alixa-cart-item__unit,
.alixa-cart-item__line {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: 0.75rem;
    font-variant-numeric: tabular-nums;
}
.alixa-cart-item__unit .lbl,
.alixa-cart-item__line .lbl { color: #6b7280; font-size: 0.85rem; font-weight: 400; }
.alixa-cart-item__line { font-weight: 700; }
.alixa-cart-item__line .num { color: #1a1a1a; }

/* ---------- Quantity stepper (always inline) ---------- */
.alixa-cart-qty {
    display: flex;
    align-items: center;
    gap: 6px;
}
.alixa-qty-btn {
    width: 30px;
    height: 30px;
    border: 1px solid #d1d5db;
    background: #fff;
    border-radius: 6px;
    cursor: pointer;
    font-size: 1.15rem;
    line-height: 1;
    color: #374151;
    flex: 0 0 auto;
    transition: all 0.15s ease;
}
.alixa-qty-btn:hover { background: #0096c7; color: #fff; border-color: #0096c7; }
.alixa-qty-btn:active { transform: scale(0.95); }
.alixa-qty-input {
    width: 52px;
    height: 30px;
    text-align: center;
    border: 1px solid #d1d5db;
    border-radius: 6px;
    font-size: 0.95rem;
    flex: 0 0 auto;
    -moz-appearance: textfield;
}
.alixa-qty-input::-webkit-outer-spin-button,
.alixa-qty-input::-webkit-inner-spin-button { -webkit-appearance: none; margin: 0; }

/* ---------- Remove button (pinned top-left of the card) ---------- */
.alixa-cart-remove {
    position: absolute;
    top: 0.6rem;
    left: 0.6rem;
    width: 30px;
    height: 30px;
    border: none;
    background: #fee2e2;
    color: #b91c1c;
    border-radius: 50%;
    cursor: pointer;
    font-size: 1.25rem;
    line-height: 1;
    transition: all 0.15s ease;
}
.alixa-cart-remove:hover { background: #b91c1c; color: #fff; }

/* ---------- Total ---------- */
.alixa-cart-foot {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.75rem;
    margin-top: 1.1rem;
    padding-top: 0.9rem;
    border-top: 2px solid #1a1a1a;
}
.alixa-cart-total-label { font-size: 1.02rem; font-weight: 700; color: #1a1a1a; }
.alixa-cart-total-value {
    font-size: 1.1rem;
    font-weight: 700;
    color: #0096c7;
    font-variant-numeric: tabular-nums;
}

/* ---------- Action buttons ---------- */
.alixa-cart-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 0.7rem;
    margin-top: 1.1rem;
}
.alixa-cart-btn {
    display: inline-block;
    padding: 0.7rem 1.4rem;
    border: none;
    border-radius: 8px;
    font-size: 0.98rem;
    font-weight: 600;
    cursor: pointer;
    text-decoration: none;
    text-align: center;
    font-family: inherit;
    transition: all 0.15s ease;
}
.alixa-cart-btn-primary { background: #0096c7; color: #fff; }
.alixa-cart-btn-primary:hover { background: #0077a8; color: #fff; }
.alixa-cart-btn-secondary { background: #f3f4f6; color: #374151; border: 1px solid #d1d5db; }
.alixa-cart-btn-secondary:hover { background: #e5e7eb; color: #1a1a1a; }

/* ---------- Empty state ---------- */
.alixa-cart-empty { text-align: center; padding: 3rem 1.5rem; }
.alixa-cart-empty h2 { font-size: 1.4rem; color: #4b5563; margin: 0 0 0.75rem; }
.alixa-cart-empty p { color: #6b7280; margin: 0 0 1.5rem; }

/* ---------- Mobile ---------- */
@media (max-width: 600px) {
    .alixa-cart,
    .alixa-cart-empty { margin: 1rem; padding: 1rem; }
    .alixa-cart-item__row { gap: 0.6rem; }
    .alixa-cart-item__prices { min-width: 8rem; }
    .alixa-cart-actions { flex-direction: column; }
    .alixa-cart-btn { width: 100%; }
}
