/* ===========================
   Product tiles
   =========================== */

.product-grid .product-tile {
    width: 100%;
    height: 18.5em;
    min-height: 18.5em;
    max-width: none;
    background-color: #fff;
    border-radius: 0.5em;
    border: 1px solid rgba(0, 0, 0, 0.05);
    padding: 0.65em 0.75em 0.8em;
    display: flex;
    flex-direction: column;
    gap: 0.35em;
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.04);

    /* Fixed aspect ratio for cleaner cards */
    aspect-ratio: 4 / 3;
    overflow: hidden;
}

/* If you find content gets cut off, you can swap to:
   overflow: auto;
   or adjust aspect-ratio as needed.
*/

.product-tile-header {
    display: flex;
    align-items: center;
    gap: 0.45em;
    width: 100%;
}

.product-tile-text {
    display: flex;
    flex-direction: column;
    gap: 0.1em;
    flex: 1 1 auto;
    min-width: 0;
}

.product-tile-name {
    margin: 0;
    font-size: 0.9rem;
    font-weight: 600;
    color: #111;
}

.product-tile-meta {
    margin: 0;
    font-size: 0.75rem;
    color: #555;
}

.product-tile-meta-secondary {
    margin: 0.1em 0 0;
    font-size: 0.72rem;
    color: #42536d;
}

/* Description text */
.product-tile-description {
    margin-top: 0.2em;
    font-size: 0.78rem;
    color: #333;
}

/* Tags */
.product-tile-tags {
    margin-top: 0.1em;
    display: flex;
    flex-wrap: wrap;
    gap: 0.3em;
}

.product-tile-tag {
    font-size: 0.7rem;
    padding: 0.1em 0.45em;
    border-radius: 999px;
    background-color: rgba(12, 43, 78, 0.06);
    color: #344762;
}

/* Footer with price + actions */
.product-tile-footer {
    margin-top: auto; /* push footer to bottom of fixed-aspect card */
    padding-top: 0.3em;
    border-top: 1px dashed rgba(0, 0, 0, 0.1);
    display: flex;
    justify-content: space-between;
    align-items: flex-end;
    gap: 0.5em;
    width: 100%;
}

.product-tile-qr {
    width: 52px;
    height: 52px;
    flex: 0 0 52px;
    border: 1px solid rgba(12, 43, 78, 0.18);
    border-radius: 6px;
    background: #fff;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 3px;
}

.product-tile-qr img {
    width: 100%;
    height: 100%;
    display: block;
}

.product-tile-pricing {
    display: flex;
    flex-direction: column;
    gap: 0.1em;
}

.product-tile-price {
    font-size: 0.92rem;
    font-weight: 600;
    color: var(--color-primary);
}

.product-tile-leadtime {
    font-size: 0.7rem;
    color: #666;
}

.product-tile-leadtime-warning {
    color: #b36a00;
}

.product-tile-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 0.25em;
}

/* Buttons */
.product-tile-btn {
    border-radius: 999px;
    padding: 0.24em 0.7em;
    font-size: 0.75rem;
    cursor: pointer;
    border: 1px solid #ccc;
    background-color: #f7f7f7;
    white-space: nowrap;
    color: #1a2738;
    text-decoration: none;
}

.product-tile-btn:visited {
    color: #1a2738;
}

.product-tile-btn:hover {
    background-color: var(--color-highlight);
}

.product-tile-btn-primary {
    border-color: var(--color-primary);
    background-color: var(--color-primary);
    color: #fff;
}

.product-tile-btn-primary:visited {
    color: #fff;
}

.product-tile-btn-primary:hover {
    background-color: #fff;
    color: var(--color-primary);
    border-color: var(--color-primary);
}

.product-tile-btn.is-adding,
.product-tile-btn-primary.is-adding,
.product-detail-secondary.is-adding,
.product-detail-cta.is-adding {
    opacity: 0.75;
    pointer-events: none;
}

.product-tile-btn.is-added,
.product-tile-btn-primary.is-added,
.product-detail-secondary.is-added,
.product-detail-cta.is-added {
    background-color: #1f7a3f;
    border-color: #1f7a3f;
    color: #fff;
    animation: cart-added-pop 0.35s ease;
}

@keyframes cart-added-pop {
    0% {
        transform: scale(1);
    }
    45% {
        transform: scale(1.08);
    }
    100% {
        transform: scale(1);
    }
}

@media (max-width: 540px) {
    .product-grid .product-tile {
        height: auto;
        min-height: 0;
        aspect-ratio: auto;
        overflow: visible;
        gap: 0.5em;
    }

    .product-tile-footer {
        flex-direction: column;
        align-items: flex-start;
        margin-top: 0.4em;
    }

    .product-tile-actions {
        width: 100%;
    }

    .product-tile-btn,
    .product-tile-btn-primary {
        text-align: center;
    }
}

/* Ensure sprite margin matches new header layout */
.product-tile-header .tile-icon {
    flex: 0 0 100px;
    width: 100px;
    height: 100px;
    min-width: 100px;
    min-height: 100px;
    margin-bottom: 0;
}
