/* ══════════════════════════════════════════════════
   BC Desktop Windows — style systemu okien
   ══════════════════════════════════════════════════ */

/* ── Warstwa pulpitu ────────────────────────────── */
#bc-desktop-layer {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 2147483640;
}

#bc-desktop-layer > * {
  pointer-events: auto;
}

/* ── Okno ────────────────────────────────────────── */
.bc-win {
  position: absolute;
  display: flex;
  flex-direction: column;
  background: #fff;
  border-radius: 10px;
  box-shadow: 0 4px 24px rgba(0, 0, 0, 0.14);
  overflow: visible;  /* PROBLEM 3 FIX: hidden blokuje interact.js resize przez ::after */
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  transition: box-shadow 0.2s, transform 0.18s;
  touch-action: none;          /* interact.js */
}

.bc-win:hover {
  transform: scale(1.03);
  box-shadow: 0 8px 36px rgba(0, 0, 0, 0.22);
}

.bc-win.bc-win-dragging,
.bc-win.bc-win-dragging:hover {
  transform: none;             /* wyłącz hover-scale podczas drag */
  opacity: 0.92;
  box-shadow: 0 12px 48px rgba(0, 0, 0, 0.28);
}

/* animacja zamknięcia */
.bc-win-closing {
  animation: bc-win-fadeout 0.22s ease forwards;
}

@keyframes bc-win-fadeout {
  to {
    opacity: 0;
    transform: scale(0.95) translateY(8px);
  }
}

/* ── Header (drag handle) ────────────────────────── */
.bc-win-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 8px 14px;
  background: #A67C52;
  color: #fff;
  cursor: grab;
  flex-shrink: 0;
  user-select: none;
  -webkit-user-select: none;
}

.bc-win-header:active {
  cursor: grabbing;
}

.bc-win-title {
  font-size: 13px;
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  flex: 1;
  margin-right: 8px;
}

.bc-win-close {
  background: none;
  border: none;
  color: #fff;
  font-size: 18px;
  line-height: 1;
  cursor: pointer;
  padding: 0 2px;
  opacity: 0.8;
  transition: opacity 0.15s;
}

.bc-win-close:hover {
  opacity: 1;
}

/* ── Body ────────────────────────────────────────── */
.bc-win-body {
  flex: 1;
  min-height: 0;
  display: flex;
  flex-direction: column;
  overflow: auto;
  overscroll-behavior: contain;
  border-radius: 0 0 10px 10px;
  position: relative;
}

.bc-win-body iframe {
  width: 100%;
  height: 100%;
  border: none;
  display: block;
}

.bc-win-body video {
  width: 100%;
  height: 100%;
  object-fit: contain;
  background: #000;
}

/* ── Navigate (pełna wysokość po prawej) ─────────── */
.bc-win[data-type="navigate"] {
  border-radius: 0;
  right: 0;
  top: 0;
}

/* ── Gallery slider ──────────────────────────────── */
.bc-gallery-slider {
  width: 100%;
  height: 100%;
  display: flex;
  flex-direction: column;
}

.bc-gallery-slide {
  display: none;
  flex: 1;
  gap: 4px;
  padding: 8px;
  align-items: center;
  justify-content: center;
}

.bc-gallery-slide.active {
  display: flex;
}

.bc-gallery-slide img {
  max-width: 48%;
  max-height: 100%;
  object-fit: contain;
  border-radius: 6px;
}

.bc-gallery-nav {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 16px;
  padding: 8px;
  background: #f5f5f5;
  flex-shrink: 0;
}

.bc-gallery-prev,
.bc-gallery-next {
  background: #A67C52;
  color: #fff;
  border: none;
  border-radius: 6px;
  width: 36px;
  height: 36px;
  font-size: 18px;
  cursor: pointer;
  transition: background 0.15s;
}

.bc-gallery-prev:hover,
.bc-gallery-next:hover {
  background: #8a6340;
}

.bc-gallery-counter {
  font-size: 13px;
  font-weight: 500;
  color: #555;
}

/* ── Lista linków (show_links) ───────────────────── */
.bc-links-list {
  display: flex;
  flex-direction: column;
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  overscroll-behavior: contain;
  scrollbar-width: thin;
  scrollbar-color: #A67C52 transparent;
  -webkit-overflow-scrolling: touch;
}

