/* ── PRODUCT MODAL DESIGN SYSTEM ── */

.pm-overlay {
    position: fixed; inset: 0; z-index: 3000;
    background: rgba(3, 3, 4, 0.8);
    backdrop-filter: blur(12px); -webkit-backdrop-filter: blur(12px);
    display: flex; align-items: center; justify-content: center;
    opacity: 0; pointer-events: none; transition: opacity 0.4s ease;
    padding: 20px;
}

.pm-overlay.open {
    opacity: 1; pointer-events: auto;
}

.pm-modal {
    width: 100%; max-width: 1100px;
    background: var(--deep);
    border: 1px solid var(--border);
    border-radius: 16px;
    overflow: hidden;
    display: flex;
    position: relative;
    transform: translateY(30px) scale(0.98);
    transition: transform 0.5s cubic-bezier(0.16, 1, 0.3, 1);
    box-shadow: 0 40px 100px rgba(0, 0, 0, 0.8),
                inset 0 0 30px rgba(255, 61, 127, 0.03);
}

/* Visible handle is small (40×4), but the touch-target is wider (80×24)
   so users can actually grab it on mobile. pointer-events stays enabled
   on mobile (where the swipe-to-close gesture is bound). */
.pm-drag-handle {
    position: absolute; top: 0; left: 50%; transform: translateX(-50%);
    width: 80px; height: 24px;
    background: transparent;
    z-index: 10;
    pointer-events: none;
    display: flex; align-items: center; justify-content: center;
    cursor: grab;
}
.pm-drag-handle::before {
    content: '';
    width: 40px; height: 4px;
    background: var(--border);
    border-radius: 2px;
    transition: background 0.2s;
}
@media (max-width: 768px) {
    .pm-drag-handle { pointer-events: auto; }
    .pm-drag-handle:active::before { background: var(--pink); }
}

.pm-overlay.open .pm-modal {

    transform: translateY(0) scale(1);
}

.pm-close {
    position: absolute; top: 20px; right: 20px;
    background: transparent; border: none; color: var(--gray);
    font-family: 'IBM Plex Mono', monospace; font-size: 20px;
    cursor: pointer; transition: color 0.3s; z-index: 10;
    width: 32px; height: 32px; display: flex; align-items: center; justify-content: center;
}

.pm-close:hover { color: var(--pink); }

/* ── GALLERY SECTION ── */
.pm-gallery {
    flex: 1.2;
    background: var(--surface);
    position: relative;
    display: flex;
    flex-direction: column;
    border-right: 1px solid var(--border);
    overflow: hidden;
}

.pm-main-view {
    position: relative;
    width: 100%;
    aspect-ratio: 1 / 1;
    overflow: hidden;
    cursor: zoom-in;
}

.pm-main-view img {
    width: 100%; height: 100%; object-fit: cover;
    transition: opacity 0.3s ease;
}

.pm-magnifier {
    position: absolute;
    width: 150px; height: 150px;
    border: 2px solid var(--pink);
    border-radius: 50%;
    pointer-events: none;
    display: none;
    box-shadow: 0 0 15px var(--pink-glow);
    z-index: 5;
    background-repeat: no-repeat;
    background-position: center;
}

.pm-thumbnails {
    display: flex; gap: 12px; padding: 20px;
    justify-content: center;
    background: var(--deep);
}

.pm-thumb {
    width: 60px; height: 60px;
    border: 2px solid transparent;
    border-radius: 6px;
    cursor: pointer;
    overflow: hidden;
    transition: all 0.3s ease;
    opacity: 0.6;
}

.pm-thumb img { width: 100%; height: 100%; object-fit: cover; }

.pm-thumb.active {
    border-color: var(--pink);
    opacity: 1;
    box-shadow: 0 0 10px var(--pink-glow);
}

/* ── INFO SECTION ── */
.pm-info {
    flex: 1;
    padding: 48px;
    display: flex;
    flex-direction: column;
    background: radial-gradient(circle at top right, rgba(255, 61, 127, 0.05) 0%, transparent 70%), var(--deep);
}

.pm-header { margin-bottom: 32px; }

