/* ===== Base (екран) ===== */
* { box-sizing:border-box; margin:0; padding:0; }
html, body { width:100%; min-height:100vh; font-family:"Roboto", sans-serif; }

body {
  background:#f4f4f4;
  padding:20px;
  display:flex; align-items:center; justify-content:center;
}

.form-container {
  width:100%;
  max-width:1200px;
  background:#fff;
  padding:30px;
  border-radius:8px;
  box-shadow:0 0 20px rgba(0,0,0,0.1);
}

.header { display:flex; justify-content:space-between; align-items:center; width:100%; margin-bottom:20px; }
.logo-left, .logo-right { max-width:150px; max-height:60px; object-fit:contain; }

.field { width:100%; margin-bottom:12px; }

input[type="text"], select {
  width:100%; padding:8px 10px; border:1px solid #ccc; border-radius:4px; font-size:16px;
}

.no-print {
  width: 170px;
}



#project-name { font-size:20px; font-weight:bold; }

.measuremens {
  display:flex; gap:16px; flex-wrap:wrap; justify-content:center; align-items:flex-end;
}
.inline-row {
  display:flex; gap:16px; flex-wrap:wrap; align-items:flex-end; width:auto; margin:0;
}
.weight-field { display:flex; align-items:flex-end; width:auto; margin:0; }

#dimensionsContainer {
  display:flex; flex-wrap:wrap; justify-content:center; gap:8px 12px; margin-top:6px;
}

.only-print { display:none; }

.button-group { display:flex; gap:10px; margin-top:20px; }
button { padding:10px 18px; border:none; border-radius:16px; cursor:pointer; }
button.generate { background:#0072ff; color:#fff; }
button.print { background:#333; color:#fff; }

/* ===== PRINT ===== */
@page { margin:8mm 10mm; }  /* компактні поля: допомагає вмістити на 1 сторінку */

@media print {
  .no-print {
    display: none !important;
  }

  body * {
    visibility: hidden !important;
  }

  #printArea,
  #printArea * {
    visibility: visible !important;
  }

  html, body, #printArea, .form-container, .field, input, select, textarea {
    background: #fff !important;
    -webkit-print-color-adjust: exact !important;
    print-color-adjust: exact !important;
  }

  html, body {
    margin: 0 !important;
    padding: 0 !important;
    font-size: 15px;
    font-family: "Times New Roman", serif;
  }

  #printArea {
    position: relative !important;
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    width: 100%;
    min-height: 100vh;
    margin: 0 !important;
    padding: 0 !important;
    gap: 4px;
    transform-origin: top center;
  }

  header.header {
    width: 100%;
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin: 0 0 4px 0 !important;
    break-inside: avoid;
    page-break-inside: avoid;
  }

  .logo-left,
  .logo-right {
    max-height: 48px;
    max-width: 140px;
  }

  input, select, textarea {
    border: none !important;
    background: #fff !important;
    box-shadow: none !important;
    outline: none !important;
    color: #000 !important;
    font-size: 16px !important;
    padding: 0 !important;
    margin: 0 !important;
    width: auto !important;
    text-align: center !important;
    appearance: none !important;
    -webkit-appearance: none !important;
    -moz-appearance: none !important;
  }

  input:focus,
  select:focus,
  textarea:focus {
    outline: none !important;
    box-shadow: none !important;
  }

  select::-ms-expand {
    display: none !important;
  }

  .field {
    width: 100% !important;
    margin: 2mm 0 1.5mm 0 !important;
    padding: 0 !important;
    break-inside: avoid;
    page-break-inside: avoid;
  }

  .field > label {
    display: none !important;
  }

  #project-name {
    display: none !important;
  }

  #project-name-print {
    display: block !important;
    font-size: 24px !important;
    font-weight: 700 !important;
    line-height: 1.2;
    max-width: 92%;
    margin: 3mm auto 2mm auto;
    white-space: normal !important;
    overflow-wrap: anywhere !important;
    break-after: avoid;
    page-break-after: avoid;
  }

  .measuremens {
    display: flex !important;
    flex-wrap: nowrap !important;
    gap: 14px;
    justify-content: center;
    align-items: flex-end;
    width: 100%;
    margin-top: 2mm !important;
  }

  .measuremens .field,
  .inline-row,
  .weight-field {
    width: auto !important;
    margin: 0 !important;
    display: flex !important;
    flex-wrap: nowrap !important;
    gap: 14px;
    align-items: flex-end;
  }

  .measuremens input.short {
    width: auto !important;
    min-width: 84px;
  }

  #package-type {
    display: none !important;
  }

  #package-type-print {
    display: inline !important;
    font-size: 15px !important;
  }

  #dimensionsContainer {
    display: flex !important;
    justify-content: center !important;
    align-items: center;
    flex-wrap: wrap;
    gap: 6px 10px;
    width: 100%;
    margin-top: 3mm !important;
    break-before: avoid;
    break-inside: avoid;
  }

  #dimensionsContainer .field {
    flex: 0 0 auto;
    min-width: 88px;
    width: auto !important;
    margin: 0 !important;
  }

 .bottom-section {
  /* ВИРІШЕННЯ: не приклеювати вниз */
  margin-top: 2mm !important;

  display: flex !important;
  flex-direction: column;
  align-items: center;
  gap: 3mm;
  width: 100%;
  break-inside: avoid;
  page-break-inside: avoid;
}

  #location {
    display: none !important;
  }

  #location-print {
    display: inline !important;
    font-size: 14px !important;
  }

  .bottom-section input {
    font-size: 14px !important;
  }
}
  @media print {
  input, select, textarea {
    background: #fff !important;
    border: none !important;
    box-shadow: none !important;
    outline: none !important;
    color: #000 !important;
    font-family: "Times New Roman", serif !important;
    font-size: 16px !important;
    padding: 0 !important;
    margin: 0 !important;
    width: auto !important;
    text-align: center !important;

    -webkit-appearance: none !important;
    -moz-appearance: none !important;
    appearance: none !important;

    filter: none !important;          /* 💥 Важливо! */
    -webkit-filter: none !important;
  }

  input:focus, select:focus {
    outline: none !important;
    box-shadow: none !important;
  }
}
@media print {
  input[type="text"] {
    display: none !important;
  }

  .only-print {
    display: block !important;
    color: #000 !important;
    background: none !important;
    font-family: "Times New Roman", serif !important;
    font-size: 16px !important;
    padding: 0 !important;
    margin: 0 0 6px 0 !important;
    text-align: center;
    word-wrap: break-word;
    white-space: pre-wrap !important;
  }
}
