﻿#colorsModal .modal-dialog {
    max-width: 1200px;
}

#colorsModal .modal-content {
    border: 0;
    border-radius: 22px;
    background: transparent;
    overflow: hidden;
}

.paint-color-modal {
    position: relative;
    width: 100%;
    max-height: 88vh;
    background: #fff;
    border-radius: 22px;
    overflow: hidden;
    color: #172033;
    display: flex;
    flex-direction: column;
}

.paint-modal-close {
    position: absolute;
    top: 18px;
    right: 18px;
    z-index: 20;
    width: 44px;
    height: 44px;
    border: 0;
    border-radius: 50%;
    background: #f3f5f8;
    color: #111827;
    font-size: 28px;
    line-height: 44px;
    cursor: pointer;
}

.paint-modal-header {
    padding: 32px 42px 8px;
}

    .paint-modal-header h3 {
        margin: 0;
        font-size: 34px;
        font-weight: 600;
    }

    .paint-modal-header p {
        margin: 8px 0 0;
        font-size: 18px;
        color: #7c8494;
    }

.paint-tabs {
    display: flex;
    gap: 14px;
    padding: 18px 42px 12px;
}

    .paint-tabs a {
        min-height: 54px;
        padding: 0 28px;
        border: 1px solid #d8e0ea;
        border-radius: 14px;
        display: inline-flex;
        align-items: center;
        justify-content: center;
        color: #172033;
        text-decoration: none;
        font-size: 18px;
        background: #fff;
    }

        .paint-tabs a.active {
            background: #102f70;
            border-color: #102f70;
            color: #fff;
        }

.paint-search {
    padding: 12px 42px 22px;
}

    .paint-search input {
        width: 100%;
        height: 56px;
        border: 1px solid #d8e0ea;
        border-radius: 16px;
        padding: 0 22px;
        font-size: 17px;
        outline: none;
    }

        .paint-search input:focus {
            border-color: #102f70;
            box-shadow: 0 0 0 3px rgba(16, 47, 112, .08);
        }

.paint-modal-body {
    flex: 1;
    min-height: 0;
    display: grid;
    grid-template-columns: minmax(0, 1fr) 420px;
    gap: 36px;
    padding: 0 42px;
    overflow: hidden;
}

.paint-colors-area,
.paint-preview-area {
    min-width: 0;
    overflow: hidden;
}

.paint-section-head,
.paint-preview-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 18px;
    gap: 12px;
}

    .paint-section-head strong,
    .paint-preview-head strong {
        font-size: 20px;
        font-weight: 600;
    }

    .paint-section-head span,
    .paint-preview-head span {
        font-size: 16px;
        color: #102f70;
    }

.paint-color-grid,
.modal-color-list {
    width: 100%;
    max-height: 100%;
    overflow-y: auto;
    overflow-x: hidden;
    display: grid !important;
    grid-template-columns: repeat(3, minmax(0, 1fr)) !important;
    gap: 20px 18px;
    padding-right: 8px;
    padding-bottom: 12px;
}

.paint-color-card {
    width: 100%;
    min-width: 0;
    border: 1px solid transparent;
    border-radius: 14px;
    background: transparent;
    padding: 0;
    text-align: left;
    cursor: pointer;
}

    .paint-color-card.active {
        border-color: #102f70;
        box-shadow: 0 0 0 2px rgba(16, 47, 112, .12);
    }

.paint-color-swatch {
    display: block;
    width: 100%;
    height: 72px;
    border-radius: 12px;
    border: 1px solid rgba(0,0,0,.10);
    background: #f4f3ef;
}

.paint-color-title {
    display: block;
    margin-top: 9px;
    font-size: 14px;
    color: #172033;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.paint-interior-slider {
    position: relative;
    overflow: hidden;
    border-radius: 20px;
}

.paint-slider-track {
    position: relative;
    width: 100%;
    aspect-ratio: 1200 / 760;
}

.paint-room-slide {
    position: absolute;
    inset: 0;
    opacity: 0;
    visibility: hidden;
    transform: scale(1.015);
    transition: opacity .25s ease, transform .25s ease, visibility .25s ease;
}

    .paint-room-slide.active {
        opacity: 1;
        visibility: visible;
        transform: scale(1);
    }

.paint-room-preview {
    position: relative;
    width: 100%;
    height: 100%;
    border-radius: 20px;
    overflow: hidden;
    background: #f0eeeb;
}

