.cart-items[hidden],
.cart-empty[hidden],
.cart-checkout[hidden],
.cart-overlay[hidden] {
    display: none !important;
}

.products-section {
    background: var(--paper);
}

.catalog-toolbar {
    display: grid;
    gap: 18px;
    margin-bottom: 34px;
}

.product-search {
    position: relative;
    width: min(100%, 560px);
    margin-inline: auto;
}

.product-search .icon {
    position: absolute;
    left: 18px;
    top: 50%;
    color: #77777d;
    transform: translateY(-50%);
}

.product-search input {
    width: 100%;
    min-height: 52px;
    padding: 12px 18px 12px 48px;
    color: var(--ink);
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: 999px;
    box-shadow: var(--shadow-sm);
}

.product-search input::placeholder {
    color: #8a8a90;
}

.filters {
    display: flex;
    justify-content: center;
    flex-wrap: wrap;
    gap: 9px;
}

.filter-btn {
    min-height: 42px;
    padding: 9px 17px;
    color: #55555b;
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: 999px;
    font-size: 0.88rem;
    font-weight: 800;
    cursor: pointer;
    transition: color 0.2s ease, background 0.2s ease, border-color 0.2s ease, transform 0.2s ease;
}

.filter-btn:hover,
.filter-btn.active {
    color: #fff;
    background: var(--primary);
    border-color: var(--primary);
    transform: translateY(-1px);
}

.products-grid {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 22px;
}

.product-card {
    position: relative;
    min-width: 0;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-sm);
    transition: transform 0.25s ease, box-shadow 0.25s ease;
}

.product-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 20px 46px rgba(0, 0, 0, 0.16);
}

.product-media {
    position: relative;
    aspect-ratio: 4 / 3;
    overflow: hidden;
    background: #252527;
}

.product-media img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.35s ease;
}

.product-card:hover .product-media img {
    transform: scale(1.035);
}

