.wpafc-root {
  --wpafc-accent: #1e6fb9;
  --wpafc-header-bg: #0b2a4a;
  --wpafc-header-text: #fff;
  --wpafc-panel-bg: #fff;
  --wpafc-overlay-bg: rgba(8, 31, 54, .55);
  --wpafc-radius: 14px;
  --wpafc-z: 10000;
  --wpafc-fab-size: 64px;
  --wpafc-crop-top: 0px;
}

.wpafc-root *, .wpafc-root *::before, .wpafc-root *::after { box-sizing: border-box; }

.wpafc-fab {
  position: fixed;
  z-index: calc(var(--wpafc-z) + 2);
  width: var(--wpafc-fab-size);
  height: var(--wpafc-fab-size);
  padding: 8px;
  border: 1px solid rgba(11, 42, 74, .18);
  border-radius: 50%;
  background: #fff;
  box-shadow: 0 14px 36px rgba(8, 31, 54, .28), 0 5px 15px rgba(11, 42, 74, .14);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: transform .18s ease, box-shadow .18s ease, opacity .18s ease;
  touch-action: none;
  user-select: none;
}

.wpafc-fab:hover { transform: translateY(-2px) scale(1.03); box-shadow: 0 17px 42px rgba(8, 31, 54, .34); }
.wpafc-fab.is-hidden { opacity: 0; pointer-events: none; transform: scale(.85); }
.wpafc-fab.is-dragging { cursor: grabbing; transform: none; transition: none; }

.wpafc-fab-media, .wpafc-panel-icon, .wpafc-loading-icon, .wpafc-media-inner {
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
}

.wpafc-media-inner { width: 100%; height: 100%; }
.wpafc-fab-media { width: 100%; height: 100%; border-radius: 50%; }
.wpafc-fab-media img { width: 100%; height: 100%; object-fit: contain; display: block; }
.wpafc-fallback { font: 700 16px/1 system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif; color: #0b2a4a; }

.wpafc-overlay {
  position: fixed;
  inset: 0;
  z-index: var(--wpafc-z);
  background: var(--wpafc-overlay-bg);
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  transition: opacity .18s ease, visibility .18s ease;
}
.wpafc-overlay.is-open { opacity: 1; visibility: visible; pointer-events: auto; }

.wpafc-panel {
  position: fixed;
  z-index: calc(var(--wpafc-z) + 1);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  background: var(--wpafc-panel-bg);
  border: 1px solid rgba(11, 42, 74, .14);
  border-top: 3px solid var(--wpafc-accent);
  border-radius: var(--wpafc-radius);
  box-shadow: 0 18px 55px rgba(8, 31, 54, .32), 0 6px 18px rgba(11, 42, 74, .14);
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  transform: translateY(10px) scale(.985);
  transform-origin: bottom right;
  transition: opacity .18s ease, visibility .18s ease, transform .18s ease;
}
.wpafc-panel.is-open { opacity: 1; visibility: visible; pointer-events: auto; transform: translateY(0) scale(1); }
.wpafc-panel.is-dragging { transition: none; }

.wpafc-header {
  min-height: 58px;
  padding: 9px 10px 9px 12px;
  background: var(--wpafc-header-bg);
  color: var(--wpafc-header-text);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  cursor: move;
  user-select: none;
  touch-action: none;
}

.wpafc-heading { min-width: 0; display: flex; align-items: center; gap: 10px; }
.wpafc-panel-icon { flex: 0 0 auto; width: 32px; height: 32px; border-radius: 50%; background: #fff; padding: 4px; }
.wpafc-panel-icon img { width: 100%; height: 100%; object-fit: contain; }
.wpafc-panel-icon .wpafc-fallback { font-size: 11px; }
.wpafc-heading-copy { min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.wpafc-title { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font: 600 14px/1.25 system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif; color: inherit; }
.wpafc-subtitle { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font: 400 11px/1.2 system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif; opacity: .78; color: inherit; }
.wpafc-subtitle:empty { display: none; }

.wpafc-actions { display: flex; align-items: center; gap: 3px; }
.wpafc-icon-button {
  width: 34px;
  height: 34px;
  padding: 0;
  border: 0;
  border-radius: 9px;
  background: transparent;
  color: inherit;
  font: 500 22px/1 system-ui, sans-serif;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}
.wpafc-icon-button:hover, .wpafc-icon-button:focus-visible { background: rgba(255, 255, 255, .12); outline: none; }
.wpafc-close { font-size: 27px; font-weight: 300; }

.wpafc-body { position: relative; flex: 1 1 auto; min-height: 0; overflow: hidden; background: #f4f6f8; }
.wpafc-iframe-viewport { position: absolute; inset: 0; overflow: hidden; background: var(--wpafc-panel-bg); }
.wpafc-iframe-viewport iframe {
  position: absolute;
  left: 0;
  top: calc(var(--wpafc-crop-top) * -1);
  width: 100%;
  height: calc(100% + var(--wpafc-crop-top));
  border: 0;
  display: block;
  background: var(--wpafc-panel-bg);
}

.wpafc-loading {
  position: absolute;
  inset: 0;
  z-index: 2;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 10px;
  background: #f7f8fa;
  color: #52606d;
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  transition: opacity .15s ease, visibility .15s ease;
}
.wpafc-loading.is-visible { opacity: 1; visibility: visible; }
.wpafc-loading-icon { width: 54px; height: 54px; border-radius: 50%; background: #fff; box-shadow: 0 5px 18px rgba(11, 42, 74, .12); padding: 7px; }
.wpafc-loading-icon img { width: 100%; height: 100%; object-fit: contain; }
.wpafc-loading-text { font: 500 13px/1.35 system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif; }

body.wpafc-no-select { user-select: none !important; }

@media (max-width: 640px) {
  .wpafc-panel {
    left: 8px !important;
    right: 8px !important;
    top: auto !important;
    bottom: 8px !important;
    width: auto !important;
    height: min(86vh, 720px) !important;
    min-height: 360px !important;
    max-height: calc(100vh - 16px) !important;
    border-radius: 14px;
  }
  .wpafc-header { cursor: default; }
}

@media (prefers-reduced-motion: reduce) {
  .wpafc-fab, .wpafc-panel, .wpafc-overlay, .wpafc-loading { transition: none !important; }
}
