/* CSS cho chức năng tạo tooltip */

/* Modal cấu hình tooltip */
#tooltip-config-modal {
  font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
}

#tooltip-config-modal > div {
  animation: modalSlideIn 0.3s ease-out;
}

@keyframes modalSlideIn {
  from {
    opacity: 0;
    transform: scale(0.9) translateY(-20px);
  }
  to {
    opacity: 1;
    transform: scale(1) translateY(0);
  }
}

/* Styling cho các input trong modal */
#tooltip-config-modal input,
#tooltip-config-modal select,
#tooltip-config-modal textarea {
  transition: border-color 0.3s ease, box-shadow 0.3s ease;
}

#tooltip-config-modal input:focus,
#tooltip-config-modal select:focus,
#tooltip-config-modal textarea:focus {
  outline: none;
  border-color: #2196F3;
  box-shadow: 0 0 0 3px rgba(33, 150, 243, 0.1);
}

/* Styling cho buttons */
#tooltip-config-modal button {
  transition: all 0.3s ease;
  font-weight: 500;
}

#tooltip-config-modal button:hover {
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
}

#tooltip-config-modal button:active {
  transform: translateY(0);
}

/* Styling cho color picker */
#tooltip-config-modal input[type="color"] {
  cursor: pointer;
  transition: transform 0.2s ease;
}

#tooltip-config-modal input[type="color"]:hover {
  transform: scale(1.1);
}

/* Styling cho file input */
#tooltip-config-modal input[type="file"] {
  cursor: pointer;
}

#tooltip-config-modal input[type="file"]::-webkit-file-upload-button {
  background: #2196F3;
  color: white;
  border: none;
  padding: 8px 16px;
  border-radius: 4px;
  cursor: pointer;
  margin-right: 10px;
}

/* Styling cho HTML preview */
#tooltip-config-modal #html-preview {
  background: #fff;
  color: #222;
  border: 1px solid #ccc;
  border-radius: 4px;
  font-family: 'Consolas', 'Monaco', 'Courier New', monospace;
  font-size: 13px;
  max-height: 240px;
  overflow-y: auto;
  white-space: pre-wrap;
  padding: 10px;
}

/* Styling cho image preview */
#image-preview img {
  transition: transform 0.3s ease;
}

#image-preview img:hover {
  transform: scale(1.05);
}

/* Styling cho tooltip point đang tạo */
.tooltip-point.creating {
  box-shadow: 0 0 20px rgba(255, 255, 0, 0.6);
}

/* Styling cho thông báo */
#tooltip-instruction,
.tooltip-success-message {
  animation: slideDown 0.3s ease-out;
}

@keyframes slideDown {
  from {
    opacity: 0;
    transform: translateX(-50%) translateY(-20px);
  }
  to {
    opacity: 1;
    transform: translateX(-50%) translateY(0);
  }
}

/* Responsive design */
@media (max-width: 768px) {
  #tooltip-config-modal > div {
    width: 95%;
    padding: 20px;
    max-height: 90vh;
  }
  
  #tooltip-config-modal h2 {
    font-size: 18px;
  }
  
  #tooltip-config-modal textarea {
    rows: 6;
  }
}

/* Hover effects cho các elements */
#tooltip-config-modal label:hover {
  color: #2196F3;
}

#tooltip-config-modal select:hover {
  border-color: #2196F3;
}

/* Loading state cho buttons */
#tooltip-config-modal button:disabled {
  opacity: 0.6;
  cursor: not-allowed;
  transform: none !important;
}

/* Custom scrollbar cho modal */
#tooltip-config-modal > div::-webkit-scrollbar {
  width: 8px;
}

#tooltip-config-modal > div::-webkit-scrollbar-track {
  background: #f1f1f1;
  border-radius: 4px;
}

#tooltip-config-modal > div::-webkit-scrollbar-thumb {
  background: #c1c1c1;
  border-radius: 4px;
}

#tooltip-config-modal > div::-webkit-scrollbar-thumb:hover {
  background: #a8a8a8;
}

/* Tooltip styles chuyển từ style.css */
.tooltip-image {
  width: 100%;
  height: auto;
  display: block;
  border-radius: 8px;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
}

.tooltip-point {
  position: absolute;
  width: 20px;
  height: 20px;
  background: transparent;
  border: 1px solid #fff;
  border-radius: 50%;
  --glow-color: #1976d2;
  cursor: pointer;
  z-index: 2;
  transition: transform 0.2s, box-shadow 0.2s;
}

