* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html {
    scroll-behavior: smooth;
}

body {
    font-family: Arial, Helvetica, sans-serif;
    color: #202020;
    background: #ffffff;
}

button,
input {
    font: inherit;
}

button {
    cursor: pointer;
}

a {
    color: inherit;
    text-decoration: none;
}

.container {
    width: min(1400px, calc(100% - 60px));
    margin: 0 auto;
}


/* HEADER */

.header {
    height: 76px;
    background: #e6ffda;
    border-bottom: 1px solid #eeeeee;
}

.header-inner {
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 35px;
}

.logo {
    display: flex;
    align-items: center;
    white-space: nowrap;
    font-size: 27px;
    font-weight: 700;
}

.logo-icon {
    margin-right: 8px;
    font-size: 31px;
}

.logo-green {
    color: #59ad32;
}

.logo-dark {
    margin-left: 6px;
    color: #252525;
}

.navigation {
    display: flex;
    align-items: center;
    gap: 42px;
    font-size: 15px;
}

.navigation a {
    transition: color 0.2s ease;
}

.navigation a:hover {
    color: #59ad32;
}

.header-actions {
    display: flex;
    align-items: center;
    gap: 20px;
}

.location {
    display: flex;
    align-items: center;
    gap: 6px;
}

.icon-button,
.cart-button {
    position: relative;
    border: none;
    background: transparent;
    font-size: 21px;
}

.cart-count {
    position: absolute;
    top: -11px;
    right: -12px;
    min-width: 19px;
    height: 19px;
    padding: 0 5px;
    border-radius: 20px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: #59ad32;
    color: #ffffff;
    font-size: 11px;
    font-weight: 700;
}


/* SEARCH */

.search-section {
    padding: 27px 0 18px;
}

.search-box {
    width: 100%;
    height: 57px;
    padding-left: 20px;
    border: 1px solid #dfdfdf;
    border-radius: 16px;
    display: flex;
    align-items: center;
    overflow: hidden;
    background: #ffffff;
    box-shadow: 0 4px 14px rgba(0, 0, 0, 0.04);
}

.search-icon {
    margin-right: 13px;
    font-size: 20px;
}

.search-box input {
    flex: 1;
    height: 100%;
    border: none;
    outline: none;
    color: #333333;
    font-size: 15px;
}

.search-box input::placeholder {
    color: #b3b3b3;
}

.search-box button {
    width: 140px;
    height: calc(100% - 10px);
    margin-right: 5px;
    border: none;
    border-radius: 12px;
    background: #59ad32;
    color: #ffffff;
    font-weight: 600;
    transition: background 0.2s ease;
}

.search-box button:hover {
    background: #468f29;
}


/* CATEGORIES */

.categories-section {
    padding: 4px 0 25px;
}

.categories {
    display: grid;
    grid-template-columns: repeat(6, minmax(0, 1fr));
    gap: 28px;
}

.category-button {
    min-height: 49px;
    padding: 10px 15px;
    border: 1px solid #e2e2e2;
    border-radius: 14px;
    background: #ffffff;
    color: #333333;
    font-weight: 600;
    transition:
        border-color 0.2s ease,
        color 0.2s ease,
        background 0.2s ease;
}

.category-button:hover,
.category-button.active {
    border-color: #73b651;
    background: #f6fbf3;
    color: #397e20;
}


/* PRODUCTS */

.catalog-section {
    padding-bottom: 50px;
}

.products-grid {
    display: grid;
    grid-template-columns: repeat(5, minmax(0, 1fr));
    gap: 16px;
    transition: opacity 0.2s ease;
}

.products-grid.loading {
    opacity: 0.45;
    pointer-events: none;
}

.product-card {
    min-width: 0;
    border: 1px solid #e8e8e8;
    border-radius: 16px;
    overflow: hidden;
    background: #ffffff;
    transition:
        transform 0.2s ease,
        box-shadow 0.2s ease;
}

.product-card:hover {
    transform: translateY(-4px);
    box-shadow: 0 12px 28px rgba(0, 0, 0, 0.08);
}

.product-image-wrapper {
    width: 100%;
    height: 215px;
    padding: 18px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: #ffffff;
}

.product-image {
    width: 100%;
    height: 100%;
    object-fit: contain;
    display: block;
}

.product-info {
    padding: 0 16px 16px;
}

