/* ── MODAL ───────────────────────────────────────────────── */
.modal {
    display: none;
    position: fixed;
    z-index: 1000;
    inset: 0;
    background: rgba(0,0,0,0.88);
    overflow-y: auto;
}
.modal-content-wrapper {
    position: relative;
    max-width: 1100px;
    width: 95%;
    margin: 40px auto;
    background: var(--surface);
    border: 1px solid var(--border-light);
    border-radius: 14px;
    overflow: hidden;
    display: flex;
    flex-direction: row;
    box-shadow: 0 24px 60px rgba(0,0,0,0.7);
    will-change: transform;
}
.modal-swipe-handle { display: none; }
@media (max-width: 800px) {
    .modal-content-wrapper { flex-direction: column; }
    .modal-swipe-handle {
        display: block;
        width: 40px;
        height: 4px;
        background: var(--border-light);
        border-radius: 2px;
        margin: 10px auto 0;
        flex-shrink: 0;
    }
}

/* ── VIDEO OVERLAY CONTROLS ──────────────────────────────── */
.video-controls-overlay {
    position: absolute;
    top: 0; left: 0; right: 0; bottom: 0;
    z-index: 500;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 14px;
    pointer-events: none;
    opacity: 0;
    transition: opacity 0.2s;
}
.video-controls-overlay.visible { opacity: 1; }
.vid-ctrl-btn {
    pointer-events: auto;
    background: rgba(0,0,0,0.55);
    border: none;
    border-radius: 50%;
    color: #fff;
    width: 58px;
    height: 58px;
    font-size: 22px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.15s;
}
.vid-ctrl-btn:active { background: rgba(255,255,255,0.25); }
.vid-ctrl-btn.vid-play { width: 64px; height: 64px; }
.vid-ctrl-row {
    display: flex;
    align-items: center;
    gap: 20px;
    pointer-events: auto;
}

/* ── GALLERY ─────────────────────────────────────────────── */
.modal-gallery-container {
    flex: 1;
    background: #000;
    position: relative;
    min-height: 420px;
    display: flex;
    flex-direction: column;
}
.gallery-track-wrapper {
    overflow: hidden;
    background: #000;
    flex-shrink: 0;
    touch-action: none;
}
#galleryTrack {
    display: flex;
    will-change: transform;
    user-select: none;
    -webkit-user-select: none;
}
.modal-content {
    min-width: 100%;
    width: 100%;
    height: 500px;
    object-fit: contain;
    background: var(--gallery-bg);
    flex-shrink: 0;
    display: block;
}
.modal-details {
    flex: 1;
    padding: 32px;
    color: var(--text-primary);
    overflow-y: auto;
    max-height: 75vh;
}
.modal-title {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--text-primary);
    margin: 0 0 8px;
    line-height: 1.3;
}
.modal-price-row {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 20px;
}
.modal-price {
    font-size: 1.55rem;
    font-weight: 700;
    color: var(--price-color);
}
.calc-btn {
    background: transparent;
    border: 1px solid var(--border);
    border-radius: 6px;
    color: var(--text-secondary);
    font-size: 0.78rem;
    font-weight: 600;
    padding: 4px 10px;
    cursor: pointer;
    font-family: inherit;
    transition: background 0.15s, color 0.15s, border-color 0.15s;
    white-space: nowrap;
}
.calc-btn:hover { background: var(--surface-2); color: var(--text-primary); border-color: var(--border-light); }
.modal-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 16px;
    margin-bottom: 20px;
    font-size: 0.9rem;
    color: var(--text-secondary);
    border-bottom: 1px solid var(--border);
    padding-bottom: 16px;
}
.modal-desc {
    line-height: 1.7;
    margin-bottom: 20px;
    white-space: pre-wrap;
    font-size: 0.9rem;
    color: var(--text-secondary);
}
.modal-video {
    margin-bottom: 16px;
}
.modal-video-player {
    width: 100%;
    max-height: 400px;
    border-radius: 8px;
    border: none;
    aspect-ratio: 16/9;
    background-color: #000;
    object-fit: contain;
}
.modal-source {
    font-size: 0.78rem;
    color: var(--text-muted);
    margin-bottom: 16px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.modal-source a {
    color: var(--text-muted);
    text-decoration: none;
}
.modal-source a:hover,
.modal-source a:focus  { text-decoration: underline; }
.modal-source:empty    { display: none; }
.close {
    position: absolute;
    top: 14px;
    right: 18px;
    color: var(--text-secondary);
    font-size: 26px;
    font-weight: 700;
    cursor: pointer;
    z-index: 1001;
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    transition: background 0.15s, color 0.15s;
    line-height: 1;
}
.close:hover { background: var(--danger); color: #fff; }
.gallery-nav {
    background: var(--gallery-bg);
    padding: 8px 10px;
    display: flex;
    overflow-x: auto;
    white-space: nowrap;
    gap: 6px;
}
.gallery-thumb {
    height: 56px;
    min-width: 56px;
    object-fit: cover;
    cursor: pointer;
    opacity: 0.4;
    transition: opacity 0.15s;
    border-radius: 4px;
    flex-shrink: 0;
}
.gallery-thumb:hover, .gallery-thumb.active {
    opacity: 1;
    outline: 2px solid var(--accent);
    outline-offset: 1px;
}
.nav-btn {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    background: rgba(0,0,0,0.55);
    color: rgba(255,255,255,0.85);
    border: none;
    padding: 14px 18px;
    font-size: 20px;
    cursor: pointer;
    z-index: 10000;
    border-radius: 6px;
    transition: background 0.2s;
    user-select: none;
    -webkit-user-select: none;
}
.nav-btn:hover { background: var(--accent); color: var(--on-accent); }
.prev-btn { left: 10px; }
.next-btn { right: 10px; }
@media (max-width: 768px) { .nav-btn { display: none !important; } }