.bc-links-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 16px;
  border-bottom: 1px solid #f0ebe5;
  cursor: pointer;
  transition: background 0.15s;
  font-size: 13px;
  font-weight: 500;
  color: #333;
}

.bc-links-item:hover {
  background: #f9f5f1;
}

.bc-links-label {
  flex: 1;
  line-height: 1.3;
}

.bc-links-arrow {
  color: #A67C52;
  font-size: 18px;
  margin-left: 8px;
  flex-shrink: 0;
}

/* ── Navigate + show_links obok siebie ──────────── */
/* Pozycja navigate obliczana jest przez JS (handleNavigate) na podstawie pozycji show_links.
   CSS ustawia jedynie fallback gdy show_links nie jest otwarte. */
.bc-win[data-type="navigate"]:not(.bc-win-positioned-by-js) {
  right: 0 !important;
  left: auto !important;
}

/* ── Resize handles (interact.js visual cues) ────── */
.bc-win::after {
  content: '';
  position: absolute;
  right: 0;
  bottom: 0;
  width: 16px;
  height: 16px;
  cursor: nwse-resize;
  background:
    linear-gradient(135deg,
      transparent 50%,
      rgba(166,124,82,0.3) 50%,
      rgba(166,124,82,0.3) 75%,
      transparent 75%);
}

/* ── Responsive ──────────────────────────────────── */
@media (max-width: 768px) {
  /* Na mobile show_links renderuje się jako panel inline (JS), nie okno */
  .bc-win[data-type="show_links"] {
    display: none !important;
  }

  .bc-win[data-type="navigate"] {
    width: 100% !important;
    height: 100vh !important;
    left: 0 !important;
    right: 0 !important;
    top: 0 !important;
    bottom: 0 !important;
    border-radius: 0;
    transform: none !important;
  }
}

/* ── Panel mobilny show_links (inline pod odpowiedzią) ── */
.bc-mobile-links-panel {
  margin: 8px 0 4px 0;
  border: 1px solid #e8dfd5;
  border-radius: 10px;
  overflow: hidden;
  background: #fff;
  box-shadow: 0 2px 8px rgba(0,0,0,0.08);
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
}

.bc-mobile-links-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 14px;
  background: #A67C52;
  color: #fff;
  font-size: 13px;
  font-weight: 600;
}

.bc-mobile-links-close {
  background: none;
  border: none;
  color: #fff;
  font-size: 16px;
  cursor: pointer;
  padding: 0 2px;
  opacity: 0.85;
  line-height: 1;
}

.bc-mobile-links-body .bc-links-item {
  padding: 13px 16px;
  font-size: 14px;
}

.bc-mobile-links-body .bc-links-item:last-child {
  border-bottom: none;
}

/* ─── Contact Form in Desktop Window ─── */
.bc-form-wrap { padding: 20px 24px; font-family: inherit; }
.bc-form-intro { font-size: 14px; color: #5a5245; margin: 0 0 18px; line-height: 1.5; }
.bc-form-label { display: block; font-size: 13px; font-weight: 500; color: #5a5245; margin-bottom: 14px; }
.bc-form-input {
  display: block; width: 100%; margin-top: 5px; padding: 10px 12px;
  border: 1px solid #d4cfc5; border-radius: 8px; font-size: 14px;
  font-family: inherit; background: #fff; color: #333;
  transition: border-color 0.15s;
  box-sizing: border-box;
}
.bc-form-input:focus { outline: none; border-color: #7a8f65; }
.bc-form-textarea { resize: vertical; min-height: 80px; }
.bc-form-submit {
  display: block; width: 100%; padding: 12px; margin-top: 6px;
  background: #7a8f65; color: #fff; border: none; border-radius: 20px;
  font-size: 14px; font-weight: 600; cursor: pointer;
  font-family: inherit; transition: background 0.15s;
}
.bc-form-submit:hover:not(:disabled) { background: #6b7d58; }
.bc-form-submit:disabled { opacity: 0.7; cursor: wait; }
.bc-form-status { margin-top: 10px; font-size: 13px; text-align: center; }
