/* Kobicart WhatsApp Sipariş Notu v1.2 — product CTA + Pro polish */
.kc-wa {
  --kc-wa-accent: #0f3d3e;
  --kc-wa-ink: #121a1a;
  --kc-wa-muted: #5b6766;
  --kc-wa-paper: #f6f3ee;
  --kc-wa-panel: #fffcf8;
  --kc-wa-line: rgba(18, 26, 26, 0.1);
  --kc-wa-shadow: 0 18px 50px rgba(12, 28, 28, 0.22);
  --kc-wa-radius: 16px;
  font-family: "Segoe UI Variable", "Segoe UI", ui-sans-serif, system-ui, sans-serif;
  z-index: 99990;
  color: var(--kc-wa-ink);
}

.kc-wa[hidden] { display: none !important; }

/* Edge tab */
.kc-wa__tab {
  position: fixed;
  top: 42%;
  transform: translateY(-50%);
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  min-height: 48px;
  padding: 0.7rem 0.85rem;
  border: 0;
  background: linear-gradient(160deg, color-mix(in srgb, var(--kc-wa-accent) 92%, #fff) 0%, var(--kc-wa-accent) 100%);
  color: #fff;
  box-shadow: var(--kc-wa-shadow);
  cursor: pointer;
  writing-mode: vertical-rl;
  text-orientation: mixed;
  letter-spacing: 0.045em;
  font-size: 0.78rem;
  font-weight: 650;
  z-index: 99991;
  transition: transform 0.2s ease, filter 0.2s ease, box-shadow 0.2s ease;
}

.kc-wa--right .kc-wa__tab {
  right: 0;
  border-radius: 14px 0 0 14px;
  padding-right: max(0.8rem, env(safe-area-inset-right));
}

.kc-wa--left .kc-wa__tab {
  left: 0;
  border-radius: 0 14px 14px 0;
  padding-left: max(0.8rem, env(safe-area-inset-left));
  writing-mode: vertical-lr;
}

.kc-wa__tab:hover {
  filter: brightness(1.05);
  box-shadow: 0 16px 44px rgba(12, 28, 28, 0.3);
}

.kc-wa__tab:focus-visible {
  outline: 2px solid #fff;
  outline-offset: 3px;
}

.kc-wa__tab-icon {
  writing-mode: horizontal-tb;
  display: inline-flex;
  opacity: 0.95;
}

/* Sheet */
.kc-wa__backdrop {
  position: fixed;
  inset: 0;
  background: rgba(8, 14, 14, 0.48);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
  z-index: 99992;
}

.kc-wa__backdrop[hidden],
.kc-wa__sheet[hidden] {
  display: none !important;
}

.kc-wa__sheet {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 99993;
  max-height: min(90vh, 680px);
  padding: 0.7rem 1.05rem max(1.1rem, env(safe-area-inset-bottom));
  background:
    radial-gradient(120% 80% at 100% 0%, color-mix(in srgb, var(--kc-wa-accent) 12%, transparent), transparent 55%),
    linear-gradient(180deg, var(--kc-wa-panel), var(--kc-wa-paper));
  color: var(--kc-wa-ink);
  border-radius: 22px 22px 0 0;
  box-shadow: var(--kc-wa-shadow);
  display: flex;
  flex-direction: column;
  gap: 0.8rem;
  animation: kc-wa-up 0.24s cubic-bezier(0.2, 0.8, 0.2, 1);
  border: 1px solid rgba(255, 255, 255, 0.5);
  border-bottom: 0;
}

@keyframes kc-wa-up {
  from { transform: translateY(22px); opacity: 0.35; }
  to { transform: translateY(0); opacity: 1; }
}

.kc-wa__handle {
  width: 40px;
  height: 4px;
  border-radius: 99px;
  background: var(--kc-wa-line);
  margin: 0.1rem auto 0.15rem;
}

.kc-wa__head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 0.75rem;
}

.kc-wa__brand {
  display: flex;
  align-items: flex-start;
  gap: 0.7rem;
  min-width: 0;
}

.kc-wa__brand-mark {
  width: 42px;
  height: 42px;
  border-radius: 12px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  background: linear-gradient(145deg, color-mix(in srgb, var(--kc-wa-accent) 88%, #fff), var(--kc-wa-accent));
  box-shadow: 0 8px 20px color-mix(in srgb, var(--kc-wa-accent) 35%, transparent);
  flex: 0 0 auto;
}

.kc-wa__title {
  margin: 0;
  font-size: 1.12rem;
  line-height: 1.25;
  font-weight: 720;
  letter-spacing: -0.01em;
}

.kc-wa__sub {
  margin: 0.22rem 0 0;
  font-size: 0.84rem;
  color: var(--kc-wa-muted);
  line-height: 1.35;
}

.kc-wa__close {
  width: 44px;
  height: 44px;
  border: 0;
  border-radius: 12px;
  background: rgba(18, 26, 26, 0.06);
  color: inherit;
  font-size: 1.55rem;
  line-height: 1;
  cursor: pointer;
  flex: 0 0 auto;
  transition: background 0.15s ease;
}

.kc-wa__close:hover {
  background: rgba(18, 26, 26, 0.1);
}

.kc-wa__notice {
  font-size: 0.82rem;
  line-height: 1.4;
  padding: 0.7rem 0.8rem;
  border-radius: 12px;
  background: color-mix(in srgb, var(--kc-wa-accent) 8%, #fff);
  border: 1px solid color-mix(in srgb, var(--kc-wa-accent) 18%, transparent);
  color: var(--kc-wa-ink);
}

.kc-wa__intents {
  display: grid;
  grid-template-columns: 1fr;
  gap: 0.5rem;
}

.kc-wa__chip {
  min-height: 48px;
  border: 1px solid var(--kc-wa-line);
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.9);
  color: inherit;
  font-size: 0.93rem;
  font-weight: 620;
  cursor: pointer;
  padding: 0.7rem 0.9rem;
  text-align: left;
  transition: border-color 0.15s ease, background 0.15s ease, color 0.15s ease, transform 0.12s ease;
}

.kc-wa__chip:hover {
  border-color: color-mix(in srgb, var(--kc-wa-accent) 40%, var(--kc-wa-line));
}

.kc-wa__chip.is-active {
  border-color: transparent;
  background: var(--kc-wa-accent);
  color: #fff;
  box-shadow: 0 8px 18px color-mix(in srgb, var(--kc-wa-accent) 28%, transparent);
}

.kc-wa__label {
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--kc-wa-muted);
}

.kc-wa__note {
  width: 100%;
  min-height: 132px;
  resize: vertical;
  border: 1px solid var(--kc-wa-line);
  border-radius: 14px;
  padding: 0.85rem 0.95rem;
  font: inherit;
  font-size: 0.94rem;
  line-height: 1.45;
  background: rgba(255, 255, 255, 0.95);
  color: inherit;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.6);
}

.kc-wa__note:focus {
  outline: 2px solid color-mix(in srgb, var(--kc-wa-accent) 45%, transparent);
  outline-offset: 1px;
  border-color: color-mix(in srgb, var(--kc-wa-accent) 35%, var(--kc-wa-line));
}

.kc-wa__send {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.55rem;
  min-height: 52px;
  border-radius: 14px;
  background: linear-gradient(160deg, color-mix(in srgb, var(--kc-wa-accent) 90%, #fff), var(--kc-wa-accent));
  color: #fff !important;
  text-decoration: none !important;
  font-weight: 700;
  font-size: 0.98rem;
  letter-spacing: 0.01em;
  box-shadow: 0 10px 24px color-mix(in srgb, var(--kc-wa-accent) 30%, transparent);
  transition: filter 0.15s ease, transform 0.12s ease;
}

.kc-wa__send:hover {
  filter: brightness(1.04);
}

.kc-wa__send.is-disabled {
  opacity: 0.42;
  pointer-events: none;
  box-shadow: none;
}

/* —— Product page CTA (next to add-to-cart) —— */
.kc-wa-pdp {
  margin-top: 0.75rem;
  width: 100%;
}

.kc-wa-pdp__btn {
  --kc-wa-accent: inherit;
  width: 100%;
  display: flex;
  align-items: center;
  gap: 0.75rem;
  min-height: 52px;
  padding: 0.7rem 1rem;
  border-radius: 14px;
  border: 1px solid color-mix(in srgb, var(--kc-wa-accent, #0f3d3e) 28%, transparent);
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.7), rgba(255, 255, 255, 0.35)),
    color-mix(in srgb, var(--kc-wa-accent, #0f3d3e) 7%, #fff);
  color: var(--kc-wa-ink, #121a1a);
  cursor: pointer;
  text-align: left;
  box-shadow: 0 8px 22px rgba(12, 28, 28, 0.06);
  transition: transform 0.15s ease, border-color 0.15s ease, box-shadow 0.15s ease, background 0.15s ease;
  font: inherit;
}

/* Inherit accent from widget root if available */
body:has(.kc-wa) .kc-wa-pdp__btn {
  --kc-wa-accent: var(--kc-wa-accent);
}

#kobicart-wa ~ .kc-wa-pdp,
.kc-wa-pdp {
  --kc-wa-accent: #0f3d3e;
}

html body .kc-wa-pdp__btn {
  color: #14201f;
}

.kc-wa-pdp__btn:hover {
  transform: translateY(-1px);
  border-color: color-mix(in srgb, var(--kc-wa-accent, #0f3d3e) 48%, transparent);
  box-shadow: 0 12px 28px rgba(12, 28, 28, 0.1);
}

.kc-wa-pdp__btn:focus-visible {
  outline: 2px solid color-mix(in srgb, var(--kc-wa-accent, #0f3d3e) 55%, transparent);
  outline-offset: 2px;
}

.kc-wa-pdp__icon {
  width: 40px;
  height: 40px;
  border-radius: 12px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex: 0 0 auto;
  color: #fff;
  background: linear-gradient(145deg, color-mix(in srgb, var(--kc-wa-accent, #0f3d3e) 85%, #fff), var(--kc-wa-accent, #0f3d3e));
  box-shadow: 0 6px 14px color-mix(in srgb, var(--kc-wa-accent, #0f3d3e) 30%, transparent);
}

.kc-wa-pdp__text {
  display: flex;
  flex-direction: column;
  gap: 0.1rem;
  min-width: 0;
}

.kc-wa-pdp__label {
  font-size: 0.98rem;
  font-weight: 720;
  letter-spacing: -0.01em;
  line-height: 1.2;
}

.kc-wa-pdp__hint {
  font-size: 0.78rem;
  color: #5b6766;
  line-height: 1.3;
}

/* Pro buy stack: full-width second row under qty + cart */
.kc-product__buy + .kc-wa-pdp {
  margin-top: 0.65rem;
}

/* Default OC input-group: break free full width */
.input-group + .kc-wa-pdp,
.mb-3 + .kc-wa-pdp {
  margin-top: 0.65rem;
}

@media (min-width: 768px) {
  .kc-wa__sheet {
    left: auto;
    right: 1.25rem;
    bottom: 1.25rem;
    width: min(410px, calc(100vw - 2.5rem));
    max-height: min(82vh, 640px);
    border-radius: 18px;
    border: 1px solid rgba(255, 255, 255, 0.55);
    animation: kc-wa-in 0.22s ease;
  }

  .kc-wa--left .kc-wa__sheet {
    right: auto;
    left: 1.25rem;
  }

  .kc-wa__handle { display: none; }

  .kc-wa__intents {
    grid-template-columns: 1fr 1fr;
  }

  .kc-wa__intents .kc-wa__chip[data-intent="cart"] {
    grid-column: 1 / -1;
  }

  @keyframes kc-wa-in {
    from { transform: translateY(12px) scale(0.985); opacity: 0.45; }
    to { transform: translateY(0) scale(1); opacity: 1; }
  }

  .kc-wa-pdp__btn {
    min-height: 50px;
  }
}

@media (max-width: 767px) {
  .kc-wa__tab {
    top: auto;
    bottom: max(5.5rem, calc(env(safe-area-inset-bottom) + 4.5rem));
    transform: none;
    writing-mode: horizontal-tb;
    text-orientation: mixed;
    border-radius: 999px;
    min-height: 48px;
    min-width: 48px;
    padding: 0.7rem;
    gap: 0;
    box-shadow: 0 10px 28px rgba(12, 28, 28, 0.28);
  }

  /* Compact FAB: icon only — less screen clutter */
  .kc-wa__tab-label {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
  }

  .kc-wa__tab-icon svg {
    width: 22px;
    height: 22px;
  }

  .kc-wa--right .kc-wa__tab { right: max(0.75rem, env(safe-area-inset-right)); }
  .kc-wa--left .kc-wa__tab { left: max(0.75rem, env(safe-area-inset-left)); }

  .kc-wa--no-mobile-tab .kc-wa__tab {
    display: none !important;
  }

  .kc-wa-pdp__btn {
    min-height: 54px;
  }
}

.kc-wa--no-tab .kc-wa__tab,
.kc-wa__tab[hidden] {
  display: none !important;
}

/* Sync accent CSS var onto PDP button from widget */
#kobicart-wa {
  /* defined */
}
body:has(#kobicart-wa) {
  /* keep */
}

html body .kc-wa-pdp {
  /* pull accent from widget if set inline on root */
}

#kobicart-wa[style*="--kc-wa-accent"] ~ * {
  /* no adjacency — pdp is elsewhere in DOM */
}

/* JS sets style on both via inherited custom property on :root when open optional */
