/**
 * Product Showcase Widget Styles
 * Custom WooCommerce Product Widget with Brand Design System
 * Following Encens & Pierres brand guidelines
 */

/* ============================================
   CSS Custom Properties for Design System
   ============================================ */
:root {
    /* Brand Colors */
    --gold-earth: #a68658;
    --soft-ivory: #f7f5f1;
    --deep-charcoal: #2f2b28;
    --secondary-text: #4a4542;
    --sage-green: #8c9a7a;
    --amethyst-violet: #7a5c8d;
    --amber-glow: #c99c63;
    --soft-jade: #b9c9a2;
    --terra-red: #a65c58;
    --white: #ffffff;

    /* Typography */
    --font-garamond: "Garamond", "EB Garamond", "Cormorant Garamond", serif;
    --font-nunito: "Nunito Sans", sans-serif;
    --font-spectral: "Spectral", serif;

    /* Spacing & Shadows */
    --shadow-subtle: 0 2px 8px rgba(47, 43, 40, 0.08);
    --shadow-medium: 0 4px 20px rgba(47, 43, 40, 0.12);
    --shadow-strong: 0 8px 30px rgba(47, 43, 40, 0.15);
    --radius-small: 4px;
    --radius-medium: 6px;
    --radius-large: 12px;
}

/* ============================================
   Enhanced Tab Styling with Brand Typography
   ============================================ */
.cwp-tab-input {
    display: none;
}

.cwp-category-tab {
    font-family: var(--font-nunito);
    font-weight: 600;
    font-size: 15px;
    background: var(--soft-ivory);
    border: 2px solid var(--sage-green);
    padding: 6px 14px;
    cursor: pointer;
    border-radius: 4px 4px 0 0;
    transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
    color: var(--deep-charcoal);
    display: inline-block;
    margin-right: 3px;
    box-shadow: var(--shadow-subtle);
    position: relative;
    overflow: hidden;
    text-transform: capitalize;
    letter-spacing: 0.5px;
}

.cwp-category-tab::before {
    content: "";
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(
        90deg,
        transparent,
        rgba(166, 134, 88, 0.15),
        transparent
    );
    transition: left 0.6s ease;
}

.cwp-category-tab:hover::before {
    left: 100%;
}

.cwp-category-tab.active,
.cwp-category-tab:hover {
    color: var(--white);
    background: linear-gradient(
        135deg,
        var(--gold-earth) 0%,
        var(--amber-glow) 100%
    );
    border-color: var(--gold-earth);
    box-shadow: 0 6px 20px rgba(166, 134, 88, 0.3);
    transform: translateY(-2px);
}

/* ============================================
   Content Visibility
   ============================================ */
.cwp-category-desc,
.cwp-category-products {
    display: none;
}

.cwp-category-desc.active,
.cwp-category-products.active {
    display: block;
}

/* ============================================
   Enhanced Widget Container with Brand Styling
   ============================================ */
.cwp-widget-container {
    font-family: var(--font-nunito);
    background: var(--soft-ivory);
    border-radius: var(--radius-large);
    padding: 12px;
    box-shadow: var(--shadow-medium);
    margin: 15px 0;
    position: relative;
    overflow: hidden;
    border: 1px solid rgba(166, 134, 88, 0.1);
}

.cwp-widget-container::before {
    content: "";
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 3px;
    background: linear-gradient(
        90deg,
        var(--gold-earth),
        var(--amber-glow),
        var(--gold-earth)
    );
    animation: brandShimmer 4s ease-in-out infinite;
}

@keyframes brandShimmer {
    0% {
        transform: translateX(-100%);
    }
    50% {
        transform: translateX(0);
    }
    100% {
        transform: translateX(100%);
    }
}

/* ============================================
   Enhanced Tabs Container
   ============================================ */
.cwp-tabs-container {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
    padding: 10px;
    background: rgba(247, 245, 241, 0.7);
    border-radius: 6px;
    border: 1px solid rgba(140, 154, 122, 0.2);
    backdrop-filter: blur(10px);
}

.cwp-category-tabs {
    display: flex;
    gap: 3px;
}

