.construction-options-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
  gap: 14px;
  justify-content: center;
  align-items: stretch;
  margin: 24px 0 32px 0;
  padding: 0 10px;
}

.construction-option-card {
  display: flex;
  flex-direction: column;
  align-items: stretch;
  border: 1px solid #ccc;
  border-radius: 14px;
  background: #fff;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.07);
  margin-bottom: 0;
  position: relative;
  transition: box-shadow 0.2s, border 0.2s;
  overflow: hidden;
  padding: 22px 18px 18px 18px;
  font-family: "Segoe UI", "Roboto", Arial, sans-serif;
  font-size: 0.8rem;
  cursor: pointer;
  min-height: 140px;
}

.construction-option-card:hover {
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.12);
}

.construction-option-card input[type="radio"] {
  position: absolute;
  opacity: 0;
  width: 100%;
  height: 100%;
  margin: 0;
  cursor: pointer;
  z-index: 2;
}

.construction-option-card
  input[type="radio"]:checked
  + .construction-card-label::before {
  content: "WYBRANE";
  display: flex;
  justify-content: center;
  align-items: center;
  position: absolute;
  top: -22px;
  right: -18px;
  background: #bf1524;
  color: #fff;
  font-weight: bold;
  padding: 0px 12px;
  height: 26px;
  border-radius: 0 0 0 6px;
  font-size: 0.5rem;
  letter-spacing: 1px;
  z-index: 2;
}

.construction-option-card.selected {
  outline: 1.5px solid #bf1524 !important;
  background: #fff !important;
}

.construction-card-label {
  display: flex;
  flex-direction: column;
  cursor: pointer;
  position: relative;
  width: 100%;
  height: 100%;
  border: none;
  background: transparent;
  padding: 0;
  margin: 0;
  flex-grow: 1;
}

.construction-title {
  font-size: 1.25rem;
  font-weight: 600;
  color: #1a1a1a;
  margin-bottom: 8px;
  line-height: 1.3;
  min-height: 1.6em;
  display: flex;
  align-items: flex-start;
}

.construction-description {
  font-size: 0.98rem;
  color: #555;
  line-height: 1.5;
  margin: 0;
  flex-grow: 1;
  display: flex;
  align-items: flex-start;
}

.openings-section {
  margin: 20px 0;
  padding: 20px;
  border: 1px solid #ddd;
  border-radius: 8px;
  background-color: #f9f9f9;
}

.openings-section h3 {
  margin: 0 0 15px 0;
  color: #333;
  font-size: 1.1rem;
  font-weight: 600;
}

.openings-list {
  margin-bottom: 15px;
}

.opening-row {
  margin-bottom: 15px;
  padding: 15px;
  border: 1px solid #ccc;
  border-radius: 6px;
  background-color: #fff;
}

.opening-row-content {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
  gap: 15px;
  align-items: end;
}

.input-group {
  display: flex;
  flex-direction: column;
  gap: 5px;
}

.input-group label {
  font-size: 0.9rem;
  color: #555;
  font-weight: 500;
}

.input-group input {
  padding: 8px;
  border: 1px solid #ccc;
  border-radius: 4px;
  font-size: 0.9rem;
}

.input-group .unit {
  font-size: 0.8rem;
  color: #666;
  margin-top: 2px;
}

.add-opening-btn {
  background-color: #007cba;
  color: white;
  border: none;
  padding: 10px 20px;
  border-radius: 4px;
  cursor: pointer;
  font-size: 0.9rem;
  transition: background-color 0.2s;
}

.add-opening-btn:hover {
  background-color: #005a87;
}

.remove-btn {
  background-color: #dc3545;
  color: white;
  border: none;
  padding: 8px 15px;
  border-radius: 4px;
  cursor: pointer;
  font-size: 0.8rem;
  transition: background-color 0.2s;
  white-space: nowrap;
  align-self: end;
}

.remove-btn:hover {
  background-color: #c82333;
}

.modal {
  display: none;
  position: fixed;
  z-index: 1000;
  left: 0;
  top: 0;
  width: 100%;
  height: 100%;
  background-color: rgba(0, 0, 0, 0.5);
  overflow-y: auto;
}

.modal-content {
  background-color: #fff;
  margin: 5% auto;
  padding: 0;
  border: 1px solid #bdbdbd;
  border-radius: 6px;
  width: 90%;
  max-width: 1000px;
  max-height: 80vh;
  overflow-y: auto;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.2);
}

