/* =========================================================
   FM COLLECTIONS — SHOPPING CART
   File: public/css/cart.css
========================================================= */


/* =========================================================
   PAGE VARIABLES
========================================================= */

.cart-page {
    --cart-primary: #2e7d32;
    --cart-primary-dark: #166534;
    --cart-primary-soft: #f0fdf4;

    --cart-danger: #dc2626;
    --cart-danger-dark: #b91c1c;
    --cart-danger-soft: #fef2f2;
    --cart-danger-border: #fecaca;

    --cart-success: #15803d;
    --cart-success-soft: #f0fdf4;
    --cart-success-border: #bbf7d0;

    --cart-text: #0f172a;
    --cart-text-soft: #334155;
    --cart-muted: #64748b;

    --cart-border: #dbe4ee;
    --cart-border-soft: #e8edf3;

    --cart-surface: #ffffff;
    --cart-surface-soft: #f8fafc;
    --cart-page-bg: #f4f7fb;

    width: 100%;
    min-height: 75vh;
    padding: 48px 0 80px;

    color: var(--cart-text);
    background: var(--cart-page-bg);
}


/* =========================================================
   GLOBAL BOX SIZING
========================================================= */

.cart-page,
.cart-page *,
.cart-page *::before,
.cart-page *::after {
    box-sizing: border-box;
}


/* =========================================================
   CONTAINER
========================================================= */

.cart-container {
    width: min(1220px, calc(100% - 40px));
    margin: 0 auto;
}


/* =========================================================
   PAGE HEADER
========================================================= */

.cart-header {
    display: flex;
    align-items: flex-end;
    justify-content: space-between;
    gap: 24px;

    margin-bottom: 28px;
    padding: 30px;

    border: 1px solid var(--cart-border-soft);
    border-radius: 22px;

    background:
        radial-gradient(
            circle at top right,
            rgba(46, 125, 50, 0.11),
            transparent 32%
        ),
        linear-gradient(
            135deg,
            #ffffff,
            #f7fbf8
        );

    box-shadow:
        0 18px 44px rgba(15, 23, 42, 0.06),
        0 3px 9px rgba(15, 23, 42, 0.025);
}

.cart-header > div {
    min-width: 0;
}

.cart-eyebrow {
    display: block;

    margin-bottom: 8px;

    color: var(--cart-primary);

    font-size: 11px;
    line-height: 1;
    font-weight: 900;
    letter-spacing: 0.12em;
    text-transform: uppercase;
}

.cart-header h1 {
    margin: 0 0 9px;

    color: var(--cart-text);

    font-size: clamp(31px, 4vw, 45px);
    line-height: 1.14;
    font-weight: 950;
    letter-spacing: -0.04em;
}

.cart-header p {
    max-width: 700px;
    margin: 0;

    color: var(--cart-muted);

    font-size: 14px;
    line-height: 1.75;
}

.cart-count {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    gap: 8px;

    min-height: 42px;
    padding: 10px 15px;

    border: 1px solid #cde6d1;
    border-radius: 999px;

    color: var(--cart-primary-dark);
    background: var(--cart-primary-soft);

    font-size: 12px;
    font-weight: 850;
}


/* =========================================================
   ALERTS
========================================================= */

.cart-alert {
    display: flex;
    align-items: center;
    gap: 10px;

    margin-bottom: 22px;
    padding: 15px 17px;

    border: 1px solid;
    border-radius: 13px;

    font-size: 12px;
    line-height: 1.5;
    font-weight: 750;
}

.cart-alert-success {
    color: #14532d;
    border-color: var(--cart-success-border);
    background: var(--cart-success-soft);
}

.cart-alert-error {
    color: #991b1b;
    border-color: var(--cart-danger-border);
    background: var(--cart-danger-soft);
}


/* =========================================================
   CART LAYOUT
========================================================= */

.cart-layout {
    display: grid;
    grid-template-columns: minmax(0, 1.55fr) minmax(320px, 0.75fr);
    gap: 28px;
    align-items: start;
}


/* =========================================================
   CART ITEMS
========================================================= */

.cart-items {
    display: grid;
    gap: 20px;
}


/* =========================================================
   CART ITEM CARD
========================================================= */

