:host {
  display: block;
}

.canvas-editor-wrapper {
  position: relative;
}

/* Canvas Editor Modal */
.canvas-editor-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  background: rgba(0, 0, 0, 0.8);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 9999;
}

.canvas-editor-modal {
  width: 95vw;
  height: 95vh;
  max-width: none;
  max-height: none;
  background: var(--feedback-canvas-editor-bg-color, #ffffff);
  border-radius: 12px;
  border: 1px solid rgba(0, 0, 0, 0.08);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  box-shadow: 
    0 0 0 1px rgba(0, 0, 0, 0.02),
    0 8px 16px rgba(0, 0, 0, 0.08),
    0 16px 32px rgba(0, 0, 0, 0.08),
    0 32px 64px rgba(0, 0, 0, 0.06);
}

.canvas-editor-header {
  background: var(--feedback-canvas-editor-header-bg-color, #fafafa);
  border-bottom: 1px solid rgba(0, 0, 0, 0.06);
  padding: 16px 20px;
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.canvas-editor-title h3 {
  margin: 0;
  font-size: 18px;
  font-weight: 600;
  color: var(--feedback-canvas-editor-tool-text-color, #1a1a1a);
  letter-spacing: -0.02em;
}

.canvas-editor-toolbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 16px;
}

.toolbar-section {
  display: flex;
  align-items: center;
  gap: 8px;
}

.tool-group {
  display: flex;
  align-items: center;
  gap: 4px;
}

.tool-btn {
  width: 36px;
  height: 36px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--feedback-canvas-editor-tool-bg-color, #ffffff);
  border: 1.5px solid rgba(0, 0, 0, 0.08);
  border-radius: 8px;
  cursor: pointer;
  transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
  padding: 0;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.04);
}

.tool-btn svg {
  width: 18px;
  height: 18px;
  color: var(--feedback-canvas-editor-tool-text-color, #333);
}

.tool-btn:hover:not(:disabled) {
  background: var(--feedback-canvas-editor-tool-bg-hover, #f5f5f5);
  border-color: rgba(0, 0, 0, 0.12);
  transform: translateY(-1px);
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.08);
}

.tool-btn.active,
.tool-btn.active:hover {
  background: var(--feedback-canvas-editor-tool-bg-active, #0070f4);
  color: var(--feedback-canvas-editor-tool-text-active, #ffffff);
  border-color: var(--feedback-canvas-editor-tool-bg-active, #0070f4);
  box-shadow: 0 2px 8px rgba(0, 112, 244, 0.3);
}

.tool-btn.active svg {
  color: var(--feedback-canvas-editor-tool-text-active, #ffffff);
}

.tool-btn:disabled {
  opacity: 0.4;
  cursor: not-allowed;
  color: var(--feedback-canvas-editor-tool-text-color, #333);
}

.toolbar-divider {
  width: 1px;
  height: 24px;
  background: var(--feedback-canvas-editor-divider-color, #e0e0e0);
  margin: 0 4px;
}

.undo-btn,
.delete-btn {
  background: var(--feedback-canvas-editor-tool-bg-color, #ffffff) !important;
  border: 1px solid var(--feedback-canvas-editor-border-color, #e0e0e0) !important;
}

.undo-btn:hover:not(:disabled),
.delete-btn:hover:not(:disabled) {
  background: var(--feedback-canvas-editor-tool-bg-hover, #f0f0f0) !important;
}

.undo-btn:disabled,
.delete-btn:disabled {
  opacity: 0.3;
  cursor: not-allowed;
}

.delete-btn:hover:not(:disabled) {
  background: #fee !important;
  border-color: #fcc !important;
}

.delete-btn:hover:not(:disabled) svg {
  color: #c53030;
}

.color-palette {
  display: flex;
  align-items: center;
  gap: 6px;
}

.color-slot-wrapper {
  position: relative;
  display: flex;
  align-items: center;
}

.color-btn {
  width: 32px;
  height: 32px;
  border-radius: 8px;
  border: 2px solid transparent;
  cursor: pointer;
  transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--feedback-canvas-editor-tool-bg-color, #ffffff);
  border: 2px solid rgba(0, 0, 0, 0.08);
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.04);
}

.color-btn:hover {
  transform: translateY(-2px) scale(1.05);
  box-shadow: 0 4px 8px rgba(0, 0, 0, 0.12);
}

.color-btn.active {
  border-color: var(--feedback-primary-color, #0070f4);
  box-shadow: 0 0 0 2px rgba(0, 112, 244, 0.2);
}

.color-btn.editing {
  border-color: var(--feedback-primary-color, #0070f4);
}

.color-picker-dropdown {
  position: absolute;
  top: 100%;
  left: 0;
  z-index: 1000;
  margin-top: 4px;
  background: var(--feedback-canvas-editor-tool-bg-color, #ffffff);
  border: 1px solid var(--feedback-canvas-editor-border-color, #e0e0e0);
  border-radius: 6px;
  padding: 8px;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
}

.color-picker-dropdown input[type="color"] {
  width: 40px;
  height: 40px;
  border: none;
  border-radius: 4px;
  cursor: pointer;
}

.size-control {
  display: flex;
  align-items: center;
  gap: 8px;
  background: var(--feedback-canvas-editor-tool-bg-color, #ffffff);
  border: 1px solid var(--feedback-canvas-editor-border-color, #e0e0e0);
  border-radius: 6px;
  padding: 6px 12px;
}

.size-slider {
  width: 80px;
  height: 14px;
  -webkit-appearance: none;
  appearance: none;
  background: transparent;
  border-radius: 2px;
  outline: none;
  cursor: pointer;
  border: none;
  position: relative;
}

.size-slider::before {
  content: '';
  position: absolute;
  top: 50%;
  left: 0;
  right: 0;
  height: 4px;
  background: rgba(0, 0, 0, 0.15);
  border-radius: 2px;
  transform: translateY(-50%);
  pointer-events: none;
}

.size-slider::-webkit-slider-track {
  width: 100%;
  height: 4px;
  background: transparent;
  border-radius: 2px;
  border: none;
}

.size-slider::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  width: 14px;
  height: 14px;
  background: var(--feedback-primary-color, #0070f4);
  border-radius: 50%;
  cursor: pointer;
  position: relative;
  z-index: 1;
}

.size-slider::-moz-range-track {
  width: 100%;
  height: 4px;
  background: transparent;
  border-radius: 2px;
  border: none;
}

.size-slider::-moz-range-thumb {
  width: 14px;
  height: 14px;
  background: var(--feedback-primary-color, #0070f4);
  border-radius: 50%;
  border: none;
  cursor: pointer;
}

.size-slider::-ms-track {
  width: 100%;
  height: 4px;
  background: transparent;
  border-radius: 2px;
  border: none;
  color: transparent;
}

.size-slider::-ms-thumb {
  width: 14px;
  height: 14px;
  background: var(--feedback-primary-color, #0070f4);
  border-radius: 50%;
  border: none;
  cursor: pointer;
}

.size-value {
  font-weight: 500;
  color: var(--feedback-canvas-editor-tool-text-color, #333);
  font-size: 12px;
  min-width: 30px;
}

/* Selected annotation controls */
.selected-annotation-controls {
  border-left: 2px solid var(--feedback-canvas-editor-divider-color, #e0e0e0);
  padding-left: 12px;
  margin-left: 8px;
  min-width: 200px;
}

/* Text controls */
.text-controls {
  display: flex;
  flex-direction: row;
  align-items: center;
  gap: 12px;
}

.font-size-control,
.border-width-control {
  display: flex;
  align-items: center;
  gap: 6px;
}

.font-size-control label,
.border-width-control label {
  font-size: 12px;
  color: var(--feedback-canvas-editor-tool-text-color, #333);
  font-weight: 500;
  min-width: 35px;
}

.action-btn {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 0 20px;
  border: 1.5px solid rgba(0, 0, 0, 0.08);
  border-radius: 8px;
  cursor: pointer;
  font-size: 14px;
  font-weight: 500;
  transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
  min-width: 80px;
  justify-content: center;
  height: 40px;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.04);
}

.action-btn.secondary {
  background: var(--feedback-canvas-editor-tool-bg-color, #ffffff);
  color: var(--feedback-canvas-editor-tool-text-color, #333);
  border-color: rgba(0, 0, 0, 0.08);
}

.action-btn.secondary:hover {
  background: var(--feedback-canvas-editor-tool-bg-hover, #f5f5f5);
  border-color: rgba(0, 0, 0, 0.12);
  transform: translateY(-1px);
  box-shadow: 0 4px 8px rgba(0, 0, 0, 0.08);
}

.action-btn.primary {
  background: var(--feedback-primary-color, #0070f4);
  color: #ffffff;
  border-color: var(--feedback-primary-color, #0070f4);
  box-shadow: 0 2px 4px rgba(0, 112, 244, 0.2);
}

.action-btn.primary:hover {
  background: #0056cc;
  border-color: #0056cc;
  transform: translateY(-1px);
  box-shadow: 0 6px 12px rgba(0, 112, 244, 0.3);
}

.action-btn:active {
  transform: translateY(0);
}

.action-btn.small {
  height: 28px;
  padding: 4px 8px;
  font-size: 12px;
  min-width: 65px;
}

/* Shape controls */
.shape-controls {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.canvas-editor-content {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  background: var(--feedback-canvas-editor-content-bg, #f5f5f5);
  overflow: hidden;
  min-height: 0;
  min-width: 0;
  position: relative;
}

/* Hide scroll indicators when at the edges */
.canvas-editor-content::-webkit-scrollbar {
  width: 8px;
  height: 8px;
}

.canvas-editor-content::-webkit-scrollbar-track {
  background: transparent;
}

.canvas-editor-content::-webkit-scrollbar-thumb {
  background: rgba(0, 0, 0, 0.2);
  border-radius: 4px;
}

.canvas-editor-content::-webkit-scrollbar-thumb:hover {
  background: rgba(0, 0, 0, 0.3);
}

.annotation-canvas {
  max-width: calc(100% - 48px);
  max-height: calc(100% - 48px);
  width: auto !important;
  height: auto !important;
  cursor: crosshair;
  border-radius: 8px;
  box-shadow: 
    0 0 0 1px rgba(0, 0, 0, 0.04),
    0 4px 6px rgba(0, 0, 0, 0.06),
    0 8px 16px rgba(0, 0, 0, 0.08);
  background: #ffffff;
  transition: box-shadow 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  object-fit: contain;
  display: block;
  margin: auto;
}

.annotation-canvas:hover {
  box-shadow: 
    0 0 0 1px rgba(0, 0, 0, 0.06),
    0 6px 10px rgba(0, 0, 0, 0.08),
    0 12px 24px rgba(0, 0, 0, 0.1);
}

/* Responsive Design */

/* Extra large screens */
@media screen and (min-width: 1920px) {
  .canvas-editor-modal {
    width: 90vw;
    height: 90vh;
  }
  
  .canvas-editor-content {
    padding: 32px;
  }
}

/* Large screens */
@media screen and (min-width: 1200px) and (max-width: 1919px) {
  .canvas-editor-modal {
    width: 92vw;
    height: 92vh;
  }
  
  .canvas-editor-content {
    padding: 28px;
  }
}

/* Medium screens */
@media screen and (min-width: 769px) and (max-width: 1199px) {
  .canvas-editor-modal {
    width: 95vw;
    height: 95vh;
  }
}

/* Mobile and tablet */
@media screen and (max-width: 768px) {
  .canvas-editor-modal {
    width: 100vw;
    height: 100vh;
    border-radius: 0;
  }
  
  .canvas-editor-toolbar {
    flex-direction: column;
    align-items: stretch;
    gap: 8px;
  }
  
  .toolbar-section {
    justify-content: center;
  }
  
  .selected-annotation-controls {
    border-left: none;
    border-top: 2px solid var(--feedback-canvas-editor-divider-color, #e0e0e0);
    padding-left: 0;
    padding-top: 8px;
    margin-left: 0;
    margin-top: 8px;
    min-width: auto;
  }
  
  .canvas-editor-content {
    padding: 16px;
  }
} 