/**
 * Soubor: front.floorcalculator.css
 * Verze souboru: 1.6.0
 * Cesta: /modules/floorcalculator/views/css/front.floorcalculator.css
 *
 * Changelog:
 * - 1.6.0 (2025-11-19):
 *   - Styly pro detailní přehled kalkulace (Materiál / Doplňky / Celkem) včetně DPH.
 *   - Zelené zvýraznění kladných částek („+X Kč“).
 *   - Jemné zarovnání textu v panelu výsledků.
 * - 1.5.0 (2025-11-18):
 *   - Nové UI pro výběr obšívacích nití: čtvercové chipy 100×100 px, zelený checkmark v rohu,
 *   - zebrazení celé šířky pod volbou obšití, jednoduchý carousel s šipkami.
 *   - Styly pro výběr obšívací nitě (chipsy) včetně stavu „Doporučeno“.
 *   - Drobné doladění chybové hlášky pro povinný výběr nitě.
 * - 1.4.0 (2025-11-13):
 *   - Přidány styly pro CSS-only popover (details/summary) u „i“ ikon.
 *   - Vyladěny chipsy: dvouřádkové popisky, min. šířka, aktivní stav, klávesnice.
 *   - Lehké doladění spacingu a kontrastů pro mobil.
 * - 1.3.0 (2025-11-10):
 *   - Širší input pro šířku po ořezu; styly pro množství a jednotky.
 *   - 1.2.0:
 *   - Základní styly pro kalkulátor (panel, řádky, souhrn, disclaimer).
 */

.product__actions {
  margin-bottom: 1.5rem;
  background: #fafafa;
  padding: 20px;
  border: 1px solid #f5f5f5;
  border-radius: 5px;
}

#fcalc-product-calculator {
  margin-bottom: 1.5rem;
}

#fcalc-product-calculator .fcalc-help-text {
  margin-bottom: 0.75rem;
}

#fcalc-product-calculator .fcalc-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  margin-bottom: 0.75rem;
}

#fcalc-product-calculator .fcalc-row-summary {
  border-top: 1px solid #e5e5e5;
  padding-top: 0.75rem;
  margin-top: 0.5rem;
  justify-content: space-between;
}

#fcalc-product-calculator .fcalc-disclaimer {
  margin-top: 0.75rem;
  font-size: 0.8rem;
}

/* Responsivita */
@media (max-width: 767.98px) {
  #fcalc-product-calculator .fcalc-row {
    flex-direction: column;
    align-items: flex-start;
  }
}

/* ===== Šířka po zúžení ===== */
#fcalc-product-calculator .fcalc-width-input {
  max-width: 120px;
  min-width: 80px;
  text-align: center;
}

/* ===== Výsledky ===== */
#fcalc-product-calculator .fcalc-row-results .fcalc-results p {
  margin-bottom: 0.25rem;
}

/* ===== Link "Jak se cena počítá" ===== */
#fcalc-product-calculator .fcalc-row-price-info .fcalc-price-info-link {
  font-size: 0.95rem;
  text-decoration: underline;
  cursor: pointer;
}

/* ===== Chipsy (šířky/kombinace) ===== */

#fcalc_variant_chips {
  display: flex;
  flex-wrap: wrap;
  gap: .5rem;
}

.fcalc-variant-chip {
  display: inline-flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  border: 1px solid rgba(0, 0, 0, .12);
  background: #fff;
  border-radius: 2px !important;
  /* ostré rohy */
  padding: .8rem .65rem;
  line-height: 1.2;
  text-align: center;
  min-width: 108px;
  cursor: pointer;
  transition: box-shadow .15s ease, border-color .15s ease, background-color .15s ease;
  user-select: none;
}

.fcalc-variant-chip:focus {
  outline: 2px solid rgba(0, 123, 255, .5);
  outline-offset: 2px;
}

