/* Tanishq-style Virtual Try-On AR */
.jto-modal .modal-dialog {
    max-width: 100%;
    margin: 0;
    height: 100%;
    padding: 0;
}

.jto-modal .modal-content {
    border: none;
    border-radius: 0;
    background: #000;
    height: 100vh;
    max-height: 100vh;
    overflow: hidden;
}

.jto-modal .modal-body {
    padding: 0;
    height: 100%;
}

.jto-ar-screen {
    position: relative;
    width: 100%;
    height: 100vh;
    background: #0a0a0a;
    overflow: hidden;
}

.jto-viewport {
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    background: #111;
}

.jto-video-hidden {
    position: absolute;
    width: 1px;
    height: 1px;
    opacity: 0;
    pointer-events: none;
}

#jto-canvas {
    display: block;
    width: 100%;
    height: 100%;
    object-fit: cover;
    touch-action: none;
}

/* Face guide */
.jto-face-guide {
    position: absolute;
    inset: 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    pointer-events: none;
    z-index: 2;
    transition: opacity 0.4s;
}

.jto-face-guide.is-hidden {
    opacity: 0;
}

.jto-face-oval {
    width: min(62vw, 240px);
    height: min(78vw, 300px);
    border: 2px dashed rgba(255, 255, 255, 0.45);
    border-radius: 50%;
    box-shadow: 0 0 0 9999px rgba(0, 0, 0, 0.35);
}

.jto-face-guide p {
    margin-top: 1rem;
    color: rgba(255, 255, 255, 0.85);
    font-size: 0.8125rem;
    font-weight: 500;
    text-align: center;
    text-shadow: 0 1px 4px rgba(0, 0, 0, 0.8);
}

/* Top bar */
.jto-top-bar {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    z-index: 10;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: max(0.75rem, env(safe-area-inset-top)) 0.85rem 0.5rem;
    background: linear-gradient(to bottom, rgba(0, 0, 0, 0.65), transparent);
}

.jto-product-chip {
    display: flex;
    align-items: center;
    gap: 0.55rem;
    background: rgba(255, 255, 255, 0.12);
    backdrop-filter: blur(8px);
    border-radius: 30px;
    padding: 0.3rem 0.85rem 0.3rem 0.3rem;
    max-width: calc(100% - 52px);
}

.jto-product-chip-img {
    width: 36px;
    height: 36px;
    min-width: 36px;
    border-radius: 50%;
    overflow: hidden;
    background: #fff;
    border: 1px solid rgba(255, 255, 255, 0.3);
}

.jto-product-chip-img img {
    width: 36px !important;
    height: 36px !important;
    max-width: 36px !important;
    max-height: 36px !important;
    object-fit: contain !important;
    display: block !important;
}

.jto-product-chip-text {
    min-width: 0;
    display: flex;
    flex-direction: column;
}

.jto-chip-label {
    font-size: 0.625rem;
    color: rgba(255, 255, 255, 0.65);
    text-transform: uppercase;
    letter-spacing: 0.06em;
}

.jto-chip-name {
    font-size: 0.75rem;
    font-weight: 600;
    color: #fff;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 180px;
}

.jto-icon-btn {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    border: none;
    background: rgba(255, 255, 255, 0.15);
    color: #fff;
    font-size: 1.25rem;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    backdrop-filter: blur(6px);
}

/* Mode tabs */
.jto-mode-tabs {
    position: absolute;
    top: max(4.5rem, calc(env(safe-area-inset-top) + 3.5rem));
    left: 50%;
    transform: translateX(-50%);
    z-index: 10;
    display: flex;
    background: rgba(0, 0, 0, 0.45);
    backdrop-filter: blur(10px);
    border-radius: 24px;
    padding: 3px;
    gap: 2px;
}

.jto-mode-tab {
    border: none;
    background: transparent;
    color: rgba(255, 255, 255, 0.7);
    font-size: 0.6875rem;
    font-weight: 600;
    padding: 0.45rem 0.85rem;
    border-radius: 20px;
    cursor: pointer;
    white-space: nowrap;
}

.jto-mode-tab.active {
    background: #fff;
    color: #111;
}

.jto-mode-tab i {
    margin-right: 0.2rem;
}

/* Bottom bar */
.jto-bottom-bar {
    position: absolute;
    bottom: max(5.5rem, calc(env(safe-area-inset-bottom) + 4.5rem));
    left: 0;
    right: 0;
    z-index: 10;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 2rem;
    padding: 0 1.5rem;
}

.jto-capture-btn {
    width: 68px;
    height: 68px;
    border-radius: 50%;
    border: none;
    background: transparent;
    padding: 0;
    cursor: pointer;
    position: relative;
}

.jto-capture-ring {
    display: block;
    width: 68px;
    height: 68px;
    border-radius: 50%;
    border: 4px solid #fff;
    box-shadow: 0 0 0 3px rgba(255, 255, 255, 0.35);
    transition: transform 0.15s;
}

.jto-capture-btn:active .jto-capture-ring {
    transform: scale(0.92);
}