.product-category {
    margin-bottom: 5px;
    color: #7d7d7d;
    font-size: 12px;
}

.product-name {
    min-height: 43px;
    margin-bottom: 8px;
    color: #222222;
    font-size: 16px;
    line-height: 1.35;
    font-weight: 600;
}

.product-price {
    margin-bottom: 14px;
    display: flex;
    align-items: baseline;
    gap: 5px;
}

.product-price strong {
    color: #202020;
    font-size: 18px;
}

.product-price span {
    color: #777777;
    font-size: 14px;
}

.add-to-cart {
    width: 100%;
    height: 39px;
    border: 1px solid #72b950;
    border-radius: 10px;
    background: #ffffff;
    color: #438d26;
    font-weight: 600;
    transition:
        background 0.2s ease,
        color 0.2s ease;
}

.add-to-cart:hover {
    background: #59ad32;
    color: #ffffff;
}

.add-to-cart.added {
    background: #59ad32;
    color: #ffffff;
}

.add-to-cart.out-of-stock {
    border-color: #cccccc;
    background: #f2f2f2;
    color: #999999;
    cursor: not-allowed;
}

.no-products {
    display: none;
    padding: 70px 0;
    text-align: center;
    color: #777777;
    font-size: 20px;
}

.error-message {
    grid-column: 1 / -1;
    padding: 60px 20px;
    text-align: center;
    color: #c13b3b;
    font-size: 18px;
}


/* RESPONSIVE */

@media (max-width: 1200px) {
    .navigation {
        gap: 20px;
    }

    .products-grid {
        grid-template-columns: repeat(4, minmax(0, 1fr));
    }

    .categories {
        grid-template-columns: repeat(3, minmax(0, 1fr));
        gap: 15px;
    }
}

@media (max-width: 900px) {
    .header {
        height: auto;
        padding: 15px 0;
    }

    .header-inner {
        flex-wrap: wrap;
    }

    .navigation {
        order: 3;
        width: 100%;
        overflow-x: auto;
    }

    .products-grid {
        grid-template-columns: repeat(3, minmax(0, 1fr));
    }
}

@media (max-width: 700px) {
    .container {
        width: calc(100% - 30px);
    }

    .navigation,
    .location {
        display: none;
    }

    .search-box button {
        width: 90px;
    }

    .categories {
        grid-template-columns: repeat(2, minmax(0, 1fr));
        gap: 10px;
    }

    .products-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .product-image-wrapper {
        height: 170px;
    }
}

@media (max-width: 450px) {
    .categories,
    .products-grid {
        grid-template-columns: 1fr;
    }
}

/* AUTHORIZATION */

.auth-page {
    min-height: 100vh;
    padding: 40px 20px;
    background: #f4f7f2;
}

.auth-container {
    width: min(850px, 100%);
    margin: 0 auto;
}

.auth-logo {
    margin-bottom: 25px;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    color: #59ad32;
    font-size: 28px;
}

.auth-card {
    padding: 38px;
    border: 1px solid #e3e7e0;
    border-radius: 20px;
    background: #ffffff;
    box-shadow: 0 12px 40px rgba(0, 0, 0, 0.06);
}

.auth-card-small {
    width: min(520px, 100%);
    margin: 0 auto;
}

.auth-card h1 {
    margin-bottom: 8px;
    text-align: center;
    font-size: 28px;
}

.auth-description {
    margin-bottom: 28px;
    color: #777777;
    text-align: center;
    line-height: 1.5;
}

.auth-form {
    display: flex;
    flex-direction: column;
    gap: 18px;
}

.form-row {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 18px;
}

.form-group {
    display: flex;
    flex-direction: column;
    gap: 7px;
}

.form-group label {
    color: #333333;
    font-size: 14px;
    font-weight: 600;
}

.form-group input {
    width: 100%;
    height: 46px;
    padding: 0 14px;
    border: 1px solid #dcdcdc;
    border-radius: 10px;
    outline: none;
    transition:
        border-color 0.2s ease,
        box-shadow 0.2s ease;
}

.form-group input:focus {
    border-color: #59ad32;
    box-shadow: 0 0 0 3px rgba(89, 173, 50, 0.12);
}

.auth-submit {
    height: 48px;
    border: none;
    border-radius: 11px;
    background: #59ad32;
    color: #ffffff;
    font-weight: 700;
}

