/**
 * WooVari Frontend Styles
 */

/* ===================================
   Base Container
   =================================== */

.woovari-product-wrapper {
    position: relative;
}

.woovari-product-wrapper * {
    box-sizing: border-box;
}

/* ===================================
   Layout Styles
   =================================== */

/* Vertical Layout (Default) */
.woovari-product-layout-vertical .woovari-product-image-wrapper {
    margin-bottom: 20px;
}

/* Horizontal Layout */
.woovari-product-layout-horizontal .woovari-product-columns {
    display: flex;
    flex-wrap: wrap;
    gap: 30px;
}

.woovari-product-layout-horizontal .woovari-product-image-wrapper {
    flex: 0 0 auto;
}

.woovari-product-layout-horizontal .woovari-product-content {
    flex: 1;
    min-width: 0;
}

/* Flex containers for alignment control */
.woovari-variations {
    display: flex;
    flex-direction: column;
}

.woovari-attribute {
    display: flex;
    flex-direction: column;
}

/* ===================================
   Image & Gallery
   =================================== */

.woovari-product-image-wrapper {
    position: relative;
}

.woovari-product-main-image {
    position: relative;
    overflow: hidden;
    background-size: 200%;
    background-position: center;
    background-repeat: no-repeat;
}

.woovari-product-main-image img {
    display: block;
    width: 100%;
    height: auto;
    transition: opacity 0.2s ease;
}

.woovari-product-main-image a {
    display: block;
    cursor: zoom-in;
}

/* Zoom on hover */
.woovari-zoom-enabled {
    cursor: crosshair;
}

/* Gallery Thumbnails */
.woovari-gallery-thumbnails {
    display: grid;
    margin-top: 10px;
}

.woovari-gallery-thumbnails[data-columns="3"] {
    grid-template-columns: repeat(3, 1fr);
}

.woovari-gallery-thumbnails[data-columns="4"] {
    grid-template-columns: repeat(4, 1fr);
}

.woovari-gallery-thumbnails[data-columns="5"] {
    grid-template-columns: repeat(5, 1fr);
}

.woovari-gallery-thumbnails[data-columns="6"] {
    grid-template-columns: repeat(6, 1fr);
}

.woovari-gallery-thumbnail {
    cursor: pointer;
    transition: opacity 0.2s ease;
}

.woovari-gallery-thumbnail img {
    display: block;
    width: 100%;
    height: auto;
    object-fit: cover;
}

.woovari-gallery-thumbnail.active img {
    opacity: 1 !important;
}

.woovari-gallery-thumbnail:hover img {
    opacity: 1 !important;
}

/* ===================================
   Product Title
   =================================== */

.woovari-product-title {
    margin: 0 0 10px 0;
    padding: 0;
    font-size: 28px;
    font-weight: 600;
    line-height: 1.3;
}

/* ===================================
   Product Price
   =================================== */

.woovari-product-price {
    margin-bottom: 15px;
    font-size: 22px;
    font-weight: 600;
}

.woovari-product-price del {
    opacity: 0.6;
    font-weight: 400;
    margin-right: 8px;
}

.woovari-product-price ins {
    text-decoration: none;
}

/* ===================================
   Description
   =================================== */

.woovari-product-short-description,
.woovari-product-description {
    margin-bottom: 20px;
    line-height: 1.6;
}

.woovari-product-short-description p:last-child,
.woovari-product-description p:last-child {
    margin-bottom: 0;
}

/* ===================================
   Stock Status
   =================================== */

.woovari-stock-status {
    margin-bottom: 15px;
    font-weight: 500;
}

.woovari-stock-status.in-stock {
    color: #7ad03a;
}

.woovari-stock-status.out-of-stock {
    color: #a44;
}

.woovari-stock-status.on-backorder {
    color: #f0ad4e;
}

/* ===================================
   SKU & Meta
   =================================== */

.woovari-product-meta {
    margin-bottom: 10px;
    font-size: 14px;
}

.woovari-product-meta-label {
    font-weight: 600;
    margin-right: 5px;
}

.woovari-product-meta a {
    text-decoration: none;
}

.woovari-product-meta a:hover {
    text-decoration: underline;
}

/* ===================================
   Variations
   =================================== */

.woovari-variations {
    margin-bottom: 20px;
}