.paint-room-image {
    position: absolute;
    inset: 0;
    z-index: 1;
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.paint-color-overlay {
    position: absolute;
    inset: 0;
    z-index: 2;
    background: #f0eeeb;
    mix-blend-mode: multiply;
    opacity: .38;
    pointer-events: none;
}

.paint-slider-btn {
    position: absolute;
    top: 50%;
    z-index: 6;
    transform: translateY(-50%);
    width: 42px;
    height: 42px;
    border: 0;
    border-radius: 50%;
    background: rgba(255,255,255,.92);
    color: #102f70;
    font-size: 30px;
    line-height: 1;
    cursor: pointer;
    box-shadow: 0 8px 24px rgba(0,0,0,.12);
}

.paint-slider-prev {
    left: 12px;
}

.paint-slider-next {
    right: 12px;
}

.paint-preview-thumbs {
    display: grid;
    grid-template-columns: repeat(5, minmax(0, 1fr));
    gap: 10px;
    margin-top: 14px;
}

.paint-preview-thumb {
    border: 2px solid transparent;
    border-radius: 12px;
    background: transparent;
    padding: 0;
    cursor: pointer;
    text-align: center;
    overflow: hidden;
}

    .paint-preview-thumb.active {
        border-color: #102f70;
    }

.paint-thumb-image {
    display: block;
    aspect-ratio: 16 / 10;
    border-radius: 10px;
    overflow: hidden;
}

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

.paint-thumb-title {
    display: block;
    margin-top: 6px;
    font-size: 13px;
    color: #172033;
}

.paint-preview-note {
    margin-top: 16px;
    font-size: 15px;
    line-height: 1.45;
    color: #7c8494;
}

.paint-modal-footer {
    flex-shrink: 0;
    margin-top: 24px;
    padding: 18px 42px;
    border-top: 1px solid #eef1f5;
    background: #fff;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 24px;
}

.paint-selected {
    display: flex;
    align-items: center;
    gap: 16px;
    min-width: 0;
}

.paint-selected-preview {
    width: 64px;
    height: 64px;
    border-radius: 16px;
    border: 1px solid #d8d8d8;
    background: #f5f4ef;
    flex-shrink: 0;
}

.paint-selected small {
    display: block;
    margin-bottom: 4px;
    font-size: 15px;
    color: #7c8494;
}

.paint-selected strong {
    display: block;
    font-size: 24px;
    line-height: 1.1;
    color: #172033;
}

.paint-apply-btn {
    height: 58px;
    min-width: 280px;
    border: 0;
    border-radius: 16px;
    background: #102f70;
    color: #fff;
    font-size: 18px;
    cursor: pointer;
}

    .paint-apply-btn:hover {
        background: #0b255b;
    }

@media (min-width: 1200px) {
    .paint-color-grid,
    .modal-color-list {
        grid-template-columns: repeat(4, minmax(0, 1fr)) !important;
    }
}

@media (max-width: 991px) {
    .paint-color-modal {
        max-height: 92vh;
    }

    .paint-modal-body {
        grid-template-columns: 1fr;
        overflow-y: auto;
    }

    .paint-color-grid,
    .modal-color-list {
        max-height: none;
        overflow: visible;
        grid-template-columns: repeat(4, minmax(0, 1fr)) !important;
    }

    .paint-preview-area {
        margin-top: 24px;
    }
}

@media (max-width: 640px) {
    #colorsModal {
        z-index: 100000003 !important;
        padding: 0 !important;
    }

    .modal-backdrop {
        z-index: 99998 !important;
    }

    body.modal-open {
        overflow: hidden !important;
    }

    #colorsModal .modal-dialog {
        margin: 0;
        max-width: 100%;
        width: 100%;
        height: 100dvh;
        min-height: 100dvh;
        align-items: stretch;
    }

    #colorsModal .modal-content {
        width: 100%;
        height: 100dvh;
        max-height: 100dvh;
        border-radius: 0;
        overflow: hidden;
    }

    .paint-color-modal {
        height: 100dvh;
        max-height: 100dvh;
        border-radius: 0;
        overflow: hidden;
    }

    .paint-modal-close {
        top: 14px;
        right: 14px;
        width: 38px;
        height: 38px;
        font-size: 25px;
        line-height: 38px;
    }

    .paint-modal-header {
        flex-shrink: 0;
        padding: 18px 16px 4px;
    }

        .paint-modal-header h3 {
            font-size: 22px;
            padding-right: 44px;
        }

        .paint-modal-header p {
            margin-top: 4px;
            font-size: 13px;
        }

    .paint-tabs {
        flex-shrink: 0;
        padding: 10px 16px 8px;
        gap: 8px;
        overflow-x: auto;
        scrollbar-width: none;
    }

        .paint-tabs::-webkit-scrollbar {
            display: none;
        }

        .paint-tabs a {
            min-height: 40px;
            padding: 0 15px;
            font-size: 14px;
            white-space: nowrap;
            border-radius: 12px;
        }

    .paint-search {
        flex-shrink: 0;
        padding: 8px 16px 10px;
    }

        .paint-search input {
            height: 44px;
            font-size: 14px;
            border-radius: 13px;
        }

    .paint-modal-body {
        flex: 1;
        min-height: 0;
        padding: 0 16px 10px;
        display: flex;
        flex-direction: column;
        overflow-y: auto;
        overflow-x: hidden;
        -webkit-overflow-scrolling: touch;
    }

    .paint-preview-area {
        order: 1;
        flex-shrink: 0;
        margin-top: 0;
        overflow: visible;
        position: relative;
    }

    .paint-colors-area {
        order: 2;
        flex-shrink: 0;
        min-height: 230px;
        margin-top: 12px;
        display: flex;
        flex-direction: column;
        overflow: hidden;
        position: relative;
        padding-bottom: 8px;
    }

    .paint-preview-head,
    .paint-section-head {
        margin-bottom: 8px;
    }

        .paint-preview-head::after {
            content: "выберите сцену ниже";
            margin-left: auto;
            font-size: 12px;
            font-weight: 500;
            color: #7c8494;
            background: #f3f5f8;
            border-radius: 999px;
            padding: 4px 9px;
        }

        .paint-section-head::after {
            content: "← листайте цвета →";
            margin-left: auto;
            font-size: 12px;
            font-weight: 500;
            color: #7c8494;
            background: #f3f5f8;
            border-radius: 999px;
            padding: 4px 9px;
        }

        .paint-section-head strong,
        .paint-preview-head strong {
            font-size: 16px;
        }

        .paint-section-head span,
        .paint-preview-head span {
            display: none;
        }

    .paint-interior-slider {
        border-radius: 16px;
        overflow: hidden;
    }

    .paint-slider-track {
        position: relative;
        width: 100%;
        height: 178px;
        aspect-ratio: auto;
        padding: 0;
    }

    .paint-room-slide {
        position: absolute;
        inset: 0;
        width: 100%;
        height: 178px;
        opacity: 0;
        visibility: hidden;
        transform: scale(1.01);
        transition: opacity .22s ease, transform .22s ease, visibility .22s ease;
    }

        .paint-room-slide.active {
            opacity: 1;
            visibility: visible;
            transform: scale(1);
        }

    .paint-room-preview {
        border-radius: 16px;
    }

    .paint-slider-btn {
        display: none;
    }

    .paint-preview-thumbs {
        display: flex;
        gap: 8px;
        margin-top: 8px;
        overflow-x: auto;
        padding: 0 30px 4px 0;
        scrollbar-width: none;
        position: relative;
    }

        .paint-preview-thumbs::-webkit-scrollbar {
            display: none;
        }

        .paint-preview-thumbs::after {
            content: "";
            position: sticky;
            right: 0;
            min-width: 34px;
            height: 58px;
            pointer-events: none;
            background: linear-gradient(to left, #fff, rgba(255,255,255,0));
        }

    .paint-preview-thumb {
        min-width: 78px;
        flex: 0 0 78px;
        border-radius: 10px;
    }

    .paint-thumb-image {
        border-radius: 8px;
    }

    .paint-thumb-title {
        font-size: 11px;
        margin-top: 4px;
    }

    .paint-preview-note {
        display: none;
    }

    .paint-color-grid,
    .modal-color-list {
        flex: 1;
        min-height: 0;
        height: 178px;
        max-height: 178px;
        overflow-x: auto;
        overflow-y: hidden;
        display: grid !important;
        grid-auto-flow: column;
        grid-auto-columns: 128px;
        grid-template-rows: repeat(2, auto);
        grid-template-columns: none !important;
        gap: 12px;
        padding-right: 36px;
        padding-bottom: 10px;
        -webkit-overflow-scrolling: touch;
        scrollbar-width: thin;
        scroll-snap-type: x proximity;
    }

        .paint-color-grid::after,
        .modal-color-list::after {
            content: "";
            width: 24px;
            height: 1px;
            grid-row: 1 / span 2;
        }

    .paint-colors-area::after {
        content: "";
        position: absolute;
        top: 32px;
        right: 0;
        bottom: 0;
        width: 42px;
        z-index: 4;
        pointer-events: none;
        background: linear-gradient(to left, #fff, rgba(255,255,255,0));
    }

    .paint-color-card {
        scroll-snap-align: start;
    }

    .paint-color-swatch {
        height: 50px;
        border-radius: 10px;
    }

    .paint-color-title {
        margin-top: 6px;
        font-size: 12px;
    }

    .paint-modal-footer {
        flex-shrink: 0;
        position: relative;
        z-index: 10;
        margin-top: 0;
        padding: 9px 16px calc(12px + env(safe-area-inset-bottom));
        flex-direction: row;
        align-items: center;
        gap: 10px;
        box-shadow: 0 -8px 24px rgba(0,0,0,.06);
        background: #fff;
    }

    .paint-selected {
        flex: 1;
        gap: 10px;
        min-width: 0;
    }

    .paint-selected-preview {
        width: 44px;
        height: 44px;
        border-radius: 12px;
    }

    .paint-selected small {
        font-size: 12px;
        margin-bottom: 2px;
    }

    .paint-selected strong {
        font-size: 17px;
        white-space: nowrap;
        overflow: hidden;
        text-overflow: ellipsis;
    }

    .paint-apply-btn {
        width: auto;
        min-width: 128px;
        height: 46px;
        padding: 0 13px;
        border-radius: 13px;
        font-size: 14px;
        white-space: nowrap;
    }
}