.fcalc-variant-chip:hover {
  border-color: rgba(0, 0, 0, .2);
  box-shadow: 0 1px 0 rgba(0, 0, 0, .04);
}

.fcalc-variant-chip.active {
  border-color: rgba(0, 0, 0, .28);
  box-shadow: 0 0 0 2px rgba(0, 0, 0, .06) inset;
  font-weight: 400;
}

.fcalc-variant-chip .fcalc-chip-value {
  display: block;
  font-size: 1.2rem;
  font-weight: 800;
  line-height: 1.8;
}

.fcalc-variant-chip .fcalc-chip-price {
  display: block;
  font-size: .875rem;
  /* ~14px */
  opacity: .9;
  line-height: 1.1;
}

/* ===== Chipsy pro obšívací nitě ===== */

.fcalc-binding-threads-list {
  display: flex;
  flex-wrap: wrap;
  gap: .5rem;
}

.fcalc-thread-chip {
  display: inline-flex;
  align-items: center;
  border: 1px solid rgba(0, 0, 0, .12);
  background: #fff;
  border-radius: 2px !important;
  padding: .35rem .5rem;
  line-height: 1.15;
  cursor: pointer;
  transition: box-shadow .15s ease, border-color .15s ease, background-color .15s ease;
  user-select: none;
}

.fcalc-thread-chip:focus {
  outline: 2px solid rgba(0, 123, 255, .5);
  outline-offset: 2px;
}

.fcalc-thread-chip:hover {
  border-color: rgba(0, 0, 0, .2);
  box-shadow: 0 1px 0 rgba(0, 0, 0, .04);
}

.fcalc-thread-chip--active {
  border-color: rgba(0, 0, 0, .28);
  box-shadow: 0 0 0 2px rgba(0, 0, 0, .06) inset;
  font-weight: 600;
}

.fcalc-thread-chip__image {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  overflow: hidden;
  margin-right: .4rem;
}

.fcalc-thread-chip__image img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.fcalc-thread-chip__label {
  font-size: .9rem;
}

.fcalc-thread-chip__badge {
  margin-left: .4rem;
  font-size: .7rem;
  text-transform: uppercase;
  letter-spacing: .04em;
  opacity: .8;
}

.fcalc-binding-error {
  font-size: .85rem;
}

/* ===== CSS-only popover (details/summary) pro "i" ===== */

.fcalc-popover {
  position: relative;
  display: inline-block;
}

.fcalc-popover>summary.fcalc-info {
  list-style: none;
  cursor: pointer;
  border: 1px solid rgba(0, 0, 0, .2);
  background: #fff;
  color: #333;
  width: 20px;
  height: 20px;
  padding: 0;
  margin: 0;
  border-radius: 999px;
  font-weight: 700;
  font-size: 12px;
  line-height: 18px;
  text-align: center;
  user-select: none;
}

.fcalc-popover>summary.fcalc-info::-webkit-details-marker {
  display: none;
}

.fcalc-popover .fcalc-popover-panel {
  position: absolute;
  top: calc(100% + 8px);
  left: 0;
  z-index: 50;
  min-width: 220px;
  max-width: min(320px, 90vw);
  background: #fff;
  border: 1px solid rgba(0, 0, 0, .15);
  box-shadow: 0 8px 18px rgba(0, 0, 0, .08);
  border-radius: 6px;
  padding: .65rem .75rem;
  font-size: .92rem;
  color: #333;
}

.fcalc-popover .fcalc-popover-panel:before {
  content: "";
  position: absolute;
  top: -8px;
  left: 10px;
  border-width: 8px;
  border-style: solid;
  border-color: transparent transparent rgba(0, 0, 0, .15) transparent;
}

.fcalc-popover .fcalc-popover-panel:after {
  content: "";
  position: absolute;
  top: -7px;
  left: 11px;
  border-width: 7px;
  border-style: solid;
  border-color: transparent transparent #fff transparent;
}

