/* ===== RESET & BASE ===== */
* {
    box-sizing: border-box;
}

#constructor-app {
    max-width: 1400px;
    margin: 0 auto;
    padding: 20px;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Arial, sans-serif;
}

/* ===== HEADER ===== */
.constructor-header {
    margin-bottom: 30px;
    padding-bottom: 20px;
    border-bottom: 2px solid #e8e8e8;
}

.constructor-header h1 {
    margin: 0;
    color: #2c3e50;
    font-size: 32px;
}

.constructor-header p {
    margin: 5px 0 0;
    color: #7f8c8d;
    font-size: 16px;
}

/* ===== WRAPPER ===== */
.constructor-wrapper {
    display: flex;
    gap: 30px;
    align-items: flex-start;
}

.constructor-main {
    flex: 1;
    min-width: 0;
}

.constructor-sidebar {
    flex: 0 0 380px;
    position: sticky;
    top: 20px;
    top: 90px;
}

.constructor-sidebar button:disabled {
    background-color: #d3d3d3;
    cursor: not-allowed;
}
/* ===== COMPONENT GROUPS ===== */
.component-group {
    background: #f8f9fa;
    border-radius: 12px;
    padding: 20px;
    margin-bottom: 20px;
    border: 2px solid #e9ecef;
    transition: border-color 0.3s;
}

.component-group:hover {
    border-color: #dee2e6;
}

.component-group.optional {
    border-style: dashed;
}

.component-header {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 15px;
}

.component-header h3 {
    margin: 0;
    font-size: 18px;
    color: #2c3e50;
}

.required {
    color: #e74c3c;
    font-weight: bold;
    font-size: 18px;
}

.optional-badge {
    background: #6c757d;
    color: #fff;
    padding: 2px 10px;
    border-radius: 12px;
    font-size: 12px;
}

.hint {
    font-size: 13px;
    color: #6c757d;
    margin-left: auto;
}

.battery-counter {
    margin-top: 10px;
    font-size: 14px;
    color: #6c757d;
}

.battery-count {
    font-weight: bold;
    color: #2c3e50;
}

/* ===== COMPONENT ITEMS ===== */
.component-items {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 10px;
}

.component-item {
    background: #fff;
    border: 2px solid #dee2e6;
    border-radius: 8px;
    padding: 12px 15px;
    cursor: pointer;
    transition: all 0.25s ease;
    position: relative;
}

.component-item:hover:not(.disabled) {
    border-color: #ccc;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 123, 255, 0.15);
}

.component-item.selected {
    border-color: #AB201C;
    background: #FBF4F3;
    /*box-shadow: 0 0 0 3px rgba(40, 167, 69, 0.2);*/
}

/*.component-item.selected::after {
    content: '✓';
    position: absolute;
    top: 5px;
    right: 10px;
    color: #28a745;
    font-weight: bold;
    font-size: 18px;
}*/

.component-item.disabled {
    opacity: 0.4;
    cursor: not-allowed;
}

.component-item .item-name {
    font-weight: 500;
    font-size: 14px;
    color: #2c3e50;
}

.component-item .item-article {
    font-size: 12px;
    color: #6c757d;
    margin-top: 4px;
}

.component-item .item-price-badge {
    display: inline-block;
    margin-top: 6px;
    padding: 2px 0px;
    /*background: #e9ecef;*/
    border-radius: 4px;
    font-size: 16px;
    color: #333;
    font-weight: 600;
}

/* ===== COLOR SELECTOR ===== */
.color-selector {
    margin-top: 15px;
    padding: 15px;
    /*background: #fff;*/
    border-top: 1px solid #f1f3f5;
    display: none;
}

.component-item.selected .color-selector {
    display: block;
}

.color-selector label {
    display: block;
    margin-bottom: 10px;
    font-weight: 500;
    font-size: 14px;
}

.color-options {
    display: flex;
    gap: 12px;
    flex-wrap: wrap;
}

.color-option {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 6px 14px;
    border: 2px solid #dee2e6;
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.2s;
    background: #fff;
}

.color-option:hover {
    border-color: #ccc;
}

.color-option.active {
    border-color: #28a745;
    background: #f0fff4;
}