/* Hiệu ứng pulse chỉ cho vòng tròn nhỏ, không áp dụng cho content */
.tooltip-point::before {
  content: '';
  position: absolute;
  left: 0; top: 0;
  width: 100%; height: 100%;
  border-radius: 50%;
  box-shadow: 0 0 12px 4px var(--glow-color, #1976d2), 0 2px 8px rgba(0,0,0,0.10);
  animation: tooltip-glow 1.4s infinite;
  pointer-events: none;
  z-index: 1;
}

@keyframes tooltip-glow {
  0% {
    box-shadow: 0 0 0 0 var(--glow-color, #1976d2), 0 0 12px 4px var(--glow-color, #1976d2);
    opacity: 1;
  }
  70% {
    box-shadow: 0 0 0 12px rgba(25,118,210,0), 0 0 16px 8px var(--glow-color, #1976d2);
    opacity: 0.7;
  }
  100% {
    box-shadow: 0 0 0 0 rgba(25,118,210,0), 0 0 12px 4px var(--glow-color, #1976d2);
    opacity: 1;
  }
}

.tooltip-point-blur {
  position: absolute;
  left: 50%;
  top: 50%;
  width: 100%;
  height: 100%;
  border-radius: 50%;
  transform: translate(-50%, -50%);
  pointer-events: none;
  z-index: 1;
}

.tooltip-point:hover {
  transform: scale(1.25);
  box-shadow: 0 0 16px 6px var(--glow-color, #1976d2), 0 2px 8px rgba(0,0,0,0.15);
  z-index: 10;
}

.tooltip-content {
  animation: none !important;
  box-shadow: none !important;
  background: #222 !important;
  opacity: 1 !important;
  backdrop-filter: none !important;
  position: absolute;
  color: #fff;
  padding: 12px 16px;
  border-radius: 8px;
  width: max-content;
  max-width: 700px;
  visibility: hidden;
  /* transition: none; */
  overflow: hidden;
  font-size: 14px;
  line-height: 1.6;
  z-index: 100;
  pointer-events: none;
  text-align: left;
}

.important-point {
  background-color: rgba(255, 215, 0, 0.3);
  border: 2px solid gold;
}

/* Default position (top) */
.tooltip-content {
  bottom: 130%;
  left: 50%;
  transform: translateX(-50%) translateY(-10px);
}

/* Position for tooltips below point */
.tooltip-point[data-position="bot"] .tooltip-content {
  bottom: auto;
  top: 130%;
  transform: translateX(-50%) translateY(10px);
}

/* Position for tooltips near left edge */
.tooltip-point[data-position="left"] .tooltip-content {
  left: auto;
  right: 130%;
  bottom: 50%;
  transform: translateY(50%) translateX(-10px);
}

/* Position for tooltips near right edge */
.tooltip-point[data-position="right"] .tooltip-content {
  left: 130%;
  bottom: 50%;
  transform: translateY(50%) translateX(10px);
}

/* Arrow positions */
.tooltip-content::before {
  content: '';
  position: absolute;
  border: 6px solid transparent;
}

/* Default arrow (top) */
.tooltip-content::before {
  bottom: -6px;
  left: 50%;
  transform: translateX(-50%);
  border-top-color: rgba(51, 51, 51, 0.95);
}

/* Arrow for bottom position */
.tooltip-point[data-position="bot"] .tooltip-content::before {
  bottom: auto;
  top: -6px;
  border-top-color: transparent;
  border-bottom-color: rgba(51, 51, 51, 0.95);
}

/* Arrow for left position */
.tooltip-point[data-position="left"] .tooltip-content::before {
  bottom: auto;
  left: auto;
  right: -6px;
  top: 50%;
  transform: translateY(-50%);
  border-top-color: transparent;
  border-left-color: rgba(51, 51, 51, 0.95);
}

/* Arrow for right position */
.tooltip-point[data-position="right"] .tooltip-content::before {
  bottom: auto;
  left: -6px;
  top: 50%;
  transform: translateY(-50%);
  border-top-color: transparent;
  border-right-color: rgba(51, 51, 51, 0.95);
}

.tooltip-point:hover .tooltip-content {
  opacity: 1;
  visibility: visible;
  transform: translateX(-50%) translateY(0);
  pointer-events: auto;
}

/* Transform adjustments for different positions */
.tooltip-point[data-position="bot"]:hover .tooltip-content {
  transform: translateX(-50%) translateY(0);
}

.tooltip-point[data-position="left"]:hover .tooltip-content {
  transform: translateY(50%) translateX(0);
}

.tooltip-point[data-position="right"]:hover .tooltip-content {
  transform: translateY(50%) translateX(0);
}

.tooltip-content p {
  margin: 0 0 8px 0;
}

.tooltip-content p:last-child {
  margin-bottom: 0;
}

.tooltip-content b {
  color: #00FFAA;
  font-weight: 600;
}

.tooltip-content i {
  color: #FFD700;
  font-style: italic;
}

.tooltip-section {
  display: block;
  cursor: move;
  position: relative;
  padding: 8px;
  border: 1px solid transparent;
  border-radius: 4px;
  font-size: 14px;
}

.tooltip-section:not(.active) {
  display: none;
}

.tooltip-section.dragging {
  opacity: 0.5;
  border: 1px dashed #00FFAA;
  background-color: rgba(0, 255, 170, 0.1);
}

.tooltip-section .drag-handle {
  position: absolute;
  top: 4px;
  right: 4px;
  width: 16px;
  height: 16px;
  background-color: rgba(0, 255, 170, 0.2);
  border-radius: 4px;
  cursor: move;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  transition: opacity 0.2s ease;
}

.tooltip-section:hover .drag-handle {
  opacity: 1;
}

.tooltip-section .drag-handle::before {
  content: '⋮';
  color: #00FFAA;
  font-size: 14px;
  line-height: 1;
}

/* Add section navigation buttons */
#section-navigation, .section-nav {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  margin-left: auto;
  margin-right: auto;
}

.section-nav button {
  background-color: rgba(0, 255, 170, 0.2);
  border: 1px solid #00FFAA;
  color: #00FFAA;
  padding: 4px 8px;
  border-radius: 4px;
  cursor: pointer;
}

.section-nav button:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

#tooltip-config-modal > div.dark-mode {
  background: #23272a !important;
  color: #f2f3f5 !important;
}
#tooltip-config-modal > div.dark-mode h2,
#tooltip-config-modal > div.dark-mode label {
  color: #f2f3f5 !important;
}
#tooltip-config-modal > div.dark-mode input,
#tooltip-config-modal > div.dark-mode select,
#tooltip-config-modal > div.dark-mode textarea {
  background: #18191c !important;
  color: #f2f3f5 !important;
  border-color: #383a40 !important;
}
#tooltip-config-modal > div.dark-mode input:focus,
#tooltip-config-modal > div.dark-mode select:focus,
#tooltip-config-modal > div.dark-mode textarea:focus {
  border-color: #5865f2 !important;
}
#tooltip-config-modal > div.dark-mode button {
  background: #5865f2 !important;
  color: #f2f3f5 !important;
  border: none !important;
}
#tooltip-config-modal > div.dark-mode button#cancel-tooltip {
  background: #ed4245 !important;
}
#tooltip-config-modal > div.dark-mode button#preview-tooltip {
  background: #248046 !important;
}
#tooltip-config-modal > div.dark-mode button#copy-html {
  background: #2196F3 !important;
}
#tooltip-config-modal > div.dark-mode #html-preview {
  background: #18191c !important;
  color: #f2f3f5 !important;
  border: 1px solid #383a40 !important;
}