/* Odsazení při vložení ve form-label řádku */
.fcalc-row .fcalc-popover {
  margin-left: .25rem;
}

/* Lepší chování na mobilu: panel může přesáhnout, srovnáme doleva/zakotvíme */
@media (max-width: 575.98px) {
  .fcalc-popover .fcalc-popover-panel {
    left: 0;
    right: auto;
    max-width: 90vw;
  }
}

/* ===== Drobnosti ===== */
#fcalc_total_summary {
  margin: 0;
}

.fcalc-inline-info {
  font-size: .9rem;
  color: #6c757d;
}

.fcalc-toggle-details {
  font-size: .95rem;
}

.fcalc-toggle-details .fcalc-toggle-icon {
  display: inline-block;
  transform: translateY(-1px);
}

/* ===== Obšívací nitě – carousel ===== */

.fcalc-binding-threads-carousel {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin-top: 0.5rem;
  width: 100%;
}

.fcalc-thread-carousel-btn {
  padding: 0.25rem 0.5rem;
  line-height: 1;
  min-width: 2.25rem;
  min-height: 2.25rem;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.fcalc-thread-carousel-btn.is-disabled,
.fcalc-thread-carousel-btn:disabled {
  opacity: 0.4;
  cursor: default;
  pointer-events: none;
}

.fcalc-binding-threads-viewport {
  overflow: hidden;
  flex: 1 1 auto;
}

.fcalc-binding-threads-list {
  display: flex;
  flex-wrap: nowrap;
  gap: 0.5rem;
  transition: transform 0.3s ease;
  will-change: transform;
}

/* Fixní velikost chipů 100×100 px, obrázek přes celý chip jako pozadí */
.fcalc-thread-chip {
  flex: 0 0 auto;
  width: 100px;
  height: 100px;
  position: relative;
  border-radius: 0.5rem;
  border: 1px solid rgba(0, 0, 0, 0.1);
  background-color: var(--fcalc-thread-bg-color, #f8f8f8);
  background-image: var(--fcalc-thread-bg-image);
  background-size: cover;
  background-position: center;
  background-repeat: no-repeat;
  overflow: hidden;
  padding: 0;
  cursor: pointer;
  display: block;
  transition: box-shadow 0.2s ease, transform 0.2s ease, border-color 0.2s ease, background-color 0.2s ease;
}

.fcalc-thread-chip:focus {
  outline: 2px solid #2a85c3;
  outline-offset: 2px;
}

.fcalc-thread-chip:hover {
  border-color: rgba(0, 0, 0, 0.25);
}

/* Aktivní stav – zvýrazněný rámeček + jemný „lift“ */
.fcalc-thread-chip--active {
  border-color: #2a85c3;
  box-shadow: 0 0 0 2px rgba(42, 133, 195, 0.25);
  transform: translateY(-1px);
}

/* Zelený checkmark v pravém horním rohu pro VYBRANOU niť */
/* Zelený checkmark v pravém horním rohu pro VYBRANOU niť */
.fcalc-thread-chip--active::after {
  content: "";
  position: absolute;
  top: 4px;
  right: 4px;
  width: 24px;
  height: 24px;
  border-radius: 2px;
  background-color: #1e7e34;
  border: 2px solid #1e7e34;
  /* Checkmark using SVG for clean look */
  background-image: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 8 8'%3e%3cpath fill='%23fff' d='M6.564.75l-3.59 3.612-1.538-1.55L0 4.26 2.974 7.25 8 2.193z'/%3e%3c/svg%3e");
  background-size: 50% 50%;
  background-position: center;
  background-repeat: no-repeat;
  box-shadow: 0 0 0 1px #fff;
  /* White outline to separate from image */
}

/* Label – název nitě vlevo dole přes poloprůhledný podklad */
.fcalc-thread-chip__label {
  position: absolute;
  left: 0px;
  bottom: 0px;
  right: 0px;
  padding: 10px 4px;
  font-size: 0.8rem;
  line-height: 1.2;
  font-weight: 400;
  color: #ffffff;
  background: linear-gradient(to top,
      rgba(0, 0, 0, 0.65),
      rgba(0, 0, 0, 0.3),
      transparent);
  border-radius: 1px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* „Doporučeno“ – badge v levém horním rohu (aby se nebila s checkmarkem) */
.fcalc-thread-chip__badge {
  position: absolute;
  top: 4px;
  left: 4px;
  font-size: 0.65rem;
  background: #2a85c3;
  color: #fff;
  padding: 0.1rem 0.35rem;
  border-radius: 0.25rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

/* Mobil – lehce zúžíme mezery, ale carousel chová se stejně */
@media (max-width: 576px) {
  .fcalc-binding-threads-carousel {
    gap: 0.25rem;
  }
}

/* === FloorCalculator: roll width container – responsivní layout === */
#fcalc_width_container {
  width: 100%;
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  box-sizing: border-box;
}

/* === FloorCalculator: binding threads container – responsivní layout === */
#fcalc_binding_threads_container {
  width: 100%;
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  box-sizing: border-box;
}

#fcalc_binding_threads_container .fcalc-binding-thread-chip {
  flex: 1 1 calc(33.333% - 0.5rem);
  max-width: calc(33.333% - 0.5rem);
}

@media (max-width: 992px) {
  #fcalc_binding_threads_container .fcalc-binding-thread-chip {
    flex: 1 1 calc(50% - 0.5rem);
    max-width: calc(50% - 0.5rem);
  }
}

