
/* ===== ОСНОВНЫЕ НАСТРОЙКИ ===== */

:root {
    --accent: #3563e9;
    --accent-hover: #244bc2;
    --bg: #f3f5fa;
    --surface: #ffffff;
    --text: #20283a;
    --muted: #727d91;
    --border: #dfe4ee;
    --radius: 12px;
    --shadow: 0 12px 36px rgba(31, 45, 75, 0.08);
}

* {
    box-sizing: border-box;
}

body {
    margin: 0;
    min-height: 100vh;
    background: var(--bg);
    color: var(--text);
    font-family: Arial, Helvetica, sans-serif;
    font-size: 15px;
    line-height: 1.5;
}

header {
    height: 25px;
}

main {
    width: min(1200px, calc(100% - 32px));
    margin: 20px auto;
    padding: 30px;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 18px;
    box-shadow: var(--shadow);
}

h1 {
    margin: 0 0 24px;
    padding-bottom: 20px;
    border-bottom: 1px solid var(--border);
    font-size: 28px;
    letter-spacing: -0.5px;
}

h2 {
    margin: 0 0 16px;
    font-size: 21px;
}

h3 {
    margin: 24px 0 12px;
    font-size: 17px;
}

/* ===== ДАННЫЕ ЗАКАЗЧИКА ===== */

.customer-row {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 12px;
    margin-bottom: 25px;
}

#customer {
    flex: 1 1 280px;
    max-width: 450px;
}

.order-number {
    display: inline-flex;
    align-items: center;
    min-height: 44px;
    padding: 10px 14px;
    border-radius: 9px;
    background: #edf2ff;
    color: var(--accent);
    font-weight: 700;
}

/* ===== КНОПКИ ВЫБОРА МАТЕРИАЛА ===== */

.material-buttons {
    display: flex;
    gap: 10px;
    margin-bottom: 25px;
}

button {
    min-height: 42px;
    padding: 10px 18px;
    border: 1px solid var(--border);
    border-radius: 9px;
    background: white;
    color: var(--text);
    font: inherit;
    font-weight: 600;
    cursor: pointer;
    transition: 0.2s;
}

button:hover {
    border-color: var(--accent);
    color: var(--accent);
}

button:focus-visible {
    outline: 3px solid rgba(53, 99, 233, 0.2);
    outline-offset: 2px;
}

.material-buttons button.active {
    border-color: var(--accent);
    background: var(--accent);
    color: white;
}

.material-buttons button.active:hover {
    background: var(--accent-hover);
}

/* ===== ПОЛЯ ВВОДА ===== */

input[type="text"],
input[type="number"],
select {
    min-height: 42px;
    padding: 10px 12px;
    border: 1px solid var(--border);
    border-radius: 9px;
    background: white;
    color: var(--text);
    font: inherit;
}

input[type="text"]:focus,
input[type="number"]:focus,
select:focus {
    border-color: var(--accent);
    outline: 3px solid rgba(53, 99, 233, 0.12);
}

input::placeholder {
    color: #929bad;
}

#form > input[type="text"] {
    display: block;
    width: min(100%, 500px);
    margin: 8px 0 16px;
}

#form > label {
    display: inline-block;
    margin: 8px 6px 8px 0;
    color: #4e5b73;
    font-weight: 600;
}

#form > select {
    margin: 6px 0;
}

.form-field {
    margin: 17px 0;
}

.form-field > label {
    display: block;
    margin-bottom: 7px;
    color: #4e5b73;
    font-weight: 600;
}

.form-field input[type="text"],
.form-field input[type="number"] {
    width: 100%;
    max-width: 500px;
}

.dimensions {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 14px;
    margin: 20px 0;
}

.dimensions .form-field {
    margin: 0;
}

.dimensions input {
    width: 100%;
}

/* ===== ГРУППЫ НАСТРОЕК ===== */

fieldset {
    min-width: 0;
    margin: 20px 0;
    padding: 17px;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    background: #fbfcff;
}

legend {
    padding: 0 8px;
    color: #4e5b73;
    font-size: 14px;
    font-weight: 700;
}

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

