/* Minimal, theme-friendly styles for the custom upload UI */
.wfu-upload { margin: 16px 0 10px; }
.wfu-upload .wfu-label { display:inline-block; margin-bottom:8px; font-weight:700; font-size:14px; letter-spacing:inherit; text-transform:none; }

/* Domyślna zmienna koloru obramowań na stronie produktu; JS może ją nadpisać, aby dopasować do "rozmiar/kolor" */
.single-product .summary { --wfu-border-color: #111827; }

/* Ułóż pole i przycisk w jednym rzędzie bez odstępu (jak jeden input z przyciskiem) */
.wfu-upload .wfu-file-ui { display:flex; align-items:stretch; gap:0; }

/* Ukryty natywny input, dostępny dla czytników ekranowych */
.wfu-upload .wfu-input-file { position:absolute; width:1px; height:1px; opacity:0; overflow:hidden; clip:rect(0 0 0 0); clip-path: inset(50%); white-space:nowrap; }

/* Lewy box wyglądający jak input tekstowy — bez własnych krawędzi (krawędź ma kontener) */
.wfu-upload .wfu-file-box { flex:1 1 auto; display:flex; align-items:center; min-height:40px; border:0; border-right:0; border-radius:0; background:#fff; padding:0 12px; cursor:pointer; min-width:0; }
.wfu-upload .wfu-file-box:focus { outline:2px solid #2563eb; outline-offset:2px; }
.wfu-upload .wfu-file-name { display:block; width:100%; color:#6b7280; overflow:hidden; text-overflow:ellipsis; white-space:nowrap; }
.wfu-upload.has-file .wfu-file-name { color:#111827; }

/* Prawy przycisk — bez własnej krawędzi (krawędź ma kontener) */
.wfu-upload .wfu-file-btn { flex:0 0 auto; height:40px; width:42px; border:0; border-left:0; border-radius:0; background:#fff; color:#111827; display:flex; align-items:center; justify-content:center; cursor:pointer;
    background-repeat:no-repeat !important; background-position:center !important; background-size:18px 18px !important;
    background-image:url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23111827' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M12 16V4'/%3E%3Cpath d='M8 8l4-4 4 4'/%3E%3Cpath d='M4 16v2a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2v-2'/%3E%3C/svg%3E") !important;
    box-shadow:none !important; filter:none !important; transform:none !important;
}
.wfu-upload .wfu-file-btn::after { content:""; width:18px; height:18px; display:block; pointer-events:none; background-repeat:no-repeat !important; background-position:center !important; background-size:18px 18px !important; background-image:url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23111827' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M12 16V4'/%3E%3Cpath d='M8 8l4-4 4 4'/%3E%3Cpath d='M4 16v2a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2v-2'/%3E%3C/svg%3E") !important; }
/* Brak zmian na hover/active — wygląd stały i nieznika tło */
.wfu-upload .wfu-file-btn:hover,
.wfu-upload .wfu-file-btn:active,
.wfu-upload .wfu-file-btn:focus { background-color:#fff !important; color:#111827 !important; background-image:inherit !important; box-shadow:none !important; filter:none !important; transform:none !important; }
/* Wymuszenie widoczności ikony i grubości linii */
.wfu-upload .wfu-file-btn .wfu-icon,
.wfu-upload .wfu-file-btn svg { display:block !important; width:18px; height:18px; }
.wfu-upload .wfu-file-btn svg path { stroke:#111827 !important; stroke-width:2 !important; }

/* Podgląd miniatury pod polem — bez zaokrągleń */
.wfu-upload .wfu-preview { margin-top:6px; }
.wfu-upload .wfu-preview .wfu-thumb { position:relative; display:inline-block; }
.wfu-upload .wfu-preview .wfu-thumb img { display:block; }
.wfu-upload .wfu-preview .wfu-remove { position:absolute; top:-6px; right:-6px; width:18px; height:18px; border-radius:50%; background:#000; color:#fff; border:0; padding:0; display:flex; align-items:center; justify-content:center; font-size:12px; font-weight:700; cursor:pointer; box-shadow:0 0 0 1px rgba(0,0,0,0.12); line-height:1; }
.wfu-upload .wfu-preview .wfu-remove:hover { background:#111; }
.wfu-upload .wfu-preview .wfu-remove:focus { outline:2px solid #fff; outline-offset:0; }

/* Upload field — overrides with higher specificity to beat theme rules */
.single-product .summary .wfu-upload { margin-left:0 !important; padding-left:0 !important; margin-top:24px !important; margin-bottom:6px !important; }
.single-product .summary .wfu-upload .wfu-label { font-size:14px !important; font-weight:700 !important; color:#111827 !important; margin-bottom:6px !important; display:block; letter-spacing:inherit; text-transform:none; }
/* Kontener ma jedną ramkę i zaokrąglenie 4px — usuwa linię między polem a ikoną */
.single-product .summary .wfu-upload .wfu-file-ui { width:100%; max-width:100%; border:1px solid var(--wfu-border-color, #111827) !important; border-radius:4px; overflow:hidden; background:#fff; }
/* Dzieci bez własnych zaokrągleń/borderów (zaokrąglenie jest na kontenerze) */
.single-product .summary .wfu-upload .wfu-file-box { border:0 !important; border-radius:0 !important; }
.single-product .summary .wfu-upload .wfu-file-btn { border:0 !important; border-radius:0 !important; }

/* Persistent icon (no hover change, no theme effects) */
.single-product .summary .wfu-upload .wfu-file-btn,
.single-product .summary .wfu-upload .wfu-file-btn:hover,
.single-product .summary .wfu-upload .wfu-file-btn:focus,
.single-product .summary .wfu-upload .wfu-file-btn:active {
  background-color:#fff !important;
  background-repeat:no-repeat !important;
  background-position:center !important;
  background-size:18px 18px !important;
  background-image:url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23111827' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M12 16V4'/%3E%3Cpath d='M8 8l4-4 4 4'/%3E%3Cpath d='M4 16v2a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2v-2'/%3E%3C/svg%3E") !important;
  box-shadow:none !important; filter:none !important; transform:none !important;
}
.single-product .summary .wfu-upload .wfu-file-btn::after { content:""; width:18px; height:18px; display:block; pointer-events:none; background-repeat:no-repeat !important; background-position:center !important; background-size:18px 18px !important; background-image:url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23111827' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M12 16V4'/%3E%3Cpath d='M8 8l4-4 4 4'/%3E%3Cpath d='M4 16v2a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2v-2'/%3E%3C/svg%3E") !important; }

/* Align left edges with quantity: ensure same left edge and no extra offset */
.single-product .summary form.cart .wfu-upload,
.single-product .summary form.cart .quantity { margin-left:0 !important; }
/* Ensure comment field aligns with upload and quantity (left edge) */
.single-product .summary .wfu-comment { margin-left:0 !important; padding-left:0 !important; margin-top:10px !important; }
.single-product .summary .wfu-comment label { display:block; margin-bottom:6px; font-weight:700; font-size:14px; color:#111827; letter-spacing:inherit; text-transform:none; }
/* Komentarz: lekkie (4px) zaokrąglenie i spójny kolor obramowania */
.single-product .summary .wfu-comment textarea { width:100% !important; max-width:100% !important; border:1px solid var(--wfu-border-color, #111827) !important; border-radius:4px; }
/* Align quantity block flush left and avoid theme offsets */
.single-product .summary form.cart { align-items:flex-start; }
.single-product .summary form.cart .quantity { margin-left:0 !important; padding-left:0 !important; }
/* Ilość: jedna ramka i zaokrąglenie na kontenerze, bez podziałek wewnątrz */
.single-product .summary form.cart .quantity { display:inline-flex; align-items:stretch; margin-left:0 !important; padding-left:0 !important; border:1px solid var(--wfu-border-color, #111827) !important; border-radius:4px; overflow:hidden; background:#fff; }
.single-product .summary form.cart .quantity .minus,
.single-product .summary form.cart .quantity .plus { border:0 !important; border-radius:0 !important; background:#fff; }
.single-product .summary form.cart .quantity .qty { border:0 !important; border-radius:0 !important; box-shadow:none !important; background:#fff; }
/* Jeżeli motyw dodaje radius na środku — wyzeruj, żeby kształt był czytelny */
.single-product .summary form.cart .quantity .qty { border-radius:0 !important; }

/* Hide the WYCZYŚĆ link under variations */
.single-product .summary .reset_variations { display:none !important; visibility:hidden !important; }

/* Spacing between variation rows: keep compact and even */
.single-product .summary table.variations tr + tr td,
.single-product .summary table.variations tr + tr .label,
.single-product .summary table.variations tr + tr .value { padding-top:0 !important; }

/* Smaller, even gap between label (e.g., "Rozmiar:") and its swatches — red marks */
.single-product .summary table.variations .label { padding-bottom:4px !important; }
.single-product .summary table.variations .value { padding-top:0 !important; }
.single-product .summary table.variations .woo-variation-items-wrapper,
.single-product .summary table.variations .variable-items-wrapper { margin-top:2px !important; }

/* Bigger gap below the first row of variations (after size swatches) — green mark */
.single-product .summary table.variations tr:first-child .value { padding-bottom:8px !important; }
.single-product .summary table.variations tr:first-child .woo-variation-items-wrapper,
.single-product .summary table.variations tr:first-child .variable-items-wrapper { margin-bottom:8px !important; }

/* Fallback for some themes: don't add extra gap on value */
.single-product .summary .variations_form .value { margin-top:0 !important; }

/* Ensure file UI is always clickable regardless of theme overlays */
.wfu-upload .wfu-file-box,
.wfu-upload .wfu-file-btn {
  pointer-events: auto !important;
  cursor: pointer !important;
}

/* Jeśli nie ma pola upload (domyślnie) — większy odstęp nad częścią z wariantami/"Dodaj do koszyka" */
.single-product .summary form.cart .single_variation_wrap {
  margin-top: 20px !important;
}

/* Gdy pole upload występuje bezpośrednio przed wariacjami — przytrzymaj mniejszy odstęp */
.single-product .summary form.cart .wfu-upload + .single_variation_wrap,
/* Gdy pole komentarza występuje przed wariacjami — też mniejsze odległości */
.single-product .summary form.cart .wfu-comment + .single_variation_wrap {
  margin-top: 6px !important;
}

/* Dodatkowe zabezpieczenie: gdy upload jest gdziekolwiek w formularzu — utrzymaj znormalizowany mniejszy odstęp */
.single-product .summary form.cart .wfu-upload ~ .single_variation_wrap {
  margin-top: 6px !important;
}

/* Fallback: jeśli temat rysuje cienką linię jako border-bottom na tabeli wariantów — usuń ją */
.single-product .summary table.variations,
.single-product .summary .variations_form table.variations {
  border-bottom: 0 !important;
  box-shadow: none !important;
}
/* Usuń ewentualną linię oddzielającą (czasem rysowaną przez pseudo-elementy) przez ustawienie przezroczystego koloru */
.single-product .summary table.variations td,
.single-product .summary table.variations td.value {
  border-bottom-color: transparent !important;
  border-bottom-width: 0 !important;
}
/* Dodatkowe duże odsunięcie pod swatchami (niweluje "przyklejenie") */
.single-product .summary table.variations td.value .woo-variation-items-wrapper,
.single-product .summary table.variations td.value .variable-items-wrapper,
.single-product .summary table.variations td.value .variation,
.single-product .summary table.variations td.value .swatch,
.single-product .summary table.variations td.value .value {
  margin-bottom: 18px !important;
  padding-bottom: 12px !important;
}
/* Jeżeli chcesz szybko zdiagnozować, który element rysuje linię - tymczasowo odkomentuj poniższą regułę w inspektorze: */
/* .single-product .summary table.variations td.value { outline: 1px dashed rgba(255,0,0,0.6) !important; } */

/* Bardziej agresywne: usuń pseudo-elementy i górną linię, którą motyw mógł dodać */
.single-product .summary table.variations::before,
.single-product .summary table.variations::after,
.single-product .summary .variations_form table.variations::before,
.single-product .summary .variations_form table.variations::after,
.single-product .summary .variations::before,
.single-product .summary .variations::after {
  content: none !important;
  display: none !important;
}
.single-product .summary form.cart .single_variation_wrap,
.single-product .summary .single_variation_wrap {
  border-top: 0 !important;
  box-shadow: none !important;
}

/* --- MOBILE FIXES: zapobieganie poziomowemu przewijaniu na małych ekranach --- */
@media (max-width: 768px) {
  /* Bezpieczne ograniczenia szerokości i brak przewijania w poziomie w sekcji produktu */
  .single-product .summary { max-width: 100%; overflow-x: hidden; }

  /* Ułóż tabelę wariantów pionowo, elementy pełnej szerokości */
  .single-product .summary table.variations { width:100% !important; max-width:100% !important; table-layout:fixed; display:block; }
  .single-product .summary table.variations tbody,
  .single-product .summary table.variations tr { display:block; width:100%; }
  .single-product .summary table.variations th,
  .single-product .summary table.variations td,
  .single-product .summary table.variations .label,
  .single-product .summary table.variations .value { display:block; width:100% !important; max-width:100% !important; padding-left:0 !important; padding-right:0 !important; }
  .single-product .summary table.variations select,
  .single-product .summary table.variations .woo-variation-items-wrapper,
  .single-product .summary table.variations .variable-items-wrapper { width:100% !important; max-width:100% !important; }

  /* Nasze pola zawsze w 100% szerokości */
  .single-product .summary .wfu-upload,
  .single-product .summary .wfu-comment { width:100%; max-width:100%; }
  .single-product .summary .wfu-upload .wfu-file-ui { width:100% !important; max-width:100% !important; }
  .single-product .summary .wfu-comment textarea { width:100% !important; max-width:100% !important; }
  .single-product .summary form.cart input[type="text"],
  .single-product .summary form.cart input[type="number"],
  .single-product .summary form.cart select,
  .single-product .summary form.cart textarea { max-width:100% !important; }

  /* Podgląd — nie pozwól przyciskowi usuń "wystawać" na prawo */
  .single-product .summary .wfu-preview { overflow:hidden; }
  .single-product .summary .wfu-preview .wfu-remove { right:0; }
}