@media (max-width: 576px) {
  #fcalc_binding_threads_container .fcalc-binding-thread-chip {
    flex: 1 1 100%;
    max-width: 100%;
  }
}

/* ===== Detail kalkulace (Materiál / Doplňky / Celkem) ===== */

#fcalc-product-calculator .fcalc-results {
  width: 100%;
  font-size: 0.95rem;
}

.fcalc-results-group {
  margin-bottom: 0.75rem;
}

.fcalc-results-group-title {
  font-weight: 600;
  margin-bottom: 0.25rem;
}

.fcalc-results-line {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: 0.35rem;
  margin-bottom: 0.15rem;
}

.fcalc-results-line--subtotal {
  margin-top: 0.25rem;
  padding-top: 0.25rem;
  border-top: 1px dashed #e0e0e0;
}

.fcalc-results-line--grandtotal {
  margin-top: 0.35rem;
  padding-top: 0.35rem;
  border-top: 1px solid #d0d0d0;
}

.fcalc-results-label {
  flex: 1 1 auto;
}

.fcalc-results-meta {
  flex: 1 1 100%;
  font-size: 0.85rem;
  color: #6c757d;
}

.fcalc-results-amount {
  flex: 0 0 auto;
  white-space: nowrap;
  margin-left: auto;
}

.fcalc-results-amount--positive {
  color: #1f8b3a;
  font-weight: 600;
}

.fcalc-results-tax {
  font-size: 0.85rem;
  color: #6c757d;
  margin-top: 0.15rem;
}

/* Mobilní zarovnání detailu */
@media (max-width: 575.98px) {
  .fcalc-results-line {
    align-items: flex-start;
  }

  .fcalc-results-amount {
    align-self: flex-start;
  }
}

/* ===== Accordion Transitions ===== */
.fcalc-accordion-panel {
  overflow: hidden;
  transition: max-height 0.35s ease-in-out, opacity 0.35s ease-in-out, margin-top 0.35s ease-in-out;
  max-height: 0;
  opacity: 0;
  margin-top: 0;
  display: block !important;
  /* Override inline display:none if present, we handle visibility via height */
}

.fcalc-accordion-panel.fcalc-open {
  opacity: 1;
  /* max-height will be set by JS to scrollHeight */
  margin-top: 0.5rem;
}

