/**
 * Masine Products - Gallery Frontend Styles
 *
 * Styles for the product gallery and similar products on the frontend.
 *
 * @package Masine_Products
 */

/* ==========================================================================
   Product Gallery
   ========================================================================== */

.masine-product-gallery {
    display: flex;
    flex-direction: column;
    gap: 1rem;
    max-width: 800px;
}

/* Main Image Container */
.masine-product-gallery__main {
    position: relative;
    overflow: hidden;
    border-radius: 8px;
    background-color: #f5f5f5;
    aspect-ratio: 1;
}

.masine-product-gallery__main img {
    width: 100%;
    height: 100%;
    object-fit: contain;
    display: block;
    transition: opacity 0.2s ease;
}

.masine-product-gallery__main img.is-loading {
    opacity: 0.5;
}

/* Thumbnails Container */
.masine-product-gallery__thumbnails {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
}

/* Individual Thumbnail */
.masine-product-gallery__thumbnail {
    width: 80px;
    height: 80px;
    padding: 0;
    border: 2px solid transparent;
    border-radius: 6px;
    overflow: hidden;
    cursor: pointer;
    background: #f5f5f5;
    transition: border-color 0.2s ease, transform 0.2s ease;
}

.masine-product-gallery__thumbnail:hover {
    border-color: #ccc;
    transform: translateY(-2px);
}

.masine-product-gallery__thumbnail.is-active {
    border-color: #0073aa;
}

.masine-product-gallery__thumbnail:focus {
    outline: none;
    border-color: #0073aa;
    box-shadow: 0 0 0 2px rgba(0, 115, 170, 0.3);
}

.masine-product-gallery__thumbnail img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

/* Responsive adjustments */
@media (max-width: 480px) {
    .masine-product-gallery__thumbnail {
        width: 60px;
        height: 60px;
    }
}

/* ==========================================================================
   Similar Products
   ========================================================================== */

.masine-similar-products {
    margin-top: 3rem;
    padding-top: 2rem;
    border-top: 1px solid #eee;
}

/* Section Title */
.masine-similar-products__title {
    font-size: 1.5rem;
    font-weight: 600;
    margin: 0 0 1.5rem;
    color: #1e1e1e;
}

/* Products Grid */
.masine-similar-products__grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
    gap: 1.5rem;
}

/* Individual Product Item */
.masine-similar-products__item {
    text-decoration: none;
    color: inherit;
    display: block;
    transition: transform 0.2s ease;
}

.masine-similar-products__item:hover {
    transform: translateY(-4px);
}

.masine-similar-products__item:focus {
    outline: none;
}

.masine-similar-products__item:focus .masine-similar-products__image {
    box-shadow: 0 0 0 3px rgba(0, 115, 170, 0.3);
}

/* Product Image */
.masine-similar-products__image {
    aspect-ratio: 1;
    overflow: hidden;
    border-radius: 8px;
    background-color: #f5f5f5;
    margin-bottom: 0.75rem;
    transition: box-shadow 0.2s ease;
}

.masine-similar-products__image img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
    transition: transform 0.3s ease;
}

.masine-similar-products__item:hover .masine-similar-products__image img {
    transform: scale(1.05);
}

/* Placeholder for products without images */
.masine-similar-products__placeholder {
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #ccc;
}

.masine-similar-products__placeholder .dashicons {
    font-size: 48px;
    width: 48px;
    height: 48px;
}

/* Product Name */
.masine-similar-products__name {
    font-size: 0.9375rem;
    font-weight: 500;
    margin: 0;
    color: #1e1e1e;
    text-align: center;
    line-height: 1.4;
    transition: color 0.2s ease;
}

.masine-similar-products__item:hover .masine-similar-products__name {
    color: #0073aa;
}

/* Responsive adjustments */
@media (max-width: 768px) {
    .masine-similar-products__grid {
        grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
        gap: 1rem;
    }

    .masine-similar-products__title {
        font-size: 1.25rem;
    }
}

@media (max-width: 480px) {
    .masine-similar-products__grid {
        grid-template-columns: repeat(2, 1fr);
    }
}

/* ==========================================================================
   Brands Grid
   ========================================================================== */

.masine-brands {
    --masine-brands-columns: 4;
}

/* Section Title */
.masine-brands__title {
    font-size: 1.5rem;
    font-weight: 600;
    margin: 0 0 1.5rem;
    color: #1e1e1e;
}

/* Brands Grid */
.masine-brands__grid {
    display: grid;
    grid-template-columns: repeat(var(--masine-brands-columns), 1fr);
    gap: 1.5rem;
}

