/* Cart page */

.cart-page {
    min-height: 100vh;
    padding: 104px 0 84px;
    background:
        radial-gradient(780px 420px at 15% 2%, rgba(45, 84, 135, 0.10), transparent 60%),
        radial-gradient(760px 420px at 92% 18%, rgba(6, 182, 212, 0.08), transparent 58%),
        var(--dark-2);
}

.cart-page a {
    text-decoration: none;
}

.cart-hero {
    position: relative;
    margin-bottom: 28px;
    padding: clamp(22px, 4vw, 34px);
    border: 1px solid rgba(15, 23, 42, 0.08);
    border-radius: 24px;
    background: rgba(255, 255, 255, 0.78);
    box-shadow: 0 18px 55px rgba(2, 6, 23, 0.08);
    backdrop-filter: blur(16px);
}

.cart-hero::before {
    content: '';
    position: absolute;
    inset: 0;
    pointer-events: none;
    background:
        linear-gradient(135deg, rgba(45, 84, 135, 0.08), transparent 38%),
        linear-gradient(315deg, rgba(6, 182, 212, 0.07), transparent 42%);
    border-radius: inherit;
}

.cart-hero > * {
    position: relative;
    z-index: 1;
}

.cart-breadcrumb {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 18px;
    color: var(--text-dim);
    font-size: 13px;
}

.cart-breadcrumb a {
    color: var(--primary);
    font-weight: 800;
    transition: color .2s ease;
}

.cart-breadcrumb a:hover {
    color: var(--primary-dark);
}

.cart-breadcrumb i {
    font-size: 10px;
}

.cart-heading {
    display: flex;
    align-items: flex-end;
    justify-content: space-between;
    gap: 20px;
}

.cart-eyebrow {
    display: inline-flex;
    align-items: center;
    gap: 7px;
    margin-bottom: 10px;
    padding: 6px 12px;
    border: 1px solid rgba(45, 84, 135, 0.14);
    border-radius: 999px;
    background: rgba(45, 84, 135, 0.08);
    color: var(--primary);
    font-size: 12px;
    font-weight: 800;
}

.cart-heading h1 {
    margin: 0;
    color: var(--text);
    font-size: clamp(28px, 4vw, 42px);
    font-weight: 900;
    line-height: 1.2;
}

.cart-heading p {
    max-width: 560px;
    margin: 10px 0 0;
    color: var(--text-muted);
    font-size: 15px;
    line-height: 1.8;
}

@keyframes floatingBadge {
    0% { transform: translateY(0); box-shadow: 0 0 15px rgba(45, 84, 135, 0.5); }
    50% { transform: translateY(-5px); box-shadow: 0 0 25px rgba(45, 84, 135, 0.7); }
    100% { transform: translateY(0); box-shadow: 0 0 15px rgba(45, 84, 135, 0.5); }
}

.cart-count-badge {
    position: absolute;
    top: -20px;
    left: -20px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 50px;
    height: 50px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--primary), #06b6d4); /* Using cyan/accent for glow */
    color: #fff;
    font-size: 20px;
    font-weight: 900;
    box-shadow: 0 0 15px rgba(45, 84, 135, 0.5), 0 0 30px rgba(45, 84, 135, 0.3);
    border: 2px solid #fff;
    z-index: 10;
    animation: floatingBadge 3s ease-in-out infinite;
}

.cart-hero-stats {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 10px;
    margin-top: 24px;
}

.cart-hero-stat {
    display: flex;
    align-items: center;
    gap: 9px;
    min-height: 42px;
    padding: 10px 12px;
    border: 1px solid rgba(15, 23, 42, 0.08);
    border-radius: 14px;
    background: rgba(255, 255, 255, 0.68);
    color: var(--text-muted);
    font-size: 13px;
    font-weight: 800;
}

.cart-hero-stat i {
    color: var(--primary);
}

.cart-layout {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 380px;
    gap: 24px;
    align-items: start;
}

.cart-table-card,
.cart-summary-card {
    border: 1px solid rgba(15, 23, 42, 0.09);
    border-radius: 22px;
    background: #fff;
    box-shadow: 0 14px 42px rgba(2, 6, 23, 0.07);
}

.cart-table-card {
    overflow: hidden;
}

