/* Virtual Try-On - Modern Redesign */

/* CSS Variables */
:root {
    --vto-primary: #AA1261;
    --vto-primary-light: #d41876;
    --vto-primary-dark: #8a0e4f;
    --vto-bg: #f8f9fa;
    --vto-sidebar-bg: #ffffff;
    --vto-border: #e9ecef;
    --vto-text: #212529;
    --vto-text-muted: #6c757d;
    --vto-shadow: 0 2px 12px rgba(0,0,0,0.08);
    --vto-shadow-lg: 0 8px 24px rgba(0,0,0,0.12);
    --vto-radius: 16px;
    --vto-transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

/* Modal Base - HIGHEST Z-INDEX */
#virtual-tryon-modal {
    z-index: 999999 !important;
}

#virtual-tryon-modal .modal-backdrop {
    z-index: 999998 !important;
    background: rgba(0, 0, 0, 0.85);
    backdrop-filter: blur(8px);
}

#virtual-tryon-modal .modal-dialog {
    z-index: 999999 !important;
    margin: 0;
}

#virtual-tryon-modal .modal-content {
    height: 100vh;
    background: #000;
    border: none;
    border-radius: 0;
    position: relative;
    z-index: 999999 !important;
}

/* Modern Header */
.vto-header {
    background: rgba(0, 0, 0, 0.95);
    backdrop-filter: blur(20px);
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    box-shadow: 0 4px 24px rgba(0, 0, 0, 0.5);
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    z-index: 1000;
    padding: 16px 24px;
}

.btn-vto-back,
.btn-vto-close {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    border: 2px solid rgba(255, 255, 255, 0.2);
    background: rgba(255, 255, 255, 0.1);
    backdrop-filter: blur(10px);
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: var(--vto-transition);
    cursor: pointer;
    font-size: 18px;
}

.btn-vto-back:hover,
.btn-vto-close:hover {
    background: var(--vto-primary);
    border-color: var(--vto-primary);
    color: #fff;
    transform: scale(1.1);
    box-shadow: 0 8px 24px rgba(170, 18, 97, 0.5);
}

.vto-btn-label {
    color: #fff;
    font-size: 14px;
    font-weight: 600;
    white-space: nowrap;
}

/* Main Container */
.vto-container {
    height: 100vh;
    overflow: hidden;
    padding-top: 72px;
}

.vto-main-content {
    display: grid;
    grid-template-columns: 1fr 420px;
    height: calc(100vh - 72px);
    gap: 0;
}

/* Camera Section */
.vto-camera-section {
    background: #000;
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
}

#tryon-camera-container {
    background: linear-gradient(135deg, #1a1a1a 0%, #000000 100%);
    width: 100%;
    height: 100%;
}

#tryon-video,
#tryon-canvas {
    display: block;
    will-change: transform;
    transform: translateZ(0);
}

/* Modern Camera Controls */
.vto-controls {
    position: absolute;
    top: 80px;
    right: 20px;
    padding: 12px;
    background: rgba(0, 0, 0, 0.75);
    backdrop-filter: blur(20px);
    border-radius: 50px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.4);
    transition: var(--vto-transition);
}

.vto-controls-wrapper {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 12px;
}

.vto-btn-control {
    width: 48px;
    height: 48px;
    border-radius: 50%;
    border: 2px solid rgba(255,255,255,0.3);
    background: rgba(255,255,255,0.15);
    backdrop-filter: blur(10px);
    color: #fff;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: var(--vto-transition);
    font-size: 18px;
    gap: 2px;
}

.vto-btn-text {
    display: none;
    font-size: 9px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    white-space: nowrap;
}

.vto-btn-control:hover {
    transform: scale(1.1);
    background: rgba(255,255,255,0.25);
    border-color: rgba(255,255,255,0.5);
}

.vto-btn-control.active {
    background: var(--vto-primary);
    border-color: var(--vto-primary-light);
    box-shadow: 0 0 20px rgba(170, 18, 97, 0.5);
}

