/**
 * Decoupled Quick Add / Quick View Module Styles
 * Built to integrate seamlessly with the global luxury color tokens.
 */

:root {
    /* Primary brand colors - fallbacks in case custom customizers aren't fully resolved */
    --jcw-qv-primary: var(--jcw-primary, #3A2418);
    --jcw-qv-secondary: var(--jcw-secondary, #D8A24A);
    --jcw-qv-light-bg: var(--jcw-light-bg, #F8F3ED);
    --jcw-qv-dark: var(--jcw-dark, #21140E);
    --jcw-qv-btn-text: var(--jcw-btn-text, #FFFFFF);
}

/* Modal Layout */
.jcw-qv-modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 99999;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.4s cubic-bezier(0.16, 1, 0.3, 1);
}

.jcw-qv-modal.active {
    opacity: 1;
    pointer-events: auto;
}

.jcw-qv-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: color-mix(in srgb, var(--jcw-qv-dark) 60%, transparent);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
}

.jcw-qv-container {
    position: relative;
    background: var(--jcw-qv-light-bg);
    width: 90%;
    max-width: 540px;
    border-radius: 20px;
    padding: 30px;
    z-index: 1;
    box-shadow: 0 20px 50px rgba(0, 0, 0, 0.15);
    border: 1px solid color-mix(in srgb, var(--jcw-qv-primary) 10%, transparent);
    transform: scale(0.9) translateY(20px);
    transition: transform 0.4s cubic-bezier(0.16, 1, 0.3, 1);
}

.jcw-qv-modal.active .jcw-qv-container {
    transform: scale(1) translateY(0);
}

/* Close button */
.jcw-qv-header {
    display: flex;
    justify-content: flex-end;
    margin-bottom: -10px;
}

.jcw-qv-close-btn {
    background: transparent;
    border: none;
    color: var(--jcw-qv-primary);
    cursor: pointer;
    padding: 8px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s ease;
}

.jcw-qv-close-btn:hover {
    background: color-mix(in srgb, var(--jcw-qv-primary) 8%, transparent);
    transform: rotate(90deg);
}

/* Loading state */
.jcw-qv-loading-placeholder {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 40px 0;
    color: var(--jcw-qv-primary);
    gap: 15px;
}

.jcw-qv-spinner-svg {
    animation: rotate 2s linear infinite;
}

.jcw-qv-spinner-svg .path {
    stroke: var(--jcw-qv-secondary);
    stroke-linecap: round;
    animation: dash 1.5s ease-in-out infinite;
}

/* Quick View Inner Layout */
.jcw-quickview-wrap {
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.jcw-quickview-header {
    display: flex;
    gap: 20px;
    align-items: center;
    padding-bottom: 20px;
    border-bottom: 1px solid color-mix(in srgb, var(--jcw-qv-primary) 10%, transparent);
}

.jcw-quickview-img {
    width: 90px;
    height: 90px;
    border-radius: 12px;
    overflow: hidden;
    background: color-mix(in srgb, var(--jcw-qv-primary) 5%, transparent);
    flex-shrink: 0;
    box-shadow: 0 4px 12px rgba(0,0,0,0.05);
}

.jcw-quickview-img img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.jcw-quickview-title {
    font-family: var(--jcw-heading-font, 'Playfair Display', serif);
    font-size: 24px;
    color: var(--jcw-qv-primary);
    margin: 0 0 6px;
    font-weight: 700;
}

.jcw-quickview-price {
    font-size: 18px;
    font-weight: 600;
    color: var(--jcw-qv-secondary);
}

.jcw-quickview-form-wrap form.cart {
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.jcw-quickview-form-wrap table.variations {
    width: 100%;
    border-collapse: collapse;
}

.jcw-quickview-form-wrap table.variations td {
    padding: 10px 0;
    border: none;
}

.jcw-quickview-form-wrap table.variations td.label {
    width: 25%;
    font-weight: 600;
    color: var(--jcw-qv-primary);
    font-size: 14px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    vertical-align: middle;
}

.jcw-quickview-form-wrap table.variations td.value select {
    width: 100%;
    padding: 10px 14px;
    border: 1px solid color-mix(in srgb, var(--jcw-qv-primary) 20%, transparent);
    border-radius: 8px;
    background-color: var(--jcw-qv-light-bg);
    color: var(--jcw-qv-primary);
    font-family: inherit;
    font-size: 14px;
    cursor: pointer;
    transition: all 0.3s ease;
}

.jcw-quickview-form-wrap table.variations td.value select:focus {
    outline: none;
    border-color: var(--jcw-qv-secondary);
    box-shadow: 0 0 0 3px color-mix(in srgb, var(--jcw-qv-secondary) 15%, transparent);
}

/* Single variation summary block */
.jcw-quickview-form-wrap .single_variation_wrap {
    padding-top: 15px;
    border-top: 1px dashed color-mix(in srgb, var(--jcw-qv-primary) 10%, transparent);
}

.jcw-quickview-form-wrap .woocommerce-variation-price {
    margin-bottom: 15px;
    font-size: 20px;
    font-weight: 600;
    color: var(--jcw-qv-secondary);
}

.jcw-quickview-form-wrap .button[type="submit"] {
    background: var(--jcw-qv-primary);
    color: var(--jcw-qv-btn-text);
    border: 2px solid var(--jcw-qv-primary);
    padding: 14px 28px;
    border-radius: 10px;
    font-weight: 600;
    cursor: pointer;
    font-size: 15px;
    letter-spacing: 0.5px;
    transition: all 0.3s cubic-bezier(0.16, 1, 0.3, 1);
    width: 100%;
}

.jcw-quickview-form-wrap .button[type="submit"]:hover {
    background: var(--jcw-qv-secondary);
    border-color: var(--jcw-qv-secondary);
    box-shadow: 0 6px 20px color-mix(in srgb, var(--jcw-qv-secondary) 25%, transparent);
}

.jcw-quickview-form-wrap .button[type="submit"].disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

/* Dual button alignment styling inside card */
.jcw-btn-quickadd {
    background: var(--jcw-qv-secondary) !important;
    border-color: var(--jcw-qv-secondary) !important;
    color: var(--jcw-qv-btn-text) !important;
}

.jcw-btn-quickadd:hover {
    background: var(--jcw-qv-primary) !important;
    border-color: var(--jcw-qv-primary) !important;
}

/* Animation utilities */
@keyframes rotate {
    100% { transform: rotate(360deg); }
}

@keyframes dash {
    0% { stroke-dasharray: 1, 150; stroke-dashoffset: 0; }
    50% { stroke-dasharray: 90, 150; stroke-dashoffset: -35; }
    100% { stroke-dasharray: 90, 150; stroke-dashoffset: -124; }
}

/* ── Custom Variation Form (replaces WC single-product form) ── */

.jcw-quickview-desc {
    font-size: 13px;
    color: var(--jcw-text, #6B6B6B);
    line-height: 1.6;
    margin: 0 0 16px;
    border-bottom: 1px solid color-mix(in srgb, var(--jcw-qv-primary) 8%, transparent);
    padding-bottom: 16px;
}

.jcw-qv-attributes {
    display: flex;
    flex-direction: column;
    gap: 14px;
    margin-bottom: 20px;
}

.jcw-qv-attr-row {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.jcw-qv-attr-label {
    font-size: 12px;
    font-weight: 700;
    color: var(--jcw-qv-primary);
    text-transform: uppercase;
    letter-spacing: 0.8px;
}

.jcw-qv-select {
    width: 100%;
    padding: 10px 14px;
    border: 1.5px solid color-mix(in srgb, var(--jcw-qv-primary) 18%, transparent);
    border-radius: 8px;
    background: #fff;
    color: var(--jcw-qv-primary);
    font-family: inherit;
    font-size: 14px;
    cursor: pointer;
    transition: border-color 0.25s ease, box-shadow 0.25s ease;
    appearance: auto;
}

.jcw-qv-select:focus {
    outline: none;
    border-color: var(--jcw-qv-secondary);
    box-shadow: 0 0 0 3px color-mix(in srgb, var(--jcw-qv-secondary) 15%, transparent);
}

.jcw-qv-add-to-cart-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    padding: 14px 20px;
    background: var(--jcw-qv-primary);
    color: #fff;
    border: none;
    border-radius: 10px;
    font-size: 15px;
    font-weight: 700;
    cursor: pointer;
    transition: background 0.25s ease, opacity 0.25s ease, transform 0.2s ease;
    letter-spacing: 0.3px;
    margin-bottom: 12px;
    text-decoration: none;
    text-align: center;
}

.jcw-qv-add-to-cart-btn:hover:not(:disabled) {
    background: var(--jcw-qv-secondary);
    transform: translateY(-1px);
}

.jcw-qv-add-to-cart-btn:disabled {
    opacity: 0.45;
    cursor: not-allowed;
}

.jcw-qv-view-link {
    display: block;
    text-align: center;
    font-size: 13px;
    color: color-mix(in srgb, var(--jcw-qv-primary) 55%, transparent);
    text-decoration: none;
    transition: color 0.2s ease;
    padding: 4px 0;
}

.jcw-qv-view-link:hover {
    color: var(--jcw-qv-secondary);
}

.jcw-qv-stock-notice {
    background: color-mix(in srgb, #D32F2F 8%, transparent);
    color: #D32F2F;
    border: 1px solid color-mix(in srgb, #D32F2F 20%, transparent);
    border-radius: 6px;
    padding: 8px 12px;
    font-size: 13px;
    margin-bottom: 12px;
}

.jcw-qv-error {
    color: var(--jcw-qv-primary);
    font-size: 14px;
}

.jcw-qv-error a {
    color: var(--jcw-qv-secondary);
}

