/**
 * NivoSync Quick View Styles - Redesigned
 *
 * Inspired by Queensmith.co.uk
 * Elegant modal with large gallery, organized specs,
 * quality badges, and prominent actions.
 *
 * @package NivoSync
 * @since   1.1.0
 */

/* ==========================================================================
   QUICK VIEW OVERLAY & MODAL
   ========================================================================== */

.ns-quick-view-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.7);
    backdrop-filter: blur(4px);
    opacity: 0;
    visibility: hidden;
    transition: all 300ms ease;
    z-index: 9998;
}

.ns-quick-view-overlay.is-open,
.ns-quick-view-overlay--visible {
    opacity: 1;
    visibility: visible;
}

.ns-quick-view-modal,
.ns-quick-view {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%) scale(0.95);
    width: 95%;
    max-width: 1000px;
    max-height: 90vh;
    background: #ffffff;
    border-radius: 12px;
    overflow: hidden;
    opacity: 0;
    visibility: hidden;
    transition: all 300ms ease;
    z-index: 9999;
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.25);
}

.ns-quick-view-modal.is-open,
.ns-quick-view-overlay--visible .ns-quick-view {
    opacity: 1;
    visibility: visible;
    transform: translate(-50%, -50%) scale(1);
}

/* Close Button */
.ns-quick-view__close,
.ns-quick-view-close {
    position: absolute;
    top: 16px;
    right: 16px;
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: #ffffff;
    border: none;
    border-radius: 50%;
    color: #666;
    cursor: pointer;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
    transition: all 150ms ease;
    z-index: 10;
}

.ns-quick-view__close:hover,
.ns-quick-view-close:hover {
    background: #f3f4f6;
    color: #1a1a1a;
    transform: scale(1.05);
}

.ns-quick-view__close svg,
.ns-quick-view-close svg {
    width: 20px;
    height: 20px;
}

/* ==========================================================================
   QUICK VIEW CONTENT (.ns-qv- prefix for new design)
   ========================================================================== */

.ns-qv {
    position: relative;
}

.ns-qv-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    max-height: 90vh;
}

/* ==========================================================================
   NAVIGATION ARROWS
   ========================================================================== */

.ns-qv-nav {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    width: 44px;
    height: 44px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(255, 255, 255, 0.95);
    border: none;
    border-radius: 50%;
    color: #1a1a1a;
    cursor: pointer;
    box-shadow: 0 2px 12px rgba(0, 0, 0, 0.15);
    transition: all 150ms ease;
    z-index: 10;
}

.ns-qv-nav:hover {
    background: #1a1a1a;
    color: #ffffff;
    transform: translateY(-50%) scale(1.05);
}

.ns-qv-nav:disabled {
    opacity: 0.3;
    cursor: not-allowed;
}

.ns-qv-nav--prev {
    left: -22px;
}

.ns-qv-nav--next {
    right: -22px;
}

/* ==========================================================================
   GALLERY COLUMN
   ========================================================================== */

.ns-qv-gallery {
    position: relative;
    background: #f8f9fa;
    display: flex;
    flex-direction: column;
}

/* Media Tabs */
.ns-qv-media-tabs {
    display: flex;
    gap: 4px;
    padding: 12px 16px;
    background: #ffffff;
    border-bottom: 1px solid #e5e7eb;
}

.ns-qv-media-tab {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 8px 16px;
    font-size: 13px;
    font-weight: 500;
    color: #666;
    background: transparent;
    border: 1px solid #e5e7eb;
    border-radius: 6px;
    cursor: pointer;
    transition: all 150ms ease;
}

.ns-qv-media-tab:hover {
    background: #f3f4f6;
    border-color: #d1d5db;
}

.ns-qv-media-tab.is-active {
    background: #1a1a1a;
    border-color: #1a1a1a;
    color: #ffffff;
}

.ns-qv-media-tab svg {
    width: 16px;
    height: 16px;
}

/* Media Display */
.ns-qv-media-display {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 400px;
    position: relative;
}

.ns-qv-media-panel {
    display: none;
    width: 100%;
    height: 100%;
    align-items: center;
    justify-content: center;
}

