/* EN Review Widget — Frame.io-style click-to-pin commenting overlay for HTML dashboards.
   Scoped under .enrw- / #enrw- to avoid colliding with host dashboard styles. */

.enrw-fab,
.enrw-toolbar,
.enrw-pin,
.enrw-popover,
.enrw-panel,
.enrw-toast {
  font-family: "Libre Franklin", -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  box-sizing: border-box;
}

.enrw-fab *,
.enrw-toolbar *,
.enrw-pin *,
.enrw-popover *,
.enrw-panel *,
.enrw-toast * {
  box-sizing: border-box;
}

/* Floating action button */
.enrw-fab {
  position: fixed;
  right: 24px;
  bottom: 24px;
  width: 52px;
  height: 52px;
  border-radius: 50%;
  border: none;
  cursor: pointer;
  background: linear-gradient(135deg, #16352A 0%, #2D5A3D 100%);
  box-shadow: 0 6px 18px rgba(22, 53, 42, 0.35);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 999997;
  transition: transform 0.15s ease, box-shadow 0.15s ease;
}

.enrw-fab:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 22px rgba(22, 53, 42, 0.45);
}

.enrw-fab.enrw-fab-active {
  background: linear-gradient(135deg, #B89455 0%, #a17f45 100%);
  box-shadow: 0 6px 18px rgba(184, 148, 85, 0.45);
}

.enrw-fab svg {
  width: 22px;
  height: 22px;
  stroke: #EEF1ED;
}

.enrw-fab-badge {
  position: absolute;
  top: -4px;
  right: -4px;
  min-width: 18px;
  height: 18px;
  padding: 0 4px;
  border-radius: 9px;
  background: #B83A2E;
  color: #fff;
  font-size: 11px;
  font-weight: 700;
  line-height: 18px;
  text-align: center;
  border: 2px solid #EEF1ED;
}

/* Top floating toolbar, visible only in review mode */
.enrw-toolbar {
  position: fixed;
  top: 18px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 999998;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 12px;
  border-radius: 999px;
  background: rgba(22, 53, 42, 0.94);
  backdrop-filter: blur(6px);
  color: #EEF1ED;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.25);
}

.enrw-toolbar-label {
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.02em;
  padding-left: 4px;
  white-space: nowrap;
}

.enrw-swatches {
  display: flex;
  gap: 6px;
  padding: 0 4px;
  border-left: 1px solid rgba(238, 241, 237, 0.25);
  border-right: 1px solid rgba(238, 241, 237, 0.25);
}

.enrw-swatch {
  width: 20px;
  height: 20px;
  border-radius: 50%;
  border: 2px solid transparent;
  cursor: pointer;
  padding: 0;
}

.enrw-swatch.enrw-swatch-selected {
  border-color: #EEF1ED;
}

.enrw-toolbar-btn {
  display: flex;
  align-items: center;
  gap: 5px;
  border: none;
  background: rgba(238, 241, 237, 0.12);
  color: #EEF1ED;
  font-size: 12px;
  font-weight: 600;
  padding: 6px 10px;
  border-radius: 999px;
  cursor: pointer;
  white-space: nowrap;
}

.enrw-toolbar-btn:hover {
  background: rgba(238, 241, 237, 0.22);
}

.enrw-toolbar-btn.enrw-toolbar-btn-primary {
  background: #B89455;
  color: #16352A;
}

.enrw-toolbar-btn.enrw-toolbar-btn-primary:hover {
  background: #a17f45;
}

.enrw-toolbar-close {
  border: none;
  background: transparent;
  color: #EEF1ED;
  cursor: pointer;
  font-size: 16px;
  line-height: 1;
  padding: 2px 4px;
  opacity: 0.7;
}

.enrw-toolbar-close:hover {
  opacity: 1;
}

/* Pins */
.enrw-pin {
  position: absolute;
  width: 26px;
  height: 26px;
  border-radius: 50% 50% 50% 0;
  transform: translate(-50%, -100%) rotate(-45deg);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  z-index: 999996;
  box-shadow: 0 3px 8px rgba(0, 0, 0, 0.3);
  border: 2px solid #EEF1ED;
}

.enrw-pin span {
  transform: rotate(45deg);
  color: #fff;
  font-size: 11px;
  font-weight: 700;
}

body.enrw-active,
body.enrw-active * {
  cursor: crosshair !important;
}

body.enrw-active .enrw-fab,
body.enrw-active .enrw-toolbar,
body.enrw-active .enrw-toolbar *,
body.enrw-active .enrw-pin,
body.enrw-active .enrw-popover,
body.enrw-active .enrw-popover *,
body.enrw-active .enrw-panel,
body.enrw-active .enrw-panel * {
  cursor: pointer !important;
}

body.enrw-active .enrw-popover textarea {
  cursor: text !important;
}

/* Comment popover */
.enrw-popover {
  position: absolute;
  width: 260px;
  z-index: 999999;
  background: #fff;
  border-radius: 12px;
  box-shadow: 0 14px 36px rgba(0, 0, 0, 0.28);
  padding: 12px;
  border: 1px solid #E5E5E5;
}

.enrw-popover-swatches {
  display: flex;
  gap: 6px;
  margin-bottom: 8px;
}

.enrw-popover textarea {
  width: 100%;
  min-height: 64px;
  resize: vertical;
  border: 1px solid #E5E5E5;
  border-radius: 8px;
  padding: 8px;
  font-size: 13px;
  font-family: inherit;
  color: #2B2D2C;
  margin-bottom: 8px;
}

.enrw-popover textarea:focus {
  outline: none;
  border-color: #B89455;
}

.enrw-popover-actions {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
}

.enrw-popover-actions button {
  border: none;
  border-radius: 999px;
  padding: 6px 12px;
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
}

.enrw-popover-cancel {
  background: #F2F2F0;
  color: #2B2D2C;
}

.enrw-popover-cancel:hover {
  background: #E5E5E5;
}

.enrw-popover-delete {
  background: transparent;
  color: #B83A2E;
  margin-right: auto;
}

.enrw-popover-delete:hover {
  text-decoration: underline;
}

.enrw-popover-save {
  background: #16352A;
  color: #EEF1ED;
}

.enrw-popover-save:hover {
  background: #2D5A3D;
}

/* Side panel listing all comments */
.enrw-panel {
  position: fixed;
  top: 0;
  right: 0;
  bottom: 0;
  width: 320px;
  background: #EEF1ED;
  border-left: 1px solid #E5E5E5;
  box-shadow: -12px 0 30px rgba(0, 0, 0, 0.15);
  z-index: 999998;
  display: flex;
  flex-direction: column;
  transform: translateX(100%);
  transition: transform 0.2s ease;
}

.enrw-panel.enrw-panel-open {
  transform: translateX(0);
}

.enrw-panel-header {
  padding: 16px;
  background: linear-gradient(135deg, #16352A 0%, #2D5A3D 100%);
  color: #EEF1ED;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.enrw-panel-header h3 {
  margin: 0;
  font-size: 14px;
  font-weight: 700;
}

.enrw-panel-header button {
  border: none;
  background: transparent;
  color: #EEF1ED;
  font-size: 18px;
  cursor: pointer;
  line-height: 1;
  opacity: 0.8;
}

.enrw-panel-header button:hover {
  opacity: 1;
}

.enrw-panel-body {
  flex: 1;
  overflow-y: auto;
  padding: 12px;
}

.enrw-panel-empty {
  color: #6b6f6c;
  font-size: 13px;
  text-align: center;
  margin-top: 40px;
}

.enrw-panel-item {
  background: #fff;
  border-radius: 10px;
  padding: 10px 12px;
  margin-bottom: 10px;
  border: 1px solid #E5E5E5;
  cursor: pointer;
}

.enrw-panel-item:hover {
  border-color: #B89455;
}

.enrw-panel-item-top {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 4px;
}

.enrw-panel-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  flex-shrink: 0;
}

.enrw-panel-item-num {
  font-size: 11px;
  font-weight: 700;
  color: #6b6f6c;
}

.enrw-panel-item-context {
  font-size: 11px;
  color: #6b6f6c;
  margin-bottom: 4px;
  font-style: italic;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.enrw-panel-item-note {
  font-size: 13px;
  color: #2B2D2C;
  line-height: 1.4;
}

.enrw-panel-footer {
  padding: 12px;
  border-top: 1px solid #E5E5E5;
  display: flex;
  gap: 8px;
}

.enrw-panel-footer button {
  flex: 1;
  border: none;
  border-radius: 8px;
  padding: 10px;
  font-size: 12px;
  font-weight: 700;
  cursor: pointer;
}

.enrw-panel-footer-copy {
  background: #B89455;
  color: #16352A;
}

.enrw-panel-footer-copy:hover {
  background: #a17f45;
}

.enrw-panel-footer-clear {
  background: #F2F2F0;
  color: #B83A2E;
  flex: 0 0 auto;
}

.enrw-panel-footer-clear:hover {
  background: #E5E5E5;
}

/* Toast */
.enrw-toast {
  position: fixed;
  bottom: 88px;
  right: 24px;
  background: #16352A;
  color: #EEF1ED;
  padding: 10px 16px;
  border-radius: 8px;
  font-size: 13px;
  font-weight: 600;
  box-shadow: 0 8px 20px rgba(0, 0, 0, 0.3);
  z-index: 999999;
  opacity: 0;
  transform: translateY(6px);
  transition: opacity 0.15s ease, transform 0.15s ease;
  pointer-events: none;
}

.enrw-toast.enrw-toast-visible {
  opacity: 1;
  transform: translateY(0);
}

/* Never render the widget in exported PDFs or print views */
@media print {
  .enrw-fab,
  .enrw-toolbar,
  .enrw-pin,
  .enrw-popover,
  .enrw-panel,
  .enrw-toast {
    display: none !important;
  }
}
