/**
 * iWP Storefront Frontend Styles
 * Modern, high-performance styling for Swatches, Slide-Out Cart, Wishlist, Quick View & Compare.
 */

/* ==========================================================================
   1. Visual Variation Swatches
   ========================================================================== */
.iwp-swatches-container {
    margin: 12px 0 20px;
}

.iwp-swatches-wrapper {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    align-items: center;
}

.iwp-swatch-item {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border: 1px solid var(--borderCard, rgba(255, 255, 255, 0.15));
    background: var(--surface1, rgba(21, 26, 38, 0.6));
    color: var(--body, #e7eaf2);
    padding: 8px 14px;
    font-size: 13px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease-in-out;
    position: relative;
    outline: none;
    user-select: none;
    min-width: 38px;
    min-height: 38px;
}

/* Shapes */
.iwp-swatches-shape--rounded .iwp-swatch-item { border-radius: 8px; }
.iwp-swatches-shape--circle .iwp-swatch-item { border-radius: 50%; padding: 0; }
.iwp-swatches-shape--square .iwp-swatch-item { border-radius: 2px; }

/* Sizes */
.iwp-swatches-size--small .iwp-swatch-item { min-width: 30px; min-height: 30px; padding: 4px 8px; font-size: 11px; }
.iwp-swatches-size--medium .iwp-swatch-item { min-width: 38px; min-height: 38px; padding: 6px 12px; font-size: 13px; }
.iwp-swatches-size--large .iwp-swatch-item { min-width: 48px; min-height: 48px; padding: 10px 18px; font-size: 15px; }

/* Color Swatches */
.iwp-swatch-type--color {
    padding: 3px;
}
.iwp-swatch-color-preview {
    display: block;
    width: 100%;
    height: 100%;
    min-width: 28px;
    min-height: 28px;
    border-radius: inherit;
    box-shadow: inset 0 0 0 1px rgba(0, 0, 0, 0.2);
}

.iwp-swatch-item .iwp-swatch-label-text {
    display: inline-block;
}
.iwp-swatch-type--color .iwp-swatch-label-text,
.iwp-swatch-type--image .iwp-swatch-label-text {
    display: none; /* Hide text for color & image swatches */
}

/* Selected State */
.iwp-swatch-item:hover {
    border-color: var(--acc, #2fe0cf);
    transform: translateY(-1px);
}
.iwp-swatch-item.is-selected {
    border-color: var(--acc, #2fe0cf) !important;
    box-shadow: 0 0 0 2px var(--accGlow, rgba(47, 224, 207, 0.4));
    background: rgba(47, 224, 207, 0.1);
}

/* Out of Stock Styling */
.iwp-swatches-oof--cross_through .iwp-swatch-item.is-out-of-stock {
    opacity: 0.5;
    cursor: not-allowed;
    position: relative;
    overflow: hidden;
}
.iwp-swatches-oof--cross_through .iwp-swatch-item.is-out-of-stock::after {
    content: '';
    position: absolute;
    top: 50%;
    left: -20%;
    width: 140%;
    height: 2px;
    background: #ff5f57;
    transform: rotate(-45deg);
}

.iwp-swatches-oof--blur .iwp-swatch-item.is-out-of-stock {
    filter: blur(1.5px) opacity(0.4);
    cursor: not-allowed;
}

.iwp-swatches-oof--hide .iwp-swatch-item.is-out-of-stock {
    display: none !important;
}


/* ==========================================================================
   2. AJAX Slide-Out Cart
   ========================================================================== */
.iwp-slide-cart-overlay {
    position: fixed;
    inset: 0;
    background: rgba(5, 7, 11, 0.7);
    backdrop-filter: blur(6px);
    z-index: 99998;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.3s ease, visibility 0.3s ease;
}
.iwp-slide-cart-overlay.is-open {
    opacity: 1;
    visibility: visible;
}

.iwp-slide-cart-drawer {
    position: fixed;
    top: 0;
    right: 0;
    bottom: 0;
    width: 440px;
    max-width: 90vw;
    background: var(--bgDeep, #080b10);
    border-left: 1px solid var(--borderCard, rgba(255, 255, 255, 0.1));
    z-index: 99999;
    transform: translateX(100%);
    transition: transform 0.35s cubic-bezier(0.16, 1, 0.3, 1);
    box-shadow: -10px 0 40px rgba(0, 0, 0, 0.6);
    display: flex;
    flex-direction: column;
}
.iwp-slide-cart-drawer.is-open {
    transform: translateX(0);
}

.iwp-slide-cart-content {
    display: flex;
    flex-direction: column;
    height: 100%;
}

.iwp-slide-cart-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 20px 24px;
    border-bottom: 1px solid var(--borderSubtle, rgba(255, 255, 255, 0.07));
}

.iwp-slide-cart-header-title {
    display: flex;
    align-items: center;
    gap: 10px;
}
.iwp-slide-cart-header-title h3 {
    margin: 0;
    font-size: 20px;
    color: var(--text, #ffffff);
}

.iwp-cart-count-badge {
    background: var(--acc, #2fe0cf);
    color: #06100f;
    font-family: var(--mono, monospace);
    font-weight: 700;
    font-size: 11px;
    padding: 2px 8px;
    border-radius: 99px;
}

.iwp-slide-cart-close {
    background: transparent;
    border: none;
    color: var(--dim, #8b93a7);
    font-size: 28px;
    cursor: pointer;
    line-height: 1;
    transition: color 0.2s;
}
.iwp-slide-cart-close:hover { color: #fff; }

/* Free Shipping Progress Bar */
.iwp-free-shipping-bar-wrap {
    padding: 16px 24px;
    background: rgba(255, 255, 255, 0.02);
    border-bottom: 1px solid var(--borderSubtle, rgba(255, 255, 255, 0.07));
}
.iwp-free-shipping-msg {
    margin: 0 0 8px;
    font-size: 13px;
    color: var(--body, #e7eaf2);
    text-align: center;
}
.iwp-free-shipping-bar-wrap.is-unlocked .iwp-free-shipping-msg {
    color: var(--acc, #2fe0cf);
    font-weight: 600;
}
.iwp-free-shipping-track {
    height: 6px;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 99px;
    overflow: hidden;
}
.iwp-free-shipping-fill {
    height: 100%;
    background: linear-gradient(90deg, var(--acc2, #7c9bff), var(--acc, #2fe0cf));
    transition: width 0.4s ease;
    border-radius: 99px;
}

/* Body & Items */
.iwp-slide-cart-body {
    flex: 1;
    overflow-y: auto;
    padding: 20px 24px;
}

.iwp-slide-cart-empty {
    text-align: center;
    padding: 60px 20px;
}
.iwp-slide-cart-empty-icon { font-size: 48px; margin-bottom: 16px; opacity: 0.5; }

.iwp-slide-cart-items {
    list-style: none;
    margin: 0;
    padding: 0;
}

.iwp-slide-cart-item {
    display: grid;
    grid-template-columns: 70px 1fr;
    gap: 16px;
    padding-bottom: 20px;
    margin-bottom: 20px;
    border-bottom: 1px solid var(--borderSubtle, rgba(255, 255, 255, 0.05));
    position: relative;
}

.iwp-slide-cart-item-thumb img {
    width: 70px;
    height: 70px;
    object-fit: cover;
    border-radius: 8px;
    border: 1px solid var(--borderCard, rgba(255, 255, 255, 0.1));
}

.iwp-slide-cart-item-name {
    margin: 0 0 6px;
    font-size: 15px;
    font-weight: 500;
}
.iwp-slide-cart-item-name a { color: var(--text, #fff); }

.iwp-slide-cart-item-price {
    font-family: var(--mono, monospace);
    font-weight: 600;
    color: var(--acc, #2fe0cf);
    margin-bottom: 10px;
}

.iwp-slide-cart-qty-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.iwp-qty-controls {
    display: inline-flex;
    align-items: center;
    border: 1px solid var(--borderCard, rgba(255, 255, 255, 0.15));
    border-radius: 6px;
    overflow: hidden;
}
.iwp-qty-btn {
    background: rgba(255, 255, 255, 0.05);
    border: none;
    color: #fff;
    width: 28px;
    height: 28px;
    cursor: pointer;
}
.iwp-qty-input {
    width: 36px;
    height: 28px;
    text-align: center;
    background: transparent !important;
    border: none !important;
    color: #fff !important;
    font-size: 12px;
    -moz-appearance: textfield;
}

.iwp-slide-cart-remove {
    background: transparent;
    border: none;
    color: var(--faint, #6b7488);
    font-size: 20px;
    cursor: pointer;
}
.iwp-slide-cart-remove:hover { color: #ff5f57; }

.iwp-slide-cart-footer {
    padding: 24px;
    border-top: 1px solid var(--borderSubtle, rgba(255, 255, 255, 0.07));
    background: rgba(0, 0, 0, 0.2);
}

.iwp-slide-cart-subtotal-row {
    display: flex;
    justify-content: space-between;
    font-size: 16px;
    margin-bottom: 6px;
}
.iwp-slide-cart-subtotal {
    font-family: var(--mono, monospace);
    font-size: 20px;
    color: var(--acc, #2fe0cf);
}

.iwp-slide-cart-note {
    font-size: 11px;
    color: var(--dim, #8b93a7);
    margin-bottom: 16px;
}

.iwp-slide-cart-actions {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.iwp-button-checkout {
    width: 100%;
    text-align: center;
}
.iwp-button-link {
    text-align: center;
    font-size: 13px;
    color: var(--muted, #aab2c6);
}


/* ==========================================================================
   3. Guest & User Wishlist
   ========================================================================== */
.iwp-wishlist-btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid var(--borderCard, rgba(255, 255, 255, 0.1));
    color: var(--body, #e7eaf2);
    padding: 8px 12px;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.2s ease;
    font-size: 13px;
}
.iwp-wishlist-btn:hover {
    border-color: #ff5f57;
    color: #ff5f57;
}
.iwp-wishlist-btn.is-active {
    background: rgba(255, 95, 87, 0.15);
    border-color: #ff5f57;
    color: #ff5f57;
}
.iwp-wishlist-btn.is-active .iwp-wishlist-icon {
    fill: #ff5f57;
}

.iwp-wishlist-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
    gap: 20px;
    margin-top: 24px;
}

.iwp-wishlist-card {
    background: linear-gradient(145deg, var(--surface1, rgba(21, 26, 38, 0.6)), var(--surface2, rgba(14, 18, 27, 0.4)));
    border: 1px solid var(--borderCard, rgba(255, 255, 255, 0.09));
    border-radius: 12px;
    padding: 18px;
    position: relative;
    display: flex;
    flex-direction: column;
}

.iwp-wishlist-card-remove {
    position: absolute;
    top: 10px;
    right: 10px;
    background: rgba(0, 0, 0, 0.4);
    border: none;
    color: var(--muted, #aab2c6);
    width: 26px;
    height: 26px;
    border-radius: 50%;
    cursor: pointer;
    display: grid;
    place-items: center;
}
.iwp-wishlist-card-remove:hover { color: #ff5f57; }

.iwp-wishlist-card-image img {
    width: 100%;
    height: 180px;
    object-fit: cover;
    border-radius: 8px;
    margin-bottom: 12px;
}

.iwp-wishlist-card-title {
    margin: 0 0 8px;
    font-size: 16px;
}
.iwp-wishlist-card-title a { color: #fff; }

.iwp-wishlist-card-price {
    font-family: var(--mono, monospace);
    color: var(--acc, #2fe0cf);
    margin-bottom: 12px;
}

.iwp-stock-badge {
    font-size: 11px;
    padding: 3px 8px;
    border-radius: 99px;
    font-family: var(--mono, monospace);
}
.iwp-stock-badge.in-stock { background: rgba(40, 200, 64, 0.15); color: #28c840; }
.iwp-stock-badge.out-of-stock { background: rgba(255, 95, 87, 0.15); color: #ff5f57; }

.iwp-wishlist-card-actions {
    margin-top: auto;
    padding-top: 14px;
}
.iwp-wishlist-card-actions .button { width: 100%; }


/* ==========================================================================
   4. Quick View & Product Comparison
   ========================================================================== */
.iwp-quick-view-btn, .iwp-compare-btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid var(--borderCard, rgba(255, 255, 255, 0.1));
    color: var(--body, #e7eaf2);
    padding: 6px 12px;
    border-radius: 6px;
    cursor: pointer;
    font-size: 12px;
    margin-right: 6px;
    margin-top: 6px;
}
.iwp-quick-view-btn:hover, .iwp-compare-btn:hover {
    border-color: var(--acc, #2fe0cf);
    color: var(--acc, #2fe0cf);
}
.iwp-compare-btn.is-active {
    background: rgba(47, 224, 207, 0.15);
    border-color: var(--acc, #2fe0cf);
    color: var(--acc, #2fe0cf);
}

/* Modals */
.iwp-modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(5, 7, 11, 0.75);
    backdrop-filter: blur(6px);
    z-index: 99990;
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s ease;
}
.iwp-modal-overlay.is-open { opacity: 1; visibility: visible; }

.iwp-modal {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -46%) scale(0.95);
    width: 800px;
    max-width: 92vw;
    max-height: 85vh;
    background: var(--bgDeep, #080b10);
    border: 1px solid var(--borderCard, rgba(255, 255, 255, 0.12));
    border-radius: 16px;
    padding: 30px;
    z-index: 99995;
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s ease;
    overflow-y: auto;
    box-shadow: 0 30px 90px rgba(0, 0, 0, 0.7);
}
.iwp-modal.iwp-modal-large { width: 1100px; }
.iwp-modal.is-open {
    opacity: 1;
    visibility: visible;
    transform: translate(-50%, -50%) scale(1);
}

.iwp-modal-close {
    position: absolute;
    top: 16px;
    right: 16px;
    background: transparent;
    border: none;
    color: var(--dim, #8b93a7);
    font-size: 26px;
    cursor: pointer;
}
.iwp-modal-close:hover { color: #fff; }

.iwp-quick-view-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 30px;
}
.iwp-quick-view-gallery img {
    width: 100%;
    border-radius: 12px;
}

/* Compare Drawer */
.iwp-compare-drawer {
    position: fixed;
    bottom: 0;
    left: 50%;
    transform: translateX(-50%) translateY(100%);
    width: min(900px, 94vw);
    background: #0e131f;
    border: 1px solid var(--borderCard, rgba(255, 255, 255, 0.15));
    border-bottom: none;
    border-radius: 14px 14px 0 0;
    padding: 16px 24px;
    z-index: 99980;
    transition: transform 0.35s cubic-bezier(0.16, 1, 0.3, 1);
    box-shadow: 0 -10px 40px rgba(0, 0, 0, 0.5);
}
.iwp-compare-drawer.is-visible {
    transform: translateX(-50%) translateY(0);
}
.iwp-compare-drawer-inner {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 20px;
}
.iwp-compare-drawer-header h4 { margin: 0; font-size: 15px; color: #fff; }
.iwp-compare-drawer-items {
    display: flex;
    gap: 12px;
}
.iwp-compare-drawer-item {
    position: relative;
    display: flex;
    align-items: center;
    gap: 8px;
    background: rgba(255, 255, 255, 0.05);
    padding: 4px 8px;
    border-radius: 6px;
}
.iwp-compare-drawer-item img { width: 32px; height: 32px; border-radius: 4px; object-fit: cover; }
.iwp-compare-drawer-item-title { font-size: 11px; max-width: 100px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; color: #fff; }
.iwp-compare-drawer-remove { background: transparent; border: none; color: #ff5f57; cursor: pointer; }

/* Compare Table Matrix */
.iwp-compare-table-wrapper { overflow-x: auto; }
.iwp-compare-table {
    width: 100%;
    border-collapse: collapse;
}
.iwp-compare-table th, .iwp-compare-table td {
    padding: 14px 18px;
    border-bottom: 1px solid var(--borderSubtle, rgba(255, 255, 255, 0.07));
    vertical-align: top;
}
.iwp-compare-row-label { width: 180px; color: var(--dim, #8b93a7); font-size: 13px; }
.iwp-compare-product-col { position: relative; text-align: center; }
.iwp-compare-remove-col { position: absolute; top: 0; right: 0; background: transparent; border: none; color: #ff5f57; font-size: 18px; cursor: pointer; }
.iwp-compare-thumb img { width: 90px; height: 90px; object-fit: cover; border-radius: 8px; margin-bottom: 8px; }
