/**
 * Single Product Page Styles
 *
 * @package SiderMaker
 * @since 1.0.0
 */

/* === TOP ROW: Gallery | Info === */
.sm-sp-top {
    display: flex;
    gap: 40px;
    align-items: flex-start;
    padding-top: 40px;
    padding-bottom: 40px;
}

.sm-sp-gallery {
    flex: 0 0 50%;
    max-width: 50%;
    position: relative;
}

.sm-sp-info {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 16px;
}

/* Main image */
.sm-sp-main-image {
    overflow: hidden;
    border-radius: 4px;
}

.sm-sp-main-image img.sm-sp-img-main {
    width: 100%;
    height: auto;
    display: block;
    object-fit: cover;
}

.sm-sp-no-image {
    aspect-ratio: 1 / 1;
    display: flex;
    align-items: center;
    justify-content: center;
    background: #f5f5f5;
    font-size: 3em;
}

/* Main video container */
.sm-sp-main-video {
    border-radius: 4px;
    overflow: hidden;
}

.sm-sp-main-video .sm-sp-video {
    margin-bottom: 0;
}

/* Video embed (16:9) */
.sm-sp-video {
    position: relative;
    padding-bottom: 56.25%;
    height: 0;
    overflow: hidden;
    border-radius: 4px;
}

.sm-sp-video iframe {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
}

/* Thumbnails */
.sm-sp-thumbnails {
    display: flex;
    gap: 8px;
    margin-top: 12px;
    flex-wrap: wrap;
}

.sm-sp-thumb {
    width: 64px;
    height: 64px;
    padding: 0;
    border: 2px solid transparent;
    border-radius: 4px;
    overflow: hidden;
    cursor: pointer;
    background: none;
    opacity: 0.6;
    transition: opacity 0.2s, border-color 0.2s;
    position: relative;
}

.sm-sp-thumb:hover,
.sm-sp-thumb.active {
    opacity: 1;
    border-color: currentColor;
}

.sm-sp-thumb img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

/* Video thumbnail play icon */
.sm-sp-thumb-video {
    position: relative;
}

.sm-sp-play-icon {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    color: #fff;
    font-size: 18px;
    text-shadow: 0 1px 4px rgba(0,0,0,0.6);
    pointer-events: none;
    line-height: 1;
}

/* Sale badge */
.sm-sp-gallery .sm-product-sale-badge {
    position: absolute;
    top: 8px;
    left: 8px;
    z-index: 2;
    font-size: 12px;
    font-weight: 700;
    padding: 4px 10px;
    border-radius: 3px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    line-height: 1;
}

/* Product info */
.sm-sp-title {
    margin: 0;
    line-height: 1.2;
}

.sm-sp-short-desc {
    opacity: 0.85;
    line-height: 1.6;
}

.sm-sp-short-desc p {
    margin: 0;
}

.sm-sp-stock {
    font-size: 0.9em;
    font-weight: 500;
}

.sm-sp-stock.in-stock {
    color: #43a047;
}

.sm-sp-stock.out-of-stock {
    color: #e53935;
}

.sm-sp-price {
    font-size: 1.4em;
    font-weight: 700;
}

.sm-sp-price del {
    opacity: 0.5;
    margin-right: 6px;
}

.sm-sp-price ins {
    text-decoration: none;
}

/* Cart form */
.sm-sp-cart-form {
    display: flex;
    align-items: stretch;
    gap: 12px;
    margin-top: 8px;
}

