/**
 * WM Forms - style frontendu.
 */

.wm-forms-wrapper {
    max-width: 100%;
    margin: 20px 0;
    font-family: inherit;
}

.wm-forms-form {
    display: block;
}

.wm-forms-description {
    margin: 0 0 20px;
    color: #555;
    font-size: 15px;
}

/* ===== Fields container - grid ===== */
.wm-forms-fields {
    display: grid;
    grid-template-columns: repeat(6, 1fr);
    gap: 15px;
}

/* ===== Field wrapper ===== */
.wm-forms-field {
    grid-column: span 6;
    display: flex;
    flex-direction: column;
    min-width: 0; /* Naprawa: bez tego pola z dużą zawartością rozszerzają track i 1/3 nie mieści 3 pól */
}

.wm-forms-width-full       { grid-column: span 6; }
.wm-forms-width-half       { grid-column: span 3; }
.wm-forms-width-third      { grid-column: span 2; }
.wm-forms-width-two-thirds { grid-column: span 4; }

/* Tablet - pomiędzy desktop a mobile */
@media (max-width: 900px) and (min-width: 641px) {
    .wm-forms-width-third {
        grid-column: span 3; /* na tablecie 1/3 staje się 1/2 */
    }
}

@media (max-width: 640px) {
    .wm-forms-field,
    .wm-forms-width-full,
    .wm-forms-width-half,
    .wm-forms-width-third,
    .wm-forms-width-two-thirds {
        grid-column: span 6;
    }
}

/* ===== Labels ===== */
.wm-forms-label {
    font-weight: 600;
    margin-bottom: 6px;
    display: block;
    font-size: 14px;
    color: #2c3338;
}

.wm-forms-label .wm-forms-required,
.wm-forms-required {
    color: #d63638;
    margin-left: 2px;
}

.wm-forms-field-desc {
    display: block;
    font-size: 13px;
    color: #666;
    margin-top: 4px;
}

/* ===== Inputs ===== */
.wm-forms-input {
    width: 100%;
    padding: 10px 12px;
    border: 1px solid #c9c9c9;
    border-radius: 4px;
    font-size: 15px;
    font-family: inherit;
    background: #fff;
    box-sizing: border-box;
    transition: border-color 0.15s, outline 0.15s;
}

.wm-forms-input:focus {
    border-color: #2271b1;
    outline: 2px solid rgba(34,113,177,0.15);
    outline-offset: 0;
}

textarea.wm-forms-input {
    resize: vertical;
    min-height: 100px;
}

.wm-forms-input.wm-forms-invalid {
    border-color: #d63638;
    background: #fef2f2;
}