.woovari-attribute {
    margin-bottom: 15px;
}

.woovari-attribute:last-child {
    margin-bottom: 0;
}

.woovari-attribute-label {
    display: block;
    margin-bottom: 8px;
    font-weight: 600;
    font-size: 14px;
}

.woovari-selected-value {
    font-weight: 400;
    opacity: 0.8;
}

/* Dropdown Select */
.woovari-variation-select {
    width: 100%;
    max-width: 300px;
    padding: 10px 15px;
    font-size: 14px;
    border: 1px solid #ddd;
    border-radius: 4px;
    background-color: #fff;
    cursor: pointer;
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='%23333' d='M6 8L1 3h10z'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 12px center;
    padding-right: 35px;
}

.woovari-variation-select:focus {
    outline: none;
    border-color: #333;
}

.woovari-variation-select option:disabled {
    color: #ccc;
}

/* Swatches Container */
.woovari-swatches {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
}

/* Base Swatch */
.woovari-swatch {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    border: 2px solid #ddd;
    transition: all 0.2s ease;
    background: none;
    padding: 0;
    font-family: inherit;
}

.woovari-swatch:hover:not(.disabled) {
    border-color: #999;
}

.woovari-swatch.selected {
    border-color: #333;
}

.woovari-swatch.disabled {
    opacity: 0.3;
    cursor: not-allowed;
    position: relative;
}

.woovari-swatch.disabled::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 0;
    right: 0;
    height: 2px;
    background: #999;
    transform: rotate(-45deg);
}

/* Color Swatch */
.woovari-swatch-color {
    width: 40px;
    height: 40px;
    border-radius: 50%;
}

.woovari-swatch-color .screen-reader-text {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

/* Image Swatch */
.woovari-swatch-image {
    padding: 2px;
    border-radius: 4px;
}

.woovari-swatch-image img {
    display: block;
    width: 40px;
    height: 40px;
    object-fit: cover;
    border-radius: 2px;
}

/* Label Swatch */
.woovari-swatch-label {
    padding: 8px 16px;
    font-size: 13px;
    font-weight: 500;
    background-color: #f5f5f5;
    border-radius: 4px;
    min-width: 40px;
    text-align: center;
}

.woovari-swatch-label.selected {
    background-color: #333;
    color: #fff;
}

/* Reset Link */
.woovari-reset-variations {
    display: inline-block;
    margin-top: 10px;
    font-size: 13px;
    color: #666;
    text-decoration: none;
}

.woovari-reset-variations:hover {
    color: #333;
    text-decoration: underline;
}

/* ===================================
   Variation Data
   =================================== */

.woovari-variation-data {
    margin-bottom: 20px;
    padding: 15px;
    background-color: #f9f9f9;
    border-radius: 4px;
}

.woovari-variation-data-item {
    margin-bottom: 8px;
}

.woovari-variation-data-item:last-child {
    margin-bottom: 0;
}

.woovari-variation-data-label {
    font-weight: 600;
    margin-right: 5px;
}

.woovari-variation-description-content {
    display: block;
    line-height: 1.5;
}

/* ===================================
   Add to Cart
   =================================== */

.woovari-add-to-cart-wrapper {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 10px;
    margin-bottom: 15px;
}

.woovari-quantity-wrapper {
    display: inline-block;
}

.woovari-quantity-input {
    width: 70px;
    padding: 10px;
    font-size: 16px;
    text-align: center;
    border: 1px solid #ddd;
    border-radius: 4px;
}

.woovari-quantity-input:focus {
    outline: none;
    border-color: #333;
}

.woovari-add-to-cart-button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 12px 30px;
    font-size: 16px;
    font-weight: 600;
    color: #fff;
    background-color: #333;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    transition: all 0.2s ease;
}

.woovari-add-to-cart-button:hover:not(:disabled) {
    background-color: #555;
}

.woovari-add-to-cart-button:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.woovari-add-to-cart-button.loading {
    position: relative;
    color: transparent;
}

.woovari-add-to-cart-button.loading::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 20px;
    height: 20px;
    margin: -10px 0 0 -10px;
    border: 2px solid #fff;
    border-top-color: transparent;
    border-radius: 50%;
    animation: woovari-spin 0.8s linear infinite;
}

@keyframes woovari-spin {
    to {
        transform: rotate(360deg);
    }
}