.cart-item {
    display: grid;
    grid-template-columns: 150px minmax(0, 1fr);
    gap: 22px;
    align-items: center;

    min-width: 0;
    padding: 22px;

    border: 1px solid var(--cart-border-soft);
    border-radius: 21px;

    background: var(--cart-surface);

    box-shadow:
        0 15px 36px rgba(15, 23, 42, 0.055),
        0 2px 7px rgba(15, 23, 42, 0.025);

    transition:
        transform 0.25s ease,
        border-color 0.25s ease,
        box-shadow 0.25s ease;
}

.cart-item:hover {
    transform: translateY(-4px);

    border-color: #c8dccb;

    box-shadow:
        0 22px 44px rgba(15, 23, 42, 0.085),
        0 4px 11px rgba(15, 23, 42, 0.04);
}


/* =========================================================
   ITEM IMAGE
========================================================= */

.cart-item-image {
    display: block;
    overflow: hidden;

    width: 150px;
    height: 150px;

    border-radius: 18px;

    background: var(--cart-surface-soft);

    text-decoration: none;
}

.cart-item-image img {
    display: block;

    width: 100%;
    height: 100%;
    padding: 14px;

    object-fit: contain;

    transition: transform 0.3s ease;
}

.cart-item:hover .cart-item-image img {
    transform: scale(1.035);
}

.cart-image-placeholder {
    display: flex;
    align-items: center;
    justify-content: center;

    width: 100%;
    height: 100%;

    color: var(--cart-primary-dark);
    background:
        linear-gradient(
            135deg,
            #f0fdf4,
            #f8fafc
        );

    font-size: 34px;
}


/* =========================================================
   ITEM CONTENT
========================================================= */

.cart-item-content {
    min-width: 0;
}

.cart-item-heading {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 16px;

    margin-bottom: 14px;
}

.cart-item-heading > div {
    min-width: 0;
}

.cart-item-heading h2 {
    margin: 0 0 8px;

    color: var(--cart-text);

    font-size: 21px;
    line-height: 1.35;
    font-weight: 900;
    letter-spacing: -0.025em;
}

.cart-item-heading h2 a {
    color: inherit;
    text-decoration: none;

    transition: color 0.2s ease;
}

.cart-item-heading h2 a:hover {
    color: var(--cart-primary-dark);
}

.cart-item-heading p {
    margin: 0;

    color: var(--cart-muted);

    font-size: 12px;
    line-height: 1.7;
}


/* =========================================================
   REMOVE BUTTON
========================================================= */

.cart-remove-form {
    flex-shrink: 0;
}

.cart-remove-button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 7px;

    min-height: 38px;
    padding: 9px 12px;

    border: 1px solid var(--cart-danger-border);
    border-radius: 10px;

    color: var(--cart-danger);
    background: var(--cart-danger-soft);

    font-family: inherit;
    font-size: 10px;
    font-weight: 900;

    cursor: pointer;

    transition:
        color 0.2s ease,
        border-color 0.2s ease,
        background-color 0.2s ease,
        transform 0.2s ease;
}

.cart-remove-button:hover {
    color: #ffffff;
    border-color: var(--cart-danger);
    background: var(--cart-danger);
    transform: translateY(-1px);
}


/* =========================================================
   ITEM PRICE
========================================================= */

.cart-item-price {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 8px;

    margin-bottom: 18px;
}

.cart-item-price strong {
    color: var(--cart-primary-dark);

    font-size: 19px;
    line-height: 1.2;
    font-weight: 950;
}

.cart-item-price del {
    color: #94a3b8;

    font-size: 11px;
    font-weight: 700;
}


/* =========================================================
   ITEM BOTTOM
========================================================= */

.cart-item-bottom {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 18px;

    padding-top: 16px;

    border-top: 1px solid var(--cart-border-soft);
}


/* =========================================================
   QUANTITY CONTROL
========================================================= */

.cart-quantity {
    display: inline-flex;
    align-items: center;
    gap: 9px;

    padding: 5px;

    border: 1px solid var(--cart-border);
    border-radius: 999px;

    background: var(--cart-surface-soft);
}

.cart-quantity form {
    display: flex;
}

.cart-quantity-button {
    display: inline-flex;
    align-items: center;
    justify-content: center;

    width: 34px;
    height: 34px;

    border: 0;
    border-radius: 50%;

    color: var(--cart-primary-dark);
    background: var(--cart-primary-soft);

    font-size: 11px;

    cursor: pointer;

    transition:
        color 0.2s ease,
        background-color 0.2s ease,
        transform 0.2s ease;
}

.cart-quantity-button:hover:not(:disabled) {
    color: #ffffff;
    background: var(--cart-primary);
    transform: scale(1.05);
}

