/* Overlay */
#d4loc-popup-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.55);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 999999;
  padding: 16px;
}

/* Popup container */
#d4loc-popup {
  background: #ffffff;
  width: 100%;
  max-width: 720px;
  border-radius: 12px;
  padding: 20px 20px 8px 18px;
  position: relative;
  box-shadow: 0 12px 40px rgba(0, 0, 0, 0.25);
  font-family: "Ubuntu Sans", sans-serif;
  color: #403f3f;
}

/* Close button */
#d4loc-popup-close {
  position: absolute;
  right: 10px;
  top: 8px;
  width: 36px;
  height: 36px;
  border: none;
  background: transparent;
  font-size: 28px;
  line-height: 36px;
  cursor: pointer;
  color: #403f3f;
}

#d4loc-popup-close:hover {
  opacity: 0.7;
}

/* Headings inside popup */
#d4loc-popup h1,
#d4loc-popup h2,
#d4loc-popup h3 {
  margin-top: 0;
  color: #403f3f;
  font-weight: 600;
}

/* Form labels */
#d4loc-lead-form label {
  display: block;
  margin: 10px 0 6px;
  font-weight: 600;
  font-size: 14px;
  color: #403f3f;
}

/* Inputs */
#d4loc-lead-form input[type="tel"],
#d4loc-lead-form input[type="text"] {
  width: 100%;
  margin-top: 4px;
  padding: 12px 14px;
  border: 1px solid #d1d1d1;
  border-radius: 6px;
  font-size: 15px;
  font-weight: 400;
  color: #403f3f;
  font-family: "Ubuntu Sans", sans-serif;
}

#d4loc-lead-form input::placeholder {
  color: #9a9a9a;
}

#d4loc-lead-form input:focus {
  outline: none;
  border-color: #cf2e2e;
  box-shadow: 0 0 0 1px rgba(207, 46, 46, 0.25);
}

/* Consent checkbox */
.d4loc-consent {
  margin-top: 12px;
  font-weight: 400;
  font-size: 14px;
  line-height: 1.4;
  color: #403f3f;
}

.d4loc-consent input {
  margin-right: 6px;
  accent-color: #cf2e2e;
}

/* Submit button */
.d4loc-btn {
  margin-top: 14px;
  width: 100%;
  padding: 20px 16px;
  border: none;
  border-radius: 6px;
  background-color: #cf2e2e;
  color: #ffffff;
  font-size: 16px;
  font-weight: 600;
  cursor: pointer;
  transition: background-color 0.2s ease, opacity 0.2s ease;
  font-family: "Ubuntu Sans", sans-serif;
}

.d4loc-btn:hover:not(:disabled) {
  background-color: #b62828;
}

.d4loc-btn:disabled {
  opacity: 0.6;
  cursor: not-allowed;
}

/* Messages */
.d4loc-msg {
    margin-top: 12px;
    font-size: 14px;
    color: #403f3f;
    padding-bottom: 6px;
    text-align: center;
}

/* Success message */
.d4loc-msg.success {
  padding: 10px 12px;
  background: rgba(207, 46, 46, 0.08);
  border-left: 4px solid #cf2e2e;
  border-radius: 6px;
}

/* Error message (jeśli używasz) */
.d4loc-msg.error {
  padding: 10px 12px;
  background: rgba(200, 0, 0, 0.08);
  border-left: 4px solid #c00000;
  border-radius: 6px;
}

/* Helpers */
.d4loc-hidden {
  display: none !important;
}
/* --- FIX: reset marginesów i szerokości w popupie --- */
#d4loc-popup *,
#d4loc-popup *::before,
#d4loc-popup *::after {
  box-sizing: border-box;
}

#d4loc-popup h1,
#d4loc-popup h2,
#d4loc-popup h3{
  margin-left: 0;
  margin-right: 0;
  font-size: 30px;
  line-height: 36px;
  color: #cf2e2e;
  margin-bottom: 10px;
}

#d4loc-popup label{
  margin-left: 0;
  margin-right: 0;
}
#d4loc-popup p{
  margin-left: 0;
  margin-right: 0;
}

/* Opis + tekst admina: niech się ładnie zawija i nie “wypycha” */
#d4loc-popup .d4loc-popup-desc,
#d4loc-popup .admin-info-text {
    margin: 0;
    max-width: 100%;
    overflow-wrap: anywhere;
    word-break: break-word;
    font-size: 14px;
    line-height: 21px;
}

/* Label jako kontener ma trzymać input w 100% szerokości */
#d4loc-lead-form label {
  display: block;
  width: 100%;
  font-size: 12px;
}