/* ===== Inputy ===== */
.fcalc-package-input,
.fcalc-area-input {
  max-width: 5.5rem;
}

/* ===== Accordion UI ===== */
.fcalc-services-accordion {
  margin-top: 1rem;
}

.fcalc-accordion-item {
  border: 1px solid #e5e5e5;
  border-radius: 4px;
  margin-bottom: 0.5rem;
  overflow: hidden;
  background: #fff;
  transition: border-color 0.2s ease;
}

.fcalc-accordion-item.open {
  /* Ensure overflow is visible when open for popovers */
  overflow: visible;
  border-color: #28a745;
  /* Green border when active? Or just header? User said checkbox green. */
  /* Let's keep border subtle or standard, focus on header elements */
}

/* Force inner panels to be visible (override legacy JS) */
.fcalc-accordion-body .fcalc-accordion-panel {
  display: block !important;
  max-height: none !important;
  opacity: 1 !important;
  transform: none !important;
  /* Reset any transform */
}

.fcalc-accordion-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0;
  /* Reduced padding to accommodate image */
  background-color: #fff;
  /* White background as per image */
  cursor: pointer;
  transition: background-color 0.2s ease;
  user-select: none;
  min-height: 60px;
  /* Ensure height for image */
  /* overflow: hidden; -- REMOVED to allow popovers to overflow */
}

.fcalc-accordion-header:hover {
  background-color: #f9f9f9;
}

/* Image Container */
.fcalc-service-image-container {
  position: relative;
  width: 60px;
  height: 60px;
  flex-shrink: 0;
  margin-right: 1rem;
  border-top-left-radius: 3px;
  border-bottom-left-radius: 3px;
  overflow: hidden;
  background-color: #f0f0f0;
  background-size: cover;
  background-position: center;
  opacity: 1;
}

/* Service Images (Set via CSS) */
.fcalc-service-image-width {
  /* background-image: url('/path/to/width-icon.jpg'); */
  /* Custom image URL */
}

.fcalc-service-image-binding {
  /* background-image: url('/path/to/binding-icon.jpg'); */
  /* Custom image URL */
}

.fcalc-service-image-strips {
  /* background-image: url('/path/to/strips-icon.jpg'); */
  /* Custom image URL */
}