.cart-table-head {
    display: flex;
    justify-content: space-between;
    gap: 32px;
    padding: 14px 22px;
    border-bottom: 1px solid rgba(15, 23, 42, 0.08);
    background: linear-gradient(180deg, #fff, rgba(248, 250, 252, 0.95));
    color: var(--text-muted);
    font-size: 12px;
    font-weight: 900;
}

.cart-table-head span:first-child {
    flex: 1;
    min-width: 0;
}

.cart-table-head span:last-child {
    width: 220px;
    flex-shrink: 0;
    text-align: left;
}

.cart-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 32px;
    padding: 16px 22px;
    border-bottom: 1px solid rgba(15, 23, 42, 0.08);
    transition: background .25s ease, opacity .25s ease, transform .25s ease;
}

.cart-row:last-child {
    border-bottom: 0;
}

.cart-row:hover {
    background: rgba(248, 250, 252, 0.85);
}

.cart-row.is-removing {
    opacity: 0;
    transform: translateX(30px);
    transition: opacity .35s ease, transform .35s ease;
}

.cart-product-main {
    display: flex;
    align-items: center;
    gap: 16px;
    flex: 1;
    min-width: 0;
}

.cart-product-main .cart-product-img {
    width: 80px;
    height: 60px;
    flex-shrink: 0;
    object-fit: cover;
    border: 1px solid rgba(15, 23, 42, 0.10);
    border-radius: 12px;
    background: var(--dark-3);
    box-shadow: 0 6px 16px rgba(2, 6, 23, 0.07);
}

.cart-product-info {
    min-width: 0;
}

.cart-product-title {
    display: -webkit-box;
    overflow: hidden;
    margin-bottom: 6px;
    color: var(--text);
    font-size: 14px;
    font-weight: 900;
    line-height: 1.5;
    -webkit-box-orient: vertical;
    -webkit-line-clamp: 2;
}

.cart-product-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin-bottom: 8px;
}

.cart-product-meta span {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    padding: 4px 9px;
    border-radius: 999px;
    background: rgba(15, 23, 42, 0.04);
    color: var(--text-muted);
    font-size: 11px;
    font-weight: 800;
}

.cart-product-meta i {
    color: var(--primary);
}

.cart-product-remove {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    min-height: 28px;
    padding: 4px 10px;
    border: 1px solid rgba(255, 107, 107, 0.22);
    border-radius: 8px;
    background: rgba(255, 107, 107, 0.07);
    color: var(--coral);
    cursor: pointer;
    font-family: 'Cairo', sans-serif;
    font-size: 11px;
    font-weight: 900;
    transition: background .2s ease, border-color .2s ease, transform .2s ease;
}

.cart-product-remove:hover {
    border-color: rgba(255, 107, 107, 0.42);
    background: rgba(255, 107, 107, 0.12);
    transform: translateY(-1px);
}

.cart-product-remove:disabled {
    cursor: wait;
    opacity: .7;
    transform: none;
}

/* ─── Pricing Section ─── */

.cart-product-pricing {
    width: 220px;
    flex-shrink: 0;
}

.cart-pricing-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 12px;
    padding: 4px 0;
    font-size: 13px;
    line-height: 1.5;
}

.cart-pricing-label {
    color: var(--text-muted);
    font-weight: 600;
}

.cart-pricing-value {
    font-weight: 700;
    color: var(--text);
    white-space: nowrap;
}

.cart-pricing-tax {
    color: #f59e0b;
}

.cart-pricing-divider {
    height: 1px;
    background: rgba(15, 23, 42, 0.08);
    margin: 4px 0;
}

.cart-pricing-total {
    padding-top: 4px;
}

.cart-pricing-total .cart-pricing-label {
    font-weight: 800;
    color: var(--text);
    font-size: 14px;
}

.cart-pricing-grand {
    font-size: 18px;
    font-weight: 900;
    color: var(--primary);
    white-space: nowrap;
}

.cart-empty {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    min-height: 360px;
    padding: 56px 24px;
    text-align: center;
}

.cart-empty-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 76px;
    height: 76px;
    margin-bottom: 18px;
    border-radius: 24px;
    background: linear-gradient(135deg, rgba(45, 84, 135,0.12), rgba(45, 84, 135,0.06));
    color: var(--primary);
    font-size: 30px;
    box-shadow: 0 8px 24px rgba(45, 84, 135,0.10);
}

.cart-empty h2 {
    margin: 0 0 8px;
    color: var(--text);
    font-size: 22px;
    font-weight: 900;
}

.cart-empty p {
    max-width: 420px;
    margin: 0 0 18px;
    color: var(--text-muted);
    font-size: 14px;
    line-height: 1.8;
}

.cart-empty-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    min-height: 44px;
    padding: 0 18px;
    border-radius: 14px;
    background: linear-gradient(135deg, var(--primary), var(--primary-dark));
    color: #fff !important;
    font-size: 14px;
    font-weight: 900;
    box-shadow: 0 12px 28px rgba(45, 84, 135, 0.24);
    transition: transform .22s ease, box-shadow .22s ease;
}