.cart-quantity-button:disabled {
    opacity: 0.45;
    cursor: not-allowed;
}

.cart-quantity-value {
    min-width: 28px;

    color: var(--cart-text);

    text-align: center;

    font-size: 13px;
    font-weight: 900;
}


/* =========================================================
   ITEM TOTAL
========================================================= */

.cart-item-total {
    text-align: right;
}

.cart-item-total small {
    display: block;

    margin-bottom: 4px;

    color: var(--cart-muted);

    font-size: 9px;
    font-weight: 800;
    letter-spacing: 0.06em;
    text-transform: uppercase;
}

.cart-item-total strong {
    color: var(--cart-text);

    font-size: 16px;
    font-weight: 950;
}

.cart-stock-message {
    display: block;

    margin-top: 10px;

    color: #b45309;

    font-size: 10px;
    line-height: 1.5;
    font-weight: 750;
}


/* =========================================================
   ORDER SUMMARY
========================================================= */

.cart-summary {
    position: sticky;
    top: 20px;

    padding: 26px;

    border: 1px solid var(--cart-border-soft);
    border-radius: 22px;

    background: var(--cart-surface);

    box-shadow:
        0 18px 42px rgba(15, 23, 42, 0.065),
        0 3px 9px rgba(15, 23, 42, 0.03);
}

.cart-summary-header {
    margin-bottom: 22px;
}

.cart-summary-header h2 {
    margin: 0;

    color: var(--cart-text);

    font-size: 26px;
    line-height: 1.25;
    font-weight: 950;
    letter-spacing: -0.03em;
}

.cart-summary-list {
    display: grid;
    gap: 14px;
}

.cart-summary-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 18px;

    color: var(--cart-muted);

    font-size: 12px;
}

.cart-summary-row strong {
    color: var(--cart-text-soft);

    font-weight: 850;
}

.cart-free-delivery {
    color: var(--cart-success) !important;
}


/* =========================================================
   SUMMARY TOTAL
========================================================= */

.cart-summary-total {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 18px;

    margin-top: 20px;
    padding-top: 20px;

    border-top: 1px solid var(--cart-border);
}

.cart-summary-total span {
    color: var(--cart-text);

    font-size: 14px;
    font-weight: 900;
}

.cart-summary-total strong {
    color: var(--cart-primary-dark);

    font-size: 22px;
    line-height: 1.2;
    font-weight: 950;
}


/* =========================================================
   SUMMARY NOTE
========================================================= */

.cart-summary-note {
    display: flex;
    align-items: flex-start;
    gap: 9px;

    margin: 18px 0 0;
    padding: 13px;

    border: 1px solid #cde6d1;
    border-radius: 11px;

    color: var(--cart-primary-dark);
    background: var(--cart-primary-soft);

    font-size: 10px;
    line-height: 1.55;
}

.cart-summary-note i {
    flex-shrink: 0;
    margin-top: 2px;
}


/* =========================================================
   SUMMARY ACTIONS
========================================================= */

.cart-checkout-button,
.cart-continue-button,
.cart-clear-button,
.cart-empty-button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 9px;

    width: 100%;
    min-height: 47px;
    padding: 11px 17px;

    border-radius: 11px;

    font-family: inherit;
    font-size: 12px;
    font-weight: 900;
    text-decoration: none;

    transition:
        color 0.2s ease,
        background-color 0.2s ease,
        border-color 0.2s ease,
        transform 0.2s ease,
        box-shadow 0.2s ease;
}

.cart-checkout-button {
    margin-top: 20px;

    color: #ffffff;
    background: var(--cart-primary);

    box-shadow:
        0 9px 20px rgba(46, 125, 50, 0.18);
}

.cart-checkout-button:hover {
    color: #ffffff;
    background: var(--cart-primary-dark);
    transform: translateY(-1px);

    box-shadow:
        0 12px 24px rgba(46, 125, 50, 0.22);
}

.cart-continue-button {
    margin-top: 10px;

    border: 1px solid #b8d7bd;

    color: var(--cart-primary-dark);
    background: var(--cart-primary-soft);
}

.cart-continue-button:hover {
    color: #ffffff;
    border-color: var(--cart-primary);
    background: var(--cart-primary);
    transform: translateY(-1px);
}

.cart-clear-form {
    margin-top: 10px;
}

.cart-clear-button {
    border: 1px solid var(--cart-danger-border);

    color: var(--cart-danger);
    background: var(--cart-danger-soft);

    cursor: pointer;
}