.radio-options label {
    display: inline-flex;
    align-items: center;
    gap: 7px;
    cursor: pointer;
}

input[type="radio"],
input[type="checkbox"] {
    width: 17px;
    height: 17px;
    accent-color: var(--accent);
    cursor: pointer;
}

.checkbox-row {
    display: flex;
    align-items: center;
    gap: 9px;
    margin: 20px 0;
}

.checkbox-row label {
    cursor: pointer;
}

/* ===== КНОПКА ДОБАВЛЕНИЯ ДЕТАЛИ ===== */

#addDetail {
    margin: 8px 0 20px;
    border-color: var(--accent);
    background: var(--accent);
    color: white;
}

#addDetail:hover {
    background: var(--accent-hover);
}

/* ===== ТАБЛИЦА ДЕТАЛЕЙ ===== */

.details-section {
    margin-top: 20px;
    padding-top: 25px;
    border-top: 1px solid var(--border);
}

.table-wrapper {
    width: 100%;
    overflow-x: auto;
    border: 1px solid var(--border);
    border-radius: 10px;
    background: white;
}

#detailsTable {
    width: 100%;
    min-width: 1450px;
    border-collapse: separate;
    border-spacing: 0;
    font-size: 13px;
}

#detailsTable th,
#detailsTable td {
    padding: 12px;
    border-bottom: 1px solid #e8ecf3;
    text-align: left;
    vertical-align: middle;
}

#detailsTable th {
    background: #f3f6fc;
    color: #526079;
    font-weight: 700;
    white-space: nowrap;
}

#detailsTable tbody tr:hover {
    background: #f8faff;
}

#detailsTable tbody tr:last-child td {
    border-bottom: 1px solid #e8ecf3;
}

#detailsTable td:nth-child(3) {
    min-width: 190px;
    white-space: normal;
    overflow-wrap: anywhere;
}

#detailsTable tfoot td {
    background: #edf2ff;
    color: #244bc2;
    font-weight: 700;
}

#detailsTable tfoot td:nth-child(2) {
    white-space: nowrap;
}

#detailsTable .delete-button {
    min-height: 32px;
    padding: 6px 10px;
    border: 1px solid #f0caca;
    border-radius: 7px;
    background: #fff5f5;
    color: #c03939;
    font-size: 12px;
}

#detailsTable .delete-button:hover {
    background: #ffe6e6;
}

.empty-row td {
    padding: 25px !important;
    color: var(--muted);
    text-align: center !important;
}

/* ===== ФОТО ПРИСАДОК ===== */

.photo-section {
    margin-top: 30px;
    padding-top: 25px;
    border-top: 1px solid var(--border);
}

.photo-section input[type="file"] {
    display: block;
    width: 100%;
    max-width: 550px;
    padding: 13px;
    border: 1px dashed #b9c5da;
    border-radius: 10px;
    background: #f8faff;
    color: var(--muted);
    font: inherit;
}

.photo-section input[type="file"]:hover {
    border-color: var(--accent);
}

/* ===== ПОДВАЛ ===== */

footer {
    padding: 10px 16px 25px;
    color: var(--muted);
    font-size: 12px;
    text-align: center;
}

/* ===== МОБИЛЬНАЯ ВЕРСИЯ ===== */

@media (max-width: 650px) {
    main {
        width: calc(100% - 20px);
        margin: 10px auto;
        padding: 18px 14px;
        border-radius: 13px;
    }

    h1 {
        font-size: 24px;
    }

    .customer-row {
        align-items: stretch;
    }

    #customer {
        width: 100%;
        max-width: none;
    }

    .material-buttons button {
        flex: 1;
    }

    .dimensions {
        grid-template-columns: 1fr;
    }

    fieldset {
        padding: 13px 10px;
    }

    .radio-options {
        gap: 12px;
    }

    #detailsTable {
        min-width: 1450px;
    }

    .table-wrapper {
        border-radius: 8px;
    }

    .photo-section {
        margin-top: 24px;
    }
}
