/* ===== /podderzhka/konstruktor-tz-servera/css/style.css ===== */

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}
body {
    font-family: 'Segoe UI', Roboto, system-ui, sans-serif;
    background: #f4f8fb;
    color: #0f3b4f;
    padding: 1.5rem;
    min-height: 100vh;
    display: flex;
    justify-content: center;
    align-items: flex-start;
}
.container {
    max-width: 1400px;
    width: 100%;
    background: #ffffff;
    border-radius: 2rem;
    box-shadow: 0 12px 40px rgba(0,0,0,0.08);
    padding: 2rem 2rem 2.5rem;
    transition: padding 0.2s;
}
h1 {
    font-size: 1.8rem;
    font-weight: 700;
    margin-bottom: 0.5rem;
    color: #0a2a38;
    display: flex;
    align-items: center;
    gap: 0.75rem;
    flex-wrap: wrap;
}
h1 small {
    font-size: 0.9rem;
    font-weight: 400;
    color: #5c7f8c;
    margin-left: auto;
}
.sub {
    color: #3a6b7a;
    margin-bottom: 2rem;
    font-size: 0.95rem;
    border-left: 4px solid #2f8db0;
    padding-left: 1rem;
}
.builder-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.9rem;
    margin-bottom: 2rem;
}
.builder-table th {
    text-align: left;
    padding: 0.7rem 0.5rem;
    background: #e9f0f5;
    font-weight: 600;
    color: #0f3b4f;
    border-bottom: 2px solid #cbdde8;
}
.builder-table td {
    padding: 0.5rem 0.4rem;
    border-bottom: 1px solid #e2edf2;
    vertical-align: middle;
}
.builder-table .cat-label {
    font-weight: 600;
    color: #1d5a6d;
    white-space: nowrap;
    padding-right: 1rem;
    width: 12%;
    min-width: 80px;
}
.builder-table select,
.builder-table input[type="number"],
.builder-table input[type="text"] {
    width: 100%;
    padding: 0.4rem 0.5rem;
    border: 1px solid #d4e2ec;
    border-radius: 8px;
    font-size: 0.85rem;
    background: #fafdff;
    transition: border 0.15s;
    font-family: inherit;
}
.builder-table select:focus,
.builder-table input:focus {
    border-color: #2f8db0;
    outline: none;
    box-shadow: 0 0 0 3px rgba(47,141,176,0.15);
}
.builder-table .qty-input {
    width: 70px;
    min-width: 60px;
    text-align: center;
}
.builder-table .chk-wrap {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.3rem;
}
.builder-table .chk-wrap input[type="checkbox"] {
    width: 18px;
    height: 18px;
    accent-color: #2f8db0;
    cursor: pointer;
}
.builder-table .chk-wrap label {
    font-size: 0.75rem;
    color: #3a6b7a;
    cursor: pointer;
}

/* ===== Кнопки управления строками ===== */
.row-actions {
    display: flex;
    gap: 0.3rem;
    align-items: center;
    flex-wrap: nowrap;
}
.btn-row {
    background: none;
    border: none;
    cursor: pointer;
    font-size: 1.1rem;
    padding: 0.2rem 0.4rem;
    border-radius: 4px;
    transition: background 0.15s;
    line-height: 1;
    color: #5c7f8c;
}
.btn-row:hover {
    background: #e9f0f5;
}
.btn-row.add {
    color: #1f8b6d;
}
.btn-row.add:hover {
    background: #e6f5ef;
}
.btn-row.remove {
    color: #c0392b;
}
.btn-row.remove:hover {
    background: #fde8e5;
}
.btn-row.remove:disabled {
    opacity: 0.3;
    cursor: not-allowed;
}

/* ===== Кнопки основных действий ===== */
.actions {
    display: flex;
    flex-wrap: wrap;
    gap: 1rem;
    margin: 1.5rem 0 2rem;
}
.btn {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    background: #eef3f8;
    border: none;
    padding: 0.7rem 1.8rem;
    border-radius: 40px;
    font-weight: 600;
    font-size: 0.95rem;
    color: #0f3b4f;
    cursor: pointer;
    transition: background 0.15s, transform 0.1s;
    font-family: inherit;
    text-decoration: none;
    border: 1px solid transparent;
}
.btn:hover {
    background: #e2eaf2;
}
.btn-primary {
    background: #1d6d8a;
    color: #fff;
}
.btn-primary:hover {
    background: #155a73;
}
.btn-success {
    background: #1f8b6d;
    color: #fff;
}
.btn-success:hover {
    background: #17755b;
}
.btn-outline {
    background: transparent;
    border-color: #cbdde8;
}
.btn-outline:hover {
    background: #f0f6fa;
}
.btn:disabled {
    opacity: 0.6;
    cursor: not-allowed;
    transform: none;
}
.result-area {
    margin-top: 2rem;
    border-top: 2px dashed #d4e2ec;
    padding-top: 2rem;
    display: none;
}
.result-area.visible {
    display: block;
}
.result-header {
    display: flex;
    flex-wrap: wrap;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1.2rem;
}
.result-header h2 {
    font-size: 1.4rem;
    font-weight: 600;
}
.result-actions {
    display: flex;
    gap: 0.8rem;
    flex-wrap: wrap;
}
.spec-table-wrap {
    overflow-x: auto;
    margin: 1rem 0 1.5rem;
    border-radius: 12px;
    border: 1px solid #e2edf2;
}
.spec-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.82rem;
    min-width: 700px;
}
.spec-table th {
    background: #e9f0f5;
    font-weight: 600;
    color: #0f3b4f;
    padding: 0.6rem 0.5rem;
    text-align: center;
    border-bottom: 2px solid #cbdde8;
    white-space: nowrap;
}
.spec-table td {
    padding: 0.5rem 0.4rem;
    text-align: center;
    border-bottom: 1px solid #e2edf2;
    word-break: break-word;
    vertical-align: middle;
}
.spec-table td:first-child {
    font-weight: 600;
    color: #1d5a6d;
    background: #f8fbfd;
}
.spec-table tr:last-child td {
    border-bottom: none;
}
.short-spec {
    background: #f8fbfd;
    padding: 0.8rem 1.2rem;
    border-radius: 12px;
    border: 1px solid #d4e2ec;
    font-family: 'Courier New', monospace;
    font-size: 0.9rem;
    word-break: break-word;
    margin: 0.5rem 0 1rem;
    display: flex;
    align-items: center;
    gap: 1rem;
    flex-wrap: wrap;
}
.short-spec .copy-btn {
    background: none;
    border: none;
    color: #2f8db0;
    font-size: 1.2rem;
    cursor: pointer;
    padding: 0.2rem 0.5rem;
    border-radius: 6px;
    transition: background 0.1s;
    margin-left: auto;
}
.short-spec .copy-btn:hover {
    background: #e2eaf2;
}
.toast {
    position: fixed;
    bottom: 2rem;
    left: 50%;
    transform: translateX(-50%);
    background: #0f3b4f;
    color: #fff;
    padding: 0.6rem 1.8rem;
    border-radius: 40px;
    font-size: 0.9rem;
    opacity: 0;
    transition: opacity 0.3s;
    pointer-events: none;
    z-index: 999;
    white-space: nowrap;
}
.toast.show {
    opacity: 1;
}