.pm-kicker {
    font-family: 'IBM Plex Mono', monospace;
    font-size: 10px; letter-spacing: 0.3em;
    text-transform: uppercase; color: var(--pink);
    margin-bottom: 12px;
}

.pm-title {
    font-family: 'Bebas Neue', sans-serif;
    font-size: 42px; letter-spacing: 0.04em;
    color: var(--white); line-height: 1;
    margin-bottom: 8px;
}

.pm-material {
    font-family: 'IBM Plex Mono', monospace;
    font-size: 11px; letter-spacing: 0.1em;
    color: var(--gray); text-transform: uppercase;
    border-bottom: 1px dashed rgba(122, 122, 138, 0.3);
    padding-bottom: 8px; display: inline-block;
}

/* ── TABS SYSTEM ── */
.pm-tabs-container {
    margin-bottom: 32px;
    display: flex; flex-direction: column;
}

.pm-tabs-nav {
    display: flex; gap: 24px;
    border-bottom: 1px solid var(--border);
    margin-bottom: 20px;
}

.pm-tab-btn {
    background: transparent; border: none;
    font-family: 'IBM Plex Mono', monospace;
    font-size: 11px; letter-spacing: 0.1em;
    text-transform: uppercase; color: var(--gray);
    padding: 12px 0; cursor: pointer;
    position: relative; transition: color 0.3s;
}

.pm-tab-btn.active { color: var(--white); }

.pm-tab-btn::after {
    content: ''; position: absolute; bottom: 0; left: 0;
    width: 0; height: 2px; background: var(--pink);
    transition: width 0.3s ease;
}

.pm-tab-btn.active::after { width: 100%; }

.pm-tabs-content { min-height: 120px; }

.pm-tab-pane {
    display: none;
    font-family: 'IBM Plex Mono', monospace;
    font-size: 14px; line-height: 1.7;
    color: var(--gray);
    animation: fadeIn 0.4s ease;
}

.pm-tab-pane.active { display: block; }

.pm-specs-grid {
    display: grid; grid-template-columns: auto 1fr;
    gap: 12px 32px;
}

.pm-spec-label {
    font-family: 'IBM Plex Mono', monospace;
    font-size: 11px; text-transform: uppercase;
    color: var(--pink);
}

.pm-spec-value {
    font-family: 'IBM Plex Mono', monospace;
    font-size: 14px; color: var(--white);
}

@keyframes fadeIn { from { opacity: 0; transform: translateY(5px); } to { opacity: 1; transform: translateY(0); } }

/* ── VARIATIONS (полноценные варианты: свои фото/цена) ── */
.pm-variations-section {
    margin-bottom: 28px;
}

.pm-variations-label {
    font-family: 'IBM Plex Mono', monospace;
    font-size: 10px; text-transform: uppercase;
    color: var(--gray); margin-bottom: 12px;
    letter-spacing: 0.1em;
}

.pm-variations-list {
    display: flex; flex-wrap: wrap; gap: 8px;
}

.pm-variation-btn {
    display: inline-flex; align-items: center; gap: 8px;
    background: var(--surface);
    border: 1px solid var(--border);
    color: var(--gray);
    font-family: 'IBM Plex Mono', monospace;
    font-size: 11px; letter-spacing: 0.05em;
    padding: 8px 14px;
    cursor: pointer;
    transition: all 0.3s ease;
    border-radius: 4px;
}

.pm-variation-btn:hover { border-color: var(--pink); color: var(--white); }

.pm-variation-btn.active {
    border-color: var(--pink);
    color: var(--white);
    background: rgba(255, 61, 127, 0.08);
    box-shadow: 0 0 12px rgba(255, 61, 127, 0.15);
}

.pm-variation-dot {
    width: 14px; height: 14px;
    border-radius: 50%;
    border: 1px solid rgba(245, 240, 240, 0.25);
    flex-shrink: 0;
    box-shadow: inset 0 0 4px rgba(0, 0, 0, 0.4);
}

.pm-variation-btn.disabled {
    opacity: 0.35; cursor: not-allowed;
    text-decoration: line-through;
    filter: grayscale(1);
}

/* ── VARIANTS SECTION ── */
.pm-variants-section {
    margin-bottom: 40px;
}

