/**
 * Quick View Styles
 * @package TUH_Checkout
 * @since 2.7.0
 */

/* ==========================================================================
   CSS Variables
   ========================================================================== */
:root {
    --tuh-qv-overlay-bg: rgba(0, 0, 0, 0.7);
    --tuh-qv-bg: #ffffff;
    --tuh-qv-text: #333333;
    --tuh-qv-text-muted: #666666;
    --tuh-qv-border: #e0e0e0;
    --tuh-qv-primary: #8C52FF;
    --tuh-qv-primary-hover: #7040d9;
    --tuh-qv-success: #10b981;
    --tuh-qv-error: #ef4444;
    --tuh-qv-modal-width: 900px;
    --tuh-qv-sidebar-width: 450px;
    --tuh-qv-radius: 12px;
    --tuh-qv-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.25);
}

/* ==========================================================================
   Button on Product Card
   ========================================================================== */

/* Garantir position relative nos containers */
body:not(.tuh-shop-active) .woocommerce ul.products li.product,
body:not(.tuh-shop-active) .welhison-wc-product-card,
body:not(.tuh-shop-active) .welhison-wc-product-image {
    position: relative;
}

body:not(.tuh-shop-active) .tuh-quick-view-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0;
    padding: 0;
    background: var(--tuh-qv-bg);
    border: none;
    border-radius: 50%;
    cursor: pointer;
    font-size: 13px;
    font-weight: 500;
    color: var(--tuh-qv-text);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
    transition: all 0.2s ease;
    position: absolute;
    top: 10px;
    left: 10px;
    z-index: 10;
    width: 36px;
    height: 36px;
}

body:not(.tuh-shop-active) .tuh-quick-view-btn:hover {
    background: var(--tuh-qv-primary);
    color: #fff;
    transform: scale(1.1);
}

body:not(.tuh-shop-active) .tuh-quick-view-btn--hover {
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.2s ease, visibility 0.2s ease;
}

body:not(.tuh-shop-active) .woocommerce ul.products li.product:hover .tuh-quick-view-btn--hover,
body:not(.tuh-shop-active) .welhison-wc-product-card:hover .tuh-quick-view-btn--hover,
body:not(.tuh-shop-active) .welhison-wc-product-image:hover .tuh-quick-view-btn--hover {
    opacity: 1;
    visibility: visible;
}

body:not(.tuh-shop-active) .tuh-quick-view-btn__icon {
    display: flex;
    align-items: center;
}

body:not(.tuh-shop-active) .tuh-quick-view-btn__icon svg {
    width: 18px;
    height: 18px;
}

/* ==========================================================================
   Modal Container
   ========================================================================== */
.tuh-quick-view {
    position: fixed;
    inset: 0;
    z-index: 999999;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.3s ease, visibility 0.3s ease;
}

.tuh-quick-view[aria-hidden="false"] {
    opacity: 1;
    visibility: visible;
}

.tuh-quick-view__overlay {
    position: absolute;
    inset: 0;
    background: var(--tuh-qv-overlay-bg);
    cursor: pointer;
}

.tuh-quick-view__container {
    position: relative;
    background: var(--tuh-qv-bg);
    border-radius: var(--tuh-qv-radius);
    box-shadow: var(--tuh-qv-shadow);
    max-height: 90vh;
    overflow: hidden;
    transform: scale(0.95) translateY(20px);
    transition: transform 0.3s ease;
}

.tuh-quick-view[aria-hidden="false"] .tuh-quick-view__container {
    transform: scale(1) translateY(0);
}

/* ==========================================================================
   Layout: Modal (default)
   ========================================================================== */
.tuh-quick-view--modal .tuh-quick-view__container {
    width: var(--tuh-qv-modal-width);
    max-width: 95vw;
}

/* ==========================================================================
   Layout: Sidebar
   ========================================================================== */
.tuh-quick-view--sidebar {
    justify-content: flex-end;
}

.tuh-quick-view--sidebar.tuh-quick-view--left {
    justify-content: flex-start;
}

.tuh-quick-view--sidebar .tuh-quick-view__container {
    width: var(--tuh-qv-sidebar-width);
    max-width: 90vw;
    height: 100vh;
    max-height: 100vh;
    border-radius: 0;
    transform: translateX(100%);
}

.tuh-quick-view--sidebar.tuh-quick-view--left .tuh-quick-view__container {
    transform: translateX(-100%);
}

.tuh-quick-view--sidebar[aria-hidden="false"] .tuh-quick-view__container {
    transform: translateX(0);
}

/* ==========================================================================
   Layout: Fullscreen
   ========================================================================== */
.tuh-quick-view--fullscreen .tuh-quick-view__container {
    width: 100vw;
    height: 100vh;
    max-width: none;
    max-height: none;
    border-radius: 0;
}

/* ==========================================================================
   Close Button
   ========================================================================== */
.tuh-quick-view__close {
    position: absolute;
    top: 15px;
    right: 15px;
    z-index: 10;
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--tuh-qv-bg);
    border: 1px solid var(--tuh-qv-border);
    border-radius: 50%;
    cursor: pointer;
    transition: all 0.2s;
}