/* ============================================
   Enhanced Category Description Container
   ============================================ */
.cwp-category-tabs-desc {
    margin-bottom: 20px;
    padding: 12px;
    background: linear-gradient(
        135deg,
        var(--soft-ivory) 0%,
        var(--white) 100%
    );
    border-radius: 6px;
    border: 1px solid rgba(140, 154, 122, 0.15);
    min-height: 50px;
    box-shadow: var(--shadow-subtle);
}

.cwp-category-desc {
    color: var(--secondary-text);
    line-height: 1.7;
    font-size: 16px;
    font-family: var(--font-nunito);
}

.cwp-category-desc h3 {
    font-family: var(--font-garamond);
    color: var(--deep-charcoal);
    margin-bottom: 12px;
    font-size: 20px;
    font-weight: 600;
    letter-spacing: 1px;
}

.cwp-category-desc p {
    margin-bottom: 8px;
}

.cwp-category-desc ul,
.cwp-category-desc ol {
    margin-left: 20px;
    margin-bottom: 8px;
    color: var(--secondary-text);
}

/* ============================================
   Enhanced Product Row Layout with Display Grid
   ============================================ */
.cwp-product-row {
    display: flex !important;
    flex-wrap: nowrap;
    gap: 18px;
    width: 100%;
    position: relative;
    padding: 12px;
    background: var(--white);
    border-radius: 6px;
    box-shadow: var(--shadow-subtle);
    border: 1px solid rgba(166, 134, 88, 0.08);
    overflow-x: auto;
}

.cwp-product-row .cwp-product-item {
    flex: 0 0 auto;
    min-width: 200px;
    max-width: calc(25% - 14px);
}

/* ============================================
   Enhanced Products in Grid with Brand Styling
   ============================================ */
/* This is now handled in the main .cwp-product-row rule above */

/* Enhanced hover effects for product items */
.cwp-product-row .cwp-product-item {
    position: relative;
    background: var(--white);
    border-radius: 6px;
    padding: 10px;
    box-shadow: var(--shadow-subtle);
    transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
    overflow: hidden;
    text-decoration: none;
    color: inherit;
    border: 1px solid rgba(166, 134, 88, 0.1);
    box-sizing: border-box;
}

.cwp-product-row .cwp-product-item::before {
    content: "";
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 4px;
    background: linear-gradient(
        90deg,
        var(--gold-earth),
        var(--amethyst-violet)
    );
    transform: scaleX(0);
    transition: transform 0.4s cubic-bezier(0.4, 0, 0.2, 1);
}

.cwp-product-row .cwp-product-item:hover::before {
    transform: scaleX(1);
}

.cwp-product-row .cwp-product-item:hover {
    transform: translateY(-8px);
    box-shadow: var(--shadow-strong);
    border-color: var(--gold-earth);
}

.cwp-product-row .cwp-product-image {
    border-radius: var(--radius-small);
    overflow: hidden;
    margin-bottom: 6px;
    background: var(--soft-ivory);
}

.cwp-product-row .cwp-product-image img {
    width: 100%;
    height: 200px;
    object-fit: cover;
    transition: transform 0.5s cubic-bezier(0.4, 0, 0.2, 1);
}

.cwp-product-row .cwp-product-item:hover .cwp-product-image img {
    transform: scale(1.08);
}

.cwp-product-row .cwp-product-title {
    font-family: var(--font-garamond);
    font-size: 18px;
    font-weight: 600;
    color: var(--deep-charcoal);
    margin: 0 0 5px 0;
    line-height: 1.3;
    text-decoration: none;
    letter-spacing: 0.5px;
    transition: color 0.3s ease;
}

.cwp-product-row .cwp-product-item:hover .cwp-product-title {
    color: var(--gold-earth);
}

.cwp-product-row .cwp-product-price {
    font-family: var(--font-nunito);
    font-size: 20px;
    font-weight: 700;
    color: var(--gold-earth);
    margin-top: 5px;
    letter-spacing: 0.3px;
}

.cwp-product-row .cwp-product-meta {
    margin-bottom: 8px;
}