.auth-submit:hover {
    background: #468f29;
}

.auth-switch {
    margin-top: 22px;
    text-align: center;
    color: #777777;
}

.auth-switch a {
    color: #4c982c;
    font-weight: 600;
}

.form-errors {
    margin-bottom: 20px;
    padding: 14px 18px;
    border: 1px solid #f0bebe;
    border-radius: 10px;
    background: #fff2f2;
    color: #b12f2f;
}

.form-errors p + p {
    margin-top: 5px;
}

.user-account {
    display: flex;
    align-items: center;
    gap: 6px;
    color: #333333;
    font-size: 14px;
    font-weight: 600;
}

.login-link,
.logout-link {
    color: #555555;
    font-size: 14px;
}

.register-link {
    padding: 9px 14px;
    border-radius: 9px;
    background: #59ad32;
    color: #ffffff;
    font-size: 14px;
    font-weight: 600;
}

.login-required-button {
    display: flex;
    align-items: center;
    justify-content: center;
    text-decoration: none;
}

@media (max-width: 650px) {
    .auth-card {
        padding: 25px 20px;
    }

    .form-row {
        grid-template-columns: 1fr;
    }
}

/* CART PAGE */

.cart-page,
.checkout-page {
    padding: 42px 0 70px;
    background: #f7f9f5;
    min-height: calc(100vh - 76px);
}

.page-heading {
    margin-bottom: 28px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 20px;
}

.page-heading h1 {
    margin-bottom: 7px;
    font-size: 32px;
}

.page-heading p {
    color: #777777;
}

.continue-shopping {
    color: #4a942c;
    font-weight: 600;
}

.cart-layout {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 350px;
    align-items: start;
    gap: 25px;
}

.cart-items {
    display: flex;
    flex-direction: column;
    gap: 14px;
}

.cart-item {
    padding: 18px;
    border: 1px solid #e3e6e0;
    border-radius: 16px;
    display: grid;
    grid-template-columns: 125px minmax(180px, 1fr) 150px 145px;
    align-items: center;
    gap: 20px;
    background: #ffffff;
}

.cart-item-image {
    width: 125px;
    height: 105px;
}

.cart-item-image img {
    width: 100%;
    height: 100%;
    object-fit: contain;
}

.cart-item-category {
    margin-bottom: 5px;
    color: #777777;
    font-size: 13px;
}

.cart-item-info h2 {
    margin-bottom: 7px;
    font-size: 18px;
}

.cart-unit-price {
    color: #555555;
}

.cart-quantity {
    display: grid;
    grid-template-columns: 38px minmax(60px, 1fr) 38px;
    align-items: center;
}

.quantity-button {
    height: 40px;
    border: 1px solid #d8d8d8;
    background: #ffffff;
    font-size: 21px;
}

.quantity-minus {
    border-radius: 9px 0 0 9px;
}

.quantity-plus {
    border-radius: 0 9px 9px 0;
}

.quantity-input {
    width: 100%;
    height: 40px;
    border: solid #d8d8d8;
    border-width: 1px 0;
    outline: none;
    text-align: center;
}

.cart-item-total {
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    gap: 13px;
}

.cart-item-total strong {
    font-size: 18px;
}

.remove-cart-item {
    border: none;
    background: none;
    color: #c13d3d;
}

.cart-summary,
.checkout-summary,
.checkout-form-card {
    padding: 25px;
    border: 1px solid #e3e6e0;
    border-radius: 17px;
    background: #ffffff;
}

.cart-summary {
    position: sticky;
    top: 20px;
}

.cart-summary h2,
.checkout-summary h2,
.checkout-form-card h2 {
    margin-bottom: 20px;
}

.summary-row,
.summary-total {
    padding: 13px 0;
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 15px;
    border-bottom: 1px solid #eeeeee;
}

.summary-row span:last-child {
    text-align: right;
}

.summary-total {
    margin-top: 5px;
    border-bottom: none;
    font-size: 19px;
}

.checkout-button,
.place-order-button {
    width: 100%;
    min-height: 48px;
    margin-top: 18px;
    border: none;
    border-radius: 11px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: #59ad32;
    color: #ffffff;
    font-weight: 700;
}

.checkout-button:hover,
.place-order-button:hover {
    background: #468f29;
}

.empty-cart {
    padding: 80px 20px;
    border-radius: 18px;
    background: #ffffff;
    text-align: center;
}