@media (max-width: 1024px) {
    .container { padding: 1.5rem; }
    .builder-table .cat-label { width: 15%; min-width: 70px; }
}
@media (max-width: 768px) {
    body { padding: 0.8rem; }
    .container { padding: 1rem; border-radius: 1.5rem; }
    h1 { font-size: 1.3rem; flex-wrap: wrap; }
    h1 small { margin-left: 0; width: 100%; font-size: 0.8rem; }
    .builder-table { font-size: 0.8rem; }
    .builder-table th { display: none; }
    .builder-table tbody,
    .builder-table tr,
    .builder-table td {
        display: block;
        width: 100%;
    }
    .builder-table tr {
        background: #fafdff;
        border: 1px solid #d4e2ec;
        border-radius: 12px;
        padding: 0.6rem 0.8rem;
        margin-bottom: 0.8rem;
        position: relative;
    }
    .builder-table td {
        border: none;
        padding: 0.25rem 0;
        display: flex;
        flex-wrap: wrap;
        align-items: center;
        gap: 0.3rem;
    }
    .builder-table .cat-label {
        width: 100%;
        font-weight: 700;
        padding-right: 0;
        font-size: 0.85rem;
        color: #0f3b4f;
        margin-bottom: 0.2rem;
    }
    .builder-table td select,
    .builder-table td input[type="number"] {
        flex: 1 1 60%;
        min-width: 100px;
    }
    .builder-table .qty-input { width: 70px; flex: 0 0 auto; }
    .builder-table .chk-wrap {
        justify-content: flex-start;
        margin-left: 0.5rem;
    }
    .row-actions {
        margin-left: auto;
    }
    .actions { gap: 0.6rem; }
    .btn { padding: 0.5rem 1.2rem; font-size: 0.85rem; width: 100%; justify-content: center; }
    .result-header { flex-direction: column; align-items: stretch; gap: 0.5rem; }
    .result-actions .btn { width: 100%; }
    .short-spec { font-size: 0.75rem; flex-direction: column; align-items: stretch; }
    .short-spec .copy-btn { margin-left: 0; align-self: flex-end; }
    .spec-table { font-size: 0.7rem; min-width: 500px; }
    .spec-table th, .spec-table td { padding: 0.3rem 0.2rem; }
}
@media (max-width: 480px) {
    .container { padding: 0.6rem; }
    h1 { font-size: 1.1rem; }
    .builder-table tr { padding: 0.4rem 0.5rem; }
    .builder-table td select { font-size: 0.75rem; }
    .builder-table .qty-input { width: 55px; }
    .spec-table { font-size: 0.6rem; min-width: 400px; }
}

/* ===== Панель зависимостей ===== */
.dependencies-panel {
    display: flex;
    flex-wrap: wrap;
    gap: 1.5rem 2rem;
    background: #f8fbfd;
    padding: 1rem 1.5rem;
    border-radius: 12px;
    border: 1px solid #d4e2ec;
    margin-bottom: 2rem;
}
.dep-group {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    flex-wrap: wrap;
}
.dep-group label {
    font-weight: 600;
    color: #0f3b4f;
    font-size: 0.9rem;
    white-space: nowrap;
}
.dep-group select {
    padding: 0.4rem 0.8rem;
    border: 1px solid #d4e2ec;
    border-radius: 8px;
    font-size: 0.9rem;
    background: #fff;
    min-width: 180px;
}
.dep-group select:disabled {
    background: #e9edf2;
    opacity: 0.7;
}

/* ===== Заблокированные строки ===== */
.component-row.built-in .cat-label::after {
    content: " 🔒";
    font-size: 0.7rem;
    color: #2f8db0;
}
.component-row.built-in select,
.component-row.built-in input[type="number"] {
    background: #eef3f8 !important;
    cursor: not-allowed;
    opacity: 0.7;
}
.component-row.built-in .btn-row.remove {
    display: none !important;
}
.component-row.built-in .btn-row.add {
    opacity: 0.6;
}