.ns-qv-media-panel.is-active {
    display: flex;
}

.ns-qv-main-image {
    max-width: 100%;
    max-height: 450px;
    object-fit: contain;
    padding: 24px;
}

/* 360° Canvas Viewer in Quick View */
.ns-qv-360-viewer {
    width: 100%;
    height: 450px;
    position: relative;
    background: var(--ns-gray-100, #f3f4f6);
    cursor: grab;
    touch-action: none;
    user-select: none;
}

.ns-qv-360-viewer:active {
    cursor: grabbing;
}

.ns-qv-360-viewer canvas {
    display: block;
    width: 100%;
    height: 100%;
    object-fit: contain;
}

.ns-qv-360-viewer .ns-360-loading {
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--ns-gray-100, #f3f4f6);
}

.ns-qv-video {
    max-width: 100%;
    max-height: 450px;
    object-fit: contain;
}

.ns-qv-placeholder {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 12px;
    color: #9ca3af;
    font-size: 14px;
}

/* ==========================================================================
   INFO COLUMN
   ========================================================================== */

.ns-qv-info {
    padding: 28px;
    overflow-y: auto;
    max-height: 90vh;
    display: flex;
    flex-direction: column;
}

/* Header */
.ns-qv-header {
    margin-bottom: 20px;
}

.ns-qv-badges {
    margin-bottom: 12px;
}

.ns-qv-type-badge {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 6px 12px;
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    border-radius: 4px;
}

.ns-qv-type-badge--natural {
    background: rgba(34, 197, 94, 0.1);
    color: #15803d;
}

.ns-qv-type-badge--labgrown {
    background: rgba(59, 130, 246, 0.1);
    color: #1d4ed8;
}

.ns-qv-growth-type {
    font-weight: 400;
    opacity: 0.8;
}

.ns-qv-title {
    margin: 0 0 8px;
    font-size: 1.5rem;
    font-weight: 600;
    color: #1a1a1a;
    line-height: 1.3;
}

.ns-qv-subtitle {
    font-size: 14px;
    color: #666;
}

/* Price Section */
.ns-qv-price-section {
    padding: 16px 0;
    border-bottom: 1px solid #e5e7eb;
    margin-bottom: 16px;
}

.ns-qv-price {
    font-size: 1.75rem;
    font-weight: 700;
    color: #1a1a1a;
}

.ns-qv-price-per-carat {
    font-size: 13px;
    color: #666;
    margin-top: 4px;
}

/* Quality Badges */
.ns-qv-quality {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-bottom: 20px;
}

.ns-qv-quality-badge {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 6px 12px;
    font-size: 12px;
    font-weight: 500;
    border-radius: 100px;
}

.ns-qv-quality-badge svg {
    width: 14px;
    height: 14px;
}

.ns-qv-quality-badge--excellent {
    background: rgba(234, 179, 8, 0.1);
    color: #a16207;
}

.ns-qv-quality-badge--good {
    background: rgba(34, 197, 94, 0.1);
    color: #15803d;
}

.ns-qv-quality-badge--info {
    background: rgba(59, 130, 246, 0.1);
    color: #1d4ed8;
}

/* Specs Section */
.ns-qv-specs {
    margin-bottom: 20px;
}

.ns-qv-specs-title {
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    color: #666;
    margin-bottom: 12px;
}

.ns-qv-specs-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 12px;
    padding: 16px;
    background: #f8f9fa;
    border-radius: 8px;
}