.cart-empty-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 18px 34px rgba(45, 84, 135, 0.30);
}

.cart-summary-card {
    position: sticky;
    top: 96px;
    overflow: hidden;
}

.cart-summary-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    padding: 18px 22px;
    background: linear-gradient(135deg, var(--primary), var(--primary-dark));
    color: #fff;
}

.cart-summary-head span {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    font-size: 16px;
    font-weight: 900;
}

.cart-summary-head small {
    padding: 4px 9px;
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.16);
    font-size: 12px;
    font-weight: 800;
}

.cart-summary-body {
    padding: 22px;
}

.checkout-steps {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 10px;
    margin-bottom: 18px;
}

.checkout-steps span {
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    height: 38px;
    border: 1px solid rgba(15, 23, 42, 0.08);
    border-radius: 12px;
    background: var(--dark-2);
    color: var(--text-dim);
}

.checkout-steps span.is-active {
    border-color: rgba(45, 84, 135, 0.22);
    background: rgba(45, 84, 135, 0.09);
    color: var(--primary);
}

.coupon-toggle-btn {
    display: flex;
    align-items: center;
    justify-content: space-between;
    width: 100%;
    padding: 13px 14px;
    border: 1px dashed rgba(45, 84, 135, 0.25);
    border-radius: 14px;
    background: rgba(45, 84, 135, 0.05);
    color: var(--primary);
    cursor: pointer;
    font-family: 'Cairo', sans-serif;
    font-size: 14px;
    font-weight: 900;
    transition: background .2s ease, border-color .2s ease;
}

.coupon-toggle-btn:hover,
.coupon-toggle-btn.open {
    border-color: rgba(45, 84, 135, 0.42);
    background: rgba(45, 84, 135, 0.09);
}

.coupon-icon {
    display: flex;
    align-items: center;
    gap: 8px;
}

.coupon-arrow {
    color: var(--text-muted);
    font-size: 12px;
    transition: transform .25s ease;
}

.coupon-toggle-btn.open .coupon-arrow {
    transform: rotate(180deg);
}

.coupon-panel {
    max-height: 0;
    overflow: hidden;
    transition: max-height .32s cubic-bezier(0.4, 0, 0.2, 1);
}

.coupon-panel.open {
    max-height: 150px;
}

.coupon-inner {
    display: flex;
    gap: 8px;
    padding: 14px 0 6px;
}

.coupon-inline-row {
    display: flex;
    gap: 8px;
    align-items: stretch;
}

.coupon-input {
    flex: 1;
    min-width: 0;
    height: 44px;
    padding: 0 13px;
    border: 1.5px solid var(--dark-4);
    border-radius: 13px;
    outline: 0;
    background: var(--dark-2);
    color: var(--text);
    direction: ltr;
    font-family: 'Cairo', sans-serif;
    font-size: 14px;
    font-weight: 900;
    letter-spacing: 2px;
    text-align: center;
    transition: border-color .2s ease, background .2s ease, box-shadow .2s ease;
}

.coupon-input::placeholder {
    color: var(--text-dim);
    direction: rtl;
    font-weight: 600;
    letter-spacing: 0;
}

.coupon-input:focus {
    border-color: var(--primary-light);
    background: #fff;
    box-shadow: var(--ring);
}

.coupon-apply-btn {
    flex: 0 0 auto;
    min-width: 78px;
    height: 44px;
    padding: 0 16px;
    border: 0;
    border-radius: 13px;
    background: linear-gradient(135deg, var(--primary), var(--primary-dark));
    color: #fff;
    cursor: pointer;
    font-family: 'Cairo', sans-serif;
    font-size: 14px;
    font-weight: 900;
    transition: transform .2s ease, box-shadow .2s ease;
}

.coupon-apply-btn:hover {
    transform: translateY(-1px);
    box-shadow: 0 12px 24px rgba(45, 84, 135, 0.24);
}

.coupon-feedback {
    min-height: 20px;
    margin: 0 0 8px;
    font-size: 12px;
    font-weight: 800;
}

.coupon-feedback.is-error {
    color: #dc2626;
}

.coupon-feedback.is-success {
    color: #059669;
}

.summary-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 14px;
    padding: 12px 0;
    border-bottom: 1px dashed rgba(15, 23, 42, 0.12);
    color: var(--text-muted);
    font-size: 14px;
}

.summary-row span:last-child {
    color: var(--text);
    font-weight: 900;
    white-space: nowrap;
}

