/**
 * WizViewSimilar v2 — Slide-in Drawer CSS
 */

/* ================================================================
   Body scroll lock
   ================================================================ */
body.wiz-viewsimilar--body-locked {
    overflow: hidden !important;
}

/* ================================================================
   Container — hidden by default, shown via JS class toggle
   ================================================================ */
.wiz-viewsimilar {
    position: fixed;
    inset: 0;
    z-index: 99998;
    display: none;
}

.wiz-viewsimilar--open {
    display: block;
    pointer-events: all;
}

/* ================================================================
   Overlay
   ================================================================ */
.wiz-viewsimilar__overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.45);
    opacity: 0;
    transition: opacity 0.3s ease;
    z-index: 1;
}

.wiz-viewsimilar--open .wiz-viewsimilar__overlay {
    opacity: 1;
}

/* ================================================================
   Drawer panel
   ================================================================ */
.wiz-viewsimilar__drawer {
    position: fixed;
    top: 0;
    bottom: 0;
    width: 420px;
    max-width: 100vw;
    background: #fff;
    box-shadow: -4px 0 24px rgba(0, 0, 0, 0.12);
    display: flex;
    flex-direction: column;
    z-index: 2;
    transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    overflow: hidden;
}

.wiz-viewsimilar__drawer--right {
    right: 0;
    transform: translateX(100%);
}

.wiz-viewsimilar__drawer--left {
    left: 0;
    transform: translateX(-100%);
}

.wiz-viewsimilar--open .wiz-viewsimilar__drawer--right,
.wiz-viewsimilar--open .wiz-viewsimilar__drawer--left {
    transform: translateX(0);
}

/* ================================================================
   Header
   ================================================================ */
.wiz-viewsimilar__header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px 20px;
    border-bottom: 1px solid var(--wiz-color-border, #e5e7eb);
    flex-shrink: 0;
}

.wiz-viewsimilar__title {
    font-size: 16px;
    font-weight: 600;
    color: var(--wiz-color-text, #111);
    margin: 0;
    font-family: var(--wiz-font-family, inherit);
}

.wiz-viewsimilar__close {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
    border-radius: 50%;
    border: none;
    background: #f3f4f6;
    color: #6b7280;
    cursor: pointer;
    transition: background 0.2s, color 0.2s;
    padding: 0;
    flex-shrink: 0;
}

.wiz-viewsimilar__close:hover {
    background: #e5e7eb;
    color: #111;
}

/* ================================================================
   Body — scrollable product list using wiz-grid__card cards
   ================================================================ */
.wiz-viewsimilar__body {
    flex: 1;
    overflow-y: auto;
    padding: 16px 20px;
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.wiz-viewsimilar__body .wiz-grid__card {
    flex-direction: row;
    gap: 10px;
}

.wiz-viewsimilar__body .wiz-grid__card-image-wrap {
    width: 120px;
}
.wiz-viewsimilar__body .wiz-grid__card-body {
    flex: 1;
    min-width: 0;
}

/* ================================================================
   Loading skeleton — self-contained, horizontal layout.
   Matches the row layout of loaded cards so there's no jarring
   layout shift when AJAX content replaces the placeholder.
   ================================================================ */
.wiz-vs-sk-card {
    display: flex;
    flex-direction: row;
    gap: 10px;
    padding: 12px;
    background: #fff;
    border-radius: 8px;
    box-sizing: border-box;
}

.wiz-vs-sk-body {
    flex: 1 1 auto;
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: 8px;
    padding: 2px 0;
}

/* Base shimmer block — gradient sweep left→right */
.wiz-vs-sk {
    display: block;
    background: #eef1f4;
    background-image: linear-gradient(
        90deg,
        #eef1f4 0%,
        #f8f9fb 50%,
        #eef1f4 100%
    );
    background-size: 200% 100%;
    background-repeat: no-repeat;
    animation: wiz-vs-shimmer 1.4s ease-in-out infinite;
    border-radius: 4px;
}

.wiz-vs-sk--img {
    width: 100px;
    height: 100px;
    flex-shrink: 0;
    border-radius: 6px;
}

.wiz-vs-sk--title    { width: 85%; height: 12px; }
.wiz-vs-sk--title-2  { width: 55%; height: 12px; }
.wiz-vs-sk--price    { width: 40%; height: 14px; margin-top: 2px; }
.wiz-vs-sk--btn      { width: 100%; height: 30px; border-radius: 6px; margin-top: 8px; }

@keyframes wiz-vs-shimmer {
    0%   { background-position: 200% 0; }
    100% { background-position: -200% 0; }
}

/* ================================================================
   Empty state — rendered server-side; controlled by the widget's
   "Empty State" content section (image / title / subtitle).
   ================================================================ */
.wiz-viewsimilar__empty {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 40px 20px;
    text-align: center;
    color: var(--wiz-color-text-muted, #6b7280);
    gap: 12px;
    flex: 1;
}

.wiz-viewsimilar__empty-img {
    max-width: 200px;
    max-height: 200px;
    width: auto;
    height: auto;
    display: block;
}

.wiz-viewsimilar__empty-title {
    font-size: 15px;
    font-weight: 600;
    color: var(--wiz-color-text, #111);
    margin: 0;
}

.wiz-viewsimilar__empty-subtitle {
    font-size: 13px;
    color: var(--wiz-color-text-muted, #6b7280);
    margin: 0;
}

/* Legacy (kept harmless in case older markup is cached) */
.wiz-viewsimilar__empty-text {
    font-size: 14px;
}

/* ================================================================
   Responsive — full width on mobile
   ================================================================ */
@media (max-width: 768px) {
    .wiz-viewsimilar__drawer {
        width: 100vw !important;
    }
}
