/* ═══════════════════════════════════════════════
   VARIATION MODAL — NourePhone Luxury Style
   ═══════════════════════════════════════════════ */

/* ─── Overlay ─── */
.vm-overlay {
    display: none;
    position: fixed;
    inset: 0;
    z-index: 100000;
    background: rgba(0, 0, 0, 0.55);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    align-items: center;
    justify-content: center;
    padding: 1rem;
    opacity: 0;
    transition: opacity 0.35s cubic-bezier(0.4, 0, 0.2, 1);
}

.vm-overlay--open {
    opacity: 1;
}

/* ─── Modal Container ─── */
.vm-modal {
    position: relative;
    width: 100%;
    max-width: 680px;
    max-height: 92vh;
    overflow-y: auto;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 24px;
    box-shadow: 0 32px 80px rgba(0, 0, 0, 0.35), 0 0 0 1px var(--border);
    transform: translateY(30px) scale(0.96);
    opacity: 0;
    transition: transform 0.4s cubic-bezier(0.16, 1, 0.3, 1), opacity 0.35s ease;
}

.vm-modal--open {
    transform: translateY(0) scale(1);
    opacity: 1;
}

/* Scrollbar */
.vm-modal::-webkit-scrollbar {
    width: 5px;
}
.vm-modal::-webkit-scrollbar-track {
    background: transparent;
}
.vm-modal::-webkit-scrollbar-thumb {
    background: var(--border-hover);
    border-radius: 10px;
}

/* ─── Close Button ─── */
.vm-close {
    position: absolute;
    top: 16px;
    right: 16px;
    z-index: 10;
    width: 36px;
    height: 36px;
    border-radius: 12px;
    border: 1px solid var(--border);
    background: var(--bg-elevated);
    color: var(--text-secondary);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.25s ease;
}

.vm-close:hover {
    background: var(--accent-soft);
    color: var(--accent);
    border-color: var(--accent);
    transform: rotate(90deg);
}

/* ─── Body Layout ─── */
.vm-body {
    display: flex;
    gap: 0;
}

/* ─── Image Side ─── */
.vm-image-side {
    flex: 0 0 45%;
    padding: 28px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.vm-image-wrap {
    width: 100%;
    aspect-ratio: 1;
    border-radius: 18px;
    overflow: hidden;
    background: var(--bg-secondary);
    display: flex;
    align-items: center;
    justify-content: center;
}

.vm-product-img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: opacity 0.3s ease, transform 0.3s ease;
}

/* ─── Info Side ─── */
.vm-info-side {
    flex: 1;
    padding: 32px 28px 28px 4px;
    display: flex;
    flex-direction: column;
    gap: 18px;
}

.vm-product-name {
    font-family: 'Cormorant Garamond', Georgia, serif;
    font-size: 1.5rem;
    font-weight: 600;
    color: var(--text-primary);
    line-height: 1.3;
    padding-right: 36px;
}

.vm-product-price {
    font-family: 'Cormorant Garamond', Georgia, serif;
    font-size: 1.35rem;
    font-weight: 700;
    color: var(--accent);
}

.vm-product-price del {
    color: var(--text-muted);
    font-size: 1rem;
    margin-right: 6px;
}

.vm-product-price ins {
    text-decoration: none;
    color: var(--accent);
}

/* ─── Attribute Groups ─── */
.vm-attrs {
    display: flex;
    flex-direction: column;
    gap: 0.9rem;
}

.vm-attr-group {
    display: flex;
    flex-direction: column;
    gap: 0.45rem;
}

.vm-attr-label-row {
    display: flex;
    align-items: baseline;
    gap: 0.5rem;
}

.vm-attr-label {
    font-size: 0.72rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 1.5px;
    color: var(--text-secondary);
}

.vm-attr-selected {
    font-size: 0.72rem;
    font-weight: 500;
    color: var(--accent);
    letter-spacing: 0.3px;
}

/* ─── Attribute Pills (non-color) ─── */
.vm-attr-pills {
    display: flex;
    flex-wrap: wrap;
    gap: 0.45rem;
}

