/* Основные переменные */
:root {
    --primary-dark: #00171c;
    --primary-accent: #4ecdc4;
    --primary-light: #88d8d0;
    --success-color: #28a745;
    --error-color: #dc3545;
    --warning-color: #ffc107;
    --text-dark: #00171c;
    --text-light: #ffffff;
    --bg-light: #f8f9fa;
    --border-light: #e9ecef;
    --shadow: 0 4px 20px rgba(0,23,28,0.1);
    --radius: 12px;
}

/* Контейнер конфигуратора */
.pc-configurator {
    display: grid;
    grid-template-columns: 1fr 350px;
    gap: 30px;
    max-width: 1400px;
    margin: 0 auto;
    padding: 20px;
}

/* Левая колонка - шаги и компоненты */
.configurator-main {
    background: #fff;
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    overflow: hidden;
}

/* Прогресс бар */
.configurator-progress {
    padding: 20px;
    background: var(--bg-light);
    border-bottom: 1px solid var(--border-light);
}

.progress-bar-container {
    height: 6px;
    background: var(--border-light);
    border-radius: 3px;
    overflow: hidden;
    margin-bottom: 10px;
}

.progress-bar {
    height: 100%;
    background: linear-gradient(90deg, var(--primary-accent), var(--primary-light));
    transition: width 0.3s ease;
}

.progress-text {
    text-align: center;
    color: var(--text-dark);
    font-weight: 600;
}

/* Шаги навигации */
.config-steps {
    display: flex;
    justify-content: space-between;
    padding: 20px;
    background: var(--bg-light);
    border-bottom: 1px solid var(--border-light);
}

.config-step {
    flex: 1;
    text-align: center;
    padding: 12px;
    background: #fff;
    border: 2px solid var(--border-light);
    border-radius: 8px;
    margin: 0 5px;
    cursor: pointer;
    transition: all 0.3s ease;
    font-weight: 600;
    color: #6c757d;
}

.config-step.active {
    border-color: var(--primary-accent);
    background: var(--primary-accent);
    color: var(--text-dark);
}

.config-step.completed {
    border-color: var(--success-color);
    background: var(--success-color);
    color: white;
}

.config-step.available:not(.active):not(.completed):hover {
    border-color: var(--primary-light);
    transform: translateY(-2px);
}

/* Область компонентов */
.components-area {
    padding: 30px;
    min-height: 500px;
}

.component-step {
    display: none;
}

.component-step.active {
    display: block;
    animation: fadeIn 0.5s ease;
}

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(20px); }
    to { opacity: 1; transform: translateY(0); }
}

.step-title {
    font-size: 1.5em;
    color: var(--text-dark);
    margin-bottom: 25px;
    text-align: center;
}

/* Сетка компонентов */
.components-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 20px;
    margin-bottom: 30px;
}

.component-card {
    background: #fff;
    border: 2px solid var(--border-light);
    border-radius: var(--radius);
    padding: 20px;
    cursor: pointer;
    transition: all 0.3s ease;
    position: relative;
}

.component-card:hover {
    border-color: var(--primary-light);
    transform: translateY(-5px);
    box-shadow: 0 8px 25px rgba(0,0,0,0.1);
}

.component-card.selected {
    border-color: var(--primary-accent);
    background: rgba(78, 205, 196, 0.05);
}

.component-card.out-of-stock {
    opacity: 0.6;
    cursor: not-allowed;
}

.component-card.out-of-stock::after {
    content: "Нет в наличии";
    position: absolute;
    top: 10px;
    right: 10px;
    background: var(--error-color);
    color: white;
    padding: 4px 8px;
    border-radius: 4px;
    font-size: 0.8em;
}

.component-image {
    text-align: center;
    margin-bottom: 15px;
}

.component-image img {
    max-width: 100%;
    height: 120px;
    object-fit: contain;
}

.component-info h4 {
    margin: 0 0 10px 0;
    color: var(--text-dark);
    font-size: 1.1em;
    line-height: 1.4;
}

.component-price {
    font-size: 1.3em;
    font-weight: 700;
    color: var(--primary-dark);
    margin-bottom: 10px;
}

.component-specs {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-bottom: 10px;
}

.component-specs span {
    background: var(--bg-light);
    padding: 4px 8px;
    border-radius: 4px;
    font-size: 0.85em;
    color: #495057;
}

/* Правая колонка - сводка */
.configurator-sidebar {
    background: #fff;
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    padding: 25px;
    position: sticky;
    top: 20px;
    height: fit-content;
}

.sidebar-title {
    font-size: 1.3em;
    color: var(--text-dark);
    margin-bottom: 20px;
    padding-bottom: 15px;
    border-bottom: 2px solid var(--primary-accent);
}

.build-summary-items {
    margin-bottom: 25px;
}

.summary-item {
    background: var(--bg-light);
    padding: 15px;
    border-radius: 8px;
    margin-bottom: 10px;
    border-left: 4px solid var(--primary-accent);
    position: relative;
}

.item-main {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 8px;
}

.item-name {
    font-weight: 600;
    color: var(--text-dark);
    flex: 1;
    margin-right: 10px;
}

.item-price {
    font-weight: 700;
    color: var(--primary-dark);
    white-space: nowrap;
}

.item-specs {
    display: flex;
    flex-wrap: wrap;
    gap: 5px;
}

.item-specs .spec {
    background: #fff;
    padding: 2px 6px;
    border-radius: 3px;
    font-size: 0.8em;
    color: #6c757d;
}

.item-remove {
    position: absolute;
    top: 10px;
    right: 10px;
    background: var(--error-color);
    color: white;
    border: none;
    width: 20px;
    height: 20px;
    border-radius: 50%;
    cursor: pointer;
    font-size: 14px;
    line-height: 1;
}