/* Individual Brand Item */
.masine-brands__item {
    text-decoration: none;
    color: inherit;
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 1.5rem 1rem;
    background: #fff;
    border: 1px solid #eee;
    border-radius: 12px;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.masine-brands__item:hover {
    transform: translateY(-4px);
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.08);
}

.masine-brands__item:focus {
    outline: none;
    box-shadow: 0 0 0 3px rgba(0, 115, 170, 0.3);
}

/* Brand Logo */
.masine-brands__logo {
    width: 100%;
    max-width: 120px;
    aspect-ratio: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 1rem;
}

.masine-brands__logo img {
    max-width: 100%;
    max-height: 100%;
    object-fit: contain;
    display: block;
}

/* Placeholder for brands without logos */
.masine-brands__placeholder {
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    background: #f5f5f5;
    border-radius: 8px;
    color: #ccc;
}

.masine-brands__placeholder .dashicons {
    font-size: 48px;
    width: 48px;
    height: 48px;
}

/* Brand Name */
.masine-brands__name {
    font-size: 1rem;
    font-weight: 500;
    margin: 0;
    color: #1e1e1e;
    text-align: center;
    line-height: 1.4;
    transition: color 0.2s ease;
}

.masine-brands__item:hover .masine-brands__name {
    color: #0073aa;
}

/* Product Count */
.masine-brands__count {
    font-weight: 400;
    color: #666;
    font-size: 0.875em;
}

/* Responsive adjustments */
@media (max-width: 1024px) {
    .masine-brands__grid {
        grid-template-columns: repeat(3, 1fr);
    }
}

@media (max-width: 768px) {
    .masine-brands__grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 1rem;
    }

    .masine-brands__title {
        font-size: 1.25rem;
    }

    .masine-brands__item {
        padding: 1rem 0.75rem;
    }
}

@media (max-width: 480px) {
    .masine-brands__logo {
        max-width: 80px;
    }
}

/* ==========================================================================
   Products Grid
   ========================================================================== */

.masine-products-grid {
    --masine-products-columns: 4;
}

/* Section Title */
.masine-products-grid__title {
    font-size: 1.5rem;
    font-weight: 600;
    margin: 0 0 1.5rem;
    color: #1e1e1e;
}

/* Products Grid Items */
.masine-products-grid__items {
    display: grid;
    grid-template-columns: repeat(var(--masine-products-columns), 1fr);
    gap: 1.5rem;
}

/* Individual Product Item */
.masine-products-grid__item {
    text-decoration: none;
    color: inherit;
    display: block;
    background: #fff;
    border-radius: 12px;
    overflow: hidden;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.masine-products-grid__item:hover {
    transform: translateY(-4px);
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.1);
}

.masine-products-grid__item:focus {
    outline: none;
    box-shadow: 0 0 0 3px rgba(0, 115, 170, 0.3);
}

/* Product Image */
.masine-products-grid__image {
    aspect-ratio: 1;
    overflow: hidden;
    background-color: #f5f5f5;
}

.masine-products-grid__image img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
    transition: transform 0.3s ease;
}

.masine-products-grid__item:hover .masine-products-grid__image img {
    transform: scale(1.05);
}

/* Placeholder for products without images */
.masine-products-grid__placeholder {
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #ccc;
}

.masine-products-grid__placeholder .dashicons {
    font-size: 48px;
    width: 48px;
    height: 48px;
}

/* Product Content */
.masine-products-grid__content {
    padding: 1rem;
    text-align: center;
}

/* Product Brand */
.masine-products-grid__brand {
    display: block;
    font-size: 0.75rem;
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: #666;
    margin-bottom: 0.25rem;
}

/* Product Name */
.masine-products-grid__name {
    font-size: 1rem;
    font-weight: 500;
    margin: 0;
    color: #1e1e1e;
    line-height: 1.4;
    transition: color 0.2s ease;
}

.masine-products-grid__item:hover .masine-products-grid__name {
    color: #0073aa;
}

/* Responsive adjustments */
@media (max-width: 1024px) {
    .masine-products-grid__items {
        grid-template-columns: repeat(3, 1fr);
    }
}

@media (max-width: 768px) {
    .masine-products-grid__items {
        grid-template-columns: repeat(2, 1fr);
        gap: 1rem;
    }

    .masine-products-grid__title {
        font-size: 1.25rem;
    }

    .masine-products-grid__content {
        padding: 0.75rem;
    }
}

@media (max-width: 480px) {
    .masine-products-grid__name {
        font-size: 0.875rem;
    }

    .masine-products-grid__brand {
        font-size: 0.6875rem;
    }
}