.product-placeholder {
    width: 100%;
    height: 100%;
    display: grid;
    place-items: center;
    align-content: center;
    gap: 10px;
    padding: 24px;
    color: #f5f5f6;
    background:
        radial-gradient(circle at 70% 20%, rgba(225, 37, 45, 0.34), transparent 34%),
        linear-gradient(135deg, #19191b, #3b0d10);
    text-align: center;
}

.product-placeholder .icon {
    color: var(--accent);
    width: 2.5rem;
    height: 2.5rem;
}

.product-placeholder small {
    color: #c8c8cc;
}

.product-badge {
    position: absolute;
    top: 14px;
    left: 14px;
    z-index: 2;
    padding: 7px 10px;
    color: #fff;
    background: rgba(15, 15, 16, 0.84);
    border: 1px solid rgba(255, 255, 255, 0.13);
    border-radius: 999px;
    backdrop-filter: blur(8px);
    font-size: 0.69rem;
    font-weight: 900;
    letter-spacing: 0.08em;
    text-transform: uppercase;
}

.product-info {
    flex: 1;
    display: flex;
    flex-direction: column;
    padding: 22px;
}

.product-name {
    margin: 0;
    color: var(--ink);
    font-family: Georgia, "Times New Roman", serif;
    font-size: 1.35rem;
    line-height: 1.15;
}

.product-description {
    min-height: 48px;
    margin: 10px 0 18px;
    color: var(--ink-soft);
    font-size: 0.89rem;
    line-height: 1.5;
}

.product-footer {
    display: flex;
    align-items: flex-end;
    justify-content: space-between;
    gap: 14px;
    margin-top: auto;
}

.product-price {
    display: grid;
    color: var(--primary-dark);
    font-size: 1.35rem;
    font-weight: 900;
    line-height: 1.1;
}

.product-price small {
    margin-top: 4px;
    color: #74747a;
    font-size: 0.72rem;
    font-weight: 700;
}

.add-to-cart {
    min-height: 44px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 10px 15px;
    color: #fff;
    background: var(--primary);
    border-radius: 999px;
    font-size: 0.83rem;
    font-weight: 900;
    cursor: pointer;
    transition: background 0.2s ease, transform 0.2s ease;
}

.add-to-cart:hover {
    background: var(--primary-dark);
    transform: translateY(-1px);
}

.no-products {
    margin: 40px auto 0;
    padding: 24px;
    color: var(--ink-soft);
    background: var(--surface);
    border: 1px dashed var(--line);
    border-radius: var(--radius-md);
    text-align: center;
}

.cart-overlay {
    position: fixed;
    inset: 0;
    z-index: 1990;
    background: rgba(0, 0, 0, 0.62);
    backdrop-filter: blur(3px);
}

.cart-drawer {
    position: fixed;
    top: 0;
    right: 0;
    z-index: 2000;
    width: min(430px, 100%);
    height: 100dvh;
    display: flex;
    flex-direction: column;
    padding: 0;
    color: var(--ink);
    background: var(--surface);
    box-shadow: -20px 0 60px rgba(0, 0, 0, 0.24);
    transform: translateX(104%);
    transition: transform 0.28s ease;
}

.cart-drawer.open {
    transform: translateX(0);
}

.cart-header {
    min-height: 90px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 20px;
    padding: 18px 22px;
    color: #fff;
    background: linear-gradient(90deg, #09090a, #252527);
}

.cart-header p,
.cart-header h2 {
    margin: 0;
}

.cart-header p {
    color: var(--accent);
    font-size: 0.72rem;
    font-weight: 900;
    letter-spacing: 0.12em;
    text-transform: uppercase;
}

.cart-header h2 {
    font-family: Georgia, serif;
    font-size: 1.55rem;
}

.icon-button {
    width: 44px;
    height: 44px;
    display: grid;
    place-items: center;
    color: #fff;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 50%;
    cursor: pointer;
}

.cart-items {
    flex: 1;
    overflow-y: auto;
    padding: 18px 20px 4px;
}

.cart-item {
    display: grid;
    grid-template-columns: 76px minmax(0, 1fr);
    gap: 13px;
    padding: 14px 0;
    border-bottom: 1px solid var(--line);
}

.cart-item-media {
    width: 76px;
    height: 76px;
    overflow: hidden;
    display: grid;
    place-items: center;
    color: #fff;
    background: #2b2b2e;
    border-radius: 12px;
}

.cart-item-media img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

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

.cart-item-info h3 {
    margin: 0 26px 4px 0;
    overflow: hidden;
    font-size: 0.98rem;
    line-height: 1.25;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.cart-item-price {
    color: var(--primary-dark);
    font-size: 0.88rem;
    font-weight: 800;
}

.cart-item-actions {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    margin-top: 10px;
}

.quantity-control {
    display: inline-flex;
    align-items: center;
    overflow: hidden;
    border: 1px solid var(--line);
    border-radius: 999px;
}

.quantity-control button {
    width: 35px;
    height: 35px;
    color: var(--ink);
    background: var(--surface);
    cursor: pointer;
}

.quantity-control span {
    min-width: 28px;
    text-align: center;
    font-size: 0.86rem;
    font-weight: 900;
}

.remove-item {
    color: #66666b;
    background: transparent;
    font-size: 0.78rem;
    font-weight: 800;
    cursor: pointer;
}

.cart-empty {
    flex: 1;
    display: grid;
    place-items: center;
    align-content: center;
    padding: 42px 28px;
    color: var(--ink-soft);
    text-align: center;
}

.cart-empty > .icon {
    width: 3.2rem;
    height: 3.2rem;
    color: #d2d2d5;
}

.cart-empty h3 {
    margin: 18px 0 6px;
    color: var(--ink);
}

.cart-empty p {
    max-width: 280px;
    margin: 0 0 22px;
}

.cart-checkout {
    max-height: 56dvh;
    overflow-y: auto;
    padding: 18px 22px 22px;
    background: var(--paper);
    border-top: 1px solid var(--line);
}

.cart-total {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 15px;
    color: var(--ink-soft);
}

.cart-total strong {
    color: var(--primary-dark);
    font-size: 1.45rem;
}

.cart-checkout label {
    display: grid;
    gap: 6px;
    margin-top: 11px;
    color: var(--ink);
    font-size: 0.79rem;
    font-weight: 900;
}

.cart-checkout input,
.cart-checkout select,
.cart-checkout textarea {
    width: 100%;
    padding: 11px 12px;
    color: var(--ink);
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: 10px;
    font-size: 0.92rem;
    font-weight: 500;
}

.cart-checkout textarea {
    resize: vertical;
}

.checkout-note {
    margin: 13px 0;
    color: #69696f;
    font-size: 0.75rem;
    line-height: 1.45;
}

.whatsapp-checkout {
    width: 100%;
    min-height: 52px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    padding: 12px;
    color: #fff;
    background: var(--green);
    border-radius: 999px;
    font-weight: 900;
    cursor: pointer;
}

.mobile-cart-bar {
    display: none;
}

@media (max-width: 980px) {
    .products-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
}

@media (max-width: 620px) {
    .catalog-toolbar {
        margin-bottom: 24px;
    }

    .filters {
        justify-content: flex-start;
        flex-wrap: nowrap;
        overflow-x: auto;
        padding: 2px 2px 10px;
        scrollbar-width: thin;
    }

    .filter-btn {
        flex: 0 0 auto;
        min-height: 44px;
    }

    .products-grid {
        grid-template-columns: 1fr;
        gap: 16px;
    }

    .product-card {
        display: grid;
        grid-template-columns: 38% 62%;
        min-height: 210px;
    }

    .product-media {
        height: 100%;
        aspect-ratio: auto;
    }

    .product-info {
        padding: 17px 15px;
    }

    .product-name {
        font-size: 1.12rem;
    }

    .product-description {
        min-height: 0;
        margin: 8px 0 13px;
        display: -webkit-box;
        overflow: hidden;
        -webkit-box-orient: vertical;
        -webkit-line-clamp: 3;
        font-size: 0.8rem;
    }

    .product-footer {
        align-items: stretch;
        flex-direction: column;
        gap: 9px;
    }

    .product-price {
        font-size: 1.08rem;
    }

    .add-to-cart {
        width: 100%;
        min-height: 42px;
        padding: 9px 10px;
        font-size: 0.77rem;
    }

    .product-badge {
        top: 9px;
        left: 8px;
        padding: 5px 7px;
        font-size: 0.58rem;
    }

    .cart-drawer {
        width: 100%;
    }

    .cart-header {
        min-height: 78px;
    }

    .mobile-cart-bar {
        position: fixed;
        left: 10px;
        right: 10px;
        bottom: 10px;
        z-index: 850;
        min-height: 58px;
        display: flex;
        align-items: center;
        justify-content: space-between;
        gap: 14px;
        padding: 12px 17px;
        color: #fff;
        background: linear-gradient(135deg, var(--primary), var(--primary-dark));
        border: 1px solid rgba(255, 255, 255, 0.18);
        border-radius: 16px;
        box-shadow: 0 14px 32px rgba(167, 15, 22, 0.38);
        font-size: 0.88rem;
        cursor: pointer;
        transform: translateY(90px);
        transition: transform 0.25s ease;
    }

    .mobile-cart-bar.visible {
        transform: translateY(0);
    }

    .mobile-cart-bar span {
        display: inline-flex;
        align-items: center;
        gap: 8px;
        font-weight: 900;
    }

    .mobile-cart-bar b {
        min-width: 22px;
        height: 22px;
        display: inline-grid;
        place-items: center;
        color: var(--primary-dark);
        background: #fff;
        border-radius: 999px;
        font-size: 0.72rem;
    }

    .mobile-cart-bar strong {
        white-space: nowrap;
    }
}

@media (max-width: 410px) {
    .product-card {
        grid-template-columns: 35% 65%;
    }

    .product-description {
        -webkit-line-clamp: 2;
    }
}