/* Placeholder pattern if no image */
.fcalc-service-image-placeholder {
  width: 100%;
  height: 100%;
  background-color: #e0e0e0;
  background-image: linear-gradient(45deg, #ccc 25%, transparent 25%, transparent 75%, #ccc 75%, #ccc),
    linear-gradient(45deg, #ccc 25%, transparent 25%, transparent 75%, #ccc 75%, #ccc);
  background-size: 10px 10px;
  background-position: 0 0, 5px 5px;
  opacity: 0.3;
  /* Opacity only on placeholder, not container */
}

/* Checkbox Overlay */
.fcalc-service-checkbox-overlay {
  position: absolute;
  top: 0;
  right: 0;
  width: 30px;
  /* Size of checkbox area */
  height: 30px;
  background: rgba(255, 255, 255, 0.0);
  /* Semi-transparent bg for visibility? Or just the checkbox? */
  /* User image shows checkbox in top right corner OVER image. */
  /* Let's make the checkbox itself custom styled */
  display: flex;
  align-items: center;
  justify-content: center;
  border-bottom-left-radius: 4px;
  z-index: 2;
  /* Ensure above image */
}

/* Custom Checkbox Styling */
.fcalc-service-checkbox {
  appearance: none;
  -webkit-appearance: none;
  width: 24px;
  height: 24px;
  border: 2px solid #28a745;
  /* Green border for unchecked */
  border-radius: 2px;
  background-color: #fff;
  cursor: pointer;
  margin: 0;
  position: relative;
  transition: all 0.2s ease;
}

.fcalc-service-checkbox:checked {
  background-color: #1e7e34;
  /* Darker green for checked */
  border-color: #1e7e34;
}

/* Gray checkmark for unchecked state (optional, user asked for it) */
.fcalc-service-checkbox::after {
  content: '';
  position: absolute;
  top: 3px;
  left: 7px;
  width: 6px;
  height: 12px;
  border: solid #ccc;
  /* Gray checkmark */
  border-width: 0 2px 2px 0;
  transform: rotate(45deg);
  opacity: 1;
  /* Always visible */
}

.fcalc-service-checkbox:checked::after {
  border-color: white;
  /* White checkmark when checked */
}

/* Add Service Button */
.fcalc-add-service-wrapper {
  text-align: right;
}

.fcalc-add-service-btn {
  /* Inherit btn-primary styles but maybe adjust if needed */
  /* Custom styles */
}

/* Hide Add Button if Service is Active */
.fcalc-accordion-item.fcalc-service-active .fcalc-add-service-wrapper {
  display: none;
}

/* Note Section */
.fcalc-note-section {
  /* Styles for note section outside accordion */
  /* Custom styles */
}

.fcalc-note-wrapper textarea {
  width: 100%;
  resize: vertical;
  /* Allow vertical resize */
  min-height: 80px;
}

.fcalc-note-counter {
  font-size: 0.85rem;
}

/* Header Content */
.fcalc-accordion-header-content {
  display: flex;
  align-items: center;
  flex-grow: 1;
  justify-content: space-between;
  /* Space between Info and Price */
  flex-wrap: nowrap;
  /* Keep on one line if possible */
}

.fcalc-service-info {
  display: flex;
  align-items: center;
}

.fcalc-service-label {
  font-weight: 500;
  margin-bottom: 0;
  cursor: pointer;
  color: #333;
}

.fcalc-service-price {
  font-weight: 600;
  font-size: 0.95rem;
  color: #6c757d;
  /* Standard color */
  margin-left: auto;
  /* Push to right */
  margin-right: 1rem;
  white-space: nowrap;
}

/* Active State (Green) */
.fcalc-accordion-item.fcalc-service-active .fcalc-service-price {
  color: #28a745;
}

.fcalc-accordion-item.fcalc-service-active .fcalc-service-checkbox {
  background-color: #28a745;
  border-color: #28a745;
}

/* Arrow */
.fcalc-accordion-arrow {
  width: 10px;
  height: 10px;
  border-right: 2px solid #ccc;
  /* Lighter arrow */
  border-bottom: 2px solid #ccc;
  transform: rotate(45deg);
  transition: transform 0.3s ease;
  margin: 0 0.5rem 0 0.5rem;
  flex-shrink: 0;
}

.fcalc-accordion-item.open .fcalc-accordion-arrow {
  transform: rotate(-135deg);
  border-color: #999;
}

.fcalc-accordion-body {
  padding: 1rem;
  border-top: 1px solid #e5e5e5;
  background-color: #fff;
}

/* Ensure checkbox label aligns well */
.fcalc-accordion-header .form-check {
  margin-bottom: 0;
  display: flex;
  align-items: center;
}

/* Mobile adjustments */
@media (max-width: 576px) {
  .fcalc-accordion-header-content {
    flex-wrap: wrap;
  }

  .fcalc-service-price {
    width: 100%;
    margin-top: 0.25rem;
    text-align: right;
    margin-right: 0;
  }
}

/* === New Popover System (Mobile Bottom Sheet / Desktop Tooltip) === */

/* Trigger Button (i icon) */
.fcalc-help-trigger {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 1.2rem;
  height: 1.2rem;
  border-radius: 50%;
  border: 1px solid #999;
  color: #666;
  font-size: 0.75rem;
  font-weight: bold;
  font-family: serif;
  /* "i" looks better in serif often, or keep sans */
  font-family: sans-serif;
  cursor: pointer;
  background: #fff;
  margin-left: 0.5rem;
  padding: 0;
  line-height: 1;
  transition: all 0.2s ease;
}

.fcalc-help-trigger:hover,
.fcalc-help-trigger:focus {
  border-color: #2a85c3;
  color: #2a85c3;
  outline: none;
}

/* Backdrop (for mobile bottom sheet) */
.fcalc-popover-backdrop {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  background: rgba(0, 0, 0, 0.5);
  z-index: 9998;
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.3s ease;
}

.fcalc-popover-backdrop.is-visible {
  opacity: 1;
  visibility: visible;
}

/* Bottom Sheet (Mobile) */
.fcalc-bottom-sheet {
  position: fixed;
  bottom: 0;
  left: 0;
  width: 100%;
  background: #fff;
  border-top-left-radius: 1rem;
  border-top-right-radius: 1rem;
  padding: 1.5rem;
  box-shadow: 0 -2px 10px rgba(0, 0, 0, 0.1);
  z-index: 9999;
  transform: translateY(100%);
  transition: transform 0.3s cubic-bezier(0.1, 0.7, 0.1, 1);
  max-height: 80vh;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
}

.fcalc-bottom-sheet.is-visible {
  transform: translateY(0);
}

.fcalc-bottom-sheet-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 1rem;
  border-bottom: 1px solid #eee;
  padding-bottom: 0.5rem;
}

.fcalc-bottom-sheet-title {
  font-weight: 600;
  font-size: 1.1rem;
  margin: 0;
}

.fcalc-bottom-sheet-close {
  background: none;
  border: none;
  font-size: 1.5rem;
  line-height: 1;
  padding: 0.25rem;
  cursor: pointer;
  color: #999;
}

.fcalc-bottom-sheet-content {
  font-size: 0.95rem;
  line-height: 1.5;
  color: #333;
}

/* Tooltip (Desktop) */
.fcalc-tooltip {
  position: absolute;
  background: #fff;
  border: 1px solid #ddd;
  border-radius: 0.5rem;
  padding: 1rem;
  width: 300px;
  max-width: 90vw;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
  z-index: 9999;
  font-size: 0.9rem;
  line-height: 1.4;
  color: #333;
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.2s ease, transform 0.2s ease;
  pointer-events: none;
  /* Initially none to prevent flicker issues, JS enables */
}

.fcalc-tooltip.is-visible {
  opacity: 1;
  visibility: visible;
  pointer-events: auto;
}

/* Arrow for tooltip (optional, tricky with dynamic positioning, skipping for robustness or simple CSS triangle) */
.fcalc-tooltip::before {
  content: "";
  position: absolute;
  width: 12px;
  height: 12px;
  background: #fff;
  border-bottom: 1px solid #ddd;
  /* Changed to bottom/left for arrow pointing left */
  border-left: 1px solid #ddd;
  transform: rotate(45deg);
  left: -7px;
  /* Move outside */
  top: var(--arrow-top, 15px);
  /* Use calculated position or default */
  z-index: 10001;
  /* Above tooltip shadow but below content if needed? No, part of tooltip */
}

/* Arrow for tooltip on the left (pointing right) */
.fcalc-tooltip--left::before {
  left: auto;
  right: -7px;
  border-left: none;
  border-bottom: none;
  border-top: 1px solid #ddd;
  border-right: 1px solid #ddd;
}

/* Positioning handled by JS modifiers or simple defaults */
/* For now, we omit arrow or keep it simple if we knew position */


/* Utility to hide template content */
.fcalc-help-content {
  display: none;
}
/* ===== Binding Visualizer ===== */
#fcalc_binding_visualizer_wrapper {
  width: 100%;
  max-width: 600px;
  margin: 0 auto;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
}