.vto-btn-primary {
    width: 56px;
    height: 56px;
    background: linear-gradient(135deg, var(--vto-primary-light) 0%, var(--vto-primary) 100%);
    border-color: var(--vto-primary-light);
    box-shadow: 0 6px 20px rgba(170, 18, 97, 0.5);
}

.vto-btn-primary:hover {
    transform: scale(1.1);
    box-shadow: 0 8px 28px rgba(170, 18, 97, 0.7);
}

/* Face Detection Badge */
.vto-face-badge {
    position: absolute;
    top: 80px;
    left: 20px;
    background: linear-gradient(135deg, #10b981 0%, #059669 100%);
    color: #fff;
    padding: 8px 16px;
    border-radius: 50px;
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 13px;
    font-weight: 600;
    box-shadow: 0 4px 16px rgba(16, 185, 129, 0.4);
    animation: fadeInScale 0.3s ease;
}

@keyframes fadeInScale {
    from {
        opacity: 0;
        transform: scale(0.8);
    }
    to {
        opacity: 1;
        transform: scale(1);
    }
}

/* Sidebar */
.vto-sidebar {
    background: linear-gradient(180deg, #ffffff 0%, #f8f9fa 100%);
    border-left: 1px solid var(--vto-border);
    overflow-y: auto;
    overflow-x: hidden;
    box-shadow: -4px 0 24px rgba(0, 0, 0, 0.1);
}

.vto-sidebar-content {
    padding: 28px 24px;
}

/* Current Product Card */
.vto-current-product {
    margin-bottom: 24px;
}

.vto-product-label {
    font-size: 12px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: var(--vto-text-muted);
    margin-bottom: 12px;
}

.vto-product-card {
    background: linear-gradient(135deg, #ffffff 0%, #fafbfc 100%);
    border: 2px solid var(--vto-border);
    border-radius: 20px;
    padding: 20px;
    display: flex;
    align-items: center;
    gap: 16px;
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.08);
    transition: var(--vto-transition);
    position: relative;
    overflow: hidden;
}

.vto-product-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 4px;
    background: linear-gradient(90deg, var(--vto-primary) 0%, var(--vto-primary-light) 100%);
}

.vto-product-card:hover {
    box-shadow: 0 8px 32px rgba(170, 18, 97, 0.15);
    transform: translateY(-4px);
    border-color: var(--vto-primary);
}

.vto-product-img {
    width: 90px;
    height: 90px;
    border-radius: 16px;
    object-fit: cover;
    border: 3px solid var(--vto-border);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
}

.vto-product-info {
    flex: 1;
}

.vto-product-name {
    font-size: 16px;
    font-weight: 700;
    color: var(--vto-text);
    margin: 0 0 6px 0;
    line-height: 1.4;
}

.vto-product-price {
    font-size: 20px;
    font-weight: 800;
    background: linear-gradient(135deg, var(--vto-primary) 0%, var(--vto-primary-light) 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    margin: 0;
}

/* Control Group */
.vto-control-group {
    margin-bottom: 24px;
    padding: 24px;
    background: linear-gradient(135deg, #ffffff 0%, #f8f9fa 100%);
    border-radius: 20px;
    border: 2px solid var(--vto-border);
    box-shadow: 0 2px 12px rgba(0, 0, 0, 0.06);
}

.vto-control-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 12px;
}

.vto-label {
    font-size: 14px;
    font-weight: 600;
    color: var(--vto-text);
    margin: 0;
}

.vto-value {
    font-size: 14px;
    font-weight: 700;
    color: var(--vto-primary);
}

/* Modern Slider */
.vto-slider {
    width: 100%;
    height: 8px;
    border-radius: 4px;
    background: linear-gradient(90deg, #e9ecef 0%, var(--vto-primary) 100%);
    outline: none;
    -webkit-appearance: none;
    position: relative;
}

.vto-slider::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 24px;
    height: 24px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--vto-primary-light) 0%, var(--vto-primary) 100%);
    cursor: pointer;
    box-shadow: 0 4px 12px rgba(170, 18, 97, 0.5);
    transition: var(--vto-transition);
    border: 3px solid #fff;
}

