/**
 * Тонкие настройки таблицы заказов (inline edit, column reorder, resize)
 * Файл: public/css/orders-table.css
 */

.editable-cell {
  position: relative;
  cursor: pointer;
}

.editable-cell:hover {
  background: rgba(79, 142, 247, 0.05);
}

.editable-cell::after {
  content: "✎";
  position: absolute;
  right: 4px;
  top: 50%;
  transform: translateY(-50%);
  font-size: 11px;
  color: var(--text-muted);
  opacity: 0;
  transition: opacity var(--t-fast);
  pointer-events: none;
}

.editable-cell:hover::after {
  opacity: 1;
}

td.col-comment.editing {
  overflow: visible !important;
  max-width: none !important;
  padding: 0 !important;
  z-index: 10;
}

td.col-comment.editing .inline-edit-form {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  min-width: 180px;
  background: var(--bg-panel);
  border: 1px solid var(--brand);
  border-radius: var(--r-sm);
  box-shadow: var(--shadow-lg);
  padding: 4px;
  z-index: 100;
}

td.col-delivery-addr.editing {
  overflow: visible !important;
  max-width: none !important;
  padding: 0 !important;
  z-index: 10;
}

td.col-delivery-addr.editing .inline-edit-form {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  min-width: 220px;
  background: var(--bg-panel);
  border: 1px solid var(--brand);
  border-radius: var(--r-sm);
  box-shadow: var(--shadow-lg);
  padding: 6px;
  z-index: 100;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

td.col-delivery-cost.editing {
  overflow: visible !important;
  max-width: none !important;
  padding: 0 !important;
  z-index: 10;
}

td.col-delivery-cost.editing .inline-edit-input {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: var(--bg-panel);
  border: 1px solid var(--brand);
  padding: 0 4px;
  text-align: right;
  font-size: 12px;
  box-sizing: border-box;
}

.resize-handle {
  position: absolute;
  top: 0;
  right: 0;
  width: 4px;
  height: 100%;
  cursor: col-resize;
  z-index: 5;
  background: transparent;
  transition: background-color var(--t-fast);
}

.resize-handle:hover {
  background-color: var(--brand);
}

.orders-table thead th:hover .th-drag-handle {
  opacity: 0.6;
}

.th-drag-handle {
  position: absolute;
  top: 2px;
  left: 50%;
  transform: translateX(-50%);
  font-size: 10px;
  color: var(--text-muted);
  cursor: grab;
  opacity: 0;
  transition: opacity var(--t-fast);
  user-select: none;
  z-index: 12;
}

.th-drag-handle:active {
  cursor: grabbing;
}

.orders-table thead th.drag-over {
  border-left: 2px dashed var(--brand);
}

.orders-table thead th.dragging {
  opacity: 0.4;
}

/* ── Column Settings Dropdown ───────────────────────────────────── */
.column-settings-container {
  position: relative;
  display: inline-block;
}

.column-settings-dropdown {
  position: absolute;
  top: calc(100% + 6px);
  right: 0;
  background: var(--bg-panel);
  border: 1px solid var(--border);
  border-radius: var(--r-md);
  box-shadow: var(--shadow-lg);
  width: 280px;
  display: none;
  flex-direction: column;
  z-index: 1000;
  animation: modalIn var(--t-fast) ease;
}

.column-settings-dropdown.open {
  display: flex;
}

.column-settings-header {
  padding: 12px 16px;
  border-bottom: 1px solid var(--border);
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.column-settings-header h3 {
  margin: 0;
  font-size: 14px;
  font-weight: 600;
  color: var(--text-primary);
}

.column-settings-list {
  max-height: 320px;
  overflow-y: auto;
  padding: 8px 0;
}

.column-settings-item {
  padding: 6px 16px;
  display: flex;
  align-items: center;
  gap: 10px;
  cursor: default;
  user-select: none;
  transition: background var(--t-fast);
}

.column-settings-item:hover {
  background: var(--bg-hover);
}

.column-settings-item.dragging {
  opacity: 0.4;
  background: var(--bg-hover);
}

.column-settings-item-drag-handle {
  cursor: grab;
  color: var(--text-muted);
  font-size: 12px;
}

.column-settings-item-drag-handle:active {
  cursor: grabbing;
}

.column-settings-item input[type="checkbox"] {
  cursor: pointer;
}

.column-settings-item span {
  font-size: 12px;
  color: var(--text-primary);
  flex: 1;
}

.column-settings-item-actions {
  display: flex;
  gap: 4px;
  opacity: 0;
  transition: opacity var(--t-fast);
}

.column-settings-item:hover .column-settings-item-actions {
  opacity: 1;
}

.column-settings-item-btn {
  border: none;
  background: transparent;
  padding: 2px 4px;
  cursor: pointer;
  font-size: 10px;
  color: var(--text-muted);
  border-radius: var(--r-xs);
}

.column-settings-item-btn:hover {
  background: var(--border);
  color: var(--text-primary);
}

.column-settings-footer {
  padding: 12px 16px;
  border-top: 1px solid var(--border);
  display: flex;
  justify-content: flex-end;
  gap: 8px;
}