.fcalc-vis-container {
  position: relative;
  width: 100%;
  padding-bottom: 60%; /* Aspect ratio placeholder */
  background: #f8f9fa;
  border-radius: 8px;
  overflow: hidden;
}

.fcalc-vis-svg {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  user-select: none;
}

/* Sides */
.fcalc-vis-side {
  cursor: pointer;
  transition: opacity 0.2s;
}
.fcalc-vis-side:hover {
  opacity: 0.8;
}
.fcalc-vis-side-click-area {
  fill: transparent;
  cursor: pointer;
}

/* Corners */
.fcalc-vis-corner {
  cursor: pointer;
  transition: transform 0.1s;
}
.fcalc-vis-corner:hover {
  transform: scale(1.1);
  transform-origin: center;
}

/* Legend */
.fcalc-vis-legend {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  background: rgba(255, 255, 255, 0.95);
  padding: 1rem;
  border-radius: 4px;
  border: 1px solid #e0e0e0;
  box-shadow: 0 2px 8px rgba(0,0,0,0.05);
  pointer-events: none; /* Let clicks pass through to SVG? No, legend might block. */
  /* If legend is in middle, it blocks clicks on carpet center (which does nothing). */
  /* But sides are on edge. */
  z-index: 10;
  min-width: 200px;
}