.cwp-product-row .cwp-product-category {
    font-family: var(--font-nunito);
    font-size: 13px;
    color: var(--secondary-text);
    background: linear-gradient(
        135deg,
        var(--soft-ivory) 0%,
        rgba(166, 134, 88, 0.05) 100%
    );
    padding: 3px 6px;
    border-radius: 8px;
    display: inline-block;
    border: 1px solid rgba(140, 154, 122, 0.2);
    font-weight: 500;
    text-transform: capitalize;
}

.cwp-product-row .cwp-product-rating {
    margin: 5px 0;
    font-size: 14px;
    color: var(--secondary-text);
}

.cwp-product-row .cwp-review-count {
    font-size: 12px;
    color: var(--secondary-text);
}

.cwp-product-row .cwp-needs-label {
    position: absolute;
    top: 12px;
    right: 12px;
    background: linear-gradient(
        135deg,
        var(--amethyst-violet) 0%,
        #8b7aa8 100%
    );
    color: var(--white);
    padding: 3px 6px;
    border-radius: 8px;
    font-size: 11px;
    font-weight: 600;
    font-family: var(--font-nunito);
    z-index: 2;
    box-shadow: 0 2px 8px rgba(122, 92, 141, 0.3);
    text-transform: capitalize;
    letter-spacing: 0.3px;
}

/* ============================================
   Enhanced Category Navigation Button with Brand Colors
   ============================================ */
.cwp-category-nav {
    display: flex;
    align-items: center;
    position: absolute;
    right: 20px;
    top: 25px;
    z-index: 10;
}

.cwp-category-nav::before {
    content: "";
    position: absolute;
    left: -30px;
    top: 50%;
    transform: translateY(-50%);
    width: 35px;
    height: 100%;
    background: linear-gradient(
        to right,
        rgba(247, 245, 241, 0.9),
        rgba(255, 255, 255, 0.95)
    );
    pointer-events: none;
    z-index: 1;
    border-radius: var(--radius-small) 0 0 var(--radius-small);
    backdrop-filter: blur(5px);
}

.cwp-category-button {
    font-family: var(--font-nunito);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 110px;
    height: 38px;
    padding: 0 16px;
    background: linear-gradient(
        135deg,
        var(--gold-earth) 0%,
        var(--amber-glow) 100%
    );
    color: var(--white);
    text-decoration: none;
    border-radius: 19px;
    font-weight: 600;
    font-size: 13px;
    transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
    white-space: nowrap;
    overflow: hidden;
    position: relative;
    z-index: 11;
    box-shadow: 0 8px 25px rgba(166, 134, 88, 0.35);
    border: 2px solid rgba(255, 255, 255, 0.2);
    text-transform: capitalize;
    letter-spacing: 0.5px;
}

.cwp-category-button::before {
    content: "";
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(
        90deg,
        transparent,
        rgba(255, 255, 255, 0.25),
        transparent
    );
    transition: left 0.8s ease;
}

.cwp-category-button:hover::before {
    left: 100%;
}

.cwp-category-button:hover {
    background: linear-gradient(
        135deg,
        var(--amber-glow) 0%,
        var(--gold-earth) 100%
    );
    transform: translateY(-3px);
    box-shadow: 0 12px 35px rgba(166, 134, 88, 0.45);
    color: var(--white);
    text-decoration: none;
}

.cwp-button-text {
    margin-right: 10px;
    font-size: 15px;
    font-weight: 600;
}

.cwp-button-arrow {
    font-size: 20px;
    font-weight: bold;
    transition: transform 0.4s cubic-bezier(0.4, 0, 0.2, 1);
    line-height: 1;
}

.cwp-category-button:hover .cwp-button-arrow {
    transform: translateX(4px);
}

.cwp-category-button::after {
    display: none;
}

/* ============================================
   View All Link with Brand Styling
   ============================================ */