/* Cart Message */
.woovari-cart-message {
    padding: 12px 15px;
    border-radius: 4px;
    font-size: 14px;
}

.woovari-cart-message.success {
    background-color: #d4edda;
    color: #155724;
}

.woovari-cart-message.error {
    background-color: #f8d7da;
    color: #721c24;
}

.woovari-view-cart-link {
    margin-left: 10px;
    font-weight: 600;
    text-decoration: underline;
}

/* ===================================
   Lightbox
   =================================== */

.woovari-lightbox-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: rgba(0, 0, 0, 0.9);
    z-index: 999999;
    display: flex;
    align-items: center;
    justify-content: center;
}

.woovari-lightbox-container {
    position: relative;
    max-width: 90vw;
    max-height: 90vh;
}

.woovari-lightbox-content {
    display: flex;
    align-items: center;
    justify-content: center;
}

.woovari-lightbox-image {
    max-width: 90vw;
    max-height: 90vh;
    object-fit: contain;
}

.woovari-lightbox-close {
    position: absolute;
    top: -40px;
    right: -10px;
    width: 40px;
    height: 40px;
    padding: 0;
    font-size: 30px;
    line-height: 1;
    color: #fff;
    background: none;
    border: none;
    cursor: pointer;
    opacity: 0.8;
    transition: opacity 0.2s ease;
}

.woovari-lightbox-close:hover {
    opacity: 1;
}

.woovari-lightbox-prev,
.woovari-lightbox-next {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    width: 50px;
    height: 50px;
    padding: 0;
    font-size: 40px;
    line-height: 1;
    color: #fff;
    background: rgba(0, 0, 0, 0.5);
    border: none;
    border-radius: 4px;
    cursor: pointer;
    opacity: 0.8;
    transition: opacity 0.2s ease;
}

.woovari-lightbox-prev {
    left: -60px;
}

.woovari-lightbox-next {
    right: -60px;
}

.woovari-lightbox-prev:hover,
.woovari-lightbox-next:hover {
    opacity: 1;
}

/* ===================================
   Editor Placeholder
   =================================== */

.woovari-editor-placeholder {
    padding: 40px;
    text-align: center;
    background-color: #f5f5f5;
    border: 2px dashed #ddd;
    border-radius: 4px;
}

.woovari-editor-placeholder p {
    margin: 0;
    color: #666;
    font-size: 14px;
}

.woovari-editor-placeholder.woovari-error {
    background-color: #fff5f5;
    border-color: #f5c6c6;
}

.woovari-editor-placeholder.woovari-error p {
    color: #c00;
}

/* ===================================
   Responsive
   =================================== */

@media (max-width: 991px) {
    .woovari-product-layout-horizontal .woovari-product-columns {
        flex-direction: column;
    }

    .woovari-product-layout-horizontal .woovari-product-image-wrapper {
        width: 100% !important;
    }
}

@media (max-width: 767px) {
    .woovari-product-title {
        font-size: 24px;
    }

    .woovari-product-price {
        font-size: 20px;
    }

    .woovari-add-to-cart-wrapper {
        flex-direction: column;
        align-items: center;
        width: 100%;
    }

    .woovari-add-to-cart-button {
        width: 100%;
        max-width: 300px;
    }

    .woovari-quantity-wrapper {
        width: 100%;
        max-width: 300px;
    }

    .woovari-quantity-input {
        width: 100%;
    }

    .woovari-lightbox-prev {
        left: 10px;
    }

    .woovari-lightbox-next {
        right: 10px;
    }

    .woovari-gallery-thumbnails[data-columns="5"],
    .woovari-gallery-thumbnails[data-columns="6"] {
        grid-template-columns: repeat(4, 1fr);
    }
}

@media (max-width: 480px) {
    .woovari-gallery-thumbnails[data-columns="4"],
    .woovari-gallery-thumbnails[data-columns="5"],
    .woovari-gallery-thumbnails[data-columns="6"] {
        grid-template-columns: repeat(3, 1fr);
    }

    .woovari-swatch-label {
        padding: 6px 12px;
        font-size: 12px;
    }
}

/* ===================================
   Print Styles
   =================================== */

@media print {
    .woovari-add-to-cart-wrapper,
    .woovari-variations,
    .woovari-lightbox-overlay {
        display: none !important;
    }
}
