/* Main CSS for Fliplet.UI.Table */

/* FL-Table General Styles */
.fl-table {
  display: flex;
  flex-direction: column;
  border: 1px solid #e4e9eb;
  background-color: #fff;
  border-radius: 3px;
  font-family: sans-serif;
}

.fl-table-scroll-container {
  overflow-x: auto;
}

/* Search Bar */
.fl-table-search {
  padding: 10px;
  border-bottom: 1px solid #e4e9eb;
}

.fl-table-search input {
  width: 100%;
  padding: 8px 12px;
  border: 1px solid #ccc;
  border-radius: 3px;
  box-sizing: border-box;
}

/* Header */
.fl-table-header {
  font-weight: bold;
  background-color: #f2f6f7;
  border-bottom: 1px solid #e4e9eb;
}

/* Body */
.fl-table-body {
  flex-grow: 1;
}

/* Rows */
.fl-table-row {
  display: flex;
  border-bottom: 1px solid #e4e9eb;
}

.fl-table-body .fl-table-row:last-child {
  border-bottom: none;
}

.fl-table-body .fl-table-row:hover {
  background-color: #f8f9fa;
}

.fl-table-row.fl-table-selected {
  background-color: #e6f7ff !important;
  font-weight: 500;
}

/* Cells */
.fl-table-cell {
  padding: 12px 15px;
  flex: 1;
  display: flex;
  align-items: center;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  box-sizing: border-box;
}

.fl-table-header .fl-table-cell {
  cursor: default;
}

.fl-table-cell.fl-table-checkbox {
  flex: 0 0 50px;
  justify-content: center;
}

.fl-table-header-checkbox {
  user-select: none;
}

.fl-table-select-all-checkbox {
  font-size: 16px;
  color: #6c757d;
  transition: color 0.2s ease;
}

.fl-table-select-all-checkbox:hover {
  color: #495057;
}

.fl-table-select-all-checkbox.fl-table-header-checkbox-selected {
  color: #007bff;
}

.fl-table-select-all-checkbox.fl-table-header-checkbox-selected:hover {
  color: #0056b3;
}

.fl-table-header-checkbox-partial {
  color: #007bff !important;
}

.fl-table-row-checkbox-partial {
  color: #007bff;
  transition: color 0.2s ease;
}

.fl-table-row-checkbox-partial:hover {
  color: #0056b3;
}

/* Sorting */
.fl-table-sortable {
  cursor: pointer;
  position: relative;
  user-select: none;
}

.fl-table-cell-content {
  flex: 1;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.fl-table-sort-icon {
  display: inline-flex;
  flex-direction: column;
  margin-left: 6px;
  line-height: 1;
  flex-shrink: 0;
}

.fl-table-sort-arrow {
  font-size: 8px;
  line-height: 8px;
  display: block;
}

.fl-table-sort-arrow.fl-table-sort-inactive {
  color: #ccc;
}

.fl-table-sort-arrow.fl-table-sort-active {
  color: #333;
}

.fl-table-sortable:hover .fl-table-sort-arrow.fl-table-sort-inactive {
  color: #999;
}

/* Column Resize */
.fl-table-resize-handle {
  position: absolute;
  right: 0;
  top: 0;
  bottom: 0;
  width: 5px;
  cursor: col-resize;
  z-index: 1;
}

/* Faint borders visible on header row hover */
.fl-table-header .fl-table-row:hover .fl-table-resize-handle {
  background-color: rgba(0, 0, 0, 0.1);
  width: 3px;
}

/* Individual handle hover = stronger hint */
.fl-table-resize-handle:hover {
  background-color: #007bff !important;
}

/* Active handle during drag */
.fl-table-resize-handle.fl-table-resize-active {
  background-color: #007bff !important;
}

.fl-table-resizing {
  cursor: col-resize;
  user-select: none;
}


/* Pagination */
.fl-table-pagination {
  padding: 10px;
  text-align: center;
  border-top: 1px solid #e4e9eb;
}

.fl-table-pagination button {
  background-color: #fff;
  border: 1px solid #ccc;
  padding: 5px 10px;
  margin: 0 5px;
  cursor: pointer;
  border-radius: 3px;
}

.fl-table-pagination button:disabled {
  cursor: not-allowed;
  opacity: 0.5;
}

.fl-table-pagination button:hover:not(:disabled) {
  background-color: #f2f6f7;
}

/* Expandable Rows */
.fl-table-expand-trigger {
  cursor: pointer !important;
  user-select: none;
}

.fl-table-expand-trigger:hover {
  background-color: rgba(0, 0, 0, 0.1);
}

.fl-table-row-expanded {
  border-bottom: 1px solid #e4e9eb;
  background-color: #f9f9f9;
  padding: 15px;
  animation: expandRow 0.2s ease-out;
}

.fl-table-row-expanded:last-child {
  border-bottom: none;
}

@keyframes expandRow {
  from {
    opacity: 0;
    max-height: 0;
    padding-top: 0;
    padding-bottom: 0;
  }
  to {
    opacity: 1;
    max-height: 200px;
    padding-top: 15px;
    padding-bottom: 15px;
  }
}