.color-option .color-circle {
    width: 20px;
    height: 20px;
    border-radius: 50%;
    border: 1px solid #ddd;
}

.color-option .color-name {
    font-size: 13px;
}

/* ===== SUMMARY ===== */
.summary-card {
    background: #fff;
    border-radius: 12px;
    padding: 24px;
    border: 1px solid #dee2e6;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.06);
}

.summary-card h3 {
    margin: 0 0 20px;
    font-size: 20px;
    color: #2c3e50;
}

.summary-items {
    margin-bottom: 20px;
    max-height: 400px;
    overflow-y: auto;
}
#summary-items {margin-top: 20px}

.summary-item {
    display: flex;
    justify-content: space-between;
    padding: 10px 0;
    border-bottom: 1px solid #f1f3f5;
    font-size: 14px;
}

.summary-item:last-child {
    border-bottom: none;
}

.summary-item .item-label {
    color: #495057;
}

.summary-item .item-value {
    font-weight: 500;
    color: #2c3e50;
    text-align: right;
}

.summary-item .item-color {
    font-size: 12px;
    color: #6c757d;
}

/* ===== TOTAL ===== */
.summary-total {
    padding: 15px 0;
    border-top: 2px solid #e9ecef;
    margin-top: 10px;
}

.total-label {
    font-size: 16px;
    color: #6c757d;
}

.total-price {
    font-size: 32px;
    font-weight: bold;
    color: #28a745;
    margin: 5px 0;
}

.total-hint {
    font-size: 13px;
    color: #6c757d;
}

/* ===== BUTTONS ===== */
.btn-add-cart {
    width: 100%;
    padding: 14px;
    background: #ccc;
    color: #fff;
    border: none;
    border-radius: 8px;
    font-size: 18px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s;
}

.btn-add-cart:hover:not(:disabled) {
    background: #0069d9;
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(0, 123, 255, 0.3);
}

.btn-add-cart:disabled {
    background: #adb5bd;
    cursor: not-allowed;
}

/* ===== MESSAGES ===== */
.compatibility-message {
    margin-top: 12px;
    padding: 10px;
    border-radius: 6px;
    font-size: 14px;
    display: none;
}

.compatibility-message.error {
    display: block;
    background: #fde8e8;
    color: #c0392b;
    border: 1px solid #f5c6cb;
}

.compatibility-message.success {
    display: block;
    background: #e8f5e9;
    color: #2e7d32;
    border: 1px solid #c8e6c9;
}

/* ===== RESPONSIVE ===== */
@media (max-width: 1024px) {
    .constructor-wrapper {
        flex-direction: column;
    }

    .constructor-sidebar {
        flex: none;
        width: 100%;
        position: static;
    }

    .component-items {
        grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
    }
}

@media (max-width: 600px) {
    .component-items {
        grid-template-columns: 1fr;
    }

    .summary-card {
        padding: 16px;
    }

    .constructor-header h1 {
        font-size: 24px;
    }
}

/* ===== КНОПКИ КОЛИЧЕСТВА ===== */
.item-quantity {
    display: flex;
    align-items: center;
    gap: 6px;
    margin-top: 8px;
    padding-top: 8px;
    border-top: 1px solid #f1f3f5;
}

.qty-btn {
    width: 26px;
    height: 26px;
    border: 1px solid #dee2e6;
    border-radius: 4px;
    background: #fff;
    cursor: pointer;
    font-size: 16px;
    font-weight: bold;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #495057;
    transition: all 0.2s;
}

.qty-btn:hover {
    background: #e9ecef;
    border-color: #adb5bd;
}

.qty-btn:active {
    background: #dee2e6;
}

.qty-value {
    min-width: 24px;
    text-align: center;
    font-weight: 600;
    font-size: 15px;
    color: #2c3e50;
}

/* ===== СЧЕТЧИК В СЕКЦИИ ===== */
.counter {
    margin-top: 10px;
    font-size: 13px;
    color: #6c757d;
    padding: 6px 12px;
    background: #f8f9fa;
    border-radius: 4px;
}

.count {
    font-weight: bold;
    color: #2c3e50;
}
#total-sum {font-size: 18px; margin: 20px 0; font-weight: bold;}