/* ============================================
   Tiptap Editor - Matching Pivot Style
   ============================================ */ 

/* ============================================
   Container
   ============================================ */

.tiptap-editor-container {
  border: 1px solid var(--s-card-border);
  border-radius: var(--bs-border-radius); /* ✅ Nga theme */
  background: var(--s-card-bg);
  box-shadow: var(--s-card-shadow); /* ✅ Nga theme */
  overflow: hidden;
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

body.dark-mode .tiptap-editor-container {
  border: 1px solid var(--s-card-border);
  box-shadow: var(--s-card-shadow);
}

/* ✅ Focus - merr ngjyrën nga theme */
.tiptap-editor-container:focus-within {
  border-width: 3px;
  border-color: var(--bs-border-color);
  box-shadow: 0 0 0 0.15rem rgba(var(--bs-primary-rgb), 0.1);
}

 

/* ============================================
   Menu Bar
   ============================================ */

.tiptap-menu-bar {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  padding: 8px;
  background: var(--s-card-bg, #f8f9fa);
  border-bottom: 1px solid var(--s-card-border); 
  align-items: center;
}

body.dark-mode .tiptap-menu-bar {
  background: transparent;
  border-bottom: 1px solid var(--s-card-border);
}

/* Menu Buttons - si chips në pivot */
.tiptap-menu-button {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  border: 1px solid transparent;
  border-radius: 4px;
  background: transparent;
  color: var(--bs-body-color, #333);
  font-size: 16px;
  cursor: pointer;
  transition: all 0.2s ease-in-out; 
}

  .tiptap-menu-button:hover {
    background: rgba(0, 0, 0, 0.05);
    border-color: rgba(var(--bs-body-color-rgb), 0.3);
  }

body.dark-mode .tiptap-menu-button {
  color: var(--bs-body-color, #ddd);
}

  body.dark-mode .tiptap-menu-button:hover {
    background: rgba(255, 255, 255, 0.05);
    border-color: rgba(var(--bs-body-color-rgb), 0.3);
  }

.tiptap-menu-button.is-active {
  background: var(--bs-primary, #007bff);
  color: white;
  border-color: var(--bs-primary, #007bff);
}

  .tiptap-menu-button.is-active:hover {
    background: #0056b3;
    border-color: #0056b3;
  }

/* Menu Divider */
.tiptap-menu-divider {
  width: 1px;
  height: 24px;
  margin: 4px 0;
  background: var(--s-card-border); 
}

body.dark-mode .tiptap-menu-divider {
  background: var(--s-card-border);
}

/* ============================================
   Font Selectors - si pivot select
   ============================================ */

.tiptap-font-selector,
.tiptap-font-size-selector {
  display: inline-flex;
  align-items: center;
}

.tiptap-font-dropdown,
.tiptap-font-size-dropdown {
  height: 32px;
  padding: 0 8px;
  border: 1px solid var(--s-card-border); 
  border-radius: 0.5rem; 
  background: var(--bs-body-bg, #fff); 
  color: var(--bs-body-color, #333);
  font-size: 0.85rem; 
  cursor: pointer;
  transition: all 0.2s ease-in-out; 
}

.tiptap-font-dropdown {
  min-width: 140px;
}

.tiptap-font-size-dropdown {
  min-width: 80px;
}

  .tiptap-font-dropdown:hover,
  .tiptap-font-size-dropdown:hover {
    border-color: var(--s-card-border);
  }

  .tiptap-font-dropdown:focus,
  .tiptap-font-size-dropdown:focus {
    outline: none !important;
    border-color: var(--bs-primary) !important; 
    box-shadow: 0 0 0 0.2rem rgba(var(--bs-primary-rgb), 0.25) !important; 
  }

body.dark-mode .tiptap-font-dropdown,
body.dark-mode .tiptap-font-size-dropdown {
  background: var(--bs-body-bg);
  border: 1px solid var(--s-card-border);
  color: var(--bs-body-color, #ddd);
}

  body.dark-mode .tiptap-font-dropdown:focus,
  body.dark-mode .tiptap-font-size-dropdown:focus {
    border-color: var(--bs-primary) !important;
    box-shadow: 0 0 0 0.2rem rgba(var(--bs-primary-rgb), 0.25) !important;
  }

  body.dark-mode .tiptap-font-dropdown option,
  body.dark-mode .tiptap-font-size-dropdown option {
    background: var(--s-card-bg, #2b2b2b);
    color: var(--bs-body-color, #ddd);
  }

/* ============================================
   Color Picker
   ============================================ */

.tiptap-color-picker-container,
.tiptap-bg-color-picker-container {
  display: inline-flex;
  align-items: center;
  position: relative;
}

.tiptap-color-button,
.tiptap-bg-color-button {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  border: 1px solid transparent;
  border-radius: 4px;
  background: transparent;
  color: var(--bs-body-color, #333);
  cursor: pointer;
  transition: all 0.2s ease-in-out; 
  position: relative;
  padding: 0;
}

  .tiptap-color-button:hover,
  .tiptap-bg-color-button:hover {
    background: rgba(0, 0, 0, 0.05);
  }

body.dark-mode .tiptap-color-button,
body.dark-mode .tiptap-bg-color-button {
  color: var(--bs-body-color, #ddd);
}

  body.dark-mode .tiptap-color-button:hover,
  body.dark-mode .tiptap-bg-color-button:hover {
    background: rgba(255, 255, 255, 0.05);
  }

.tiptap-color-button svg,
.tiptap-bg-color-button svg {
  display: block;
}

.tiptap-color-preview,
.tiptap-bg-color-preview {
  position: absolute;
  bottom: 3px;
  left: 50%;
  transform: translateX(-50%);
  width: 18px;
  height: 3px;
  border-radius: 1.5px;
  box-shadow: 0 0 0 1px rgba(0, 0, 0, 0.1);
}

body.dark-mode .tiptap-color-preview,
body.dark-mode .tiptap-bg-color-preview {
  box-shadow: 0 0 0 1px rgba(255, 255, 255, 0.2);
}

/* Color Palette */
.tiptap-color-palette,
.tiptap-bg-color-palette {
  position: absolute;
  top: calc(100% + 4px);
  left: 0;
  padding: 12px;
  background: var(--s-card-bg, #fff);
  border: 1px solid var(--s-card-border); 
  border-radius: 8px; 
  box-shadow: 0 6px 20px rgba(0, 0, 0, 0.1); 
  z-index: 1000;
  min-width: 220px;
  transition: border-color 0.2s ease;
}

body.dark-mode .tiptap-color-palette,
body.dark-mode .tiptap-bg-color-palette {
  background: var(--s-card-bg, #2b2b2b);
  border: 1px solid var(--s-card-border);
  box-shadow: 0 6px 20px rgba(0, 0, 0, 0.3);
}

.tiptap-color-group-label {
  font-size: 11px;
  font-weight: 600;
  color: var(--bs-body-color, #666);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin-bottom: 8px;
  margin-top: 8px;
}

  .tiptap-color-group-label:first-child {
    margin-top: 0;
  }

body.dark-mode .tiptap-color-group-label {
  color: rgba(255, 255, 255, 0.6);
}

.tiptap-color-group {
  display: grid;
  grid-template-columns: repeat(6, 1fr);
  gap: 6px;
  margin-bottom: 4px;
}

/* Color swatches - si chips në pivot */
.tiptap-color-swatch {
  width: 28px;
  height: 28px;
  border: 2px solid transparent;
  border-radius: 4px;
  cursor: pointer;
  transition: all 0.15s ease;
  padding: 0;
  position: relative;
  box-shadow: inset 0 0 0 1px rgba(0, 0, 0, 0.1);
}

body.dark-mode .tiptap-color-swatch {
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.15);
}

.tiptap-color-swatch:hover {
  transform: scale(1.1);
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2), inset 0 0 0 1px rgba(0, 0, 0, 0.1);
  z-index: 1;
}

body.dark-mode .tiptap-color-swatch:hover {
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.4), inset 0 0 0 1px rgba(255, 255, 255, 0.15);
}

.tiptap-color-swatch.active {
  border-color: var(--bs-primary, #007bff);
  box-shadow: 0 0 0 2px var(--bs-primary, #007bff), inset 0 0 0 1px rgba(0, 0, 0, 0.1);
}

body.dark-mode .tiptap-color-swatch.active {
  border-color: var(--bs-primary);
  box-shadow: 0 0 0 2px var(--bs-primary), inset 0 0 0 1px rgba(255, 255, 255, 0.15);
}

.tiptap-color-swatch[data-color="#FFFFFF"] {
  box-shadow: inset 0 0 0 1px rgba(0, 0, 0, 0.2);
}

body.dark-mode .tiptap-color-swatch[data-color="#FFFFFF"] {
  box-shadow: inset 0 0 0 1px rgba(0, 0, 0, 0.4);
}

/* Reset Color Swatch */
.tiptap-color-swatch-reset {
  background: rgba(0, 0, 0, 0.05);
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: inset 0 0 0 1px rgba(0, 0, 0, 0.15);
}

body.dark-mode .tiptap-color-swatch-reset {
  background: rgba(255, 255, 255, 0.05);
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.2);
}

.tiptap-color-swatch-reset svg {
  color: var(--bs-danger, #dc3545);
  stroke: var(--bs-danger, #dc3545);
  display: block;
}

body.dark-mode .tiptap-color-swatch-reset svg {
  color: #ff6b6b;
  stroke: #ff6b6b;
}

.tiptap-color-swatch-reset:hover {
  background: var(--bs-danger, #dc3545);
  box-shadow: 0 2px 8px rgba(220, 53, 69, 0.4), inset 0 0 0 1px rgba(220, 53, 69, 0.8);
  transform: scale(1.1);
}

body.dark-mode .tiptap-color-swatch-reset:hover {
  background: #ff4d4d;
  box-shadow: 0 2px 8px rgba(255, 77, 77, 0.4), inset 0 0 0 1px rgba(255, 77, 77, 0.8);
}

.tiptap-color-swatch-reset:hover svg {
  color: white;
  stroke: white;
}

/* ============================================
   Editor Content
   ============================================ */

.tiptap-editor {
  background: var(--s-card-bg, #fff);
}

.tiptap-content {
  padding: 12px;
  color: var(--bs-body-color, #333);
  outline: none;
}

  .tiptap-content:focus {
    outline: none;
  }

  .tiptap-content h1,
  .tiptap-content h2,
  .tiptap-content h3 {
    color: var(--bs-body-color, #333);
    margin-top: 0.5em;
    margin-bottom: 0.5em;
  }

  .tiptap-content p {
    margin: 0.5em 0;
    color: var(--bs-body-color, #333);
  }

  .tiptap-content a {
    color: var(--bs-link-color, #007bff);
    text-decoration: underline;
  }

body.dark-mode .tiptap-content a {
  color: var(--bs-link-color);
}

.tiptap-content ul,
.tiptap-content ol {
  padding-left: 1.5em;
  margin: 0.5em 0;
}

.tiptap-content li {
  color: var(--bs-body-color, #333);
}

/* Tables */
.tiptap-content table {
  border-collapse: collapse;
  width: 100%;
  margin: 1em 0;
  table-layout: fixed;
}

  .tiptap-content table td,
  .tiptap-content table th {
    border: 1px solid var(--s-card-border); 
    padding: 8px;
    color: var(--bs-body-color, #333);
    position: relative;
    min-width: 50px;
    vertical-align: top;
  }

body.dark-mode .tiptap-content table td,
body.dark-mode .tiptap-content table th {
  border: 1px solid var(--s-card-border);
}

.tiptap-content table th {
  background: rgba(0, 0, 0, 0.05);
  font-weight: bold;
}

body.dark-mode .tiptap-content table th {
  background: rgba(255, 255, 255, 0.03);
}

.tiptap-content .selectedCell {
  background: rgba(var(--bs-primary-rgb), 0.1);
}

body.dark-mode .tiptap-content .selectedCell {
  background: rgba(var(--bs-primary-rgb), 0.15);
}

.tiptap-content .tableWrapper {
  overflow-x: auto;
  margin: 1em 0;
}

.tiptap-content .column-resize-handle {
  position: absolute;
  right: -2px;
  top: 0;
  bottom: 0;
  width: 4px;
  background-color: var(--bs-primary);
  cursor: col-resize;
  pointer-events: none;
}

  .tiptap-content .column-resize-handle:hover {
    background-color: #0056b3;
  }

body.dark-mode .tiptap-content .column-resize-handle {
  background-color: var(--bs-primary);
}

/* Blockquote */
.tiptap-content blockquote {
  border-left: 3px solid var(--s-card-border); 
  padding-left: 1em;
  margin-left: 0;
  font-style: italic;
  color: #6c757d;
}

body.dark-mode .tiptap-content blockquote {
  border-left: 3px solid var(--s-card-border);
  color: rgba(255, 255, 255, 0.5);
}

/* Code */
.tiptap-content code {
  background: rgba(0, 0, 0, 0.1);
  padding: 2px 6px;
  border-radius: 3px;
  font-family: 'Courier New', monospace;
  color: var(--bs-body-color, #333);
  border: 1px solid var(--s-card-border); 
}

body.dark-mode .tiptap-content code {
  background: rgba(255, 255, 255, 0.08);
  color: #e0e0e0;
  border: 1px solid var(--s-card-border);
}

.tiptap-content pre {
  background: rgba(0, 0, 0, 0.05);
  padding: 12px;
  border-radius: 4px;
  overflow-x: auto;
  border: 1px solid var(--s-card-border); 
}

body.dark-mode .tiptap-content pre {
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid var(--s-card-border);
}

/* Horizontal Rule */
.tiptap-content hr {
  border: none;
  border-top: 1px solid var(--s-card-border); 
  margin: 2em 0;
}

body.dark-mode .tiptap-content hr {
  border-top: 1px solid var(--s-card-border);
}

/* Images */
.tiptap-content img {
  max-width: 100%;
  height: auto;
  border-radius: 4px;
  margin: 0.5em 0;
  cursor: pointer;
}

  .tiptap-content img.ProseMirror-selectednode {
    outline: 3px solid var(--bs-primary);
  }

body.dark-mode .tiptap-content img.ProseMirror-selectednode {
  outline-color: var(--bs-primary);
}

/* Highlight */
.tiptap-content mark {
  padding: 2px 0;
  border-radius: 2px;
}

/* ============================================
   Placeholder
   ============================================ */

.tiptap-content.is-editor-empty:first-child::before {
  content: attr(data-placeholder);
  float: left;
  color: #6c757d;
  pointer-events: none;
  height: 0;
}

body.dark-mode .tiptap-content.is-editor-empty:first-child::before {
  color: rgba(255, 255, 255, 0.3);
}

/* ============================================
   Dialogs (Link & Image) - si pivot FilterBox
   ============================================ */

.tiptap-link-dialog,
.tiptap-image-dialog {
  position: fixed !important;
  top: 0 !important;
  left: 0 !important;
  right: 0 !important;
  bottom: 0 !important;
  background: rgba(0, 0, 0, 0.5) !important;
  display: flex !important;
  align-items: center !important;
  justify-content: center !important;
  z-index: 10000 !important;
  animation: fadeIn 0.2s;
}

@keyframes fadeIn {
  from {
    opacity: 0;
  }

  to {
    opacity: 1;
  }
}

.tiptap-link-dialog-content,
.tiptap-image-dialog-content {
  background: var(--s-card-bg, #fff) !important;
  padding: 24px !important;
  border-radius: 8px !important; 
  min-width: 400px !important;
  max-width: 90% !important;
  box-shadow: 0 6px 20px rgba(0, 0, 0, 0.1) !important; 
  animation: slideUp 0.2s;
  position: relative !important;
  margin: auto !important;
  border: 1px solid var(--s-card-border) !important; 
}

@keyframes slideUp {
  from {
    transform: translateY(20px);
    opacity: 0;
  }

  to {
    transform: translateY(0);
    opacity: 1;
  }
}

body.dark-mode .tiptap-link-dialog-content,
body.dark-mode .tiptap-image-dialog-content {
  background: var(--s-card-bg, #2b2b2b) !important;
  box-shadow: 0 6px 20px rgba(0, 0, 0, 0.3) !important;
  border: 1px solid var(--s-card-border) !important;
}

.tiptap-link-dialog h4,
.tiptap-image-dialog h4 {
  margin: 0 0 16px 0 !important;
  color: var(--bs-body-color, #333);
  font-size: 16px; 
  font-weight: 600; 
}

body.dark-mode .tiptap-link-dialog h4,
body.dark-mode .tiptap-image-dialog h4 {
  color: var(--bs-body-color, #ddd);
}

/* Inputs - si pivot FilterBox input */
.tiptap-link-input,
.tiptap-image-input {
  width: 100% !important;
  padding: 6px 8px !important; 
  border: 1px solid var(--s-card-border) !important; 
  border-radius: 6px !important; 
  margin-bottom: 10px !important; 
  background-color: var(--bs-body-bg) !important; 
  color: var(--bs-body-color) !important;
  font-size: 14px !important;
  transition: border-color 0.2s, box-shadow 0.2s;
  box-sizing: border-box !important;
  outline: none !important;
}

  .tiptap-link-input:hover,
  .tiptap-image-input:hover {
    border-color: var(--s-card-border) !important;
  }

  .tiptap-link-input:focus,
  .tiptap-image-input:focus {
    border-color: var(--bs-primary) !important; 
    box-shadow: 0 0 0 0.2rem rgba(var(--bs-primary-rgb), 0.25) !important; 
  }

body.dark-mode .tiptap-link-input,
body.dark-mode .tiptap-image-input {
  background-color: var(--bs-body-bg) !important;
  border: 1px solid var(--s-card-border) !important;
  color: var(--bs-body-color) !important;
}

  body.dark-mode .tiptap-link-input:focus,
  body.dark-mode .tiptap-image-input:focus {
    border-color: var(--bs-primary) !important;
    box-shadow: 0 0 0 0.2rem rgba(var(--bs-primary-rgb), 0.25) !important;
  }

.tiptap-link-dialog-buttons,
.tiptap-image-dialog-buttons {
  display: flex !important;
  gap: 8px !important;
  justify-content: flex-end !important;
  margin-top: 4px !important;
}

/* Buttons - si pivot FilterBox buttons */
.tiptap-btn {
  padding: 5px 12px !important; 
  border: 1px solid var(--s-card-border) !important;
  border-radius: 6px !important; 
  cursor: pointer !important;
  font-size: 14px !important;
  font-weight: 500 !important;
  transition: background 0.2s, color 0.2s; 
  margin-right: 6px !important;
}

.tiptap-btn-cancel {
  background: var(--s-card-bg) !important; 
  border: 1px solid var(--s-card-border) !important;
  color: var(--bs-body-color) !important;
}

  .tiptap-btn-cancel:hover {
    background: var(--bs-light) !important; 
  }

body.dark-mode .tiptap-btn-cancel {
  background: var(--s-card-bg) !important;
  color: var(--bs-body-color) !important;
  border: 1px solid var(--s-card-border) !important;
}

  body.dark-mode .tiptap-btn-cancel:hover {
    background: rgba(255, 255, 255, 0.05) !important;
  }

.tiptap-btn-primary {
  background-color: var(--bs-primary) !important; 
  color: var(--bs-light) !important; 
  border: 1px solid var(--bs-primary-dark, var(--bs-primary)) !important;
}

  .tiptap-btn-primary:hover {
    background-color: #0261ed !important; 
    color: var(--bs-light) !important;
  }

.tiptap-btn-danger {
  background: var(--bs-danger, #dc3545) !important;
  color: var(--bs-light) !important;
  border: 1px solid var(--bs-danger) !important;
}

  .tiptap-btn-danger:hover {
    background: #c82333 !important;
  }

/* ============================================
   Character Counter
   ============================================ */

.tiptap-counter {
  padding: 8px 12px;
  text-align: right;
  font-size: 12px;
  color: rgba(var(--bs-body-color-rgb), 0.6);
  border-top: 1px solid var(--s-card-border); 
  background: var(--s-card-bg, #f8f9fa);
}

body.dark-mode .tiptap-counter {
  color: rgba(255, 255, 255, 0.5);
  border-top: 1px solid var(--s-card-border);
  background: rgba(0, 0, 0, 0.1);
}

/* ============================================
   Full Screen Mode
   ============================================ */

.tiptap-fullscreen {
  position: fixed !important;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 9999;
  background: var(--s-card-bg, #fff);
  margin: 0 !important;
  border-radius: 0 !important;
  border: none !important;
}

body.dark-mode .tiptap-fullscreen {
  background: var(--s-card-bg, #1a1a1a);
}

.tiptap-fullscreen .tiptap-content {
  max-height: calc(100vh - 120px) !important;
  min-height: calc(100vh - 120px) !important;
}

.tiptap-fullscreen .tiptap-menu-bar {
  flex-wrap: nowrap;
  overflow-x: auto;
}

.tiptap-fullscreen .tiptap-counter {
  position: sticky;
  bottom: 0;
}

/* ============================================
   Table Controls
   ============================================ */

.tiptap-table-controls {
  display: flex;
  align-items: center;
  gap: 4px;
  padding-left: 4px;
  border-left: 2px solid var(--bs-primary);
}

body.dark-mode .tiptap-table-controls {
  border-left-color: var(--bs-primary);
}

.tiptap-table-button {
  font-size: 14px;
  opacity: 0.9;
}

  .tiptap-table-button:hover {
    opacity: 1;
    background: rgba(var(--bs-primary-rgb), 0.1);
  }

body.dark-mode .tiptap-table-button:hover {
  background: rgba(var(--bs-primary-rgb), 0.1);
}
