/* ========================
   Product Grid Layout
   ======================== */
.card-products-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 5px;
    padding: 0;
}

@media (min-width: 768px) {
    .card-products-grid {
        grid-template-columns: repeat(3, 1fr);
    }
}

@media (min-width: 1024px) {
    .card-products-grid {
        grid-template-columns: repeat(4, 1fr);
    }
}

/* ========================
   Product Card Styling
   ======================== */
.card-product {
    position: relative;
    background: #fff;
    border-radius: 4px;
    border: 1px solid #ddd;
    overflow: hidden;
    text-align: center;
    height: 100%;
}

.card-product-detail {
    display: flex;
    flex-direction: column;
}

.product-image img {
    width: 100%;
    height: 120px;
    object-fit: cover;
    border-bottom: 1px solid #eee;
}

.product-title h3 {
    font-size: 1.2rem;
    margin: 10px 0 8px;
    line-height: 1.2;
    color: #333;
}

.product-price {
    font-weight: 500;
    color: #e53935;
    margin: 2px 0;
}

.product-price del {
    color: #ccc;
    font-size: 0.75em;
}

/* ========================
   Product Options
   ======================== */
.product-custom-options {
    display: none;
}

.radio-inputs {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
    gap: 0.25rem;
}

.radio {
    position: relative;
    display: flex;
}

.radio input {
    display: none;
}

.radio .name {
    display: block;
    width: 100%;
    padding: 0.5rem 0rem;
    line-height: 1.2;
    border: 1.5px solid #d0d0d0;
    border-radius: 0.25rem;
    font-size: 0.8rem;
    background: #f9f9f9;
    color: #333;
    text-align: center;
    cursor: pointer;
}

.radio input:checked+.name {
    border-color: #28a745;
    background-color: #e6f4ea;
    color: #1b5e20;
    font-weight: bold;
    box-shadow: 0 0 0 2px #28a74533;
}

/* ========================
   Button Styles
   ======================== */
.card-product-footer {}

.button {
    background-color: #0073aa;
    color: white;
    border: none;
    padding: 10px;
    border-radius: 0;
    font-weight: 600;
    font-size: 0.95rem;
    cursor: pointer;
    width: 100%;
}

.button:hover {
    background-color: #005f8d;
}

/* ========================
   Modal Styles
   ======================== */
.buy-now-backdrop {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.5);
    display: none;
    justify-content: center;
    align-items: flex-end;
    z-index: 9999;
    backdrop-filter: blur(2px);
    transition: opacity 0.3s;
    opacity: 0;
}

.buy-now-backdrop.show {
    display: flex;
    opacity: 1;
}

.buy-now-modal {
    background: white;
    width: 100%;
    max-width: 600px;
    max-height: 85vh;
    border-radius: 16px 16px 0 0;
    overflow: hidden;
    transform: translateY(100%);
    transition: transform 0.3s;
    box-shadow: 0 -4px 20px rgba(0, 0, 0, 0.1);
    display: flex;
    flex-direction: column;
}

.buy-now-backdrop.show .buy-now-modal {
    transform: translateY(0);
}

.product-summary {
    display: flex;
    gap: 16px;
    align-items: start;
    margin-bottom: 20px;
    padding: 20px 20px 16px;
    border-bottom: 1px solid #f0f0f0;
    position: relative;
}

.product-image-container {
    width: 80px;
    height: 80px;
    flex-shrink: 0;
    border-radius: 8px;
    overflow: hidden;
    background: #f5f5f5;
}

.product-image-container img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.product-info {
    flex-grow: 1;
    padding-right: 30px;
}

.modal-close {
    position: absolute;
    top: 20px;
    right: 20px;
    background: transparent;
    border: none;
    cursor: pointer;
    padding: 4px;
    color: #666;
}

.quantity-section {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 16px 20px;
    border-top: 1px solid #f0f0f0;
    border-bottom: 1px solid #f0f0f0;
    margin-bottom: 20px;
}

.quantity-wrapper {
    display: flex;
    align-items: center;
}

.quantity-icon {
    width: 10px;
    padding: 10px;
    height: 10px;
    border: 1px solid #ddd;
    background: var(--ast-global-color-1);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    font-weight: bold;
}

.quantity-display {
    min-width: 36px;
    text-align: center;
}

.modal-footer {
    padding: 0 20px 20px;
    display: flex;
    gap: 10px;
}

.final-buy-button {
    background: #e53935;
}

@media (min-width: 768px) {
    .buy-now-backdrop {
        align-items: center;
    }

    .buy-now-modal {
        border-radius: 12px;
        max-height: 80vh;
    }

    .product-image img {
        height: 220px;
    }
}