/* INPUTY: czasem motyw daje min-width albo inline sizing */
#d4loc-lead-form input[type="tel"],
#d4loc-lead-form input[type="text"] {
  display: block;
  width: 100%;
  max-width: 100%;
  min-width: 0; /* ważne gdy theme narzuca min */
}

/* Checkbox consent: wyrównanie i brak “rozjeżdżania” */
#d4loc-lead-form .d4loc-consent {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  width: 100%;
  font-size: 12px;
  line-height: 16px;
  margin-top: 16px;
  font-weight: 400;
}

#d4loc-lead-form .d4loc-consent input[type="checkbox"] {
    flex: 0 0 auto;
    margin: 3px 0 0;
    width: 16px;
    height: 16px;
    border: 1px solid #bbbbbb;
}

#d4loc-lead-form .d4loc-consent {
  overflow-wrap: anywhere;
  word-break: break-word;
}

/* Button też na sztywno w 100% i bez dziwnych min-width */
#d4loc-popup .d4loc-btn {
  display: block;
  width: 100%;
  max-width: 100%;
  min-width: 0;
}
#d4loc-popup .admin-info-text{
    font-size: 12px;
    line-height: 18px;
    color: #999;
    padding-left: 0;
}

/* Box z informacją RODO */
#d4loc-popup .admin-info-box {
  margin-top: 16px;
  padding-left: 26px;
}

/* Tekst zwinięty do 2 linijek */
#d4loc-popup .admin-info-text.is-collapsed {
  display: -webkit-box;
  -webkit-box-orient: vertical;
  overflow: hidden;
  max-height: 40px;
  margin-top: 0;
}

/* Tekst rozwinięty */
#d4loc-popup .admin-info-text.is-expanded {
  display: block;
  max-height: none;
  overflow: visible;
}

/* Przycisk rozwiń / zwiń */
#d4loc-popup .d4loc-toggle-info {
  margin-top: 0;
  padding: 0;
  border: none;
  background: transparent;
  color: #cf2e2e;
  font-size: 12px;
  font-weight: 600;
  font-family: "Ubuntu Sans", sans-serif;
  cursor: pointer;
  text-decoration: underline;
}

#d4loc-popup .d4loc-toggle-info:hover {
  opacity: 0.8;
}

@media (min-width: 992px) {
  #d4loc-lead-form {
    display: grid;
    grid-template-columns: 1fr 1fr;
    column-gap: 16px;
    row-gap: 14px;
    align-items: start;
  }

  /* dwa pierwsze pola obok siebie */
  #d4loc-lead-form > label:not(.d4loc-consent) {
    width: 100%;
    margin: 0;
  }

  /* wszystko poniżej na pełną szerokość */
  #d4loc-lead-form > .d4loc-consent,
  #d4loc-lead-form > .admin-info-box,
  #d4loc-lead-form > .d4loc-btn,
  #d4loc-lead-form > .d4loc-msg {
    grid-column: 1 / -1;
    width: 100%;
    margin-top: 0;
  }

  /* checkboxy ciaśniej na desktopie */
  #d4loc-lead-form .d4loc-consent {
    margin: 0;
  }

  /* przycisk bez dodatkowego wielkiego odstępu */
  #d4loc-popup .d4loc-btn {
    margin-top: 0;
  }

  /* tekst RODO też bez sztucznego luzu */
  #d4loc-popup .admin-info-box {
    margin-top: 0;
  }
}


/* Header popupu: logo + tekst */
.d4loc-popup-header {
  display: flex;
  align-items: center;
  gap: 16px;
  margin: 0 0 15px;
  padding-right: 40px; /* żeby nie wchodziło pod X */
}

.d4loc-popup-logo {
    display: block;
    width: 60px;
    height: auto;
    flex: 0 0 auto;
    margin-right: 10px;
}

.d4loc-popup-title-text {
  font-size: 30px;
  line-height: 38px;
  font-weight: 600;
  color: #cf2e2e;
}

/* Mobile */
@media (max-width: 767px) {
  .d4loc-popup-header {
    gap: 12px;
    align-items: flex-start;
  }

  .d4loc-popup-logo {
    width: 62px;
  }

  .d4loc-popup-title-text {
    font-size: 18px;
    line-height: 26px;
  }
  #d4loc-popup .d4loc-popup-desc{
    font-size: 12px;
    line-height: 20px;
  }
  #d4loc-lead-form .d4loc-consent {
    font-size: 10px;
    line-height: 14px;
    margin-top: 10px;
  }
  #d4loc-popup .admin-info-text {
    font-size: 10px;
    line-height: 14px;
  }
  #d4loc-popup .d4loc-toggle-info {
    font-size: 10px;
  }
}