/* Theme switch (from thoitiet.css) */
.theme-switch {
  --toggle-size: 20px;
  --container-width: 5.625em;
  --container-height: 2.5em;
  --container-radius: 6.25em;
  --container-light-bg: #3D7EAE;
  --container-night-bg: #1D1F2C;
  --circle-container-diameter: 3.375em;
  --sun-moon-diameter: 2.125em;
  --sun-bg: #ECCA2F;
  --moon-bg: #C4C9D1;
  --spot-color: #959DB1;
  --circle-container-offset: calc((var(--circle-container-diameter) - var(--container-height)) / 2 * -1);
  --stars-color: #fff;
  --clouds-color: #F3FDFF;
  --back-clouds-color: #AACADF;
  --transition: .5s cubic-bezier(0, -0.02, 0.4, 1.25);
  --circle-transition: .3s cubic-bezier(0, -0.02, 0.35, 1.17);
}
.theme-switch, .theme-switch *, .theme-switch *::before, .theme-switch *::after {
  -webkit-box-sizing: border-box;
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  font-size: var(--toggle-size);
}
.theme-switch__container {
  width: var(--container-width);
  height: var(--container-height);
  background-color: var(--container-light-bg);
  border-radius: var(--container-radius);
  overflow: hidden;
  cursor: pointer;
  -webkit-box-shadow: 0em -0.062em 0.062em rgba(0, 0, 0, 0.25), 0em 0.062em 0.125em rgba(255, 255, 255, 0.94);
  box-shadow: 0em -0.062em 0.062em rgba(0, 0, 0, 0.25), 0em 0.062em 0.125em rgba(255, 255, 255, 0.94);
  -webkit-transition: var(--transition);
  -o-transition: var(--transition);
  transition: var(--transition);
  position: relative;
}
.theme-switch__container::before {
  content: "";
  position: absolute;
  z-index: 1;
  inset: 0;
  -webkit-box-shadow: 0em 0.05em 0.187em rgba(0, 0, 0, 0.25) inset, 0em 0.05em 0.187em rgba(0, 0, 0, 0.25) inset;
  box-shadow: 0em 0.05em 0.187em rgba(0, 0, 0, 0.25) inset, 0em 0.05em 0.187em rgba(0, 0, 0, 0.25) inset;
  border-radius: var(--container-radius)
}
.theme-switch__checkbox {
  display: none;
}
.theme-switch__circle-container {
  width: var(--circle-container-diameter);
  height: var(--circle-container-diameter);
  background-color: rgba(255, 255, 255, 0.1);
  position: absolute;
  left: var(--circle-container-offset);
  top: var(--circle-container-offset);
  border-radius: var(--container-radius);
  -webkit-box-shadow: inset 0 0 0 3.375em rgba(255, 255, 255, 0.1), inset 0 0 0 3.375em rgba(255, 255, 255, 0.1), 0 0 0 0.625em rgba(255, 255, 255, 0.1), 0 0 0 1.25em rgba(255, 255, 255, 0.1);
  box-shadow: inset 0 0 0 3.375em rgba(255, 255, 255, 0.1), inset 0 0 0 3.375em rgba(255, 255, 255, 0.1), 0 0 0 0.625em rgba(255, 255, 255, 0.1), 0 0 0 1.25em rgba(255, 255, 255, 0.1);
  display: -webkit-box;
  display: -ms-flexbox;
  display: flex;
  -webkit-transition: var(--circle-transition);
  -o-transition: var(--circle-transition);
  transition: var(--circle-transition);
  pointer-events: none;
}
.theme-switch__sun-moon-container {
  pointer-events: auto;
  position: relative;
  z-index: 2;
  width: var(--sun-moon-diameter);
  height: var(--sun-moon-diameter);
  margin: auto;
  border-radius: var(--container-radius);
  background-color: var(--sun-bg);
  -webkit-box-shadow: 0.062em 0.062em 0.062em 0em rgba(254, 255, 239, 0.61) inset, 0em -0.062em 0.062em 0em #a1872a inset;
  box-shadow: 0.062em 0.062em 0.062em 0em rgba(254, 255, 239, 0.61) inset, 0em -0.062em 0.062em 0em #a1872a inset;
  -webkit-filter: drop-shadow(0.062em 0.125em 0.125em rgba(0, 0, 0, 0.25)) drop-shadow(0em 0.062em 0.125em rgba(0, 0, 0, 0.25));
  filter: drop-shadow(0.062em 0.125em 0.125em rgba(0, 0, 0, 0.25)) drop-shadow(0em 0.062em 0.125em rgba(0, 0, 0, 0.25));
  overflow: hidden;
  -webkit-transition: var(--transition);
  -o-transition: var(--transition);
  transition: var(--transition);
}
.theme-switch__moon {
  -webkit-transform: translateX(100%);
  -ms-transform: translateX(100%);
  transform: translateX(100%);
  width: 100%;
  height: 100%;
  background-color: var(--moon-bg);
  border-radius: inherit;
  -webkit-box-shadow: 0.062em 0.062em 0.062em 0em rgba(254, 255, 239, 0.61) inset, 0em -0.062em 0.062em 0em #969696 inset;
  box-shadow: 0.062em 0.062em 0.062em 0em rgba(254, 255, 239, 0.61) inset, 0em -0.062em 0.062em 0em #969696 inset;
  -webkit-transition: var(--transition);
  -o-transition: var(--transition);
  transition: var(--transition);
  position: relative;
}
.theme-switch__spot {
  position: absolute;
  top: 0.75em;
  left: 0.312em;
  width: 0.75em;
  height: 0.75em;
  border-radius: var(--container-radius);
  background-color: var(--spot-color);
  -webkit-box-shadow: 0em 0.0312em 0.062em rgba(0, 0, 0, 0.25) inset;
  box-shadow: 0em 0.0312em 0.062em rgba(0, 0, 0, 0.25) inset;
}
.theme-switch__spot:nth-of-type(2) {
  width: 0.375em;
  height: 0.375em;
  top: 0.937em;
  left: 1.375em;
}
.theme-switch__spot:nth-of-type(3) {
  width: 0.25em;
  height: 0.25em;
  top: 1.5em;
  left: 1.25em;
}
.theme-switch__clouds {
  position: absolute;
  bottom: 0.5em;
  left: 0.5em;
  width: 2.5em;
  height: 1em;
  background: #F3FDFF;
  border-radius: 1em;
  box-shadow: 1.5em 0 #AACADF, 2.5em 0 #F3FDFF;
  opacity: 0.7;
  z-index: 2;
  transition: bottom 0.3s;
}
.theme-switch__stars-container {
  position: absolute;
  color: var(--stars-color);
  top: -100%;
  left: 0.312em;
  width: 2.75em;
  height: auto;
  -webkit-transition: var(--transition);
  -o-transition: var(--transition);
  transition: var(--transition);
}
.theme-switch__checkbox:checked + .theme-switch__container {
  background-color: var(--container-night-bg);
}
.theme-switch__checkbox:checked + .theme-switch__container .theme-switch__circle-container {
  left: calc(100% - var(--circle-container-offset) - var(--circle-container-diameter));
}
.theme-switch__checkbox:checked + .theme-switch__container .theme-switch__circle-container:hover {
  left: calc(100% - var(--circle-container-offset) - var(--circle-container-diameter) - 0.187em)
}
.theme-switch__circle-container:hover {
  left: calc(var(--circle-container-offset) + 0.187em);
}
.theme-switch__checkbox:checked + .theme-switch__container .theme-switch__moon {
  -webkit-transform: translate(0);
  -ms-transform: translate(0);
  transform: translate(0);
}
.theme-switch__checkbox:checked + .theme-switch__container .theme-switch__clouds {
  bottom: -4.062em;
}
.theme-switch__checkbox:checked + .theme-switch__container .theme-switch__stars-container {
  top: 50%;
  -webkit-transform: translateY(-50%);
  -ms-transform: translateY(-50%);
  transform: translateY(-50%);
}