.cart-clear-button:hover {
    color: #ffffff;
    border-color: var(--cart-danger);
    background: var(--cart-danger);
    transform: translateY(-1px);
}


/* =========================================================
   EMPTY STATE
========================================================= */

.cart-empty-state {
    max-width: 720px;
    margin: 0 auto;
    padding: 70px 30px;

    border: 1px solid var(--cart-border-soft);
    border-radius: 24px;

    background:
        radial-gradient(
            circle at top right,
            rgba(46, 125, 50, 0.08),
            transparent 34%
        ),
        #ffffff;

    text-align: center;

    box-shadow:
        0 18px 42px rgba(15, 23, 42, 0.055);
}

.cart-empty-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;

    width: 78px;
    height: 78px;
    margin-bottom: 18px;

    border: 1px solid #cde6d1;
    border-radius: 23px;

    color: var(--cart-primary-dark);
    background: var(--cart-primary-soft);

    font-size: 30px;
}

.cart-empty-state h2 {
    margin: 0 0 11px;

    color: var(--cart-text);

    font-size: 30px;
    line-height: 1.25;
    font-weight: 950;
    letter-spacing: -0.03em;
}

.cart-empty-state p {
    max-width: 520px;
    margin: 0 auto 24px;

    color: var(--cart-muted);

    font-size: 14px;
    line-height: 1.75;
}

.cart-empty-button {
    width: auto;
    min-width: 180px;

    color: #ffffff;
    background: var(--cart-primary);
}

.cart-empty-button:hover {
    color: #ffffff;
    background: var(--cart-primary-dark);
    transform: translateY(-1px);
}


/* =========================================================
   ACCESSIBILITY
========================================================= */

.cart-page a:focus-visible,
.cart-page button:focus-visible {
    outline: 3px solid rgba(46, 125, 50, 0.18);
    outline-offset: 3px;
}


/* =========================================================
   TABLET
========================================================= */

@media (max-width: 980px) {
    .cart-layout {
        grid-template-columns: 1fr;
    }

    .cart-summary {
        position: static;
    }
}


/* =========================================================
   MOBILE
========================================================= */

@media (max-width: 680px) {
    .cart-page {
        padding-top: 24px;
        padding-bottom: 55px;
    }

    .cart-container {
        width: min(100% - 24px, 1220px);
    }

    .cart-header {
        flex-direction: column;
        align-items: flex-start;

        padding: 23px 19px;

        border-radius: 18px;
    }

    .cart-count {
        align-self: flex-start;
    }

    .cart-item {
        grid-template-columns: 1fr;
        gap: 18px;

        padding: 18px;

        border-radius: 18px;
    }

    .cart-item-image {
        width: 100%;
        height: auto;
        aspect-ratio: 4 / 3;
    }

    .cart-item-heading {
        flex-direction: column;
        align-items: flex-start;
    }

    .cart-remove-form,
    .cart-remove-button {
        width: 100%;
    }

    .cart-item-bottom {
        align-items: flex-start;
        flex-direction: column;
    }

    .cart-item-total {
        width: 100%;

        text-align: left;
    }

    .cart-summary {
        padding: 21px 18px;

        border-radius: 18px;
    }

    .cart-empty-state {
        padding: 52px 20px;

        border-radius: 20px;
    }
}


/* =========================================================
   SMALL MOBILE
========================================================= */

@media (max-width: 420px) {
    .cart-header h1 {
        font-size: 31px;
    }

    .cart-item-heading h2 {
        font-size: 19px;
    }

    .cart-summary-total {
        align-items: flex-start;
        flex-direction: column;
    }

    .cart-empty-state h2 {
        font-size: 26px;
    }
}


/* =========================================================
   REDUCED MOTION
========================================================= */

@media (prefers-reduced-motion: reduce) {
    .cart-page *,
    .cart-page *::before,
    .cart-page *::after {
        scroll-behavior: auto !important;
        transition: none !important;
        animation: none !important;
    }
}


/* =========================================================
   PRINT
========================================================= */

@media print {
    .cart-header,
    .cart-item,
    .cart-summary,
    .cart-empty-state {
        box-shadow: none;
    }

    .cart-item:hover {
        transform: none;
    }

    .cart-remove-form,
    .cart-quantity,
    .cart-checkout-button,
    .cart-continue-button,
    .cart-clear-form {
        display: none;
    }

    .cart-summary {
        position: static;
    }
}