.vto-slider::-webkit-slider-thumb:hover {
    transform: scale(1.3);
    box-shadow: 0 6px 20px rgba(170, 18, 97, 0.7);
}

.vto-slider::-moz-range-thumb {
    width: 20px;
    height: 20px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--vto-primary-light) 0%, var(--vto-primary) 100%);
    cursor: pointer;
    border: none;
    box-shadow: 0 2px 8px rgba(170, 18, 97, 0.4);
}

/* Products Section */
.vto-products-section {
    margin-top: 12px;
}

.vto-section-title {
    font-size: 17px;
    font-weight: 800;
    color: var(--vto-text);
    margin-bottom: 20px;
    padding-bottom: 12px;
    border-bottom: 2px solid var(--vto-border);
    position: relative;
}

.vto-section-title::after {
    content: '';
    position: absolute;
    bottom: -2px;
    left: 0;
    width: 60px;
    height: 2px;
    background: linear-gradient(90deg, var(--vto-primary) 0%, var(--vto-primary-light) 100%);
}

/* Loading State */
.vto-loading {
    text-align: center;
    padding: 40px 20px;
}

.vto-spinner {
    width: 40px;
    height: 40px;
    border: 4px solid var(--vto-border);
    border-top-color: var(--vto-primary);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
    margin: 0 auto 16px;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

.vto-loading p {
    color: var(--vto-text-muted);
    font-size: 14px;
    margin: 0;
}

/* Products List */
.vto-products-list {
    max-height: calc(100vh - 520px);
    overflow-y: auto;
    padding-right: 8px;
}

/* Custom Scrollbar */
.vto-products-list::-webkit-scrollbar,
.vto-sidebar::-webkit-scrollbar {
    width: 6px;
}

.vto-products-list::-webkit-scrollbar-track,
.vto-sidebar::-webkit-scrollbar-track {
    background: transparent;
}

.vto-products-list::-webkit-scrollbar-thumb,
.vto-sidebar::-webkit-scrollbar-thumb {
    background: var(--vto-border);
    border-radius: 3px;
}

.vto-products-list::-webkit-scrollbar-thumb:hover,
.vto-sidebar::-webkit-scrollbar-thumb:hover {
    background: var(--vto-primary);
}

/* Product Items */
.tryon-product-item {
    background: #fff;
    border: 2px solid var(--vto-border);
    border-radius: 16px;
    padding: 14px;
    cursor: pointer;
    transition: var(--vto-transition);
    margin-bottom: 14px;
    animation: slideInRight 0.3s ease;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.04);
}

.tryon-product-item:hover {
    transform: translateY(-3px);
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.12);
    border-color: var(--vto-primary);
}

.tryon-product-item.active {
    border-color: var(--vto-primary);
    background: linear-gradient(135deg, rgba(170, 18, 97, 0.08) 0%, rgba(170, 18, 97, 0.03) 100%);
    box-shadow: 0 0 0 4px rgba(170, 18, 97, 0.15), 0 8px 24px rgba(170, 18, 97, 0.2);
    transform: translateY(-3px);
}

.tryon-product-item img {
    border-radius: 12px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.tryon-variation-item {
    background: var(--vto-bg);
    border: 2px solid var(--vto-border);
    border-left: 4px solid var(--vto-primary);
    border-radius: 8px;
    padding: 10px;
    cursor: pointer;
    transition: var(--vto-transition);
    margin-bottom: 8px;
}

.tryon-variation-item:hover {
    background: rgba(170, 18, 97, 0.05);
    transform: translateX(4px);
}

.tryon-variation-item.active {
    background-color: rgba(170, 18, 97, 0.15) !important;
    border-left-width: 4px !important;
}

.variation-toggle {
    transition: transform 0.3s ease;
    cursor: pointer;
}

.variation-toggle:hover {
    color: var(--primary-color, #AA1261) !important;
}

.bg-gradient {
    backdrop-filter: blur(10px);
}

#tryon-products-list {
    max-height: calc(100vh - 500px);
    overflow-y: auto;
}

#tryon-products-list::-webkit-scrollbar {
    width: 6px;
}

