/* src/client/widgets/styles/NotesBoard.css */
/* Стили для NotesBoard с @noction/vue-draggable-grid */

.notes-board {
  display: flex;
  flex-direction: column;
  height: 100%;
  overflow: hidden;
}

/* Grid Container */
.grid-container {
  flex: 1;
  position: relative;
  overflow: hidden;
  background-color: #F9FAFB;
}

/* Принудительно заставляем внутренний контейнер плагина 
   вписываться в наш контейнер */
:deep(.vgl-layout) {
  min-height: 100% !important;
  /* Убираем возможность появления внутренних скроллов у самого плагина */
  overflow: visible !important;
}

/* vue-draggable-grid Styles */
.grid-layout {
  min-height: 100%;
}

.grid-item {
  touch-action: none;
  transition: transform 0.2s ease;
}

.grid-item.is-dragging {
  opacity: 0.8;
  z-index: 1000;
}

.grid-item.is-dragging .note-card {
  box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 10px 10px -5px rgba(0, 0, 0, 0.04);
}

.grid-item.is-resizing {
  z-index: 1000;
}

/* Resizable handle styling */
.grid-item .resizable-handle {
  background: transparent;
  bottom: 0;
  left: 0;
  right: 0;
  height: 10px;
  cursor: s-resize;
  position: absolute;
  z-index: 100;
}

.grid-item .resizable-handle:hover {
  background: linear-gradient(to bottom, transparent, rgba(0, 0, 0, 0.05));
}

.grid-item .resizable-handle::after {
  content: '';
  position: absolute;
  bottom: 2px;
  left: 50%;
  transform: translateX(-50%);
  width: 40px;
  height: 3px;
  background-color: rgba(0, 0, 0, 0.1);
  border-radius: 2px;
  opacity: 0;
  transition: opacity 0.2s ease;
}

.grid-item .resizable-handle:hover::after {
  opacity: 1;
}

/* List View Styles */
.list-container {
  flex: 1;
  position: relative;
  overflow: auto;
  background-color: #F9FAFB;
  padding: 16px;
}

.notes-table {
  width: 100%;
  border-collapse: collapse;
  background-color: #FFFFFF;
  border-radius: 8px;
  overflow: hidden;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
}

.notes-table thead {
  background-color: #F3F4F6;
}

.notes-table th {
  padding: 12px 16px;
  text-align: left;
  font-size: 13px;
  font-weight: 600;
  color: #374151;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  border-bottom: 1px solid #E5E7EB;
}

.notes-table th.col-priority {
  width: 40px;
  text-align: center;
}

.notes-table th.col-title {
  width: 25%;
}

.notes-table th.col-content {
  width: 20%;
}

.notes-table th.col-author {
  width: 18%;
}

.notes-table th.col-date {
  width: 25%;
}

.notes-table th.col-reason {
  width: 20%;
}

.notes-table th.col-reminder {
  width: 40px;
  text-align: center;
}

.notes-table th.col-actions {
  width: 100px;
  text-align: center;
}

.notes-table tbody {
  background-color: #FFFFFF;
}

.note-row {
  cursor: pointer;
  transition: background-color 0.15s ease;
  border-bottom: 1px solid #F3F4F6;
}

.note-row:hover {
  background-color: #F9FAFB;
}

.note-row:last-child {
  border-bottom: none;
}

.notes-table td {
  padding: 12px 16px;
  vertical-align: middle;
}

.notes-table td.col-priority {
  text-align: center;
}

.notes-table td.col-title {
  font-weight: 500;
  color: #111827;
}

.note-title {
  max-width: 220px;
  font-weight: 500;
  color: #111827;
}

.notes-table td.col-content {
  color: #6B7280;
  font-size: 13px;
}

.note-content-preview {
  display: block;
  max-width: 250px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.note-col-content {
  color: #6B7280;
  font-size: 13px;
  max-width: 200px;
}

.notes-table td.col-author {
  color: #6B7280;
}

.author-badge {
  display: inline-block;
  padding: 4px 10px;
  background-color: #E5E7EB;
  color: #374151;
  border-radius: 12px;
  font-size: 12px;
  font-weight: 500;
}

.author-badge-truncated {
  display: inline-block;
  padding: 4px 10px;
  background-color: #E5E7EB;
  color: #374151;
  border-radius: 12px;
  font-size: 12px;
  font-weight: 500;
  max-width: 120px;
}

.notes-table td.col-date {
  color: #6B7280;
  font-size: 13px;
}

.notes-table td.col-reason {
  color: #6B7280;
  font-size: 13px;
}

.reason-text {
  display: block;
  max-width: 250px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  cursor: help;
}

.reason-empty {
  color: #D1D5DB;
}

.notes-table td.col-reminder {
  text-align: center;
}

.notes-table td.col-actions {
  text-align: center;
}

/* Priority Indicator Styles */
.priority-dot {
  width: 12px;
  height: 12px;
  border-radius: 50%;
  display: inline-block;
}

/* Normal priority: White inside, 3px colored border */
.dot-normal {
  background-color: #FFFFFF;
  border-width: 3px;
  border-style: solid;
}

/* High priority: Full filled circle */
.dot-high {
  background-color: currentColor;
  border: 3px solid transparent;
}

/* Color schemes */
.dot-admin {
  color: #D41D00;
  border-color: #D41D00;
}

.dot-manager-public {
  color: #E3AA00;
  border-color: #E3AA00;
}

.dot-manager-private {
  color: #2F9FFA;
  border-color: #2F9FFA;
}

/* Loading State Styles */
.loading-container {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 200px;
  width: 100%;
}

.spinner {
  width: 40px;
  height: 40px;
  border: 4px solid #E5E7EB;
  border-top-color: #3B82F6;
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

/* Print Styles */
@media print {
  /* Grid view */
  .notes-board,
  .grid-container,
  .grid-layout {
    display: block !important;
    height: auto !important;
    min-height: auto !important;
    overflow: visible !important;
    background: white !important;
  }

  .grid-item {
    break-inside: avoid;
    page-break-inside: avoid;
  }

  /* List view */
  .list-container {
    overflow: visible !important;
    height: auto !important;
    display: block !important;
    background: white !important;
  }

  .notes-table {
    display: table !important;
    width: 100% !important;
    table-layout: auto !important;
    border-collapse: collapse !important;
  }

  .notes-table thead {
    display: table-header-group !important;
  }

  .notes-table tbody {
    display: table-row-group !important;
  }

  .note-row {
    display: table-row !important;
    page-break-inside: avoid !important;
    break-inside: avoid !important;
  }

  .notes-table th,
  .notes-table td {
    display: table-cell !important;
    padding: 8px !important;
    border-bottom: 1px solid #E5E7EB !important;
    text-align: left !important;
  }

  /* Hide columns that are not needed in PDF */
  .notes-table th.col-priority,
  .notes-table td.col-priority,
  .notes-table th.col-reminder,
  .notes-table td.col-reminder,
  .notes-table th.col-actions,
  .notes-table td.col-actions {
    display: none !important;
  }

  /* Reset max-width for content elements to use full available space */
  .note-title,
  .note-col-content,
  .author-badge-truncated,
  .reason-text {
    max-width: none !important;
    white-space: normal !important;
  }

  /* Prevent rows from breaking across pages */
  .note-row {
    break-inside: avoid;
    page-break-inside: avoid;
  }

  /* Hide empty cells */
  .notes-table th:empty,
  .notes-table td:empty {
    display: none !important;
  }
}