.pm-variants-label {
    font-family: 'IBM Plex Mono', monospace;
    font-size: 10px; text-transform: uppercase;
    color: var(--gray); margin-bottom: 12px;
    letter-spacing: 0.1em;
}

.pm-variants-list {
    display: grid; grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
    gap: 10px;
}

.pm-variant-btn {
    background: var(--surface);
    border: 1px solid var(--border);
    color: var(--white);
    font-family: 'IBM Plex Mono', monospace;
    font-size: 11px; padding: 10px;
    text-align: center; cursor: pointer;
    transition: all 0.3s ease;
    border-radius: 4px;
}

.pm-variant-btn:hover { border-color: var(--pink); color: var(--pink); }

.pm-variant-btn.active {
    background: var(--pink);
    border-color: var(--pink);
    color: var(--white);
}

.pm-variant-btn.disabled {
    opacity: 0.3; cursor: not-allowed;
    filter: grayscale(1);
}

/* ── FOOTER ── */
.pm-footer {
    display: flex; align-items: center; justify-content: space-between;
    margin-top: auto; padding-top: 24px;
    border-top: 1px solid var(--border);
}

.pm-price-display {
    display: flex; align-items: baseline;
    font-family: 'Bebas Neue', sans-serif;
    font-size: 38px; color: var(--white);
    letter-spacing: 0.02em;
}

.pm-currency {
    color: var(--pink); font-family: 'IBM Plex Mono', monospace;
    font-size: 18px; margin-right: 8px;
}

.pm-odometer {
    display: inline-block; min-width: 80px;
}

.pm-add-btn {
    font-family: 'IBM Plex Mono', monospace;
    font-size: 11px; letter-spacing: 0.2em;
    text-transform: uppercase; color: var(--white);
    background: var(--pink); border: 1px solid var(--pink);
    padding: 14px 32px; cursor: pointer;
    transition: all 0.3s; border-radius: 4px;
    position: relative; overflow: hidden;
}

.pm-add-btn:hover {
    background: transparent; color: var(--pink);
    box-shadow: 0 0 20px var(--pink-glow);
}

.pm-add-btn:active { transform: scale(0.96); }

/* ── MOBILE BOTTOM SHEET ── */
@media (max-width: 768px) {
    .pm-overlay {
        align-items: flex-end; padding: 0;
    }

    .pm-modal {
        width: 100%; border-radius: 24px 24px 0 0;
        flex-direction: column;
        transform: translateY(100%);
        max-height: 90vh; overflow-y: auto;
    }

    .pm-overlay.open .pm-modal {
        transform: translateY(0);
    }

    .pm-gallery {
        border-right: none; border-bottom: 1px solid var(--border);
        flex: none;
    }

    .pm-main-view { aspect-ratio: 4 / 3; }

    .pm-info {
        padding: 32px 24px;
    }

    .pm-title { font-size: 32px; }

    /* Tabs: горизонтальный свайп вместо обрезания за viewport */
    .pm-tabs-nav {
        gap: 4px;
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
        flex-wrap: nowrap;
        scrollbar-width: none;
        margin-left: -24px;
        margin-right: -24px;
        padding-left: 24px;
        padding-right: 24px;
    }
    .pm-tabs-nav::-webkit-scrollbar { display: none; }
    .pm-tab-btn {
        font-size: 12px;
        padding: 14px 12px;
        min-height: 44px;
        white-space: nowrap;
        flex-shrink: 0;
    }
}

/* ── VISUAL POLISH (CRT & FLASH) ── */
.pm-modal::after {
    content: ''; position: absolute; inset: 0;
    background: linear-gradient(
        rgba(18, 16, 16, 0) 50%,
        rgba(0, 0, 0, 0.1) 50%
    ), linear-gradient(
        90deg,
        rgba(255, 0, 0, 0.02),
        rgba(0, 255, 0, 0.01),
        rgba(0, 0, 255, 0.02)
    );
    background-size: 100% 4px, 3px 100%;
    pointer-events: none; z-index: 20;
}

@keyframes pmFlash {
    0% { opacity: 0; }
    10% { opacity: 0.8; background: var(--pink); }
    20% { opacity: 0; }
    100% { opacity: 0; }
}

.pm-flash {
    animation: pmFlash 0.3s ease-out;
}