.sm-sp-quantity {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.sm-sp-quantity label {
    font-size: 0.85em;
    font-weight: 500;
}

.sm-sp-quantity input {
    width: 70px;
    padding: 0 10px;
    border: 1px solid #ccc;
    border-radius: 4px;
    font-size: 1em;
    text-align: center;
    height: 100%;
    box-sizing: border-box;
}

.sm-sp-add-to-cart {
    margin: 0;
    line-height: 1;
}

.sm-sp-add-to-cart:hover {
    opacity: 0.85;
}

/* === BOTTOM: Description then Related (stacked) === */
.sm-sp-bottom {
    display: flex;
    flex-direction: column;
    gap: 40px;
    padding-bottom: 60px;
}

.sm-sp-description {
    max-width: 100%;
}

.sm-sp-related {
    max-width: 100%;
}

/* Full description */
.sm-sp-full-desc {
    line-height: 1.7;
}

.sm-sp-full-desc p {
    margin: 0 0 1em;
}

/* Related products */
.sm-sp-related-title {
    margin: 0 0 16px;
}

.sm-sp-related-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 16px;
}

.sm-sp-related-link {
    text-decoration: none;
    color: inherit;
    display: block;
}

.sm-sp-related-link:hover {
    opacity: 0.85;
}

.sm-sp-related-image {
    position: relative;
    overflow: hidden;
    border-radius: 4px;
}

.sm-sp-related-image img {
    width: 100%;
    aspect-ratio: 1 / 1;
    object-fit: cover;
    display: block;
}

.sm-sp-related-image .sm-product-sale-badge {
    position: absolute;
    top: 6px;
    left: 6px;
    font-size: 11px;
    font-weight: 700;
    padding: 3px 8px;
    border-radius: 3px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    line-height: 1;
}

.sm-sp-related-name {
    margin: 8px 0 4px;
    font-size: 0.95em;
    line-height: 1.3;
}

.sm-sp-related-price {
    font-weight: 600;
    font-size: 0.9em;
}

.sm-sp-related-price del {
    opacity: 0.5;
    margin-right: 4px;
}

.sm-sp-related-price ins {
    text-decoration: none;
}

/* WooCommerce variable product overrides */
.sm-sp-info .variations_form {
    margin-top: 8px;
}

.sm-sp-info .variations_form .variations {
    border-collapse: collapse;
}

.sm-sp-info .variations_form .variations td {
    padding: 4px 0;
}

.sm-sp-info .variations_form .variations td.label {
    padding-right: 0;
}

.sm-sp-info .variations_form .variations td.value {
    padding-left: 8px;
}

.sm-sp-info .variations_form .variations td.value select {
    margin-left: 4px;
}

.sm-sp-info .variations_form .woocommerce-variation-add-to-cart {
    display: flex;
    align-items: stretch;
    gap: 12px;
    margin-top: 8px;
}

.sm-sp-info .variations_form .woocommerce-variation-add-to-cart .quantity {
    display: flex;
    align-items: stretch;
}

.sm-sp-info .variations_form .woocommerce-variation-add-to-cart .quantity input[type="number"] {
    width: 70px;
    padding: 0 10px;
    border: 1px solid #ccc;
    border-radius: 4px;
    font-size: 1em;
    text-align: center;
    height: 100%;
    box-sizing: border-box;
}

.sm-sp-info .variations_form .single_add_to_cart_button {
    margin: 0;
    line-height: 1;
}

/* === RESPONSIVE === */

/* Tablet */
@media (max-width: 767px) {
    .sm-sp-top {
        flex-direction: column;
        gap: 24px;
        padding-top: 24px;
        padding-bottom: 24px;
    }

    .sm-sp-gallery {
        flex: 0 0 auto;
        max-width: 100%;
    }

    .sm-sp-bottom {
        gap: 24px;
        padding-bottom: 40px;
    }

    .sm-sp-related-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}

/* Mobile */
@media (max-width: 480px) {
    .sm-sp-top {
        padding-top: 16px;
        padding-bottom: 16px;
    }

    .sm-sp-cart-form {
        flex-direction: column;
        align-items: stretch;
    }

    .sm-sp-add-to-cart {
        text-align: center;
    }

    .sm-sp-related-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 12px;
    }

    .sm-sp-thumb {
        width: 52px;
        height: 52px;
    }
}