#tooltip-config-modal > div.dark-mode .section-item > div {
  border: 1px solid #383a40 !important;
}
#tooltip-config-modal > div.dark-mode .section-item {
  border: none !important;
}

#tooltip-config-modal > div.dark-mode .section-item input,
#tooltip-config-modal > div.dark-mode .section-item textarea {
  background: #18191c;
  color: #f2f3f5;
  border-color: #383a40;
}
#tooltip-config-modal > div.dark-mode .section-item h4,
#tooltip-config-modal > div.dark-mode .section-item label,
#tooltip-config-modal > div.dark-mode .section-item .section-content {
  color: #f2f3f5;
}

#tooltip-config-modal > div.dark-mode #section-indicator {
  background: #23272a !important;
  color: #f2f3f5 !important;
  border: 1px solid #383a40 !important;
}

#tooltip-config-modal #multi-section-content > div[style*='display: flex'] {
  border: none !important;
  background: none !important;
  box-shadow: none !important;
  margin: 0 !important;
  padding: 0 !important;
}

#tooltip-config-modal > div.dark-mode #tooltip-content[contenteditable],
#tooltip-config-modal > div.dark-mode .section-content[contenteditable] {
  background: #18191c !important;
  color: #f2f3f5 !important;
  border-color: #383a40 !important;
}
#tooltip-config-modal > div.dark-mode #tooltip-content[contenteditable]:focus,
#tooltip-config-modal > div.dark-mode .section-content[contenteditable]:focus {
  outline: 1.5px solid #5865f2;
}

.format-toolbar button i.fa-solid {
  font-size: 18px;
  display: flex;
  align-items: center;
  justify-content: center;
}
.format-toolbar button {
  background: none;
  border: none;
  color: #2196F3;
  cursor: pointer;
  border-radius: 4px;
  transition: background 0.2s, color 0.2s;
}
.format-toolbar button:hover, .format-toolbar button.active {
  background: #e3f2fd;
  color: #1565c0;
}
#tooltip-config-modal > div.dark-mode .format-toolbar button {
  color: #90caf9;
}
#tooltip-config-modal > div.dark-mode .format-toolbar button:hover, #tooltip-config-modal > div.dark-mode .format-toolbar button.active {
  background: #263245;
  color: #fff;
} 