.fcalc-vis-legend-item {
  display: flex;
  align-items: center;
  margin-bottom: 0.5rem;
  font-size: 0.85rem;
  color: #333;
}
.fcalc-vis-legend-item:last-child {
  margin-bottom: 0;
}
.fcalc-vis-legend-icon {
  width: 20px;
  height: 20px;
  margin-right: 0.75rem;
  border: 1px solid #ddd;
  border-radius: 2px;
}

/* Legend Icons */
.fcalc-vis-legend-icon.is-bound {
  background: repeating-linear-gradient(
    45deg,
    #fff,
    #fff 4px,
    #15803d 4px,
    #15803d 6px
  );
  border-color: #15803d;
}
.fcalc-vis-legend-icon.is-unbound {
  background: repeating-linear-gradient(
    45deg,
    #fff,
    #fff 4px,
    #ccc 4px,
    #ccc 6px
  );
}
.fcalc-vis-legend-icon.is-round {
  background: #60a5fa;
  border-radius: 50%;
  border: none;
}
.fcalc-vis-legend-icon.is-sharp {
  background: #9ca3af;
  border-radius: 0;
  border: none;
}

/* Dimensions Labels */
.fcalc-vis-dim-label {
  position: absolute;
  font-size: 0.9rem;
  font-weight: 600;
  color: #374151;
  background: rgba(255,255,255,0.8);
  padding: 2px 6px;
  border-radius: 4px;
}
.fcalc-vis-dim-top {
  top: 10px;
  left: 50%;
  transform: translateX(-50%);
}
.fcalc-vis-dim-right {
  top: 50%;
  right: 10px;
  transform: translateY(-50%) rotate(90deg);
}

/* Info Box below visualizer */
.fcalc-vis-info {
  margin-top: 1rem;
  padding: 0.75rem;
  background: #f0fdf4;
  border: 1px solid #bbf7d0;
  border-radius: 6px;
  color: #166534;
}
.fcalc-vis-info-row {
  display: flex;
  justify-content: space-between;
  margin-bottom: 0.25rem;
  font-size: 0.95rem;
}
.fcalc-vis-info-row:last-child {
  margin-bottom: 0;
  font-weight: 600;
  font-size: 1.05rem;
  border-top: 1px dashed #86efac;
  padding-top: 0.25rem;
  margin-top: 0.25rem;
}

/* Inline Legend */
.fcalc-vis-legend-inline {
  display: flex;
  flex-wrap: wrap;
  gap: 1rem;
  justify-content: center;
  font-size: 0.85rem;
}

.fcalc-vis-legend-inline .fcalc-vis-legend-item {
  display: flex;
  align-items: center;
  color: #333;
}