.jto-round-btn {
    width: 44px;
    height: 44px;
    border-radius: 50%;
    border: none;
    background: rgba(255, 255, 255, 0.18);
    color: #fff;
    font-size: 1.15rem;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    backdrop-filter: blur(6px);
}

.jto-flip-btn {
    display: none;
}

.jto-ar-screen.is-live .jto-flip-btn {
    display: flex;
}

/* Secondary bar */
.jto-secondary-bar {
    position: absolute;
    bottom: max(1rem, env(safe-area-inset-bottom));
    left: 0;
    right: 0;
    z-index: 10;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 1rem;
    flex-wrap: wrap;
    padding: 0 1rem;
}

.jto-text-btn {
    border: none;
    background: rgba(255, 255, 255, 0.12);
    color: rgba(255, 255, 255, 0.9);
    font-size: 0.6875rem;
    font-weight: 600;
    padding: 0.35rem 0.75rem;
    border-radius: 16px;
    cursor: pointer;
    backdrop-filter: blur(6px);
}

.jto-mini-tip {
    font-size: 0.625rem;
    color: rgba(255, 255, 255, 0.45);
}

/* Adjust panel */
.jto-adjust-panel {
    position: absolute;
    bottom: max(7.5rem, calc(env(safe-area-inset-bottom) + 6.5rem));
    left: 50%;
    transform: translateX(-50%) translateY(12px);
    z-index: 11;
    background: rgba(20, 20, 20, 0.92);
    backdrop-filter: blur(12px);
    border-radius: 14px;
    padding: 0.85rem 1rem;
    min-width: min(92vw, 320px);
    opacity: 0;
    visibility: hidden;
    transition: all 0.25s;
    border: 1px solid rgba(255, 255, 255, 0.1);
}

.jto-adjust-panel.is-open {
    opacity: 1;
    visibility: visible;
    transform: translateX(-50%) translateY(0);
}

.jto-adjust-row {
    margin-bottom: 0.65rem;
}

.jto-adjust-row:last-child {
    margin-bottom: 0;
}

.jto-adjust-row label {
    display: block;
    font-size: 0.625rem;
    font-weight: 700;
    color: rgba(255, 255, 255, 0.5);
    text-transform: uppercase;
    letter-spacing: 0.05em;
    margin-bottom: 0.35rem;
}

.jto-stepper {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 1rem;
}

.jto-stepper button {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    border: 1px solid rgba(255, 255, 255, 0.25);
    background: transparent;
    color: #fff;
    font-size: 1.1rem;
    cursor: pointer;
}

.jto-stepper span {
    color: #fff;
    font-size: 0.875rem;
    font-weight: 600;
    min-width: 48px;
    text-align: center;
}

.jto-type-pills {
    display: flex;
    flex-wrap: wrap;
    gap: 0.35rem;
}

.jto-type-pill {
    border: 1px solid rgba(255, 255, 255, 0.2);
    background: transparent;
    color: rgba(255, 255, 255, 0.75);
    border-radius: 14px;
    padding: 0.2rem 0.55rem;
    font-size: 0.6875rem;
    font-weight: 600;
    cursor: pointer;
}

.jto-type-pill.active {
    border-color: #c9a227;
    background: rgba(201, 162, 39, 0.2);
    color: #f5e6a3;
}

/* Loading */
.jto-loading {
    position: absolute;
    inset: 0;
    background: rgba(0, 0, 0, 0.7);
    display: none;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    color: #fff;
    font-size: 0.8125rem;
    z-index: 20;
    gap: 0.75rem;
}

.jto-loading.is-visible {
    display: flex;
}

.jto-spinner {
    width: 36px;
    height: 36px;
    border: 3px solid rgba(255, 255, 255, 0.2);
    border-top-color: #c9a227;
    border-radius: 50%;
    animation: jto-spin 0.8s linear infinite;
}

@keyframes jto-spin {
    to { transform: rotate(360deg); }
}

/* PDP buttons */
.jto-try-on-btn {
    border-radius: 12px !important;
    font-weight: 600 !important;
    border: 2px solid var(--primary, #c9a227) !important;
    color: var(--primary, #c9a227) !important;
    background: transparent !important;
    min-height: 46px;
}

.jto-try-on-btn:hover {
    background: var(--primary, #c9a227) !important;
    color: #fff !important;
}

.jto-gallery-try-btn {
    position: absolute;
    bottom: 12px;
    right: 12px;
    z-index: 4;
    border-radius: 24px;
    font-weight: 600;
    font-size: 0.8125rem;
    padding: 0.45rem 1rem;
    box-shadow: 0 4px 14px rgba(0, 0, 0, 0.25);
    background: rgba(0, 0, 0, 0.55) !important;
    border: 1px solid rgba(255, 255, 255, 0.3) !important;
    color: #fff !important;
}

@media (min-width: 768px) {
    .jto-modal .modal-dialog {
        max-width: 420px;
        margin: auto;
        height: auto;
    }

    .jto-modal .modal-content {
        height: 90vh;
        max-height: 820px;
        border-radius: 16px;
        margin: 5vh auto;
    }

    .jto-ar-screen {
        height: 90vh;
        max-height: 820px;
        border-radius: 16px;
    }

    .jto-face-oval {
        width: 200px;
        height: 260px;
    }
}