.summary-row.total-row {
    margin-top: 6px;
    padding: 16px 0 4px;
    border-bottom: 0;
    color: var(--text);
    font-size: 17px;
    font-weight: 900;
}

.summary-row.total-row span:last-child {
    color: var(--primary);
    font-size: 22px;
}

.checkout-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    width: 100%;
    min-height: 54px;
    margin-top: 22px;
    padding: 0 16px;
    border: 0;
    border-radius: 15px;
    background: linear-gradient(135deg, var(--primary), var(--primary-dark));
    color: #fff;
    cursor: pointer;
    font-family: 'Cairo', sans-serif;
    font-size: 15px;
    font-weight: 900;
    box-shadow: 0 16px 34px rgba(45, 84, 135, 0.30);
    transition: transform .22s ease, box-shadow .22s ease;
    text-decoration: none;
    min-width: 0;
    overflow: hidden;
}

.checkout-btn:hover {
    transform: translateY(-2px);
    color: #fff;
    box-shadow: 0 22px 42px rgba(45, 84, 135, 0.36);
}

.checkout-btn:disabled,
.checkout-btn[aria-disabled="true"] {
    opacity: .65;
    cursor: wait;
    transform: none !important;
    box-shadow: none !important;
    pointer-events: none;
}

.checkout-form { margin: 0; }

.checkout-btn .btn-text,
.checkout-btn .btn-loading {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: inherit;
    flex: 1;
    min-width: 0;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.checkout-btn .btn-loading {
    display: none;
}

.checkout-btn.loading .btn-text {
    display: none;
}

.checkout-btn.loading .btn-loading {
    display: inline-flex;
}

.continue-link {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 7px;
    width: 100%;
    min-height: 44px;
    margin-top: 12px;
    border-radius: 13px;
    color: var(--primary);
    font-size: 14px;
    font-weight: 900;
    transition: background .2s ease, color .2s ease;
}

.continue-link:hover {
    background: rgba(45, 84, 135, 0.07);
    color: var(--primary-dark);
}

.secure-badge {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 7px;
    margin-top: 12px;
    padding-top: 14px;
    border-top: 1px solid rgba(15, 23, 42, 0.08);
    color: var(--text-muted);
    font-size: 12px;
    font-weight: 800;
}

.secure-badge i {
    color: #16a34a;
}

.select_style,
.profile-modal-group input {
    width: 100%;
    min-height: 44px;
    border: 1.5px solid #d1d5db;
    border-radius: 12px;
    padding: 10px 14px;
    outline: none;
    color: var(--text);
    font-family: 'Cairo', sans-serif;
    font-size: 14px;
    transition: border-color .2s ease, box-shadow .2s ease, background .2s ease;
}

.select_style {
    margin-bottom: 0;
    background: #fff;
}

.select_style:focus,
.profile-modal-group input:focus {
    border-color: var(--primary);
    box-shadow: var(--ring);
}

.profile-modal-overlay {
    position: fixed;
    inset: 0;
    z-index: 9999;
    display: none;
    align-items: center;
    justify-content: center;
    padding: 20px;
    background: rgba(15, 23, 42, 0.58);
    backdrop-filter: blur(8px);
}

.profile-modal-overlay.active {
    display: flex;
}

.profile-modal {
    width: min(100%, 500px);
    max-height: calc(100vh - 40px);
    overflow: auto;
    padding: 28px;
    border: 1px solid rgba(15, 23, 42, 0.10);
    border-radius: 22px;
    background: #fff;
    box-shadow: 0 28px 80px rgba(2, 6, 23, 0.28);
    direction: rtl;
    animation: pmSlideIn .24s ease;
}

@keyframes pmSlideIn {
    from {
        transform: translateY(14px) scale(.98);
        opacity: 0;
    }
    to {
        transform: translateY(0) scale(1);
        opacity: 1;
    }
}

.profile-modal-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 14px;
    margin-bottom: 8px;
}

.profile-modal-header h2 {
    display: flex;
    align-items: center;
    gap: 9px;
    margin: 0;
    color: var(--text);
    font-size: 19px;
    font-weight: 900;
    line-height: 1.5;
}

.profile-modal-header h2 i {
    color: var(--primary);
}

.profile-modal-close {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
    border: 0;
    border-radius: 12px;
    background: var(--dark-2);
    color: var(--text-muted);
    cursor: pointer;
    font-size: 22px;
    line-height: 1;
    transition: background .2s ease, color .2s ease;
}

.profile-modal-close:hover {
    background: rgba(255, 107, 107, 0.10);
    color: var(--coral);
}

