/**
 * Webup Woo - Core Styles
 */

/* Reset & Box Sizing */
.webup-woo-archive *,
.webup-woo-archive *::before,
.webup-woo-archive *::after,
.webup-woo-single *,
.webup-woo-single *::before,
.webup-woo-single *::after {
    box-sizing: border-box;
}

/* Container */
.webup-woo-container {
    max-width: 1400px;
    margin: 0 auto;
    padding: 0 20px;
}

/* Typography */
.webup-woo-archive,
.webup-woo-single {
    font-size: var(--webup-woo-body-size, 14px);
    color: var(--webup-woo-text, #333333);
    line-height: 1.6;
}

/* Buttons - use !important to override theme reset.css */
.webup-woo-btn,
button.webup-woo-btn,
.webup-woo-add-to-cart,
.webup-woo-load-more,
.webup-woo-filter-apply,
.webup-woo-archive button,
.webup-woo-single button,
.webup-woo-quick-view-modal button {
    display: inline-flex !important;
    align-items: center !important;
    justify-content: center !important;
    gap: 8px !important;
    padding: 12px 24px !important;
    font-size: 14px !important;
    font-weight: 500 !important;
    line-height: 1 !important;
    text-decoration: none !important;
    border: none !important;
    border-radius: 4px !important;
    cursor: pointer !important;
    transition: all 0.2s ease !important;
    background-color: var(--webup-woo-primary, #333333) !important;
    color: #ffffff !important;
}

.webup-woo-btn:hover,
button.webup-woo-btn:hover,
.webup-woo-add-to-cart:hover,
.webup-woo-load-more:hover,
.webup-woo-filter-apply:hover {
    opacity: 0.9;
    transform: translateY(-1px);
}

.webup-woo-btn-secondary,
.webup-woo-filter-clear {
    background-color: transparent !important;
    color: var(--webup-woo-text, #333333) !important;
    border: 1px solid var(--webup-woo-border, #e0e0e0) !important;
}

.webup-woo-btn-secondary:hover,
.webup-woo-filter-clear:hover {
    background-color: var(--webup-woo-bg, #ffffff) !important;
    border-color: var(--webup-woo-text, #333333) !important;
}

/* Specific button overrides to ensure theme styles don't bleed through */
.webup-woo-quick-view-btn,
.webup-woo-wishlist-btn,
.webup-woo-qty-btn,
.webup-woo-gallery-nav,
.webup-woo-quick-view-close {
    background-color: var(--webup-woo-bg, #ffffff) !important;
    border: none !important;
    color: var(--webup-woo-text, #333333) !important;
}

.webup-woo-quick-view-btn:hover,
.webup-woo-gallery-nav:hover,
.webup-woo-quick-view-close:hover {
    background-color: var(--webup-woo-primary, #333333) !important;
    color: #ffffff !important;
}

/* Wishlist button in card - filled on hover */
.webup-woo-card-actions .webup-woo-wishlist-btn:hover {
    background-color: var(--webup-woo-primary, #333333) !important;
    color: #ffffff !important;
}

/* Wishlist button in add-to-cart section - outline style */
.webup-woo-add-to-cart-section .webup-woo-wishlist-btn {
    width: 54px !important;
    height: 54px !important;
    padding: 0 !important;
    background-color: #ffffff !important;
    border: 1px solid var(--webup-woo-border, #e0e0e0) !important;
    border-radius: 4px !important;
    color: var(--webup-woo-text, #333333) !important;
    box-shadow: none !important;
}

.webup-woo-add-to-cart-section .webup-woo-wishlist-btn svg {
    width: 24px !important;
    height: 24px !important;
}

.webup-woo-add-to-cart-section .webup-woo-wishlist-btn:hover {
    background-color: #ffffff !important;
    border-color: var(--webup-woo-text, #333333) !important;
    color: var(--webup-woo-text, #333333) !important;
}

.webup-woo-add-to-cart-section .webup-woo-wishlist-btn.active {
    background-color: #ffffff !important;
    border-color: var(--webup-woo-sale, #e74c3c) !important;
    color: var(--webup-woo-sale, #e74c3c) !important;
}

/* Tab buttons - should look like text links, not buttons */
.webup-woo-tab-btn,
.webup-woo-single .webup-woo-tab-btn,
button.webup-woo-tab-btn {
    display: inline-block !important;
    padding: 15px 25px !important;
    font-size: 15px !important;
    font-weight: 500 !important;
    color: var(--webup-woo-light-text, #666666) !important;
    background: none !important;
    background-color: transparent !important;
    border: none !important;
    border-radius: 0 !important;
    line-height: 1.4 !important;
}

.webup-woo-tab-btn:hover,
.webup-woo-single .webup-woo-tab-btn:hover,
button.webup-woo-tab-btn:hover {
    color: var(--webup-woo-text, #333333) !important;
    background: none !important;
    background-color: transparent !important;
    transform: none !important;
    opacity: 1 !important;
}

.webup-woo-tab-btn.active,
.webup-woo-single .webup-woo-tab-btn.active {
    color: var(--webup-woo-primary, #333333) !important;
}

/* Filter toggle header - discrete, not button-like */
.webup-woo-filter-toggle-header {
    display: flex !important;
    align-items: center !important;
    justify-content: space-between !important;
    width: 100% !important;
    padding: 15px 20px !important;
    background: none !important;
    border: none !important;
    font-size: 14px !important;
    font-weight: 600 !important;
    color: var(--webup-woo-text, #333333) !important;
    cursor: pointer !important;
    text-align: left !important;
}

.webup-woo-filter-toggle-header:hover {
    background-color: var(--webup-woo-bg-alt, #f9f9f9) !important;
}

/* Outline button style for add-to-cart */
.webup-woo-add-to-cart.outline {
    background-color: var(--webup-woo-bg, #ffffff) !important;
    color: var(--webup-woo-text, #333333) !important;
    border: 1px solid var(--webup-woo-text, #333333) !important;
}

.webup-woo-add-to-cart.outline:hover {
    background-color: var(--webup-woo-text, #333333) !important;
    color: #ffffff !important;
}

/* Loading Spinner */
.webup-woo-spinner {
    width: 40px;
    height: 40px;
    border: 3px solid var(--webup-woo-border, #e0e0e0);
    border-top-color: var(--webup-woo-primary, #333333);
    border-radius: 50%;
    animation: webup-woo-spin 0.8s linear infinite;
}

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

.webup-woo-loading {
    display: flex;
    justify-content: center;
    padding: 40px 0;
}

/* Badges */
.webup-woo-badge {
    position: absolute;
    top: 10px;
    left: 10px;
    padding: 4px 10px;
    font-size: 12px;
    font-weight: 600;
    line-height: 1.2;
    border-radius: 3px;
    z-index: 2;
}

.webup-woo-badge.sale {
    background-color: var(--webup-woo-sale, #e74c3c);
    color: #ffffff;
}

.webup-woo-badge.out-of-stock {
    background-color: var(--webup-woo-light-text, #666666);
    color: #ffffff;
    left: auto;
    right: 10px;
}

/* Lazy Loading */
img.lazy {
    opacity: 0;
    transition: opacity 0.3s ease;
}

img.lazy.loaded {
    opacity: 1;
}

/* Skeleton loading */
.webup-woo-skeleton {
    background: linear-gradient(90deg, #f0f0f0 25%, #e0e0e0 50%, #f0f0f0 75%);
    background-size: 200% 100%;
    animation: webup-woo-skeleton 1.5s infinite;
}

@keyframes webup-woo-skeleton {
    0% {
        background-position: 200% 0;
    }
    100% {
        background-position: -200% 0;
    }
}

/* Modal overlay */
.webup-woo-filter-modal-overlay,
.webup-woo-quick-view-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.5);
    z-index: 9998;
}

/* Visually hidden */
.webup-woo-sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

/* Focus styles */
.webup-woo-archive a:focus,
.webup-woo-archive button:focus,
.webup-woo-single a:focus,
.webup-woo-single button:focus {
    outline: 2px solid var(--webup-woo-primary, #333333);
    outline-offset: 2px;
}

/* Price styles */
.webup-woo-price-current {
    font-size: var(--webup-woo-price-size, 18px);
    font-weight: 600;
    color: var(--webup-woo-text, #333333);
}

.on-sale .webup-woo-price-current {
    color: var(--webup-woo-sale, #e74c3c);
}

.webup-woo-price-original {
    font-size: calc(var(--webup-woo-price-size, 18px) - 4px);
    color: var(--webup-woo-light-text, #666666);
    text-decoration: line-through;
    margin-left: 8px;
}

/* No products message */
.webup-woo-no-products {
    grid-column: 1 / -1;
    text-align: center;
    padding: 60px 20px;
    color: var(--webup-woo-light-text, #666666);
    font-size: 16px;
}

/* Quick View Modal */
.webup-woo-quick-view-modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 99999;
    display: none;
    align-items: center;
    justify-content: center;
}

.webup-woo-quick-view-modal.active {
    display: flex;
}

.webup-woo-quick-view-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.5);
    z-index: 1;
}

.webup-woo-quick-view-content {
    position: relative;
    width: 90%;
    max-width: 900px;
    max-height: 90vh;
    background-color: var(--webup-woo-bg, #ffffff);
    border-radius: 12px;
    box-shadow: 0 25px 50px rgba(0, 0, 0, 0.25);
    z-index: 2;
    overflow: hidden;
}

.webup-woo-quick-view-close {
    position: absolute;
    top: 15px;
    right: 15px;
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    background-color: rgba(0, 0, 0, 0.05);
    border: none;
    border-radius: 50%;
    cursor: pointer;
    z-index: 10;
    transition: background-color 0.2s;
}

.webup-woo-quick-view-close:hover {
    background-color: rgba(0, 0, 0, 0.1);
}

.webup-woo-quick-view-body {
    padding: 30px;
    max-height: 90vh;
    overflow-y: auto;
}

.webup-woo-quick-view-body .webup-woo-loading {
    min-height: 300px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.webup-woo-quick-view-body .webup-woo-error {
    text-align: center;
    padding: 60px 20px;
    color: var(--webup-woo-sale, #e74c3c);
}

/* Body class when modal open */
body.webup-woo-modal-open {
    overflow: hidden;
}

/* Rating stars */
.webup-woo-rating {
    display: flex;
    align-items: center;
    gap: 8px;
}

.webup-woo-stars {
    display: flex;
    gap: 2px;
}

.webup-woo-star {
    width: 16px;
    height: 16px;
    color: var(--webup-woo-border, #e0e0e0);
}

.webup-woo-star.filled {
    color: #ffc107;
}

.webup-woo-star.half {
    color: #ffc107;
}

.webup-woo-review-count {
    font-size: 13px;
    color: var(--webup-woo-light-text, #666666);
}

/* Stock status */
.webup-woo-stock {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-size: 14px;
}

.webup-woo-stock.in-stock {
    color: var(--webup-woo-primary, #333333);
}

.webup-woo-stock.out-of-stock {
    color: var(--webup-woo-sale, #e74c3c);
}

/* Quantity input - compact with arrows on the right */
.webup-woo-quantity {
    display: inline-flex;
    align-items: center;
    border: 1px solid var(--webup-woo-border, #e0e0e0);
    border-radius: 4px;
    overflow: hidden;
    height: 42px;
    background-color: #ffffff;
}

.webup-woo-qty-input {
    width: 44px;
    height: 100%;
    border: none;
    text-align: center;
    font-size: 14px;
    font-weight: 500;
    color: var(--webup-woo-text, #333333);
    background: transparent;
    -moz-appearance: textfield;
}

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

.webup-woo-qty-input:focus {
    outline: none;
}

.webup-woo-qty-buttons {
    display: flex;
    flex-direction: column;
    border-left: 1px solid var(--webup-woo-border, #e0e0e0);
    height: 100%;
}

.webup-woo-qty-btn,
.webup-woo-single .webup-woo-qty-btn,
.webup-woo-quick-view-modal .webup-woo-qty-btn,
button.webup-woo-qty-btn {
    width: 20px !important;
    height: 21px !important;
    min-width: 20px !important;
    min-height: 21px !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    background-color: #ffffff !important;
    border: none !important;
    border-radius: 0 !important;
    cursor: pointer !important;
    transition: background-color 0.2s !important;
    padding: 0 !important;
    color: #999999 !important;
    gap: 0 !important;
    line-height: 1 !important;
}

.webup-woo-qty-btn:hover,
.webup-woo-single .webup-woo-qty-btn:hover,
.webup-woo-quick-view-modal .webup-woo-qty-btn:hover,
button.webup-woo-qty-btn:hover {
    background-color: #f5f5f5 !important;
    color: #333333 !important;
    transform: none !important;
    opacity: 1 !important;
}

.webup-woo-qty-btn.plus,
.webup-woo-single .webup-woo-qty-btn.plus,
.webup-woo-quick-view-modal .webup-woo-qty-btn.plus {
    border-bottom: 1px solid var(--webup-woo-border, #e0e0e0) !important;
}

.webup-woo-qty-btn svg {
    width: 10px !important;
    height: 10px !important;
}

/* Add to cart button states */
.webup-woo-add-to-cart.loading {
    pointer-events: none;
    opacity: 0.7;
}

.webup-woo-add-to-cart.loading::after {
    content: '';
    width: 16px;
    height: 16px;
    border: 2px solid rgba(255, 255, 255, 0.3);
    border-top-color: #ffffff;
    border-radius: 50%;
    animation: webup-woo-spin 0.8s linear infinite;
    margin-left: 8px;
}

.webup-woo-add-to-cart.added {
    background-color: var(--webup-woo-primary, #333333);
}

.webup-woo-add-to-cart.disabled {
    background-color: var(--webup-woo-light-text, #666666);
    cursor: not-allowed;
    pointer-events: none;
}

/* Variations */
.webup-woo-variations {
    display: flex;
    flex-direction: column;
    gap: 15px;
}

.webup-woo-variation-row {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.webup-woo-variation-label {
    font-size: 14px;
    font-weight: 500;
    color: var(--webup-woo-text, #333333);
}

.webup-woo-variation-label span {
    font-weight: 400;
    color: var(--webup-woo-light-text, #666666);
}

/* Swatches */
.webup-woo-swatches {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.webup-woo-swatch {
    position: relative;
    cursor: pointer;
}

.webup-woo-swatch input {
    position: absolute;
    opacity: 0;
    pointer-events: none;
}

.webup-woo-swatch-inner {
    display: flex;
    align-items: center;
    justify-content: center;
    min-width: 36px;
    min-height: 36px;
    border: 2px solid var(--webup-woo-border, #e0e0e0);
    border-radius: 4px;
    transition: all 0.2s;
}

.webup-woo-swatch input:checked + .webup-woo-swatch-inner,
.webup-woo-swatch.selected .webup-woo-swatch-inner {
    border-color: var(--webup-woo-primary, #333333);
    box-shadow: 0 0 0 2px var(--webup-woo-primary, #333333);
}

.webup-woo-swatch-color .webup-woo-swatch-inner {
    width: 36px;
    height: 36px;
    border-radius: 50%;
}

.webup-woo-swatch-image .webup-woo-swatch-inner {
    width: 44px;
    height: 44px;
    background-size: cover;
    background-position: center;
}

.webup-woo-swatch-button .webup-woo-swatch-inner {
    padding: 8px 16px;
    font-size: 13px;
    font-weight: 500;
}

.webup-woo-swatch.disabled {
    opacity: 0.4;
    pointer-events: none;
}

.webup-woo-swatch[data-tooltip]::after {
    content: attr(data-tooltip);
    position: absolute;
    bottom: 100%;
    left: 50%;
    transform: translateX(-50%);
    padding: 4px 8px;
    background-color: var(--webup-woo-text, #333333);
    color: #ffffff;
    font-size: 11px;
    border-radius: 4px;
    white-space: nowrap;
    opacity: 0;
    visibility: hidden;
    transition: all 0.2s;
    margin-bottom: 5px;
    z-index: 10;
}

.webup-woo-swatch[data-tooltip]:hover::after {
    opacity: 1;
    visibility: visible;
}

/* Select wrapper */
.webup-woo-select-wrapper {
    position: relative;
}

.webup-woo-select {
    width: 100%;
    max-width: 300px;
    padding: 10px 40px 10px 15px;
    font-size: 14px;
    border: 1px solid var(--webup-woo-border, #e0e0e0);
    border-radius: 4px;
    background-color: var(--webup-woo-bg, #ffffff);
    cursor: pointer;
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='24' height='24' viewBox='0 0 24 24' fill='none' stroke='%23666666' stroke-width='2'%3E%3Cpolyline points='6 9 12 15 18 9'%3E%3C/polyline%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 10px center;
    background-size: 16px;
}

.webup-woo-select:focus {
    outline: none;
    border-color: var(--webup-woo-primary, #333333);
}

@media (max-width: 768px) {
    .webup-woo-quick-view-content {
        width: 95%;
        max-height: 95vh;
    }

    .webup-woo-quick-view-body {
        padding: 20px;
    }
}