.vm-attr-pill {
    padding: 0.45rem 1.1rem;
    font-size: 0.78rem;
    font-weight: 500;
    font-family: 'Outfit', sans-serif;
    color: var(--text-primary);
    background: transparent;
    border: 1.5px solid var(--border);
    border-radius: 50px;
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.16, 1, 0.3, 1);
    animation: vmFadeIn 0.3s ease both;
    white-space: nowrap;
    user-select: none;
    position: relative;
}

.vm-attr-pill:hover {
    border-color: var(--text-muted);
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.06);
}

.vm-attr-pill.active {
    border-color: var(--accent);
    background: linear-gradient(135deg, var(--accent-soft), rgba(139, 110, 78, 0.14));
    color: var(--accent);
    font-weight: 600;
    box-shadow: 0 0 0 1.5px var(--accent), 0 4px 16px var(--accent-glow);
    transform: translateY(-2px);
}

.vm-attr-pill.vm-disabled {
    opacity: 0.32;
    pointer-events: none;
    cursor: not-allowed;
    color: var(--text-muted);
    border-color: transparent;
    transform: none;
    box-shadow: none;
}

.vm-attr-pill.vm-disabled::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 10%;
    right: 10%;
    height: 1.5px;
    background: var(--text-muted);
    border-radius: 2px;
    transform: rotate(-12deg);
    opacity: 0.7;
}

/* ─── Color Swatches — Premium Quick View Style ─── */
.vm-color-pills {
    gap: 10px;
}

.vm-color-swatch {
    position: relative;
    width: 38px;
    height: 38px;
    border-radius: 50%;
    background: transparent;
    border: 2.5px solid transparent;
    padding: 3px;
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.16, 1, 0.3, 1);
    display: flex;
    align-items: center;
    justify-content: center;
    outline: none;
    animation: vmFadeIn 0.3s ease both;
}

.vm-color-circle {
    width: 100%;
    height: 100%;
    border-radius: 50%;
    display: block;
    transition: transform 0.3s cubic-bezier(0.16, 1, 0.3, 1), box-shadow 0.3s ease;
    box-shadow:
        0 3px 10px rgba(0, 0, 0, 0.15),
        inset 0 1px 2px rgba(255, 255, 255, 0.15);
}

/* Light colors need a visible border */
.vm-color-circle.vm-light {
    box-shadow:
        inset 0 0 0 1.5px rgba(0, 0, 0, 0.1),
        0 3px 10px rgba(0, 0, 0, 0.06);
}

/* Hover */
.vm-color-swatch:hover {
    transform: scale(1.18);
}
.vm-color-swatch:hover .vm-color-circle {
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.22);
}

/* Active — accent ring + checkmark */
.vm-color-swatch.active {
    border-color: var(--accent);
    transform: scale(1.12);
}
.vm-color-swatch.active .vm-color-circle {
    box-shadow: 0 0 0 2px var(--accent), 0 6px 20px rgba(0, 0, 0, 0.2);
}

/* Checkmark overlay (accent circle with check) */
.vm-color-check {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%) scale(0);
    width: 18px;
    height: 18px;
    background: var(--accent);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #fff;
    transition: transform 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
    z-index: 3;
    box-shadow: 0 2px 8px var(--accent-glow);
    pointer-events: none;
}

.vm-color-swatch.active .vm-color-check {
    transform: translate(-50%, -50%) scale(1);
}

/* Tooltip on hover */
.vm-color-tip {
    position: absolute;
    bottom: calc(100% + 10px);
    left: 50%;
    transform: translateX(-50%) translateY(5px);
    background: var(--bg-elevated);
    color: var(--text-primary);
    font-family: 'Outfit', sans-serif;
    font-size: 0.68rem;
    font-weight: 600;
    padding: 5px 10px;
    border-radius: 8px;
    white-space: nowrap;
    pointer-events: none;
    opacity: 0;
    transition: all 0.25s cubic-bezier(0.16, 1, 0.3, 1);
    z-index: 20;
    border: 1px solid var(--border);
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.1);
    letter-spacing: 0.3px;
}
.vm-color-tip::after {
    content: '';
    position: absolute;
    top: 100%;
    left: 50%;
    transform: translateX(-50%);
    border: 5px solid transparent;
    border-top-color: var(--bg-elevated);
}