.modal-header {
  padding: 20px;
  background-color: #f2f2f2;
  border-bottom: 1px solid #bdbdbd;
  border-radius: 6px 6px 0 0;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.modal-header h2 {
  margin: 0;
  color: #111;
  font-size: 1.2rem;
  font-weight: 600;
}

.modal-body {
  padding: 20px;
  min-height: 250px;
  background: #fff;
}

.modal-body .btn.btn-primary {
  background: #fff;
  color: #111;
  border: 1px solid #111;
  padding: 10px 18px;
  border-radius: 6px;
  cursor: pointer;
  font-size: 0.95rem;
  font-weight: 500;
  transition: all 0.2s ease;
  margin-bottom: 16px;
}

.modal-body .btn.btn-primary:hover {
  background: #111;
  color: #fff;
  border: 1px solid #111;
}

.modal-footer {
  padding: 16px 20px;
  background-color: #f2f2f2;
  border-top: 1px solid #bdbdbd;
  border-radius: 0 0 6px 6px;
  text-align: right;
}

.modal-footer .btn.btn-secondary {
  background: #fff;
  color: #111;
  border: 1px solid #111;
  padding: 10px 18px;
  border-radius: 6px;
  cursor: pointer;
  font-size: 0.9rem;
  font-weight: 500;
  transition: all 0.2s ease;
}

.modal-footer .btn.btn-secondary:hover {
  background: #111;
  color: #fff;
  border: 1px solid #111;
}

.close {
  color: #555;
  font-size: 24px;
  font-weight: bold;
  cursor: pointer;
  line-height: 1;
  transition: color 0.2s;
}

.close:hover,
.close:focus {
  color: #111;
  text-decoration: none;
}

.openings-management {
  margin: 20px 0;
  padding: 20px;
  border: 1px solid #bdbdbd;
  border-radius: 6px;
  background: #fafbfc;
  transition: all 0.2s ease;
}

@media (min-width: 769px) {
  .powierzchnia_przegród .openings-management {
    margin: 0;
    height: fit-content;
    align-self: start;
  }

  .powierzchnia_przegród .col-md-12:nth-child(7) {
    margin-bottom: 0;
  }
}

.openings-management:hover {
  background: #fff;
}

.openings-management h3 {
  margin: 0 0 16px 0;
  color: #111;
  font-size: 1.2rem;
  font-weight: 600;
}

.openings-summary {
  background: #fff;
  padding: 16px;
  border-radius: 6px;
  margin-bottom: 16px;
  border: 1px solid #bdbdbd;
}

.openings-summary p {
  margin: 6px 0;
  color: #555;
  font-size: 0.95rem;
  line-height: 1.4;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.openings-summary p:last-child {
  margin-bottom: 0;
}

.openings-summary strong {
  color: #111;
  font-weight: 600;
}

.openings-summary span {
  background: #f2f2f2;
  padding: 2px 6px;
  border-radius: 4px;
  font-weight: 500;
  min-width: 35px;
  text-align: center;
}

.openings-buttons {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  justify-content: flex-start;
}

.manage-btn {
  background: #fff;
  color: #111;
  border: 1px solid #111;
  padding: 10px 18px;
  border-radius: 6px;
  cursor: pointer;
  font-size: 0.95rem;
  font-weight: 500;
  transition: all 0.2s ease;
  min-width: 160px;
}

.manage-btn:hover {
  background: #111;
  color: #fff;
  border: 1px solid #111;
}

.modal-opening-row {
  margin-bottom: 16px;
  padding: 16px;
  border: 1px solid #bdbdbd;
  border-radius: 6px;
  background: #fff;
  transition: all 0.2s ease;
}

.modal-opening-row:hover {
  background: #fafbfc;
}

.modal-opening-row-content {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  gap: 16px;
  align-items: end;
}

.modal-input-group {
  display: flex;
  flex-direction: column;
  gap: 6px;
  height: 100%;
}

.modal-input-group label {
  font-size: 0.9rem;
  color: #555;
  font-weight: 500;
  margin-bottom: 4px;
}

.modal-input-group input {
  padding: 10px 14px;
  border: 1px solid #bdbdbd;
  border-radius: 6px;
  font-size: 0.95rem;
  transition: all 0.2s ease;
  background: #fafbfc;
  color: #111;
}

.modal-input-group .unit {
  font-size: 0.8rem;
  color: #888;
  margin-top: 4px;
}

#windows-modal-list .modal-remove-btn {
  margin-top: 33.5px;
}

.modal-remove-btn {
  background: #fff;
  color: #dc3545;
  border: 1px solid #dc3545;
  padding: 8px 16px;
  border-radius: 6px;
  cursor: pointer;
  font-size: 0.85rem;
  font-weight: 500;
  transition: all 0.2s ease;
  white-space: nowrap;
  align-self: center;
  justify-self: center;
  width: 100%;
  height: 42px;
  margin-top: 23px;
}

.modal-remove-btn:hover {
  background: #dc3545;
  color: #fff;
  border: 1px solid #dc3545;
}

.modal-input-group input[type="number"] {
  padding-right: 14px;
}

.modal-input-group .unit {
  position: static;
  transform: none;
  background: none;
  padding: 0;
  margin-top: 4px;
  font-size: 0.8rem;
  color: #888;
}

@media (max-width: 1100px) {
  .construction-options-grid {
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  }
}

@media (max-width: 900px) {
  .construction-options-grid {
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
  }

  .construction-option-card {
    font-size: 0.95rem;
    padding: 12px 14px 10px 14px;
    min-height: 120px;
  }

  .construction-option-card
    input[type="radio"]:checked
    + .construction-card-label::before {
    top: -12px;
    right: -14px;
  }

  .construction-title {
    font-size: 1.18rem;
  }

  .construction-description {
    font-size: 0.9rem;
  }
}

@media (max-width: 768px) {
  .modal-content {
    width: 95%;
    margin: 3% auto;
  }

  .modal-opening-row-content {
    grid-template-columns: 1fr 1fr;
    gap: 12px;
  }

  .modal-opening-row {
    padding: 14px;
  }

  .openings-buttons {
    flex-direction: column;
    gap: 8px;
  }

  .manage-btn {
    min-width: auto;
    width: 100%;
  }

  .openings-management {
    padding: 16px;
  }

  .modal-header {
    padding: 16px;
  }

  .modal-body {
    padding: 16px;
  }

  .modal-footer {
    padding: 12px 16px;
  }
}

@media (max-width: 600px) {
  .construction-options-grid {
    grid-template-columns: 1fr;
    gap: 10px;
  }

  .construction-option-card {
    font-size: 0.9rem;
    padding: 10px 12px 8px 12px;
    min-height: 110px;
  }

  .construction-option-card
    input[type="radio"]:checked
    + .construction-card-label::before {
    top: -10px;
    right: -12px;
  }

  .construction-title {
    font-size: 1.1rem;
  }

  .construction-description {
    font-size: 0.85rem;
  }
}

@media (max-width: 480px) {
  .modal-content {
    width: 98%;
    margin: 2% auto;
  }

  .modal-opening-row-content {
    grid-template-columns: 1fr;
    gap: 10px;
  }

  .modal-opening-row {
    padding: 12px;
  }

  .modal-remove-btn {
    margin-top: 8px;
    align-self: center;
    justify-self: center;
    padding: 8px 12px;
  }

  .openings-management {
    padding: 12px;
  }

  .openings-summary {
    padding: 12px;
  }

  .openings-summary p {
    font-size: 0.85rem;
    flex-direction: column;
    align-items: flex-start;
    gap: 4px;
  }

  .modal-input-group input {
    padding: 8px 12px;
    font-size: 0.9rem;
  }

  .modal-input-group label {
    font-size: 0.85rem;
  }

  .modal-header {
    padding: 12px;
  }

  .modal-header h2 {
    font-size: 1.1rem;
  }

  .modal-body {
    padding: 12px;
  }

  .modal-footer {
    padding: 8px 12px;
  }

  .close {
    font-size: 20px;
  }
}

@media (max-width: 360px) {
  .modal-content {
    width: 100%;
    margin: 1% auto;
    border-radius: 4px;
  }

  .construction-options-grid {
    padding: 0 5px;
    gap: 8px;
  }

  .construction-option-card {
    padding: 8px 10px;
    min-height: 100px;
  }

  .construction-title {
    font-size: 1rem;
  }

  .construction-description {
    font-size: 0.8rem;
  }

  .openings-management {
    padding: 10px;
    margin: 10px 0;
  }

  .openings-management h3 {
    font-size: 1rem;
    margin-bottom: 12px;
  }

  .openings-summary {
    padding: 10px;
  }

  .manage-btn {
    padding: 8px 14px;
    font-size: 0.85rem;
  }

  .modal-opening-row {
    padding: 10px;
  }

  .modal-input-group {
    gap: 4px;
  }

  .modal-input-group input {
    padding: 6px 10px;
    font-size: 0.85rem;
  }

  .modal-input-group label {
    font-size: 0.8rem;
  }

  .modal-remove-btn {
    padding: 6px 10px;
    font-size: 0.8rem;
  }

  .modal-header {
    padding: 10px;
  }

  .modal-header h2 {
    font-size: 1rem;
  }

  .modal-body {
    padding: 10px;
  }

  .modal-footer {
    padding: 6px 10px;
  }

  .modal-body .btn.btn-primary {
    padding: 8px 14px;
    font-size: 0.85rem;
  }

  .modal-footer .btn.btn-secondary {
    padding: 8px 14px;
    font-size: 0.85rem;
  }
}

.modal-content,
.modal-header,
.modal-body,
.modal-footer,
.modal-opening-row,
.modal-input-group,
.modal-input-group input,
.openings-management,
.openings-summary {
  box-sizing: border-box;
}

.modal-content {
  max-width: calc(100vw - 20px);
}

.modal-opening-row-content {
  min-width: 0;
}

.modal-input-group {
  min-width: 0;
}

.modal-input-group input {
  min-width: 0;
  width: 100%;
}

.manage-btn,
.modal-remove-btn,
.modal-body .btn.btn-primary,
.modal-footer .btn.btn-secondary {
  white-space: nowrap;
  text-overflow: ellipsis;
  overflow: hidden;
}

@media (max-width: 480px) {
  .manage-btn,
  .modal-remove-btn,
  .modal-body .btn.btn-primary,
  .modal-footer .btn.btn-secondary {
    white-space: normal;
    word-wrap: break-word;
  }
}
