.vcp-tryon-modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    z-index: var(--vcp-z-modal);
    font-family: var(--vcp-font);
}

.vcp-tryon-modal__backdrop {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.7);
    backdrop-filter: blur(8px);
}

.vcp-tryon-modal__container {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 90%;
    max-width: 900px;
    background: var(--vcp-bg);
    border-radius: 12px;
    box-shadow: 0 25px 50px -12px rgb(0 0 0 / 0.5);
    display: flex;
    flex-direction: column;
    max-height: 90vh;
    overflow: hidden;
    animation: vcp-modal-in 0.3s cubic-bezier(0.16, 1, 0.3, 1);
}

@keyframes vcp-modal-in {
    from {
        opacity: 0;
        transform: translate(-50%, -48%) scale(0.96);
    }

    to {
        opacity: 1;
        transform: translate(-50%, -50%) scale(1);
    }
}

/* Header & Tabs */
.vcp-tryon-modal__header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px 24px;
    border-bottom: 1px solid var(--vcp-border);
    background: #f8fafc;
}

.vcp-tryon-modal__title {
    display: flex;
    align-items: center;
    gap: 8px;
    font-weight: 700;
    font-size: 18px;
    color: var(--vcp-text);
    margin: 0;
}

.vcp-tryon-modal__tabs {
    display: flex;
    gap: 4px;
    background: #e2e8f0;
    padding: 4px;
    border-radius: 8px;
}

.vcp-tryon-tab {
    border: none;
    background: transparent;
    padding: 6px 16px;
    border-radius: 6px;
    font-weight: 600;
    font-size: 14px;
    color: #475569;
    cursor: pointer;
    transition: var(--vcp-transition);
}

.vcp-tryon-tab:hover {
    color: var(--vcp-text);
}

.vcp-tryon-tab.is-active {
    background: #fff;
    color: var(--vcp-primary);
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
}

.vcp-tryon-modal__close {
    background: transparent;
    border: none;
    color: #64748b;
    cursor: pointer;
    padding: 4px;
    transition: var(--vcp-transition);
    border-radius: 4px;
}

.vcp-tryon-modal__close:hover {
    color: #ef4444;
    background: #fee2e2;
}

/* Panels */
.vcp-tryon-panel {
    display: none;
    flex: 1;
    overflow-y: auto;
}

.vcp-tryon-panel.is-active {
    display: flex;
}

/* AI Try-On Panel */
.vcp-tryon-panel--ai {
    flex-direction: row;
}

.vcp-tryon-panel__left {
    width: 40%;
    padding: 24px;
    border-right: 1px solid var(--vcp-border);
    display: flex;
    flex-direction: column;
    gap: 16px;
    background: #fafafa;
}

.vcp-tryon-panel__right {
    width: 60%;
    padding: 24px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    position: relative;
    background: #f1f5f9;
}

.vcp-tryon-panel__label {
    font-size: 13px;
    font-weight: 600;
    color: #64748b;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: -8px;
}