.ns-qv-spec {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.ns-qv-spec--full {
    grid-column: span 2;
}

.ns-qv-spec-label {
    font-size: 10px;
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: #9ca3af;
}

.ns-qv-spec-value {
    font-size: 14px;
    font-weight: 600;
    color: #1a1a1a;
}

/* Certificate */
.ns-qv-certificate {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 16px;
    background: #f8f9fa;
    border-radius: 8px;
    margin-bottom: 20px;
}

.ns-qv-certificate-info {
    display: flex;
    align-items: center;
    gap: 8px;
}

.ns-qv-certificate-lab {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 4px 10px;
    font-size: 12px;
    font-weight: 700;
    background: #1a1a1a;
    color: #ffffff;
    border-radius: 4px;
}

.ns-qv-certificate-number {
    font-size: 14px;
    font-weight: 500;
    color: #1a1a1a;
}

.ns-qv-certificate-link {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-size: 13px;
    font-weight: 500;
    color: #3b82f6;
    text-decoration: none;
    transition: color 150ms ease;
}

.ns-qv-certificate-link:hover {
    color: #1d4ed8;
    text-decoration: underline;
}

.ns-qv-certificate-link svg {
    width: 14px;
    height: 14px;
}

/* Actions */
.ns-qv-actions {
    margin-top: auto;
    padding-top: 20px;
    border-top: 1px solid #e5e7eb;
}

.ns-qv-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 14px 24px;
    font-size: 14px;
    font-weight: 600;
    border-radius: 8px;
    text-decoration: none;
    cursor: pointer;
    transition: all 150ms ease;
}

.ns-qv-btn svg {
    width: 16px;
    height: 16px;
}

.ns-qv-btn--primary {
    width: 100%;
    background: #1a1a1a;
    border: none;
    color: #ffffff;
    margin-bottom: 12px;
}

.ns-qv-btn--primary:hover {
    background: #333333;
}

.ns-qv-btn--outline {
    flex: 1;
    background: transparent;
    border: 1px solid #e5e7eb;
    color: #1a1a1a;
}

.ns-qv-btn--outline:hover {
    background: #f8f9fa;
    border-color: #d1d5db;
}

.ns-qv-btn--outline.is-active {
    background: rgba(201, 169, 98, 0.1);
    border-color: #c9a962;
    color: #a07f33;
}

.ns-qv-secondary-actions {
    display: flex;
    gap: 12px;
}

/* ==========================================================================
   LOADING STATE
   ========================================================================== */

.ns-quick-view__loading {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 16px;
    min-height: 400px;
    color: #666;
    font-size: 14px;
}

.ns-spinner {
    width: 40px;
    height: 40px;
    border: 3px solid #e5e7eb;
    border-top-color: #1a1a1a;
    border-radius: 50%;
    animation: ns-spin 0.8s linear infinite;
}

@keyframes ns-spin {
    to {
        transform: rotate(360deg);
    }
}

/* ==========================================================================
   THEME VARIATIONS
   ========================================================================== */

/* Elegant Theme — moved to themes/elegant/elegant-loop.css (v2.1.0) */

/* Classic Theme */
.ns-theme-classic .ns-qv-title {
    font-family: var(--ns-font-family-primary, 'Playfair Display', Georgia, serif);
}