.cwp-view-all {
    font-family: var(--font-nunito);
    background: linear-gradient(135deg, var(--sage-green) 0%, #7a886a 100%);
    color: var(--white);
    padding: 6px 16px;
    border-radius: 15px;
    text-decoration: none;
    font-weight: 600;
    font-size: 13px;
    transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: var(--shadow-subtle);
    border: 1px solid rgba(255, 255, 255, 0.2);
    text-transform: capitalize;
    letter-spacing: 0.3px;
}

.cwp-view-all:hover {
    background: linear-gradient(135deg, #7a886a 0%, var(--sage-green) 100%);
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(140, 154, 122, 0.3);
    color: var(--white);
    text-decoration: none;
}

/* ============================================
   Enhanced Custom Products Container
   ============================================ */
.cwp-custom-woo-products {
    position: relative;
}

/* ============================================
   Option-Specific Styles
   ============================================ */
.cwp-option1 .cwp-product-row {
    /* Option 1 specific styling if needed */
}

.cwp-option2 .cwp-product-row {
    /* Option 2 specific styling if needed */
}

/* ============================================
   Enhanced Responsive Design
   ============================================ */
@media (max-width: 768px) {
    .cwp-widget-container {
        padding: 12px 12px;
        margin: 12px 10px;
    }

    .cwp-tabs-container {
        flex-direction: column;
        gap: 8px;
        padding: 8px;
    }

    .cwp-category-tabs {
        width: 100%;
        justify-content: center;
        flex-wrap: wrap;
    }

    .cwp-category-tab {
        font-size: 14px;
        padding: 4px 12px;
        margin: 2px;
    }

    .cwp-product-row {
        flex-wrap: wrap;
        gap: 12px;
        padding: 10px 8px;
    }

    .cwp-product-row .cwp-product-item {
        min-width: 180px;
        max-width: calc(50% - 6px);
    }

    .cwp-category-nav {
        position: static;
        margin-top: 15px;
        justify-content: center;
    }

    .cwp-category-nav::before {
        display: none;
    }

    .cwp-category-button {
        min-width: 90px;
        height: 36px;
        padding: 0 16px;
        font-size: 12px;
    }

    .cwp-button-arrow {
        font-size: 18px;
    }

    .cwp-product-row .cwp-product-title {
        font-size: 17px;
    }

    .cwp-product-row .cwp-product-price {
        font-size: 18px;
    }

    .cwp-product-row .cwp-product-image img {
        height: 180px;
    }
}

@media (max-width: 480px) {
    .cwp-widget-container {
        padding: 12px 10px;
        margin: 10px 8px;
    }

    .cwp-category-tab {
        font-size: 13px;
        padding: 10px 16px;
    }

    .cwp-product-row {
        flex-direction: column;
        gap: 12px;
        padding: 12px 8px;
    }

    .cwp-product-row .cwp-product-item {
        min-width: 160px;
        max-width: 100%;
    }

    .cwp-product-row .cwp-product-item {
        padding: 15px;
    }

    .cwp-category-button {
        min-width: 100px;
        height: 34px;
        padding: 0 14px;
        font-size: 12px;
    }

    .cwp-button-arrow {
        font-size: 16px;
    }

    .cwp-button-text {
        font-size: 13px;
        margin-right: 8px;
    }

    .cwp-product-row .cwp-product-title {
        font-size: 16px;
        margin-bottom: 10px;
    }

    .cwp-product-row .cwp-product-price {
        font-size: 17px;
    }

    .cwp-category-tabs-desc {
        padding: 15px 12px;
        margin-bottom: 15px;
    }

    .cwp-category-desc {
        font-size: 15px;
    }

    .cwp-product-row .cwp-product-image img {
        height: 160px;
    }
}

/* ============================================
   Accessibility Enhancements
   ============================================ */
.cwp-category-tab:focus {
    outline: 2px solid var(--gold-earth);
    outline-offset: 3px;
}

.cwp-category-button:focus {
    outline: 2px solid var(--white);
    outline-offset: 3px;
}

/* ============================================
   Print Styles
   ============================================ */
@media print {
    .cwp-category-nav,
    .cwp-view-all {
        display: none;
    }

    .cwp-widget-container {
        box-shadow: none;
        background: var(--white);
        border: 1px solid var(--deep-charcoal);
    }

    .cwp-product-row .cwp-product-item {
        break-inside: avoid;
        border: 1px solid var(--secondary-text);
    }

    .cwp-product-row .cwp-product-item::before {
        display: none;
    }
}
