/* src/client/app/index.css */
/* Global styles and Tailwind CSS directives */

@import "tailwindcss";

@layer base {
  body {
    font-family: 'Ruda', sans-serif;
  }
}

@layer components {
  .btn-primary {
    @apply bg-blue-600 hover:bg-blue-700 text-white font-medium py-2 px-4 rounded-lg transition-colors;
  }
  
  .btn-secondary {
    @apply bg-gray-200 hover:bg-gray-300 text-gray-800 font-medium py-2 px-4 rounded-lg transition-colors;
  }
  
  .card {
    @apply bg-white rounded-lg shadow-md p-4;
  }
  
  .input-field {
    @apply w-full px-4 py-2 border border-gray-300 rounded-lg focus:outline-none focus:ring-2 focus:ring-blue-500;
  }

  .action-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 6px;
    border: none;
    background-color: transparent;
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.15s ease;
  }

  .edit-btn {
    color: #2563EB;
  }

  .edit-btn:hover {
    background-color: #DBEAFE;
  }

  .delete-btn {
    color: #DC2626;
  }

  .delete-btn:hover {
    background-color: #FEE2E2;
  }

  .approve-btn {
    color: #16A34A;
  }

  .approve-btn:hover {
    background-color: #DCFCE7;
  }

  .reject-btn {
    color: #DC2626;
  }

  .reject-btn:hover {
    background-color: #FEE2E2;
  }

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

/* Print Styles */
@media print {
  /* Hide UI infrastructure */
  header,
  .app-header,
  nav,
  aside,
  .sidebar,
  .notification-bell,
  .action-bar,
  .toolbar-right,
  .notes-toolbar,
  .action-btn,
  button {
    display: none !important;
  }

  /* Hide elements with print:hidden class */
  .print\:hidden {
    display: none !important;
  }

  /* Ensure main content occupies full width */
  main,
  .content-area {
    margin: 0 !important;
    padding: 0 !important;
    width: 100% !important;
  }

  /* Hide all extra UI elements for notes */
  .notes-toolbar,
  .toolbar-right,
  .view-toggles-group,
  .sort-control {
    display: none !important;
  }

  /* Reset page margins */
  @page {
    size: landscape;
    margin: 0 !important; /* Это убирает надписи по углам */
  }

  /* Reset body for print */
  body {
    padding: 1.5cm !important; /* Чтобы текст не прилипал к краю листа */
    background: white !important;
  }

  /* Скрываем колонку 'Действия' во вкладке кассы */
  .paymaster-table th:last-child,
  .paymaster-table td:last-child {
    display: none !important;
  }

  /* Ensure background colors are preserved for printing */
  * {
    color-adjust: exact;
    -webkit-print-color-adjust: exact;
    print-color-adjust: exact;
  }

  /* Reset body for print */
  body {
    padding: 1cm !important;
    background: white !important;
  }

  /* Reset main content layout */
  main,
  main > div,
  .flex-1,
  .overflow-y-auto,
  .overflow-hidden {
    margin-left: 0 !important;
    overflow: visible !important;
    height: auto !important;
    position: static !important;
    width: 100% !important;
    max-width: none !important;
  }

  /* Ensure content flows as block */
  main {
    display: block !important;
    width: 100% !important;
    max-width: none !important;
  }

  /* Ensure notes-page also stretches */
  .notes-page {
    width: 100% !important;
    max-width: none !important;
  }

  /* Table styles for list view */
  table {
    width: 100% !important;
    table-layout: auto !important;
  }

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

  /* Notes-specific print styles */
  .notes-page {
    display: block !important;
  }

  .notes-page > *:not(.notes-board):not(.notes-table) {
    display: none !important;
  }

  .notes-board {
    display: block !important;
    height: auto !important;
    min-height: auto !important;
    overflow: visible !important;
  }

  .notes-board > *:not(.grid-container):not(.list-container) {
    display: none !important;
  }

  .grid-container {
    display: block !important;
    height: auto !important;
    min-height: auto !important;
    overflow: visible !important;
    background: white !important;
  }

  /* List view styles for printing */
  .list-container {
    flex: auto !important;
    overflow: visible !important;
    background: white !important;
    padding: 0 !important;
  }

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

  .notes-table thead,
  .notes-table tbody,
  .notes-table tr {
    display: table-header-group !important;
    display: table-row-group !important;
    display: table-row !important;
  }

  .notes-table th,
  .notes-table td {
    border: 1px solid #eee !important;
    border-bottom: 1px solid #E5E7EB !important;
  }

  /* Prevent breaking grid items across pages */
  .grid-item {
    break-inside: avoid;
    page-break-inside: avoid;
  }

  /* Advance color for print (Violet 600) */
  .mini-value.advance, 
  .total-value.advance,
  .text-purple-600 {
    color: #7c3aed !important; /* Фиолетовый (Violet 600) */
  }
}

/* Floating Action Button (FAB) - Global Style */
.floating-create-btn {
  position: fixed;
  bottom: 32px;
  right: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 56px;
  height: 56px;
  border: none;
  background-color: #22C55E;
  color: #FFFFFF;
  border-radius: 50%;
  cursor: pointer;
  transition: all 0.2s ease;
  box-shadow: 0 4px 12px rgba(34, 197, 94, 0.4);
  z-index: 100;
}

.floating-create-btn:hover {
  background-color: #16A34A;
  transform: scale(1.1);
  box-shadow: 0 6px 16px rgba(34, 197, 94, 0.5);
}

.floating-create-btn:active {
  transform: scale(0.95);
}

/* Hide FAB on print */
@media print {
  .floating-create-btn {
    display: none;
  }
}

/* Global Tooltip Styles - Floating UI (v-popper) */
.v-popper--theme-tooltip .v-popper__inner {
  max-width: min(520px, calc(100vw - 32px));
  white-space: pre-line;
  word-break: break-word;
}

/* Global Mention Styles - <app-mention> tags */
app-mention {
  display: inline-flex;
  align-items: center;
  max-width: 160px; /* Лимит по ширине для всей плашки */
  background: rgba(59, 130, 246, 0.15);
  padding: 0 6px;
  border-radius: 4px;
  vertical-align: middle;
  gap: 4px;
}

/* Стили для внутреннего текста с обрезкой */
app-mention .mention-text {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  display: inline-block;
  flex: 1;
  min-width: 0;
}

/* Стили для кнопки удаления (для редактора) */
app-mention .mention-delete {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 16px;
  height: 16px;
  padding: 0;
  background-color: rgba(239, 68, 68, 0.2);
  border: none;
  border-radius: 4px;
  cursor: pointer;
  transition: all 0.2s ease;
  pointer-events: auto;
  margin-left: 2px;
  flex-shrink: 0;
}

app-mention .mention-delete:hover {
  background-color: rgba(239, 68, 68, 0.4);
}

app-mention .mention-delete svg {
  color: rgba(248, 113, 113, 0.8);
}

/* Скрываем удаление только внутри контента редактора, который заморожен */
.mention-editor-content[contenteditable="false"] .mention-delete {
  display: none !important;
}

/* При этом в активном редакторе (contenteditable="true") кнопки должны быть видны */
.mention-editor-content[contenteditable="true"] .mention-delete {
  display: inline-flex;
}