.empty-cart-icon {
    margin-bottom: 18px;
    font-size: 58px;
}

.empty-cart h2 {
    margin-bottom: 10px;
}

.empty-cart p {
    margin-bottom: 23px;
    color: #777777;
}

.empty-cart a {
    padding: 13px 22px;
    border-radius: 10px;
    display: inline-flex;
    background: #59ad32;
    color: #ffffff;
}


/* CHECKOUT */

.checkout-layout {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 400px;
    align-items: start;
    gap: 25px;
}

.checkout-form-card h2:not(:first-child) {
    margin-top: 30px;
}

.form-group textarea {
    width: 100%;
    padding: 13px 14px;
    border: 1px solid #dcdcdc;
    border-radius: 10px;
    outline: none;
    resize: vertical;
}

.form-group textarea:focus {
    border-color: #59ad32;
    box-shadow: 0 0 0 3px rgba(89, 173, 50, 0.12);
}

.payment-option {
    padding: 16px;
    border: 1px solid #75b955;
    border-radius: 12px;
    display: flex;
    align-items: flex-start;
    gap: 12px;
    background: #f7fcf4;
}

.payment-option span {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.payment-option small {
    color: #777777;
}

.checkout-summary {
    position: sticky;
    top: 20px;
}

.checkout-products {
    margin-bottom: 15px;
}

.checkout-product {
    padding: 12px 0;
    border-bottom: 1px solid #eeeeee;
    display: grid;
    grid-template-columns: 55px minmax(0, 1fr) auto;
    align-items: center;
    gap: 12px;
}

.checkout-product img {
    width: 55px;
    height: 55px;
    object-fit: contain;
}

.checkout-product div {
    display: flex;
    flex-direction: column;
    gap: 5px;
}

.checkout-product span {
    color: #777777;
    font-size: 13px;
}

.checkout-product b {
    white-space: nowrap;
    font-size: 14px;
}


/* SUCCESS */

.success-page {
    min-height: 100vh;
    padding: 50px 20px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: #f5f8f3;
}

.success-card {
    width: min(600px, 100%);
    padding: 40px;
    border-radius: 20px;
    background: #ffffff;
    box-shadow: 0 15px 45px rgba(0, 0, 0, 0.08);
    text-align: center;
}

.success-icon {
    width: 72px;
    height: 72px;
    margin: 0 auto 20px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    background: #59ad32;
    color: #ffffff;
    font-size: 36px;
}

.success-card h1 {
    margin-bottom: 10px;
}

.success-card > p {
    color: #777777;
    line-height: 1.55;
}

.order-success-details {
    margin: 27px 0;
    border-top: 1px solid #eeeeee;
}

.order-success-details div {
    padding: 13px 0;
    border-bottom: 1px solid #eeeeee;
    display: flex;
    justify-content: space-between;
    gap: 15px;
    text-align: left;
}

.order-success-details span {
    color: #777777;
}

.success-actions {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.payment-test-button {
    min-height: 48px;
    border: none;
    border-radius: 10px;
    background: #dddddd;
    color: #888888;
}

.success-actions a {
    color: #4a942c;
    font-weight: 600;
}


@media (max-width: 1000px) {
    .cart-layout,
    .checkout-layout {
        grid-template-columns: 1fr;
    }

    .cart-summary,
    .checkout-summary {
        position: static;
    }

    .cart-item {
        grid-template-columns: 100px minmax(0, 1fr);
    }

    .cart-quantity,
    .cart-item-total {
        grid-column: 2;
    }

    .cart-item-total {
        align-items: flex-start;
    }
}

@media (max-width: 600px) {
    .page-heading {
        align-items: flex-start;
        flex-direction: column;
    }

    .cart-item {
        grid-template-columns: 80px minmax(0, 1fr);
        gap: 13px;
    }

    .cart-item-image {
        width: 80px;
        height: 80px;
    }

    .cart-quantity,
    .cart-item-total {
        grid-column: 1 / -1;
    }

    .cart-item-total {
        flex-direction: row;
        align-items: center;
        justify-content: space-between;
    }

    .checkout-form-card,
    .checkout-summary,
    .cart-summary {
        padding: 19px;
    }

    .success-card {
        padding: 28px 20px;
    }

    .order-success-details div {
        flex-direction: column;
        gap: 5px;
    }
}