* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background-color: #f9f9f9;
    color: #333;
    line-height: 1.6;
    padding: 10px;
}

header {
    text-align: center;
    margin-bottom: 20px;
    padding: 15px;
    background-color: #eef5ff;
    border-radius: 10px;
}

header h1 {
    color: #2c3e50;
    font-size: 1.5rem;
}

main {
    max-width: 600px;
    margin: 0 auto;
}

.actions {
    display: flex;
    justify-content: center;
    margin: 15px 0;
}

.actions button {
    padding: 12px 24px;
    background-color: #3498db;
    color: white;
    border: none;
    border-radius: 6px;
    font-size: 1rem;
    cursor: pointer;
    transition: background-color 0.3s;
    margin: 0 15px;
}

.actions button.del {
    background-color: #8f8787;
}

.actions button:hover {
    background-color: #2980b9;
}

.card {
    background: white;
    padding: 20px;
    border-radius: 10px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
    margin-bottom: 20px;
}

.card h2 {
    color: #2c3e50;
    margin-bottom: 15px;
}

.card label {
    display: block;
    margin-bottom: 5px;
    font-weight: bold;
}

.card input[type="text"] {
    width: 100%;
    padding: 10px;
    border: 1px solid #ddd;
    border-radius: 6px;
    margin-bottom: 15px;
}

.card button {
    width: 100%;
    padding: 12px;
    background-color: #2ecc71;
    color: white;
    border: none;
    border-radius: 6px;
    font-size: 1rem;
    cursor: pointer;
    margin-top: 10px;
}

.card button:hover {
    background-color: #27ae60;
}

#qrCodeDisplay {
    font-family: monospace;
    color: #e74c3c;
    word-break: break-all;
}

.message {
    padding: 12px;
    margin: 15px 0;
    border-radius: 6px;
    text-align: center;
    font-weight: bold;
}

.message.success {
    background-color: #d4edda;
    color: #155724;
    border: 1px solid #c3e6cb;
}

.message.error {
    background-color: #f8d7da;
    color: #721c24;
    border: 1px solid #f5c6cb;
}

.hidden {
    display: none;
}

table {
    width: 100%;
    border-collapse: collapse;
    margin: 20px 0;
}

table th,
table td {
    padding: 12px;
    text-align: left;
    border-bottom: 1px solid #ddd;
}

table th {
    background-color: #f2f2f2;
    font-weight: bold;
}

table tr:hover {
    background-color: #f5f5f5;
}

table img.qr {
    width: 50px;
    height: 50px;
    object-fit: contain;
    vertical-align: middle;
}

#packQrContainer {
    display: flex;
    justify-content: center;
    margin: 20px 0;
}

#packQrContainer img {
    width: 150px;
    height: 150px;
    border: 1px solid #ddd;
    border-radius: 8px;
}

#packPartsList {
    list-style-type: none;
}

#packPartsList li {
    padding: 10px;
    margin: 8px 0;
    background-color: #f8f9fa;
    border-left: 4px solid #3498db;
    border-radius: 0 4px 4px 0;
}

@media (max-width: 480px) {
    body {
        padding: 5px;
    }
    header h1 {
        font-size: 1.3rem;
    }
    .card {
        padding: 15px;
    }
    table th, table td {
        padding: 8px;
        font-size: 0.9rem;
    }
}

a {
    color: #222222;
}

.print-btn {
    display: block;
    margin: 20px auto;
    padding: 14px 28px;
    background-color: #27ae60;
    color: white;
    border: none;
    border-radius: 8px;
    font-size: 1.1rem;
    font-weight: bold;
    cursor: pointer;
    box-shadow: 0 3px 8px rgba(0,0,0,0.1);
    transition: background-color 0.3s, transform 0.1s;
}

.gpa {
    float: left;
    margin-right: 30px;
    padding: 2px 15px;
    border-radius: 5px;
}

.gpa.selected {
    background-color: #555555 !important;
    color: #ffffff !important;
}

br.clear {
    clear: both;
}

.print-btn:hover {
    background-color: #219955;
}

.print-btn:active {
    transform: scale(0.98);
}

.btn-photo {
    padding: 10px 20px;
    background-color: #3498db;
    color: white;
    border: none;
    border-radius: 6px;
    font-size: 1rem;
    cursor: pointer;
    margin: 10px 0;
    transition: background-color 0.3s;
}

.btn-photo:hover {
    background-color: #2980b9;
}

#photoPreview img {
    max-width: 100%;
    max-height: 200px;
    border: 1px solid #ddd;
    border-radius: 6px;
    margin-top: 10px;
}

button.del {
    background-color: #aa0000;
}

/* === СКРЫВАЕМ НОВЫЕ БЛОКИ НА ЭКРАНЕ === */
/*
#printPage1,
#printPage2 {
    display: none;
}

 */

/* === ПЕЧАТЬ: ВЫВОДИМ ТОЛЬКО НУЖНОЕ === */
@media print {
    @page {
        size: A4 portrait; /* ← ВАЖНО: явно указываем книжную ориентацию */
        margin: 20mm;      /* Отступы по краям — для красивой печати */
    }
    /* Скрываем всё, что не нужно печатать */
    body * {
        visibility: hidden;
    }

    /* Показываем только наши два листа */
    #printPage1,
    #printPage2,
    #printPage1 *,
    #printPage2 * {
        visibility: visible;
    }

    /* Позиционируем листы */
    #printPage1 {
        page-break-after: always;
        text-align: center;
        padding: 50px 20px;
    }

    #printPage2 {
        padding: 50px 20px;
    }

    /* QR-код на первом листе — большой */
    #printPage1 #packQrContainer img {
        width: 200px !important;
        height: 200px !important;
        margin: 30px auto;
    }

    #printPage1 h2,
    #printPage1 h3 {
        font-size: 22px;
        margin: 10px 0;
    }

    /* Таблица деталей на втором листе */
    #partsTablePrint {
        width: 100%;
        border-collapse: collapse;
        margin-bottom: 60px;
    }

    #partsTablePrint th,
    #partsTablePrint td {
        border: 1px solid #000;
        padding: 10px;
        text-align: left;
        font-size: 14px;
    }

    #partsTablePrint th {
        background-color: #f0f0f0;
        font-weight: bold;
    }

    /* Подписи — красиво выровнены */
    .signatures .signature-line {
        margin: 30px 0;
        line-height: 2;
        font-size: 16px;
    }

    .signatures p {
        margin: 0;
        padding-left: 10px;
/*        border-bottom: 1px dashed #000;*/
        min-height: 40px;
    }

    /* Заголовки */
    #printPage2 h2 {
        font-size: 20px;
        text-align: center;
        margin-bottom: 30px;
    }

    /* Убираем лишнее */
    #packPartsList,
    .print-btn,
    header,
    .card > p {
        display: none !important;
    }
}