@import url("root.css");

/* Общие стили */
body {
    background: linear-gradient(-45deg, rgb(160, 5, 5), var(--black) 45%, var(--white) 150%);
    background-repeat: no-repeat;
    background-size: cover;
    background-attachment: fixed;
    color: var(--white);
    font-family: Arial, sans-serif;
    margin: 0;
    padding: 20px;
}

h1 {
    text-align: center;
    margin-top: 20px;
    font-size: 32px;
}

.back-btn {
    display: inline-block;
    margin: 20px;
    color: var(--white);
    text-decoration: none;
    font-size: 18px;
    opacity: 0.8;
    transition: 0.2s;
}

.back-btn:hover {
  transform: translateY(-2px);
}

/* Основной лейаут */

.builder-layout {
    display: flex;
    gap: 20px;
    padding: 20px;
}

/* левая панель  */

.summary-panel {
    background: var(--darkgray);
    padding: 20px;
    border-radius: 10px;
    box-shadow: 0 0 10px #000;
    flex: 0 400px; /* минимальная ширина */
}

.summary-panel h2 {
    margin-bottom: 15px;
    font-size: 24px;
}

.summary-table {
    width: 100%;
    border-collapse: collapse;
    margin-bottom: 20px;
}

.summary-table td {
    padding: 8px 0;
    border-bottom: 1px solid #333;
}

.total {
    font-size: 20px;
    margin-bottom: 20px;
}

.clear-btn {
    width: 100%;
    padding: 12px;
    background: #dc2626;
    border: none;
    border-radius: 8px;
    color: white;
    font-size: 18px;
    cursor: pointer;
    transition: 0.2s;
}

.clear-btn:hover {
    background: #b91c1c;
    transform: scale(1.02);
}

.clear-btn:active {
    transform: scale(0.98);
}

/* Правая таблица */
.parts-table tbody tr:nth-child(odd) {
    background: #1e1e1e;
}

.parts-table tbody tr:nth-child(even) {
    background: #252525;
}
.parts-table tbody tr:hover {
    background: #333;
    transition: 0.2s;
}

.parts-table-container {
    width: 75%;
}

.parts-table {
    width: 100%;
    border-collapse: collapse;
    background: var(--darkgray);
    overflow: hidden;
    box-shadow: 0 0 10px #000;
    border-radius: 12px;
    overflow: hidden;
    box-shadow: 0 0 12px rgba(0,0,0,0.6);
}

.parts-table td:nth-child(1) { width: 28%; }
.parts-table td:nth-child(2) { width: 28%; }
.parts-table td:nth-child(3) { width: 24%; }
.parts-table td:nth-child(4) { width: 20%; }

.parts-table th {
    background: var(--black);
    padding: 14px;
    text-align: left;
    font-size: 18px;
}

.parts-table td {
    padding: 12px 14px;
    border-bottom: 1px solid #333;
}

/* Кнопки в таблице */

.parts-table button {
    background: var(--lightgray);
    color: white;
    border: 1px solid #636363;
    padding: 6px 12px;
    border-radius: 6px;
    cursor: pointer;
    transition: 0.2s;
    margin-right: 6px;
}

.parts-table button:hover {
    background: #636363;
    border: 1px solid rgb(165, 165, 165);
}
/* ДАНЕК НЕ ТРОГАЙ ЭТО ОНО ЕЛЕ РАБОТАЕТ */
.parts-table td button:nth-child(2) {
    border-color: #ff0000;
    color: #ffffff;
}

.parts-table td button:nth-child(2):hover {
    background: #636363;
    color: white;
}

/* Совместимость */

.compat {
    color: #4caf50;
    font-weight: bold;
}

.incompat {
    color: #ff5252;
    font-weight: bold;
}

/* Модалка */
.compat-modal {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.7);
    justify-content: center;
    align-items: center;
}

.compat-modal-content {
    background: var(--darkgray);
    padding: 20px;
    border-radius: 10px;
    width: 350px;
    text-align: center;
    box-shadow: 0 0 10px #000;
}

.compat-buttons button {
    margin-top: 15px;
    padding: 10px 20px;
    background: var(--darkred);
    border: none;
    border-radius: 6px;
    color: white;
    cursor: pointer;
    transition: 0.2s;
}

.compat-buttons button:hover {
    background: rgb(200, 0, 0);
}

::selection {
    background: #47474793;
    color: white;      
}

@keyframes fadeSlide {
    0% {
        opacity: 0;
        transform: translateY(12px);
    }
    100% {
        opacity: 1;
        transform: translateY(0);
    }
}

/* базовое состояние строк */
.parts-table tbody tr {
    opacity: 0;
    transform: translateY(12px);
}

/* когда строка должна анимироваться */
.parts-table tbody tr.animate-in {
    animation: fadeSlide 0.7s ease forwards;
}

.parts-table tbody tr.animate-in:nth-child(1) { animation-delay: 0.10s; }
.parts-table tbody tr.animate-in:nth-child(2) { animation-delay: 0.20s; }
.parts-table tbody tr.animate-in:nth-child(3) { animation-delay: 0.30s; }
.parts-table tbody tr.animate-in:nth-child(4) { animation-delay: 0.40s; }
.parts-table tbody tr.animate-in:nth-child(5) { animation-delay: 0.50s; }
.parts-table tbody tr.animate-in:nth-child(6) { animation-delay: 0.60s; }
.parts-table tbody tr.animate-in:nth-child(7) { animation-delay: 0.70s; }
.parts-table tbody tr.animate-in:nth-child(8) { animation-delay: 0.80s; }

/* Начальное состояние — панель скрыта слева */
.summary-panel {
    transform: translateX(-90px);
    opacity: 0;
    animation: slideIn 1.5s ease forwards;
}

/* Анимация выезда */
@keyframes slideIn {
    0% {
        transform: translateX(-90px);
        opacity: 0;
    }
    100% {
        transform: translateX(0);
        opacity: 1;
    }
}

/* Выравнивание цен по вертикали */
.price-cell {
    white-space: nowrap;
    vertical-align: middle;
    line-height: 1.4;
}

/* Для левой панели */
.summary-table .price-cell {
    text-align: right;
    white-space: nowrap;
}

/* Для правой таблицы - выравниваем все ячейки по центру по вертикали */
.parts-table td,
.summary-table td {
    vertical-align: middle;
}

/* Для общего итога */
.total {
    font-size: 20px;
    margin-bottom: 20px;
    text-align: right;
}

.total span {
    font-weight: bold;
    white-space: nowrap;
}