.tuh-quick-view__close:hover {
    background: var(--tuh-qv-primary);
    border-color: var(--tuh-qv-primary);
    color: #fff;
}

.tuh-quick-view__close svg {
    width: 20px;
    height: 20px;
}

/* ==========================================================================
   Content Area
   ========================================================================== */
.tuh-quick-view__content {
    overflow-y: auto;
    max-height: 90vh;
    padding: 30px;
}

.tuh-quick-view--sidebar .tuh-quick-view__content,
.tuh-quick-view--fullscreen .tuh-quick-view__content {
    max-height: calc(100vh - 60px);
    padding-top: 60px;
}

/* ==========================================================================
   Loading State
   ========================================================================== */
.tuh-quick-view__loading {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 60px 40px;
    gap: 15px;
    color: var(--tuh-qv-text-muted);
}

.tuh-quick-view__spinner {
    width: 40px;
    height: 40px;
    border: 3px solid var(--tuh-qv-border);
    border-top-color: var(--tuh-qv-primary);
    border-radius: 50%;
    animation: tuh-qv-spin 0.8s linear infinite;
}

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

/* ==========================================================================
   Product Layout
   ========================================================================== */
.tuh-quick-view__product {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 30px;
}

.tuh-quick-view--sidebar .tuh-quick-view__product,
.tuh-quick-view--fullscreen .tuh-quick-view__product {
    grid-template-columns: 1fr;
}

/* ==========================================================================
   Gallery
   ========================================================================== */
.tuh-quick-view__gallery {
    position: relative;
}

.tuh-quick-view__main-image {
    width: 100%;
    height: auto;
    border-radius: 8px;
    object-fit: cover;
}

.tuh-quick-view__thumbnails {
    display: flex;
    gap: 8px;
    margin-top: 12px;
    overflow-x: auto;
    padding-bottom: 5px;
}

.tuh-quick-view__thumb {
    flex-shrink: 0;
    width: 60px;
    height: 60px;
    padding: 0;
    border: 2px solid transparent;
    border-radius: 6px;
    cursor: pointer;
    overflow: hidden;
    background: none;
    transition: border-color 0.2s;
}

.tuh-quick-view__thumb:hover,
.tuh-quick-view__thumb.active {
    border-color: var(--tuh-qv-primary);
}

.tuh-quick-view__thumb img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

/* ==========================================================================
   Details
   ========================================================================== */