.profile-modal-desc {
    margin: 0 0 18px;
    color: var(--text-muted);
    font-size: 13px;
    line-height: 1.8;
}

.profile-modal-form {
    display: flex;
    flex-direction: column;
    gap: 15px;
}

.profile-modal-group {
    display: flex;
    flex-direction: column;
    gap: 7px;
}

.profile-modal-group label {
    color: var(--text);
    font-size: 13px;
    font-weight: 900;
}

.profile-modal-group .req {
    color: #ef4444;
}

.profile-modal-group input.is-invalid,
.select_style.is-invalid {
    border-color: #ef4444;
    background: #fff5f5;
}

.profile-invalid-msg {
    display: flex;
    align-items: center;
    gap: 6px;
    color: #ef4444;
    font-size: 12px;
    font-weight: 800;
}

.profile-modal-alert {
    display: flex;
    align-items: flex-start;
    gap: 8px;
    margin-bottom: 16px;
    padding: 12px 14px;
    border: 1px solid #fecdd3;
    border-radius: 14px;
    background: #fff1f2;
    color: #be123c;
    font-size: 13px;
}

.profile-modal-alert ul {
    margin: 0;
    padding: 0 16px 0 0;
}

.profile-modal-submit {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    min-height: 50px;
    margin-top: 4px;
    border: 0;
    border-radius: 15px;
    background: linear-gradient(135deg, var(--primary), var(--primary-dark));
    color: #fff;
    cursor: pointer;
    font-family: 'Cairo', sans-serif;
    font-size: 15px;
    font-weight: 900;
    box-shadow: 0 14px 30px rgba(45, 84, 135, 0.24);
    transition: transform .2s ease, box-shadow .2s ease;
}

.profile-modal-submit:hover {
    transform: translateY(-1px);
    box-shadow: 0 18px 36px rgba(45, 84, 135, 0.30);
}

@media (max-width: 1020px) {
    .cart-layout {
        grid-template-columns: 1fr;
    }

    .cart-summary-card {
        position: static;
    }
}

@media (max-width: 700px) {
    .cart-page {
        padding: 92px 0 72px;
    }

    .cart-hero {
        border-radius: 20px;
    }

    .cart-heading {
        align-items: flex-start;
    }

    .cart-count-badge {
        min-width: 44px;
        height: 44px;
        border-radius: 50%;
        font-size: 17px;
        top: -15px;
        left: -15px;
    }

    .cart-hero-stats {
        grid-template-columns: 1fr;
    }

    .cart-table-head {
        display: none;
    }

    .cart-table-card,
    .cart-summary-card {
        border-radius: 18px;
    }

    .cart-row {
        flex-direction: column;
        align-items: stretch;
        gap: 14px;
        padding: 16px;
    }

    .cart-product-main {
        width: 100%;
    }

    .cart-product-main .cart-product-img {
        width: 82px;
        height: 64px;
        border-radius: 12px;
    }

    .cart-product-pricing {
        width: 100%;
    }

    .cart-pricing-row {
        padding: 5px 0;
    }

    .cart-pricing-grand {
        font-size: 17px;
    }

    .coupon-inner,
    .coupon-inline-row {
        flex-direction: column;
    }

    .coupon-input {
        width: 100%;
        text-align: right;
        letter-spacing: 1px;
    }

    .coupon-apply-btn {
        width: 100%;
    }

    .profile-modal {
        padding: 22px;
        border-radius: 18px;
    }
}

@media (max-width: 420px) {
    .cart-heading {
        flex-direction: column;
    }

    .cart-product-main {
        flex-direction: column;
        align-items: stretch;
    }

    .cart-product-main .cart-product-img {
        width: 100%;
        height: auto;
        aspect-ratio: 16 / 9;
    }
}

@media (prefers-reduced-motion: reduce) {
    .cart-page *,
    .cart-page *::before,
    .cart-page *::after,
    .profile-modal {
        animation: none !important;
        transition: none !important;
    }
}

/* تنبيه إكمال البيانات في السلة (بعد تسجيل مجاني بملف ناقص) */
.cart-profile-alert {
    display: flex;
    align-items: center;
    gap: 10px;
    margin: 0 0 18px;
    padding: 14px 18px;
    border: 1px solid #f0c36d;
    border-right: 4px solid #e0a800;
    background: #fff8e6;
    color: #7a5c00;
    border-radius: 10px;
    font-weight: 700;
    font-size: 15px;
}

.cart-profile-alert i {
    font-size: 18px;
    color: #e0a800;
}