.vm-color-swatch:hover .vm-color-tip {
    opacity: 1;
    transform: translateX(-50%) translateY(0);
}

/* Disabled / unavailable color swatch — strikethrough line */
.vm-color-swatch.vm-disabled {
    opacity: 0.28;
    pointer-events: none;
    cursor: not-allowed;
    filter: grayscale(75%);
    transform: scale(0.85);
}
.vm-color-swatch.vm-disabled .vm-color-circle {
    box-shadow: none;
}
.vm-color-swatch.vm-disabled::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 110%;
    height: 1.5px;
    background: rgba(0, 0, 0, 0.4);
    border-radius: 2px;
    transform: translate(-50%, -50%) rotate(-45deg);
    z-index: 5;
}

/* ─── Quantity Row ─── */
.vm-qty-row {
    display: flex;
    align-items: center;
    gap: 14px;
}

.vm-qty-label {
    font-size: 0.78rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: var(--text-secondary);
}

.vm-qty-wrap {
    display: flex;
    align-items: center;
    border: 1.5px solid var(--border);
    border-radius: 12px;
    overflow: hidden;
    background: var(--bg-secondary);
}

.vm-qty-btn {
    width: 36px;
    height: 36px;
    border: none;
    background: none;
    color: var(--text-secondary);
    font-size: 1.1rem;
    cursor: pointer;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    justify-content: center;
}

.vm-qty-btn:hover {
    background: var(--accent-soft);
    color: var(--accent);
}

.vm-qty-input {
    width: 42px;
    text-align: center;
    border: none;
    background: none;
    color: var(--text-primary);
    font-size: 0.9rem;
    font-weight: 600;
    font-family: 'Outfit', sans-serif;
    -moz-appearance: textfield;
}

.vm-qty-input::-webkit-outer-spin-button,
.vm-qty-input::-webkit-inner-spin-button {
    -webkit-appearance: none;
    margin: 0;
}

/* ─── Add to Cart Button ─── */
.vm-add-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    width: 100%;
    padding: 14px 24px;
    border: none;
    border-radius: 14px;
    font-family: 'Outfit', sans-serif;
    font-size: 0.92rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    background: var(--inverse-bg);
    color: var(--inverse-text);
    margin-top: 4px;
}

.vm-add-btn:hover:not(:disabled) {
    background: var(--accent);
    color: #fff;
    transform: translateY(-2px);
    box-shadow: 0 8px 25px var(--accent-glow);
}

.vm-add-btn:disabled {
    opacity: 0.65;
    cursor: default;
}

.vm-add-btn.noure-btn--loading {
    pointer-events: none;
    opacity: 0.7;
}

.vm-add-btn.noure-btn--success {
    background: #38a169 !important;
    color: #fff !important;
}