.vcp-tryon-panel__product-img {
    background: #fff;
    border-radius: var(--vcp-radius);
    border: 1px solid var(--vcp-border);
    padding: 16px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.vcp-tryon-panel__product-img img {
    max-height: 200px;
    object-fit: contain;
}

.vcp-tryon-upload-label {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 24px;
    border: 2px dashed #cbd5e1;
    border-radius: var(--vcp-radius);
    background: #fff;
    cursor: pointer;
    color: #64748b;
    font-size: 14px;
    transition: var(--vcp-transition);
    text-align: center;
}

.vcp-tryon-upload-label:hover {
    border-color: var(--vcp-primary);
    color: var(--vcp-primary);
    background: #f8fafc;
}

.vcp-tryon__photo-preview {
    width: 100%;
    height: 200px;
    object-fit: cover;
    border-radius: var(--vcp-radius);
    margin-top: 16px;
    border: 1px solid var(--vcp-border);
}

.hidden {
    display: none !important;
}

/* Generating States */
.vcp-tryon__loading,
.vcp-tryon__error,
.vcp-tryon__empty {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 16px;
    text-align: center;
    color: #64748b;
}

.vcp-tryon__spinner-ring {
    width: 48px;
    height: 48px;
    border: 3px solid #e2e8f0;
    border-top-color: var(--vcp-primary);
    border-radius: 50%;
    animation: vcp-spin 1s linear infinite;
}

.vcp-tryon__error {
    color: #ef4444;
}

/* Results */
.vcp-tryon__result {
    width: 100%;
    height: 100%;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 16px;
}

.vcp-tryon__result-img {
    max-width: 100%;
    max-height: calc(90vh - 200px);
    border-radius: var(--vcp-radius);
    box-shadow: 0 10px 25px -5px rgba(0, 0, 0, 0.1);
    object-fit: contain;
}

.vcp-tryon__result-actions {
    display: flex;
    gap: 12px;
}

.vcp-btn-icon {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    background: #fff;
    border: 1px solid var(--vcp-border);
    padding: 8px 16px;
    border-radius: 20px;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    color: var(--vcp-text);
    box-shadow: var(--vcp-shadow-sm);
    transition: var(--vcp-transition);
}

.vcp-btn-icon:hover {
    background: #f8fafc;
    transform: translateY(-1px);
}

/* Camera Try-On */
.vcp-tryon-panel--camera {
    flex-direction: column;
}

.vcp-camera__wrap {
    display: flex;
    flex: 1;
    padding: 24px;
    gap: 24px;
    background: #000;
}

.vcp-camera__stage {
    flex: 1;
    position: relative;
    background: #111;
    border-radius: var(--vcp-radius);
    overflow: hidden;
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 400px;
}

.vcp-camera__video {
    display: none;
}

.vcp-camera__canvas {
    width: 100%;
    height: 100%;
    object-fit: contain;
}

.vcp-camera__placeholder {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    color: #666;
    gap: 16px;
}

.vcp-camera__controls {
    width: 250px;
    background: #1a1a1a;
    padding: 20px;
    border-radius: var(--vcp-radius);
    color: #fff;
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.vcp-camera__controls-row {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.vcp-camera__slider-group label {
    display: flex;
    justify-content: space-between;
    font-size: 12px;
    margin-bottom: 8px;
    color: #a3a3a3;
}

.vcp-camera__slider-group input[type=range] {
    width: 100%;
}

.vcp-camera__blend-select {
    width: 100%;
    padding: 8px;
    background: #333;
    color: #fff;
    border: 1px solid #444;
    border-radius: 4px;
    margin-top: 8px;
}

/* Capture Preview Overlay */
.vcp-capture-preview {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.9);
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    z-index: 100;
    padding: 24px;
}

.vcp-capture-preview img {
    max-width: 100%;
    max-height: calc(100% - 80px);
    border-radius: var(--vcp-radius);
}

.vcp-capture-actions {
    display: flex;
    gap: 16px;
    margin-top: 24px;
}

/* Avatar Panel */
.vcp-tryon-panel--avatar {
    flex-direction: column;
    align-items: center;
    padding: 40px;
    gap: 32px;
}

.vcp-avatar__product-preview {
    text-align: center;
}

.vcp-avatar__product-preview img {
    max-height: 150px;
    border-radius: 8px;
    margin-bottom: 16px;
}

.vcp-avatar__selector {
    display: flex;
    gap: 16px;
    flex-wrap: wrap;
    justify-content: center;
}

.vcp-avatar__option {
    background: transparent;
    border: 2px solid transparent;
    border-radius: 12px;
    padding: 8px;
    cursor: pointer;
    transition: var(--vcp-transition);
}

.vcp-avatar__option img {
    width: 80px;
    height: 80px;
    border-radius: 50%;
    object-fit: cover;
    border: 1px solid var(--vcp-border);
    margin-bottom: 8px;
}

.vcp-avatar__option span {
    display: block;
    font-size: 13px;
    font-weight: 500;
}

.vcp-avatar__option:hover {
    background: #f1f5f9;
}

.vcp-avatar__option.is-active {
    border-color: var(--vcp-primary);
    background: #eff6ff;
}

.vcp-avatar__option.is-active img {
    border-color: var(--vcp-primary);
}

/* Footer */
.vcp-tryon-modal__footer {
    padding: 12px 24px;
    border-top: 1px solid var(--vcp-border);
    background: #f8fafc;
    text-align: center;
}

.vcp-tryon-modal__powered {
    font-size: 12px;
    color: #94a3b8;
    font-weight: 500;
}

@media (max-width: 767px) {
    .vcp-tryon-panel--ai {
        flex-direction: column;
    }

    .vcp-tryon-panel__left,
    .vcp-tryon-panel__right {
        width: 100%;
    }

    .vcp-tryon-modal__container {
        width: 100%;
        height: 100%;
        max-height: 100vh;
        border-radius: 0;
    }

    .vcp-tryon-modal__tabs {
        margin-top: 8px;
        width: 100%;
        overflow-x: auto;
    }

    .vcp-tryon-modal__header {
        flex-direction: column;
        align-items: flex-start;
    }

    .vcp-tryon-modal__close {
        position: absolute;
        right: 16px;
        top: 16px;
    }

    .vcp-camera__wrap {
        flex-direction: column;
    }

    .vcp-camera__controls {
        width: 100%;
    }
}