#tryon-products-list::-webkit-scrollbar-track {
    background: #f1f1f1;
    border-radius: 10px;
}

#tryon-products-list::-webkit-scrollbar-thumb {
    background: #888;
    border-radius: 10px;
}

#tryon-products-list::-webkit-scrollbar-thumb:hover {
    background: #555;
}

/* Responsive Styles */
@media (max-width: 1200px) {
    .vto-main-content {
        grid-template-columns: 1fr 380px;
    }
}

@media (max-width: 991px) {
    .vto-main-content {
        grid-template-columns: 1fr;
        grid-template-rows: 60vh auto;
    }
    
    .vto-container {
        padding-top: 60px;
    }
    
    .vto-sidebar {
        border-left: none;
        border-top: 1px solid var(--vto-border);
        max-height: 40vh;
    }
    
    .vto-products-list {
        max-height: calc(40vh - 280px);
    }
    
    .vto-header {
        padding: 12px 16px;
    }
    
    .vto-btn-label {
        font-size: 13px;
    }
}

@media (max-width: 767px) {
    .vto-header h5 {
        font-size: 14px;
    }
    
    .vto-subtitle {
        font-size: 11px;
        display: none;
    }
    
    .vto-btn-label {
        display: none;
    }
    
    .btn-vto-back,
    .btn-vto-close {
        width: 36px;
        height: 36px;
        font-size: 16px;
    }
    
    .vto-sidebar-content {
        padding: 16px;
    }
    
    .vto-product-card {
        padding: 14px;
    }
    
    .vto-product-img {
        width: 70px;
        height: 70px;
    }
    
    .vto-product-name {
        font-size: 14px;
    }
    
    .vto-product-price {
        font-size: 16px;
    }
    
    .vto-controls {
        top: 60px;
        right: 12px;
        padding: 8px;
    }
    
    .vto-controls-wrapper {
        gap: 8px;
    }
    
    .vto-btn-control {
        width: auto;
        min-width: 60px;
        height: 60px;
        border-radius: 30px;
        padding: 8px 12px;
        font-size: 16px;
        gap: 4px;
    }
    
    .vto-btn-text {
        display: block;
    }
    
    .vto-btn-primary {
        min-width: 70px;
        height: 70px;
    }
    
    .vto-face-badge {
        top: 60px;
        left: 12px;
        padding: 6px 12px;
        font-size: 12px;
    }
    
    .vto-main-content {
        grid-template-rows: 55vh auto;
    }
    
    .vto-container {
        padding-top: 56px;
    }
    
    #tryon-video,
    #tryon-canvas {
        object-fit: cover !important;
    }
}

@media (max-width: 480px) {
    .vto-header h5 {
        font-size: 13px;
    }
    
    .vto-control-group {
        padding: 16px;
    }
    
    .vto-section-title {
        font-size: 15px;
    }
    
    .tryon-product-item {
        padding: 10px;
    }
    
    .vto-controls {
        top: 56px;
        right: 8px;
        padding: 6px;
    }
    
    .vto-btn-control {
        width: 40px;
        height: 40px;
        font-size: 16px;
    }
    
    .vto-btn-primary {
        width: 48px;
        height: 48px;
    }
    
    .vto-face-badge {
        top: 56px;
        left: 8px;
        padding: 5px 10px;
        font-size: 11px;
    }
}

@media (min-width: 992px) {
    .col-lg-8 {
        border-right: 1px solid #dee2e6;
    }
}

/* Performance optimizations */
* {
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

#tryon-video, #tryon-canvas {
    will-change: transform;
    transform: translateZ(0);
}

.tryon-product-item, .tryon-variation-item {
    will-change: transform, background-color;
}