/* ─── Animations ─── */
@keyframes vmFadeIn {
    from {
        opacity: 0;
        transform: translateY(6px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* ─── Shake animation for unselected attribute groups ─── */
@keyframes vmShake {
    0%, 100% { transform: translateX(0); }
    10%, 30%, 50%, 70%, 90% { transform: translateX(-4px); }
    20%, 40%, 60%, 80% { transform: translateX(4px); }
}

.vm-attr-group--shake {
    animation: vmShake 0.6s cubic-bezier(0.36, 0.07, 0.19, 0.97) both;
}

.vm-attr-group--shake .vm-attr-label {
    color: #e53e3e !important;
}

/* ─── Warning state for add button ─── */
.vm-add-btn--warning {
    background: #e53e3e !important;
    color: #fff !important;
    animation: vmShake 0.6s cubic-bezier(0.36, 0.07, 0.19, 0.97) both;
}


/* ═══════════════════════════════════════════════
   ADD-TO-CART BUTTON STATES (Shop Grid)
   ═══════════════════════════════════════════════ */

.add-btn.noure-btn--loading {
    pointer-events: none;
    animation: noureSpinPulse 0.6s ease infinite alternate;
}

.add-btn.noure-btn--success {
    background: #38a169 !important;
    color: #fff !important;
    transform: scale(1.1) !important;
    box-shadow: 0 4px 15px rgba(56, 161, 105, 0.35) !important;
}

@keyframes noureSpinPulse {
    from { opacity: 0.6; }
    to { opacity: 1; }
}

.noure-spin {
    animation: noureSpinAnim 0.8s linear infinite;
}

@keyframes noureSpinAnim {
    from { transform: rotate(0deg); }
    to { transform: rotate(360deg); }
}


/* ═══════════════════════════════════════════════
   TOAST NOTIFICATIONS
   ═══════════════════════════════════════════════ */

#noure-toast-container {
    position: fixed;
    top: 90px;
    right: 20px;
    z-index: 200000;
    display: flex;
    flex-direction: column;
    gap: 10px;
    pointer-events: none;
}

.noure-toast {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 12px 20px;
    border-radius: 14px;
    font-family: 'Outfit', sans-serif;
    font-size: 0.88rem;
    font-weight: 500;
    pointer-events: auto;
    transform: translateX(120%);
    opacity: 0;
    transition: all 0.4s cubic-bezier(0.16, 1, 0.3, 1);
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.2);
    border: 1px solid var(--border);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
}

.noure-toast--show {
    transform: translateX(0);
    opacity: 1;
}

.noure-toast--hide {
    transform: translateX(120%);
    opacity: 0;
}

.noure-toast--success {
    background: var(--bg-elevated);
    color: #38a169;
}

.noure-toast--success svg {
    color: #38a169;
    flex-shrink: 0;
}

.noure-toast--error {
    background: var(--bg-elevated);
    color: #e53e3e;
}

.noure-toast--error svg {
    color: #e53e3e;
    flex-shrink: 0;
}


/* ═══════════════════════════════════════════════
   MOBILE RESPONSIVE
   ═══════════════════════════════════════════════ */

@media (max-width: 640px) {
    .vm-modal {
        max-width: 100%;
        border-radius: 20px 20px 0 0;
        max-height: 95vh;
        margin-top: auto;
    }

    .vm-overlay {
        align-items: flex-end;
        padding: 0;
    }

    .vm-body {
        flex-direction: column;
    }

    .vm-image-side {
        flex: none;
        padding: 20px 20px 12px;
    }

    .vm-image-wrap {
        aspect-ratio: 4/3;
        border-radius: 14px;
    }

    .vm-info-side {
        padding: 8px 20px 28px;
        gap: 14px;
    }

    .vm-product-name {
        font-size: 1.25rem;
        padding-right: 0;
    }

    .vm-product-price {
        font-size: 1.2rem;
    }

    .vm-close {
        top: 12px;
        right: 12px;
    }

    #noure-toast-container {
        top: auto;
        bottom: 80px;
        right: 12px;
        left: 12px;
    }

    .noure-toast {
        width: 100%;
        justify-content: center;
    }

    .noure-toast--show {
        transform: translateY(0);
    }

    .noure-toast--hide {
        transform: translateY(30px);
    }

    .noure-toast {
        transform: translateY(30px);
    }

    /* Safe area padding for bottom sheet on iOS */
    .vm-info-side {
        padding-bottom: calc(28px + env(safe-area-inset-bottom, 0px));
    }
}

/* ─── RTL Support ─── */
html[dir="rtl"] .vm-close {
    right: auto;
    left: 16px;
}

html[dir="rtl"] .vm-info-side {
    padding: 32px 4px 28px 28px;
}

html[dir="rtl"] .vm-product-name {
    padding-right: 0;
    padding-left: 36px;
}

html[dir="rtl"] #noure-toast-container {
    right: auto;
    left: 20px;
}

html[dir="rtl"] .noure-toast {
    transform: translateX(-120%);
}

html[dir="rtl"] .noure-toast--show {
    transform: translateX(0);
}

html[dir="rtl"] .noure-toast--hide {
    transform: translateX(-120%);
}

@media (max-width: 640px) {
    html[dir="rtl"] .vm-info-side {
        padding: 8px 20px 28px;
    }

    html[dir="rtl"] .noure-toast {
        transform: translateY(30px);
    }
}
