/**
 * ŚCIEŻKA: /wcm-ipricelist/assets/css/frontend-email-block.css
 * ZMIANA: Wzmocniono style błędów walidacji, dodano obsługę kafelków i etykiet (checkbox/radio).
 */

/* =================================================
   GŁÓWNY KONTENER SEKCJI E-MAIL
================================================= */
.wcm-ipricelist-email-quote-section {
  margin: clamp(24px, 5vw, 48px) auto;
  max-width: min(100%, 1200px);
  border-radius: var(--radius-lg, 16px) !important;
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.2) !important;
  padding: clamp(20px, 4vw, 45px) !important;
  background: linear-gradient(145deg, rgba(13, 32, 18, 0.2), rgba(13, 14, 32, 1)) !important;
  border: 1px solid rgba(255, 255, 255, 0.1) !important;
  position: relative !important;
  overflow: hidden !important;
  backdrop-filter: blur(10px) !important;
}

.wcm-ipricelist-email-quote-section h3 {
  color: var(--ae-white, #fff) !important;
  font-size: clamp(1.25rem, 3vw, 1.7rem) !important;
  font-family: Poppins, Quicksand, sans-serif !important;
  margin: 0 0 clamp(20px, 4vw, 32px) 0 !important;
  text-align: center !important;
  font-weight: 800 !important;
  letter-spacing: 0.5px !important;
  text-shadow: 0 2px 4px rgba(0,0,0,0.3) !important;
}

.wcm-ipricelist-email-quote-section h4 {
  color: var(--ae-white, #fff) !important;
  font-family: Poppins, Quicksand, sans-serif !important;
  font-weight: 700 !important;
  font-size: clamp(1rem, 2.2vw, 1.1rem) !important;
  margin: clamp(20px, 3vw, 30px) 0 clamp(8px, 1.5vw, 12px) 0 !important; 
  padding-bottom: clamp(6px, 1.2vw, 10px) !important;
  border-bottom: 1px solid rgba(255,255,255,0.1) !important;
  display: flex !important;
  align-items: center !important;
}

/* FIX: Jeśli po nagłówku H4 jest ukryty element, usuwamy dolny margines H4 */
.wcm-ipricelist-email-quote-section h4:has(+ .wcm-force-hidden),
.wcm-ipricelist-email-quote-section h4:has(+ * + .wcm-force-hidden) {
    margin-bottom: 0 !important;
    padding-bottom: 0 !important;
    border-bottom: none !important;
}

.wcm-ipricelist-email-quote-section h4::before {
    content: '' !important;
    display: inline-block !important;
    width: clamp(6px, 1vw, 8px) !important;
    height: clamp(6px, 1vw, 8px) !important;
    background: var(--ae-green, #54aa09) !important;
    border-radius: 50% !important;
    margin-right: clamp(8px, 1.5vw, 12px) !important;
    box-shadow: 0 0 10px var(--ae-green, #54aa09) !important;
}

.wcm-ipricelist-email-quote-section p {
  margin-bottom: 0 !important;
  color: var(--ae-white, #fff) !important;
  font-size: clamp(0.9rem, 1.9vw, 1rem) !important;
}

.wcm-ipricelist-email-quote-section label {
  margin-bottom: 0 !important;
  color: rgba(255, 255, 255, 0.9) !important;
  font-weight: 500 !important;
  font-size: clamp(0.85rem, 1.8vw, 0.95rem) !important;
}

.wcm-ipricelist-email-quote-section .wcm-ipricelist-field,
.wcm-ipricelist-email-quote-section p > label:not(:has(input[type="checkbox"])):not(:has(input[type="radio"])) {
  margin-bottom: clamp(6px, 1.2vw, 10px) !important;
  display: block !important;
}

/* Inputy, Selecty, Textarea */
.wcm-ipricelist-email-quote-section textarea,
.wcm-ipricelist-email-quote-section select,
.wcm-ipricelist-email-quote-section input[type="text"],
.wcm-ipricelist-email-quote-section input[type="email"],
.wcm-ipricelist-email-quote-section input[type="tel"],
.wcm-ipricelist-email-quote-section input[type="date"] {
    width: 100% !important;
    padding: clamp(10px, 1.8vw, 12px) clamp(12px, 2.3vw, 16px) !important;
    border-radius: 8px !important;
    border: 1px solid rgba(255,255,255,0.15) !important;
    background: rgba(0,0,0,0.3) !important;
    color: #fff !important;
    font-family: inherit !important;
    box-sizing: border-box !important;
    transition: all 0.3s ease !important;
    font-size: clamp(0.9rem, 1.8vw, 0.95rem) !important;
}

.wcm-ipricelist-email-quote-section textarea:focus,
.wcm-ipricelist-email-quote-section select:focus,
.wcm-ipricelist-email-quote-section input:focus {
  background: rgba(0,0,0,0.5) !important;
  border-color: var(--ae-green, #54aa09) !important;
  box-shadow: 0 0 0 4px rgba(84, 170, 9, 0.15) !important;
  outline: none !important;
}

/* --- STYL BŁĘDU WALIDACJI (NUCLEAR OPTION) --- */
/* Bardzo wysoka specyficzność selektora, aby przebić style domyślne */
body .wcm-ipricelist-email-quote-section input.wcm-input-error,
body .wcm-ipricelist-email-quote-section textarea.wcm-input-error,
body .wcm-ipricelist-email-quote-section select.wcm-input-error,
/* Fix dla customowego wrappera daty */
body .wcm-ipricelist-email-quote-section .wcm-date-input-wrapper input.wcm-input-error {
    border-color: #ff4d4d !important; /* Jasnoczerwona ramka */
    background-color: rgba(180, 20, 20, 0.35) !important; /* Ciemnoczerwone półprzezroczyste tło */
    box-shadow: 0 0 0 1px #ff4d4d, 0 0 12px rgba(255, 50, 50, 0.4) !important; /* Czerwona poświata */
    transition: box-shadow 0.2s ease, background-color 0.2s ease !important;
}

/* --- STYL BŁĘDU DLA ELEMENTÓW UKRYTYCH (Radio/Checkbox/Kafelki) --- */

/* 1. Kafelki Profilu Klienta */
.wcm-profile-option.wcm-input-error {
    border-color: #ff4d4d !important;
    box-shadow: 0 0 15px rgba(255, 50, 50, 0.3) !important;
    animation: wcmErrorShake 0.4s ease-in-out !important;
}

.wcm-profile-option.wcm-input-error span {
    color: #ff4d4d !important;
}

/* 2. Checkboxy w etykietach (np. zgody, dokumenty) */
label.wcm-input-error {
    color: #ff4d4d !important;
    text-shadow: 0 0 5px rgba(255, 0, 0, 0.3) !important;
}

label.wcm-input-error input[type="checkbox"] + span, /* Jeśli struktura to input + span */
label.wcm-input-error span {
   color: #ff4d4d !important; 
}

@keyframes wcmErrorShake {
    0%, 100% { transform: translateX(0); }
    25% { transform: translateX(-5px); }
    75% { transform: translateX(5px); }
}


.wcm-ipricelist-email-quote-section select option {
    background-color: #1a1a1a !important;
    color: #fff !important;
}

.wcm-ipricelist-email-quote-section .description {
  display: block !important;
  font-size: clamp(0.78rem, 1.6vw, 0.85rem) !important;
  color: rgba(255, 255, 255, 0.6) !important;
  margin-top: clamp(4px, 1vw, 6px) !important;
  line-height: 1.4 !important;
  margin-bottom: clamp(8px, 1.5vw, 12px) !important;
}

.wcm-ipricelist-email-quote-section .required,
.wcm-ipricelist-email-quote-section .wcm-ipricelist-required-indicator {
  color: var(--ae-green, #54aa09) !important;
  font-weight: 700 !important;
  margin-left: 4px !important;
}

/* =================================================
   SEKCJE GRUPOWE I ROZWIJANE
================================================= */

.wcm-collapsible-wrapper {
    margin-top: clamp(12px, 2.5vw, 20px) !important;
    margin-bottom: clamp(12px, 2.5vw, 20px) !important;
    border-top: 1px solid rgba(255,255,255,0.1) !important;
    padding-top: clamp(12px, 2.5vw, 20px) !important;
    clear: both !important;
}

.wcm-collapsible-trigger-label {
    display: flex !important;
    justify-content: space-between !important; /* Strzałka po prawej */
    align-items: center !important;
    padding: clamp(12px, 2.5vw, 16px) clamp(14px, 3vw, 20px) !important;
    border-radius: 10px !important;
    border: 1px solid rgba(255,255,255,0.1) !important;
    background: rgba(255,255,255,0.05) !important;
    color: #fff !important;
    cursor: pointer !important;
    font-weight: 700 !important;
    margin-bottom: clamp(6px, 1.5vw, 10px) !important;
    transition: background 0.3s !important;
    font-size: clamp(0.9rem, 1.9vw, 0.95rem) !important;
}

.wcm-collapsible-trigger-label:hover {
    background: rgba(255,255,255,0.1) !important;
}

.wcm-collapsible-trigger-label input[type="checkbox"] {
    position: absolute !important;
    opacity: 0 !important;
    width: 0 !important;
    height: 0 !important;
    pointer-events: none !important;
}

/* Ukrywamy kwadrat checkboxa w nagłówku */
.wcm-collapsible-trigger-label::before { display: none !important; }

/* Strzałka Chevron */
.wcm-collapsible-trigger-label::after {
    content: '' !important;
    display: block !important;
    width: clamp(7px, 1.2vw, 8px) !important;
    height: clamp(7px, 1.2vw, 8px) !important;
    border-right: 2px solid rgba(255,255,255,0.6) !important;
    border-bottom: 2px solid rgba(255,255,255,0.6) !important;
    transform: rotate(45deg) !important;
    transition: transform 0.3s ease, border-color 0.3s !important;
    margin-left: clamp(10px, 2vw, 15px) !important;
    opacity: 1 !important;
}

.wcm-collapsible-trigger-label:has(input[type="checkbox"]:checked)::after {
    transform: rotate(225deg) !important;
    border-color: var(--ae-green, #54aa09) !important;
}

.wcm-collapsible-fields-container {
    display: none !important;
    padding: clamp(18px, 3vw, 25px) !important;
    background-color: rgba(0, 0, 0, 0.25) !important;
    border-radius: 10px !important;
    border: 1px solid rgba(255,255,255,0.08) !important;
    margin-bottom: clamp(10px, 2.5vw, 15px) !important;
    margin-top: clamp(4px, 1.5vw, 8px) !important;
}

.wcm-collapsible-fields-container.is-visible {
    display: block !important;
    animation: wcmSlideDown 0.3s cubic-bezier(0.4, 0, 0.2, 1) !important;
}

/* Klasa pancernego ukrywania */
.wcm-force-hidden {
    display: none !important;
}

@keyframes wcmSlideDown {
    from { opacity: 0 !important; transform: translateY(-10px) !important; }
    to { opacity: 1 !important; transform: translateY(0) !important; }
}

/* =================================================
   WYBÓR DOKUMENTÓW - KONTENER I CHECKBOXY
================================================= */
#wcm-pdf-documents-selection {
  margin-top: clamp(12px, 2.5vw, 16px) !important;
  padding: clamp(14px, 3vw, 20px) !important;
  background: rgba(255, 255, 255, .04) !important;
  border-radius: 10px !important;
  border: 1px solid rgba(255,255,255,0.1) !important;
}

#wcm-pdf-documents-selection label {
    display: inline-flex !important;
    align-items: center !important;
    position: relative !important;
    cursor: pointer !important;
    font-size: clamp(0.85rem, 1.7vw, 0.95rem) !important;
}

#wcm-pdf-documents-selection label input[type="checkbox"] {
    position: absolute !important; opacity: 0 !important; width: 0 !important; height: 0 !important; pointer-events: none !important;
}

#wcm-pdf-documents-selection label::before {
    content: '' !important;
    width: clamp(18px, 3vw, 22px) !important;
    height: clamp(18px, 3vw, 22px) !important;
    flex-shrink: 0 !important;
    border: 1px solid rgba(255,255,255,0.3) !important;
    border-radius: 6px !important;
    background: rgba(255, 255, 255, .06) !important;
    transition: all .2s ease !important;
    margin-right: clamp(8px, 1.6vw, 12px) !important; 
}

#wcm-pdf-documents-selection label::after {
    content: '\2713' !important;
    position: absolute !important;
    left: clamp(5px, 1.2vw, 6px) !important;
    top: 50% !important;
    font-size: clamp(12px, 2vw, 14px) !important;
    font-weight: 900 !important;
    color: #fff !important;
    opacity: 0 !important;
    transition: all .2s ease-in-out !important;
    pointer-events: none !important;
    transform: translateY(-50%) scale(0) !important;
}

#wcm-pdf-documents-selection label:has(input[type="checkbox"]:checked)::before {
    background: var(--ae-green, #54aa09) !important; border-color: var(--ae-green, #54aa09) !important;
}

#wcm-pdf-documents-selection label:has(input[type="checkbox"]:checked)::after {
    opacity: 1 !important; transform: translateY(-50%) scale(1) !important;
}

/* =================================================
   PRZYCISKI
================================================= */
.wcm-ipricelist-email-quote-section .button-primary {
  display: block !important;
  width: 100% !important;
  padding: clamp(14px, 3vw, 18px) clamp(18px, 4vw, 24px) !important;
  background: linear-gradient(135deg, var(--ae-green, #54aa09) 0%, #438a06 100%) !important;
  color: #fff !important;
  border: none !important;
  border-radius: 10px !important;
  font-size: clamp(0.95rem, 2.2vw, 1.1rem) !important;
  font-weight: 800 !important;
  cursor: pointer !important;
  transition: all 0.3s cubic-bezier(0.25, 0.8, 0.25, 1) !important;
  margin-top: clamp(24px, 5vw, 40px) !important;
  box-shadow: 0 10px 30px rgba(84, 170, 9, 0.3) !important;
  text-transform: uppercase !important;
  letter-spacing: 1px !important;
  position: relative !important;
  overflow: hidden !important;
}

.wcm-ipricelist-email-quote-section .button-primary:hover {
  transform: translateY(-3px) !important;
  box-shadow: 0 15px 35px rgba(84, 170, 9, 0.5) !important;
  filter: brightness(1.1) !important;
}

/* =================================================
   SEKCJA PROFILU KLIENTA
================================================= */
.wcm-profile-selector {
    margin-bottom: clamp(20px, 4vw, 30px) !important;
    padding: 0 !important;
    background: transparent !important;
    border: none !important;
}

.wcm-profile-selector h5 {
    margin: 0 0 clamp(10px, 2vw, 15px) 0 !important;
    color: rgba(255,255,255,0.8) !important;
    font-size: clamp(0.78rem, 1.6vw, 0.9rem) !important;
    font-weight: 700 !important;
    text-transform: uppercase !important;
    letter-spacing: 1px !important;
    padding-left: 5px !important;
}

.wcm-profile-options {
    display: grid !important;
    grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
    gap: clamp(12px, 3vw, 20px) !important;
}

.wcm-profile-option {
    display: flex !important;
    flex-direction: column !important;
    align-items: center !important;
    justify-content: center !important;
    padding: clamp(14px, 3vw, 20px) !important;
    background: rgba(255, 255, 255, 0.05) !important;
    border: 2px solid rgba(255, 255, 255, 0.1) !important;
    border-radius: 12px !important;
    cursor: pointer !important;
    transition: all 0.3s cubic-bezier(0.25, 0.8, 0.25, 1) !important;
    position: relative !important;
    user-select: none !important;
    text-align: center !important;
}

.wcm-profile-option input[type="radio"] {
    position: absolute !important; opacity: 0 !important; width: 0 !important; height: 0 !important; pointer-events: none !important;
}

.wcm-profile-option svg {
    width: clamp(24px, 5vw, 32px) !important;
    height: clamp(24px, 5vw, 32px) !important;
    margin-bottom: clamp(8px, 1.8vw, 12px) !important;
    stroke: rgba(255, 255, 255, 0.5) !important;
    transition: stroke 0.3s ease, transform 0.3s ease !important;
}

.wcm-profile-option span {
    color: rgba(255, 255, 255, 0.7) !important;
    font-weight: 600 !important;
    font-size: clamp(0.9rem, 2vw, 1rem) !important;
    transition: color 0.3s ease !important;
}

.wcm-profile-option:hover {
    background: rgba(255, 255, 255, 0.1) !important;
    border-color: rgba(255, 255, 255, 0.3) !important;
    transform: translateY(-2px) !important;
}

.wcm-profile-option:hover svg {
    stroke: #fff !important;
    transform: scale(1.1) !important;
}

.wcm-profile-option:hover span {
    color: #fff !important;
}

.wcm-profile-option:has(input:checked) {
    background: rgba(84, 170, 9, 0.15) !important;
    border-color: var(--ae-green, #54aa09) !important;
    box-shadow: 0 0 20px rgba(84, 170, 9, 0.2) !important;
}

.wcm-profile-option:has(input:checked) svg {
    stroke: var(--ae-green, #54aa09) !important;
    filter: drop-shadow(0 0 5px rgba(84, 170, 9, 0.6)) !important;
}

.wcm-profile-option:has(input:checked) span {
    color: #fff !important;
}

@media (max-width: 600px) {
    .wcm-profile-options {
        grid-template-columns: 1fr !important;
    }
    .wcm-profile-option {
        flex-direction: row !important;
        justify-content: flex-start !important;
        padding: clamp(12px, 3.5vw, 16px) clamp(14px, 4vw, 20px) !important;
    }
    .wcm-profile-option svg {
        margin-bottom: 0 !important;
        margin-right: clamp(10px, 3vw, 15px) !important;
        width: clamp(20px, 4.5vw, 24px) !important;
        height: clamp(20px, 4.5vw, 24px) !important;
    }
}

/* =================================================
   POLA DATY Z IKONĄ
================================================= */
.wcm-date-input-wrapper {
    position: relative !important;
    display: flex !important;
    align-items: center !important;
    width: 100% !important;
}

.wcm-date-input-wrapper .wcm-date-icon {
    position: absolute !important;
    left: clamp(12px, 2.5vw, 16px) !important;
    pointer-events: none !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    color: rgba(255,255,255,0.5) !important;
    z-index: 1 !important;
}

.wcm-date-input-wrapper input[type="date"] {
    padding-left: clamp(36px, 6vw, 44px) !important;
}

/* =================================================
   STYLE DLA GRUP PÓL (FIELDSET)
   + FIX NA GAP (LUKĘ)
================================================= */

fieldset.wcm-customer-group {
    border: 1px solid rgba(255, 255, 255, 0.1) !important;
    background: rgba(255, 255, 255, 0.02) !important;
    border-radius: 8px !important;
    padding: clamp(10px, 2.5vw, 15px) clamp(14px, 3vw, 20px) !important;
    margin: 0 0 clamp(10px, 2.5vw, 15px) 0 !important;
    min-width: 0 !important;
    transition: all 0.2s ease !important;
}

fieldset.wcm-customer-group legend {
    color: rgba(255, 255, 255, 0.7) !important;
    font-size: clamp(0.78rem, 1.6vw, 0.85rem) !important;
    font-weight: 700 !important;
    text-transform: uppercase !important;
    padding: 0 10px !important;
    margin-left: -10px !important;
    letter-spacing: 1px !important;
}

/* --- FIX NA PUSTE PRZESTRZENIE (BRUTALNY RESET) --- */
/* Zwiększamy specyficzność selektora, aby wygrał z definicją fieldset powyżej */
.wcm-ipricelist-email-quote-section .wcm-force-hidden,
fieldset.wcm-customer-group.wcm-force-hidden {
    display: none !important;
    visibility: hidden !important;
    opacity: 0 !important;
    height: 0 !important;
    margin: 0 !important;
    padding: 0 !important;
    border: none !important;
    overflow: hidden !important;
    width: 0 !important;
    max-height: 0 !important;
    pointer-events: none !important; /* POPRAWKA: Zapobiega interakcjom z ukrytym elementem */
}

/* Dodatkowy fix: Jeśli po H4 następuje ukryty element, usuń margines H4 */
.wcm-ipricelist-email-quote-section h4:has(+ .wcm-force-hidden) {
    margin-bottom: 0 !important;
    padding-bottom: 0 !important;
    border-bottom: none !important;
}