/* ===== Radio / Checkbox groups ===== */
.wm-forms-radio-group,
.wm-forms-checkbox-group {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.wm-forms-radio-label,
.wm-forms-checkbox-label {
    display: flex;
    align-items: center;
    gap: 8px;
    cursor: pointer;
    font-size: 15px;
    font-weight: normal;
}

.wm-forms-radio-label input,
.wm-forms-checkbox-label input {
    margin: 0;
}

/* ===== Consent (RODO) ===== */
.wm-forms-consent-label {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    font-size: 13px;
    color: #444;
    cursor: pointer;
}
.wm-forms-consent-label input { margin-top: 4px; flex-shrink: 0; }

/* ===== HTML / Heading / Section ===== */
.wm-forms-heading {
    margin: 10px 0 5px;
    font-size: 18px;
    font-weight: 600;
    color: #1d2327;
}

.wm-forms-section-divider {
    border: 0;
    border-top: 1px solid #e5e5e5;
    margin: 15px 0;
}

.wm-forms-html-block {
    line-height: 1.6;
}

/* ===== File upload ===== */
.wm-forms-file,
input[type="file"].wm-forms-input {
    padding: 8px;
    border: 1px dashed #c9c9c9;
    border-radius: 4px;
    background: #fafafa;
    font-size: 14px;
}

/* ===== Submit button ===== */
.wm-forms-submit {
    margin-top: 20px;
    display: flex;
    align-items: center;
    gap: 10px;
}

.wm-forms-submit-btn {
    background: #2271b1;
    color: #fff;
    padding: 12px 28px;
    border: none;
    border-radius: 4px;
    font-size: 15px;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.15s;
    font-family: inherit;
}

.wm-forms-submit-btn:hover { background: #135e96; }
.wm-forms-submit-btn:disabled { opacity: 0.6; cursor: not-allowed; }

.wm-forms-loader {
    display: none;
    width: 18px;
    height: 18px;
    border: 3px solid #dcdcde;
    border-top-color: #2271b1;
    border-radius: 50%;
    animation: wm-forms-spin 0.8s linear infinite;
}
.wm-forms-form.wm-forms-loading .wm-forms-loader { display: inline-block; }

.wm-forms-submit-btn .wm-forms-inline-loader {
    display: none;
    width: 14px;
    height: 14px;
    border: 2px solid rgba(255,255,255,0.3);
    border-top-color: #fff;
    border-radius: 50%;
    animation: wm-forms-spin 0.8s linear infinite;
    margin-right: 8px;
    vertical-align: middle;
}
.wm-forms-submit-btn.wm-forms-loading .wm-forms-inline-loader { display: inline-block; }

@keyframes wm-forms-spin { to { transform: rotate(360deg); } }

/* ===== Honeypot (ukryte) ===== */
.wm-forms-honeypot {
    position: absolute !important;
    left: -9999px !important;
    top: -9999px !important;
    height: 1px !important;
    width: 1px !important;
    overflow: hidden !important;
}

/* ===== Messages ===== */
.wm-forms-messages:empty { display: none; }

.wm-forms-message {
    padding: 12px 15px;
    margin-bottom: 15px;
    border-radius: 4px;
    font-size: 14px;
    line-height: 1.5;
}

/* v1.3.11.4: zachowaj odstępy z WYSIWYG w komunikatach (motyw może je resetować). */
.wm-forms-message p {
    margin: 0 0 10px 0;
}
.wm-forms-message p:last-child {
    margin-bottom: 0;
}
.wm-forms-message ul,
.wm-forms-message ol {
    margin: 0 0 10px 20px;
}
.wm-forms-message strong,
.wm-forms-message b {
    font-weight: 600;
}

.wm-forms-message-success {
    background: #dcfce7;
    color: #166534;
    border-left: 4px solid #16a34a;
}

.wm-forms-message-error {
    background: #fee2e2;
    color: #991b1b;
    border-left: 4px solid #dc2626;
}

.wm-forms-field-error {
    color: #d63638;
    font-size: 13px;
    margin-top: 4px;
    display: block;
}

/* ===== Pole obliczane (kalkulator) ===== */
.wm-forms-calc-display {
    width: 100%;
    padding: 10px 12px;
    border: 1px solid #c9c9c9;
    border-radius: 4px;
    font-size: 18px;
    font-weight: 600;
    font-family: inherit;
    background: #f6f7f7;
    color: #135e96;
    box-sizing: border-box;
    min-height: 44px;
    display: flex;
    align-items: center;
    justify-content: flex-end;
    text-align: right;
}

/* ===== Conditional hidden ===== */
.wm-forms-hidden {
    display: none !important;
}

/* ===== Closed / disabled state ===== */
.wm-forms-disabled {
    padding: 20px;
    background: #f6f7f7;
    border: 1px solid #dcdcde;
    border-radius: 4px;
    color: #50575e;
    text-align: center;
}

/* ===== Pole "Imię i nazwisko" ===== */
.wm-forms-fullname-wrap {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 8px;
}
@media (max-width: 480px) {
    .wm-forms-fullname-wrap { grid-template-columns: 1fr; }
}

/* ===== Pole "Adres" ===== */
.wm-forms-address-wrap {
    display: grid;
    grid-template-columns: 1fr;
    gap: 8px;
}
.wm-forms-address-wrap .wm-forms-addr-postal { max-width: 120px; }
.wm-forms-address-wrap .wm-forms-addr-street { grid-column: 1 / -1; }

@media (min-width: 600px) {
    .wm-forms-address-wrap {
        grid-template-columns: 120px 1fr;
    }
    .wm-forms-address-wrap .wm-forms-addr-street,
    .wm-forms-address-wrap .wm-forms-addr-state,
    .wm-forms-address-wrap .wm-forms-addr-country {
        grid-column: 1 / -1;
    }
}

/* ===== Auto-zapis - notyfikacja ===== */
.wm-forms-autosave-notice {
    background: #f0f6fc;
    border-left: 3px solid #2271b1;
    padding: 8px 12px;
    margin-bottom: 15px;
    border-radius: 3px;
    font-size: 13px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
}
.wm-forms-autosave-notice button {
    background: transparent;
    border: 1px solid #2271b1;
    color: #2271b1;
    padding: 3px 10px;
    border-radius: 3px;
    cursor: pointer;
    font-size: 12px;
}
.wm-forms-autosave-notice button:hover {
    background: #2271b1;
    color: #fff;
}

/* ===== Pole "Mapa / lokalizacja" ===== */
.wm-forms-map-wrap {
    margin-top: 6px;
}
.wm-forms-map-search-wrap {
    display: flex;
    gap: 6px;
    margin-bottom: 8px;
}
.wm-forms-map-search-wrap .wm-forms-map-search {
    flex: 1;
}
.wm-forms-map-canvas {
    width: 100%;
    border: 1px solid #dcdcde;
    border-radius: 4px;
    background: #f6f7f7;
}
.wm-forms-map-address-display {
    margin-top: 6px;
    padding: 6px 10px;
    background: #f0f6fc;
    border-left: 3px solid #2271b1;
    font-size: 13px;
    color: #1d2327;
    border-radius: 3px;
    display: none;
    word-break: break-word;
}

/* ===== Pole "Powtarzacz" (Repeater) ===== */
.wm-forms-repeater {
    border: 1px solid #dcdcde;
    border-radius: 6px;
    padding: 12px;
    background: #fafbfc;
}
.wm-forms-repeater-rows {
    display: flex;
    flex-direction: column;
    gap: 12px;
    margin-bottom: 10px;
}
.wm-forms-repeater-row {
    background: #fff;
    border: 1px solid #e0e0e0;
    border-radius: 4px;
    padding: 10px 12px;
}
.wm-forms-repeater-row-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 8px;
    padding-bottom: 6px;
    border-bottom: 1px solid #f0f0f1;
}
.wm-forms-repeater-row-label {
    font-size: 13px;
    font-weight: 600;
    color: #50575e;
}
.wm-forms-repeater-row-num {
    color: #2271b1;
}
.wm-forms-repeater-row-remove {
    background: transparent;
    border: 1px solid transparent;
    color: #d63638;
    cursor: pointer;
    font-size: 18px;
    line-height: 1;
    padding: 2px 8px;
    border-radius: 3px;
}
.wm-forms-repeater-row-remove:hover {
    background: #fee2e2;
    border-color: #d63638;
}
.wm-forms-repeater-row-fields {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 10px;
}
/* v1.4.10-alpha29: etykieta subfielda (np. "TAK") wyróżniona, by nie zlewała się
   z etykietami opcji checkboxa/radio wewnątrz tego subfielda. */
.wm-forms-repeater-field > label,
.wm-forms-repeater-field-label {
    display: block;
    font-size: 13px;
    color: #1d2327;
    margin-bottom: 5px;
    font-weight: 700;
    padding-bottom: 3px;
    border-bottom: 1px solid #e0e0e0;
}
/* Etykiety pojedynczych opcji checkbox/radio — drobniejsze, normalna waga, inline. */
.wm-forms-repeater-checkbox-group label,
.wm-forms-repeater-radio-group label {
    display: inline-block;
    font-size: 12px;
    color: #50575e;
    font-weight: 400;
    margin: 0 10px 4px 0;
    padding: 0;
    border: 0;
}
.wm-forms-repeater-field input,
.wm-forms-repeater-field textarea,
.wm-forms-repeater-field select {
    width: 100%;
}
/* Grupy opcji nie są pełnej szerokości inputami. */
.wm-forms-repeater-checkbox-group input,
.wm-forms-repeater-radio-group input {
    width: auto;
}
.wm-forms-repeater-add {
    background: #2271b1 !important;
    color: #fff !important;
    border-color: #2271b1 !important;
    font-weight: 500 !important;
}
.wm-forms-repeater-add:hover {
    background: #135e96 !important;
}

/* v1.4.10-alpha10: pole ukryte w formularzu (np. kalkulator do obliczeń backendowych).
   Pole jest w DOM (działa skrypt, walidacja, kalkulacja), ale niewidoczne dla usera. */
.wm-forms-field.wm-forms-hidden-field {
    display: none !important;
}