.tuh-quick-view__details {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.tuh-quick-view__categories {
    font-size: 12px;
    color: var(--tuh-qv-text-muted);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.tuh-quick-view__categories a {
    color: inherit;
    text-decoration: none;
}

.tuh-quick-view__categories a:hover {
    color: var(--tuh-qv-primary);
}

.tuh-quick-view__title {
    font-size: 24px;
    font-weight: 600;
    color: var(--tuh-qv-text);
    margin: 0;
    line-height: 1.3;
}

.tuh-quick-view__rating {
    display: flex;
    align-items: center;
    gap: 8px;
}

.tuh-quick-view__rating .star-rating {
    position: relative;
    display: inline-block;
    font-size: 14px;
    line-height: 1;
    width: 5.4em;
    height: 1em;
    overflow: hidden;
    color: #f59e0b;
}

.tuh-quick-view__rating .star-rating::before {
    content: "★★★★★";
    position: absolute;
    top: 0;
    left: 0;
    color: #d1d5db;
}

.tuh-quick-view__rating .star-rating span {
    position: absolute;
    top: 0;
    left: 0;
    height: 100%;
    overflow: hidden;
    text-indent: -9999px;
}

.tuh-quick-view__rating .star-rating span::before {
    content: "★★★★★";
    position: absolute;
    top: 0;
    left: 0;
    color: #f59e0b;
    text-indent: 0;
}

.tuh-quick-view__rating-count {
    font-size: 13px;
    color: var(--tuh-qv-text-muted);
    white-space: nowrap;
}

.tuh-quick-view__price {
    font-size: 28px;
    font-weight: 700;
    color: var(--tuh-qv-text);
}

.tuh-quick-view__price del {
    font-size: 18px;
    color: var(--tuh-qv-text-muted);
    font-weight: 400;
}

.tuh-quick-view__price ins {
    text-decoration: none;
    color: var(--tuh-qv-success);
}

.tuh-quick-view__stock {
    font-size: 13px;
    font-weight: 500;
}

.tuh-quick-view__stock.in-stock {
    color: var(--tuh-qv-success);
}

.tuh-quick-view__stock.out-of-stock {
    color: var(--tuh-qv-error);
}

.tuh-quick-view__description {
    font-size: 14px;
    line-height: 1.6;
    color: var(--tuh-qv-text-muted);
}

.tuh-quick-view__sku {
    font-size: 13px;
    color: var(--tuh-qv-text-muted);
}

/* ==========================================================================
   Add to Cart
   ========================================================================== */
.tuh-quick-view__add-to-cart {
    display: flex;
    gap: 12px;
    margin-top: 10px;
}

.tuh-quick-view__quantity {
    display: flex;
    align-items: center;
    border: 1px solid var(--tuh-qv-border);
    border-radius: 6px;
    overflow: hidden;
}

.tuh-qty-btn {
    width: 36px;
    height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--tuh-qv-bg);
    border: none;
    cursor: pointer;
    font-size: 18px;
    color: var(--tuh-qv-text);
    transition: background 0.2s;
}

.tuh-qty-btn:hover {
    background: #f5f5f5;
}

.tuh-qty-input {
    width: 50px;
    height: 36px;
    text-align: center;
    border: none;
    border-left: 1px solid var(--tuh-qv-border);
    border-right: 1px solid var(--tuh-qv-border);
    font-size: 14px;
    -moz-appearance: textfield;
}

.tuh-qty-input::-webkit-outer-spin-button,
.tuh-qty-input::-webkit-inner-spin-button {
    -webkit-appearance: none;
    margin: 0;
}

.tuh-quick-view__cart-btn {
    flex: 1;
    padding: 10px 20px;
    background: var(--tuh-qv-primary);
    color: #fff;
    border: none;
    border-radius: 6px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.2s;
    text-decoration: none;
    text-align: center;
}

.tuh-quick-view__cart-btn:hover {
    background: var(--tuh-qv-primary-hover);
    color: #fff;
}

/* ==========================================================================
   Full Link
   ========================================================================== */
.tuh-quick-view__full-link {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    color: var(--tuh-qv-primary);
    text-decoration: none;
    font-size: 14px;
    font-weight: 500;
    margin-top: 10px;
}

.tuh-quick-view__full-link:hover {
    text-decoration: underline;
}

/* ==========================================================================
   Variable Products
   ========================================================================== */
.tuh-quick-view__variations {
    display: flex;
    flex-direction: column;
    gap: 16px;
    margin-top: 15px;
}

.tuh-quick-view__variation-row {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.tuh-quick-view__variation-label {
    font-size: 13px;
    font-weight: 600;
    color: #374151;
    text-transform: uppercase;
    letter-spacing: 0.3px;
}

.tuh-quick-view__variation-select {
    width: 100%;
    padding: 10px 14px;
    border: 1px solid #d1d5db;
    border-radius: 6px;
    font-size: 14px;
    color: #1f2937;
    background: #fff;
    cursor: pointer;
    transition: border-color 0.2s, box-shadow 0.2s;
    appearance: none;
    background-image: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' fill='none' viewBox='0 0 20 20'%3e%3cpath stroke='%236b7280' stroke-linecap='round' stroke-linejoin='round' stroke-width='1.5' d='M6 8l4 4 4-4'/%3e%3c/svg%3e");
    background-position: right 10px center;
    background-repeat: no-repeat;
    background-size: 20px;
}

.tuh-quick-view__variation-select:hover {
    border-color: #9ca3af;
}

.tuh-quick-view__variation-select:focus {
    outline: none;
    border-color: var(--tuh-qv-primary);
    box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.1);
}

.tuh-quick-view__variation-info {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
    align-items: center;
    min-height: 24px;
    padding: 8px 0;
    border-top: 1px solid #f3f4f6;
}

.tuh-quick-view__variation-price {
    font-size: 18px;
    font-weight: 700;
    color: #1f2937;
}

.tuh-quick-view__variation-price del {
    font-size: 14px;
    color: #9ca3af;
    font-weight: 400;
    text-decoration: line-through;
    margin-right: 6px;
}

.tuh-quick-view__variation-price ins {
    text-decoration: none;
    color: var(--tuh-qv-primary);
}

.tuh-quick-view__variation-stock {
    font-size: 13px;
}

.tuh-quick-view__variation-stock .in-stock {
    color: #10b981;
}

.tuh-quick-view__variation-stock .out-of-stock {
    color: #ef4444;
}

/* Botao desabilitado */
.tuh-quick-view__cart-btn--variable:disabled {
    background: #e5e7eb;
    color: #9ca3af;
    cursor: not-allowed;
}

.tuh-quick-view__cart-btn--variable:disabled:hover {
    background: #e5e7eb;
    color: #9ca3af;
}

/* ==========================================================================
   Responsive
   ========================================================================== */
@media (max-width: 768px) {
    .tuh-quick-view__product {
        grid-template-columns: 1fr;
    }

    .tuh-quick-view__container {
        max-width: 95vw;
    }

    .tuh-quick-view__content {
        padding: 20px;
    }

    .tuh-quick-view__title {
        font-size: 20px;
    }

    .tuh-quick-view__price {
        font-size: 22px;
    }

    .tuh-quick-view__add-to-cart {
        flex-direction: column;
    }

    .tuh-quick-view__quantity {
        justify-content: center;
    }

    /* Mobile: sempre fullscreen */
    .tuh-quick-view--modal .tuh-quick-view__container {
        width: 100vw;
        height: 100vh;
        max-width: 100vw;
        max-height: 100vh;
        border-radius: 0;
    }
}

@media (max-width: 480px) {
    .tuh-quick-view-btn {
        width: 32px;
        height: 32px;
        top: 8px;
        left: 8px;
    }

    .tuh-quick-view-btn__icon svg {
        width: 16px;
        height: 16px;
    }
}