.total-section {
    border-top: 2px solid var(--border-light);
    padding-top: 20px;
    margin-bottom: 25px;
}

.total-price {
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 1.3em;
    font-weight: 700;
    color: var(--text-dark);
}

.sidebar-actions {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

#add-configuration-to-cart {
    background: var(--primary-accent);
    color: var(--text-dark);
    border: none;
    padding: 15px;
    border-radius: 8px;
    font-weight: 700;
    font-size: 1.1em;
    cursor: pointer;
    transition: all 0.3s ease;
}

#add-configuration-to-cart:hover:not(:disabled) {
    background: var(--primary-light);
    transform: translateY(-2px);
}

#add-configuration-to-cart:disabled {
    background: #6c757d;
    cursor: not-allowed;
    transform: none;
}

#restart-configuration {
    background: transparent;
    color: #6c757d;
    border: 1px solid #6c757d;
    padding: 12px;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.3s ease;
}

#restart-configuration:hover {
    background: #6c757d;
    color: white;
}

/* Сообщения и загрузка */
.configurator-messages {
    position: fixed;
    top: 20px;
    right: 20px;
    z-index: 1000;
}

.configurator-message {
    padding: 15px 20px;
    border-radius: 8px;
    margin-bottom: 10px;
    font-weight: 600;
    animation: slideIn 0.3s ease;
}

.configurator-message.success {
    background: var(--success-color);
    color: white;
}

.configurator-message.error {
    background: var(--error-color);
    color: white;
}

@keyframes slideIn {
    from { transform: translateX(100%); opacity: 0; }
    to { transform: translateX(0); opacity: 1; }
}

.loading-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0,0,0,0.7);
    display: none;
    align-items: center;
    justify-content: center;
    z-index: 9999;
}

.loading-overlay.active {
    display: flex;
}

.loading-content {
    background: white;
    padding: 30px;
    border-radius: var(--radius);
    text-align: center;
}

.loading-text {
    margin-top: 15px;
    font-weight: 600;
    color: var(--text-dark);
}

/* Адаптивность */
@media (max-width: 1024px) {
    .pc-configurator {
        grid-template-columns: 1fr;
    }
    
    .configurator-sidebar {
        position: static;
        margin-top: 30px;
    }
}

@media (max-width: 768px) {
    .pc-configurator {
        padding: 10px;
    }
    
    .config-steps {
        flex-direction: column;
        gap: 10px;
    }
    
    .components-grid {
        grid-template-columns: 1fr;
    }
    
    .components-area {
        padding: 20px;
    }
}

/* Нет компонентов */
.no-components {
    text-align: center;
    padding: 40px 20px;
    color: #6c757d;
}

.no-components p {
    margin-bottom: 10px;
}


/* Фильтры и категории */
.component-filters {
    margin-bottom: 25px;
    padding: 20px;
    background: var(--bg-light);
    border-radius: var(--radius);
}

.filter-categories {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 15px;
}

.filter-label {
    font-weight: 600;
    color: var(--text-dark);
    white-space: nowrap;
}

.category-buttons {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.category-btn {
    padding: 8px 16px;
    background: #fff;
    border: 2px solid var(--border-light);
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.3s ease;
    font-weight: 500;
}

.category-btn:hover {
    border-color: var(--primary-light);
}

.category-btn.active {
    background: var(--primary-accent);
    border-color: var(--primary-accent);
    color: var(--text-dark);
}

/* Бейдж текущего выбора */
.current-badge {
    position: absolute;
    top: 10px;
    left: 10px;
    background: var(--success-color);
    color: white;
    padding: 4px 8px;
    border-radius: 4px;
    font-size: 0.8em;
    font-weight: 600;
    z-index: 2;
}

/* Сравнение цен */
.component-price-comparison {
    margin-bottom: 10px;
}

.current-price {
    font-size: 1.3em;
    font-weight: 700;
    color: var(--primary-dark);
}

.price-difference {
    font-size: 1.2em;
    font-weight: 700;
    margin-bottom: 5px;
}

.price-difference.price-higher {
    color: var(--error-color);
}

.price-difference.price-lower {
    color: var(--success-color);
}

.price-difference.price-same {
    color: #6c757d;
}

.actual-price {
    font-size: 0.9em;
    color: #6c757d;
    text-decoration: line-through;
}

/* Кнопка выбора */
.component-action {
    margin-top: 15px;
    text-align: center;
}

.select-component-btn {
    background: var(--primary-accent);
    color: var(--text-dark);
    border: none;
    padding: 10px 20px;
    border-radius: 6px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    width: 100%;
}

.select-component-btn:hover {
    background: var(--primary-light);
    transform: translateY(-2px);
}

/* Выделение текущего выбора */
.component-card.current-selection {
    border-color: var(--success-color);
    background: rgba(40, 167, 69, 0.05);
    box-shadow: 0 4px 15px rgba(40, 167, 69, 0.2);
}

/* Скрываем цену у выбранных компонентов */
.current-selection .component-price-comparison .selected-badge {
    background: var(--success-color);
    color: white;
    padding: 8px 12px;
    border-radius: 6px;
    font-size: 0.9em;
    font-weight: 600;
    display: inline-block;
}

.current-selection .actual-price,
.current-selection .price-difference {
    display: none !important;
}

/* Стили для сводки */
.summary-item .item-price {
    font-weight: 700;
    color: var(--primary-dark);
    white-space: nowrap;
}

.assembly-fee {
    border-top: 2px dashed var(--border-light);
    margin-top: 10px;
    padding-top: 10px;
}