/* ======================================================
   Image Resize Module Styles
   ====================================================== */

/* Resize handles */
.ql-editor img {
  cursor: pointer;
  display: block;
  max-width: 100%;
  height: auto;
  margin: 10px 0;
}

/* Image alignment using data-align attribute */
.ql-editor img[data-align="left"],
.ql-editor img:not([data-align]) {
  margin-left: 0;
  margin-right: auto;
}

.ql-editor img[data-align="center"] {
  margin-left: auto;
  margin-right: auto;
}

.ql-editor img[data-align="right"] {
  margin-left: auto;
  margin-right: 0;
}

/* Image loading state */
.ql-editor img.image-loading {
  opacity: 0.4;
  filter: blur(2px);
  transition: opacity 0.3s ease, filter 0.3s ease;
}

/* Image alignment toolbar */
.image-align-toolbar {
  display: flex;
  gap: 4px;
}

.image-align-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s ease;
  user-select: none;
  min-width: 28px;
}

.image-align-btn:hover {
  transform: scale(1.05);
}

.image-align-btn:active {
  transform: scale(0.95);
}

.image-resize-overlay {
  position: absolute;
  box-sizing: border-box;
  border: 1px dashed #50ca59;
  cursor: move;
}

.image-resize-handle {
  position: absolute;
  width: 12px;
  height: 12px;
  background: #50ca59;
  border: 1px solid #fff;
  box-sizing: border-box;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.3);
  cursor: nwse-resize;
  z-index: 1000;
}

.image-resize-handle.handle-sw {
  bottom: -6px;
  left: -6px;
  cursor: nesw-resize;
}

.image-resize-handle.handle-nw {
  top: -6px;
  left: -6px;
  cursor: nwse-resize;
}

.image-resize-handle.handle-ne {
  top: -6px;
  right: -6px;
  cursor: nesw-resize;
}

.image-resize-handle.handle-se {
  bottom: -6px;
  right: -6px;
  cursor: nwse-resize;
}

/* Display size indicator */
.image-resize-display-size {
  position: absolute;
  top: -26px;
  right: 0;
  background: #50ca59;
  color: #fff;
  padding: 2px 8px;
  border-radius: 3px;
  font-size: 11px;
  font-weight: 600;
  font-family: 'Open Sans', sans-serif;
  white-space: nowrap;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.2);
  z-index: 1001;
}

/* Alignment toolbar */
.image-resize-toolbar {
  position: absolute;
  top: -42px;
  left: 50%;
  transform: translateX(-50%);
  background: #fff;
  border: 1px solid #ddd;
  border-radius: 3px;
  padding: 4px;
  display: flex;
  gap: 4px;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.15);
  z-index: 1001;
}

.image-resize-toolbar button {
  background: #fff;
  border: none;
  cursor: pointer;
  padding: 4px 8px;
  border-radius: 2px;
  font-size: 12px;
  color: #696969;
  transition: all 0.2s;
}

.image-resize-toolbar button:hover {
  background: #f5f5f5;
  color: #50ca59;
}

.image-resize-toolbar button.active {
  background: #50ca59;
  color: #fff;
}

/* Dark mode styles */
body.dark .image-resize-overlay {
  border-color: #50ca59;
}

body.dark .image-resize-handle {
  background: #50ca59;
  border-color: #2a2a2a;
}

body.dark .image-resize-display-size {
  background: #50ca59;
}

body.dark .image-resize-toolbar {
  background: #2a2a2a;
  border-color: #404040;
}

body.dark .image-resize-toolbar button {
  background: #2a2a2a;
  color: #8a8a8a;
}

body.dark .image-resize-toolbar button:hover {
  background: #353535;
  color: #50ca59;
}

body.dark .image-resize-toolbar button.active {
  background: #50ca59;
  color: #fff;
}

/* Selection Word Count Tooltip */
.selection-word-count {
  position: absolute;
  background: #696969;
  color: #fff;
  padding: 6px 12px;
  border-radius: 4px;
  font-size: 12px;
  font-weight: 600;
  white-space: nowrap;
  z-index: 10000;
  pointer-events: none;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
  opacity: 0;
  transition: opacity 0.15s ease-in-out;
}

.selection-word-count.visible {
  opacity: 1;
}

/* Dark mode support */
body.dark .selection-word-count {
  background: #8a8a8a;
  color: #2a2a2a;
}

/* Hide on mobile/touch devices */
@media (max-width: 768px), (hover: none) {
  .selection-word-count {
    display: none !important;
  }
}

