* {
    box-sizing: border-box;
}

.psm-container {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Arial, sans-serif;
    background: #f0f0f0;
    border-radius: 8px;
    overflow: hidden;
    box-shadow: 0 2px 10px rgba(0,0,0,0.1);
}

.psm-top-bar {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    padding: 12px;
    background: #fff;
    border-bottom: 1px solid #ddd;
    align-items: center;
}

.psm-top-bar button, .psm-top-bar select {
    padding: 6px 12px;
    font-size: 14px;
    border: 1px solid #ccc;
    border-radius: 4px;
    background: #f9f9f9;
    cursor: pointer;
}

.psm-top-bar button:hover {
    background: #e6e6e6;
}

.psm-main-area {
    display: flex;
    flex-wrap: wrap;
    gap: 20px;
    padding: 15px;
}

.psm-canvas-area {
    flex: 3;
    min-width: 0;
    background: #6c6c6c;  /* серый фон */
    border-radius: 8px;
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 10px;
    /* убираем overflow: auto, чтобы не было прокрутки */
}
#psm-canvas {
    display: block;
    width: 100%;
    height: auto;
    background: white;
    box-shadow: 0 0 0 2px rgba(0,0,0,0.2);
}

.psm-sidebar {
    flex: 1.5;
    min-width: 260px;
    background: #fff;
    border-radius: 8px;
    padding: 15px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.1);
    max-height: 85vh;
    overflow-y: auto;
}

.psm-layer-controls-top {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-bottom: 20px;
}

#psm-add-layer-btn{width: 100%;margin-bottom: 10px;}

.psm-layer-controls-top button, .psm-layer-controls-top select {
    padding: 6px 10px;
    border-radius: 4px;
    border: 1px solid #ccc;
    background: #f9f9f9;
    cursor: pointer;
    font-size: 13px;
}

.psm-properties h3 {
    margin-top: 0;
    font-size: 16px;
    border-bottom: 1px solid #eee;
    padding-bottom: 6px;
}

.prop-group label {
    display: block;
    margin: 8px 0 4px;
    font-size: 13px;
    font-weight: 500;
}

.prop-group input, .prop-group select, .prop-group textarea {
    width: 100%;
    padding: 6px;
    border: 1px solid #ccc;
    border-radius: 4px;
    font-size: 13px;
}

.prop-group input[type="range"] {
    padding: 0;
    margin-top: 4px;
}

.prop-group .range-with-number {
    display: flex;
    gap: 8px;
    align-items: center;
}
.prop-group .range-with-number input[type="number"] {
    width: 70px;
}

.psm-modal {
    display: none;
    position: fixed;
    z-index: 1000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0,0,0,0.5);
    overflow: auto;
}

.psm-modal-content {
    background-color: #fff;
    margin: 10% auto;
    padding: 20px;
    border-radius: 8px;
    width: 90%;
    max-width: 700px;
    box-shadow: 0 4px 20px rgba(0,0,0,0.2);
}

.psm-modal-content .close {
    float: right;
    font-size: 28px;
    font-weight: bold;
    cursor: pointer;
}

.psm-modal-content h2 {
    margin-top: 0;
}

#psm-category-buttons {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin: 10px 0;
}

#psm-category-buttons button, #psm-color-filters button {
    padding: 5px 10px;
    border: 1px solid #ccc;
    background: #f0f0f0;
    border-radius: 4px;
    cursor: pointer;
}

#psm-image-search {
    width: 100%;
    padding: 8px;
    margin: 10px 0;
    border: 1px solid #ccc;
    border-radius: 4px;
}

#psm-image-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(80px, 1fr));
    gap: 10px;
    max-height: 300px;
    overflow-y: auto;
    margin-top: 10px;
}

#psm-image-grid img {
    width: 100%;
    cursor: pointer;
    border: 1px solid #ddd;
    border-radius: 4px;
    transition: transform 0.1s;
}
#psm-image-grid img:hover {
    transform: scale(1.05);
}

@media (max-width: 768px) {
    .psm-main-area {
        flex-direction: column;
    }
    .psm-canvas-area {
        max-height: 60vh;
        max-width: 100%;
    }
    .psm-sidebar {
        max-height: none;
    }
}


/* Вкладки свойств */
.psm-prop-tabs {
    display: flex;
    flex-wrap: wrap;
    gap: 5px;
    margin-bottom: 15px;
    border-bottom: 1px solid #ddd;
    padding-bottom: 5px;
}
.psm-tab-btn {
    background: #f0f0f0;
    border: none;
    padding: 6px 12px;
    border-radius: 4px;
    cursor: pointer;
    font-size: 13px;
}
.psm-tab-btn.active {
    background: #0073aa;
    color: white;
}
.psm-tab-pane {
    transition: 0.2s;
}
@media (max-width: 768px) {
    .psm-prop-tabs {
        justify-content: space-around;
    }
    .psm-tab-btn {
        flex: 1;
        text-align: center;
        font-size: 12px;
        padding: 8px 4px;
    }
    .psm-sidebar {
        max-height: 60vh;
        overflow-y: auto;
    }
}



/* Кнопки выбора типа слоя */
.psm-add-type-btn {
    display: inline-flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    width: 80px;
    height: 80px;
    margin: 8px;
    background: #f9f9f9;
    border: 1px solid #ddd;
    border-radius: 12px;
    cursor: pointer;
    transition: 0.2s;
    box-shadow: 0 1px 2px rgba(0,0,0,0.05);
}
.psm-add-type-btn:hover {
    background: #e6f4ff;
    border-color: #0073aa;
    transform: translateY(-2px);
}
.psm-add-type-btn span:first-child {
    font-size: 32px;
    margin-bottom: 8px;
}
.psm-add-type-btn span:last-child {
    font-size: 12px;
    font-weight: 500;
    color: #333;
}
@media (max-width: 768px) {
    .psm-add-type-btn {
        width: 70px;
        height: 70px;
    }
    .psm-add-type-btn span:first-child {
        font-size: 28px;
    }
}