.ns-theme-classic .ns-qv-btn--primary {
    background: var(--ns-color-primary, #1a1a1a);
    border-radius: 0;
}

.ns-theme-classic .ns-qv-type-badge--natural {
    border: 1px solid currentColor;
    background: transparent;
}

/* Modern Theme */
.ns-theme-modern .ns-qv-media-tab.is-active {
    background: var(--ns-color-primary, #3498db);
    border-color: var(--ns-color-primary, #3498db);
}

.ns-theme-modern .ns-qv-btn--primary {
    background: var(--ns-color-primary, #3498db);
}

/* ==========================================================================
   RESPONSIVE
   ========================================================================== */

@media (max-width: 900px) {
    .ns-qv-nav {
        display: none;
    }
    
    .ns-qv-specs-grid {
        grid-template-columns: repeat(3, 1fr);
    }
}

@media (max-width: 768px) {
    .ns-quick-view-modal,
    .ns-quick-view {
        width: 100%;
        max-width: 100%;
        max-height: 100vh;
        border-radius: 0;
        top: 0;
        left: 0;
        transform: translateY(100%);
    }
    
    .ns-quick-view-modal.is-open,
    .ns-quick-view-overlay--visible .ns-quick-view {
        transform: translateY(0);
    }
    
    .ns-qv-grid {
        grid-template-columns: 1fr;
        max-height: 100vh;
    }
    
    .ns-qv-gallery {
        max-height: 40vh;
    }
    
    .ns-qv-media-display {
        min-height: 250px;
    }
    
    .ns-qv-main-image {
        max-height: 250px;
        padding: 16px;
    }
    
    .ns-qv-360-viewer {
        height: 250px;
    }
    
    .ns-qv-info {
        padding: 20px;
        max-height: 60vh;
    }
    
    .ns-qv-title {
        font-size: 1.25rem;
    }
    
    .ns-qv-price {
        font-size: 1.5rem;
    }
    
    .ns-qv-specs-grid {
        grid-template-columns: repeat(2, 1fr);
    }
    
    .ns-qv-spec--full {
        grid-column: span 2;
    }
    
    .ns-qv-certificate {
        flex-direction: column;
        align-items: flex-start;
        gap: 12px;
    }
    
    .ns-qv-secondary-actions {
        flex-direction: column;
    }
    
    .ns-qv-btn--outline {
        width: 100%;
    }
}

@media (max-width: 480px) {
    .ns-qv-media-tabs {
        flex-wrap: wrap;
    }
    
    .ns-qv-media-tab {
        padding: 6px 12px;
        font-size: 12px;
    }
    
    .ns-qv-quality {
        gap: 6px;
    }
    
    .ns-qv-quality-badge {
        padding: 4px 10px;
        font-size: 11px;
    }
}

/* ==========================================================================
   LEGACY SUPPORT (old class names)
   ========================================================================== */

.ns-quick-view__content {
    max-height: 90vh;
    overflow: hidden;
}

/* Old QV classes mapping */
.ns-qv-gallery-col {
    background: #f8f9fa;
}

.ns-qv-info-col {
    padding: 28px;
    overflow-y: auto;
}

.ns-qv-media {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 400px;
    position: relative;
}

.ns-qv-image {
    max-width: 100%;
    max-height: 400px;
    object-fit: contain;
    padding: 24px;
}

.ns-qv-media-buttons {
    position: absolute;
    bottom: 16px;
    left: 50%;
    transform: translateX(-50%);
    display: flex;
    gap: 8px;
    padding: 8px;
    background: rgba(255, 255, 255, 0.95);
    border-radius: 100px;
}

.ns-qv-media-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 8px 16px;
    font-size: 13px;
    font-weight: 500;
    background: transparent;
    border: none;
    border-radius: 100px;
    color: #666;
    cursor: pointer;
    transition: all 150ms ease;
}

.ns-qv-media-btn:hover,
.ns-qv-media-btn.is-active {
    background: #1a1a1a;
    color: #ffffff;
}

.ns-qv-header {
    margin-bottom: 16px;
    padding-bottom: 16px;
    border-bottom: 1px solid #e5e7eb;
}

.ns-qv-type {
    display: inline-block;
    padding: 4px 12px;
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    border-radius: 4px;
    margin-bottom: 12px;
}

.ns-type-natural {
    background: rgba(34, 197, 94, 0.1);
    color: #15803d;
}

.ns-type-labgrown {
    background: rgba(59, 130, 246, 0.1);
    color: #1d4ed8;
}

.ns-qv-cert {
    margin: 0;
    font-size: 13px;
    color: #666;
}

.ns-qv-price-value {
    font-size: 1.5rem;
    font-weight: 700;
    color: #1a1a1a;
}

.ns-qv-price-ppc {
    font-size: 13px;
    color: #666;
    margin-left: 8px;
}

.ns-qv-btns {
    display: flex;
    gap: 8px;
}

.ns-btn-icon {
    width: 44px;
    height: 44px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: #f8f9fa;
    border: 1px solid #e5e7eb;
    border-radius: 8px;
    color: #666;
    cursor: pointer;
    transition: all 150ms ease;
}

.ns-btn-icon:hover {
    background: #e5e7eb;
    color: #1a1a1a;
}

.ns-btn-icon.ns-active {
    background: rgba(201, 169, 98, 0.15);
    border-color: #c9a962;
    color: #a07f33;
}

.ns-btn-icon svg {
    width: 20px;
    height: 20px;
}
