/* Modern Selection Table Container */
.modern-selection-table {
  width: 100%;
}

/* .selection_table td {
    padding: 0 8px;
} */

.selection_table tr td:nth-child(1),
.selection_table thead th:nth-child(1) {
  width: 10%;
  padding-right: 30px;
  text-align: center;
}

.selection_table tr td:nth-child(2),
.selection_table thead th:nth-child(2) {
  width: 67%;
}

.selection_table tr td:nth-child(3),
.selection_table thead th:nth-child(3) {
  width: 10%;
  text-align: center;
}

.selection_table tr td:nth-child(4),
.selection_table thead th:nth-child(4) {
  width: 10%;
  text-align: center;
}

.selection-handle {
  padding: 0 !important;
}

.selection-handle {
  display: block;
  height: 20px;
  margin: 5px 0;
  padding: 5px 10px;
  color: #333;
  text-decoration: none;
  font-weight: 400;
  border: 1px solid #ccc;
  background: #fafafa;
  -webkit-border-radius: 3px;
  border-radius: 3px;
  box-sizing: border-box;
  -moz-box-sizing: border-box;
}

.selection-handle {
  height: auto !important;
}

.selection-list {
  display: block;
  position: relative;
  margin: 0;
  padding: 0;
  list-style: none;
}

.selection-list {
  list-style-type: none;
}

/* Remove any counter pseudo-elements */
.selection-list li::before {
  display: none !important;
  content: none !important;
}

.selection-item {
  display: block;
  position: relative;
  margin: 0;
  padding: 0;
  min-height: 50px;
  font-size: 13px;
  line-height: 20px;
}

.selection-list {
  display: block;
  position: relative;
  margin: 0;
  padding: 0;
  list-style: none;
}

.selection-list .selection-list {
  padding-left: 30px;
}

.selection-collapsed .selection-list {
  display: none;
}

.selection-item,
.selection-empty,
.selection-placeholder {
  display: block;
  position: relative;
  margin: 0;
  padding: 0;
  min-height: 20px;
  font-size: 13px;
  line-height: 20px;
}

.selection-handle {
  display: block;
  height: 30px;
  margin: 5px 0;
  padding: 5px 10px;
  color: #333;
  text-decoration: none;
  font-weight: 400;
  border: 1px solid #ccc;
  background: #fafafa;
  -webkit-border-radius: 3px;
  border-radius: 3px;
  box-sizing: border-box;
  -moz-box-sizing: border-box;
}

.selection-handle:hover {
  color: #2ea8e5;
  background: #fff;
}

.selection-item > button {
  display: block;
  position: relative;
  cursor: pointer;
  float: left;
  width: 25px;
  height: 20px;
  margin: 7px 0;
  padding: 0;
  text-indent: 100%;
  white-space: nowrap;
  overflow: hidden;
  border: 0;
  background: transparent;
  font-size: 10px;
  line-height: 1;
  text-align: center;
  font-weight: bold;
}

.selection-item > button:before {
  content: "\f067";
  display: block;
  position: absolute;
  width: 100%;
  text-align: center;
  text-indent: 0;
  font-family: "FontAwesome";
}

.selection-item > button[data-action="collapse"]:before {
  content: "\f068";
}

.selection-placeholder,
.selection-empty {
  margin: 5px 0;
  padding: 0;
  min-height: 30px;
  background: #f2fbff;
  border: 1px dashed #b6bcbf;
  box-sizing: border-box;
  -moz-box-sizing: border-box;
}

.selection-empty {
  border: 1px dashed #bbb;
  min-height: 100px;
  background-color: #e5e5e5;
  background-size: 60px 60px;
  background-position:
    0 0,
    30px 30px;
}

.selection-dragel {
  position: absolute;
  pointer-events: none;
  z-index: 9999;
}

.selection-dragel > .selection-item .selection-handle {
  margin-top: 0;
}

.selection-dragel .selection-handle {
  -webkit-box-shadow: 2px 4px 6px 0 rgba(0, 0, 0, 0.1);
  box-shadow: 2px 4px 6px 0 rgba(0, 0, 0, 0.1);
}

.selection-hover > .selection-handle {
  background: #2ea8e5 !important;
}

body.swal2-in:not(.swal2-no-backdrop):not(.swal2-toast-shown) {
  overflow-y: visible !important;
}

/* Modern Selection Table Container */

.modern-selection-table {
  width: 100%;
}

/* System Legend */
.system-legend {
  display: flex;
  gap: 16px;
  margin-bottom: 24px;
  flex-wrap: wrap;
}

.legend-item {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 16px;
  border-radius: 12px;
  font-weight: 600;
  font-size: 14px;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.legend-color {
  width: 20px;
  height: 20px;
  border-radius: 6px;
  flex-shrink: 0;
}

.legend-zankoline {
  background: linear-gradient(
    135deg,
    rgba(180, 210, 230, 0.5) 0%,
    rgba(180, 210, 230, 0.7) 100%
  );
  color: #2d3561;
}

.legend-zankoline .legend-color {
  background: #b4d2e6;
}

.legend-parallel {
  background: linear-gradient(
    135deg,
    rgba(190, 235, 215, 0.5) 0%,
    rgba(190, 235, 215, 0.7) 100%
  );
  color: #2d3561;
}

.legend-parallel .legend-color {
  background: #bee7d7;
}

.legend-evening {
  background: linear-gradient(
    135deg,
    rgba(255, 214, 214, 0.3) 0%,
    rgba(255, 214, 214, 0.5) 100%
  );
  color: #2d3561;
}

.legend-evening .legend-color {
  background: #ffd6d6;
}

/* Loading State */
.loading-container {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 60px 20px;
  text-align: center;
}

.modern-spinner {
  width: 50px;
  height: 50px;
  border: 4px solid rgba(102, 126, 234, 0.2);
  border-top: 4px solid #667eea;
  border-radius: 50%;
  animation: spin 1s linear infinite;
  margin-bottom: 20px;
}

@keyframes spin {
  0% {
    transform: rotate(0deg);
  }
  100% {
    transform: rotate(360deg);
  }
}

.loading-text {
  color: #667eea;
  font-size: 16px;
  font-weight: 600;
}

/* Selection Header */
.selection-header {
  display: grid;
  grid-template-columns: 80px 120px 1fr 150px 120px;
  gap: 12px;
  padding: 16px 20px;
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  border-radius: 16px 16px 0 0;
  color: white;
  font-weight: 700;
  font-size: 14px;
  margin-bottom: 0;
}

.header-cell {
  display: flex;
  align-items: center;
  gap: 8px;
}

.header-cell i {
  font-size: 18px;
  opacity: 0.9;
}

.header-sequence {
  justify-content: center;
}

.header-code {
  justify-content: center;
}

.header-name {
  justify-content: flex-end;
}

.header-total {
  justify-content: center;
}

.header-actions {
  justify-content: center;
}

/* Selection List */
.selection-list {
  display: block;
  position: relative;
  margin: 0;
  padding: 0;
  list-style: none;
}

.selection-item {
  display: block;
  position: relative;
  margin-bottom: 12px;
}

/* Ensure no counter appears on list items */
.selection-list li::before,
.selection-item::before {
  display: none !important;
  content: none !important;
}

.selection-handle {
  display: block;
  background: white;
  border-radius: 16px;
  border: 2px solid rgba(102, 126, 234, 0.1);
  border-left: 4px solid #667eea;
  padding: 0;
  transition: all 0.3s ease;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.08);
  overflow: hidden;
}

.selection-handle:hover {
  border-color: rgba(102, 126, 234, 0.3);
  box-shadow: 0 8px 24px rgba(102, 126, 234, 0.15);
  transform: translateY(-2px);
}

.selection-item.fixed-item .selection-handle {
  border-left-color: #43e97b;
  background: linear-gradient(90deg, rgba(67, 233, 123, 0.05) 0%, white 100%);
}

.selection-content {
  display: grid;
  grid-template-columns: 80px 120px 1fr 150px 120px;
  gap: 12px;
  padding: 20px;
  align-items: center;
}

/* Sequence Badge */
.selection-sequence {
  display: flex;
  justify-content: center;
}

.sequence-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 48px;
  height: 48px;
  border-radius: 12px;
  font-weight: 800;
  font-size: 18px;
  color: white;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
  transition: all 0.3s ease;
}

.sequence-badge:hover {
  transform: scale(1.1) rotate(5deg);
}

.sequence-badge.sequence-first {
  background: linear-gradient(135deg, #f6d365 0%, #fda085 100%);
}

.sequence-badge.sequence-second {
  background: linear-gradient(135deg, #c0c0c0 0%, #808080 100%);
}

.sequence-badge.sequence-third {
  background: linear-gradient(135deg, #cd7f32 0%, #8b4513 100%);
}

.sequence-badge.sequence-other {
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
}

/* Department Code */
.selection-code {
  display: flex;
  justify-content: center;
}

.code-badge {
  font-family: "Courier New", monospace;
  font-weight: 700;
  font-size: 16px;
  color: #667eea;
  background: linear-gradient(
    135deg,
    rgba(102, 126, 234, 0.1) 0%,
    rgba(118, 75, 162, 0.1) 100%
  );
  padding: 8px 14px;
  border-radius: 8px;
  letter-spacing: 1px;
}

/* Department Name */
.selection-name {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-direction: row-reverse;
  justify-content: flex-end;
}

.selection-name i {
  font-size: 20px;
  color: #667eea;
  flex-shrink: 0;
}

.selection-name span {
  font-weight: 600;
  color: #2d3561;
  line-height: 1.5;
}

/* Total Score */
.selection-total {
  display: flex;
  justify-content: center;
}

.total-badge {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 10px 18px;
  background: linear-gradient(135deg, #43e97b 0%, #38f9d7 100%);
  color: white;
  border-radius: 20px;
  font-weight: 700;
  font-size: 16px;
  box-shadow: 0 4px 12px rgba(67, 233, 123, 0.3);
}

.total-badge.direct-badge {
  background: linear-gradient(135deg, #f6d365 0%, #fda085 100%);
  box-shadow: 0 4px 12px rgba(246, 211, 101, 0.3);
}

.total-badge i {
  font-size: 18px;
}

.direct-label {
  font-size: 12px;
  opacity: 0.9;
  font-weight: 600;
}

/* Actions */
.selection-actions {
  display: flex;
  justify-content: center;
  gap: 8px;
}

.btn-action {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
  border: none;
  border-radius: 10px;
  font-size: 16px;
  cursor: pointer;
  transition: all 0.3s ease;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.btn-view {
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  color: white;
}

.btn-view:hover {
  background: linear-gradient(135deg, #764ba2 0%, #667eea 100%);
  transform: scale(1.1);
  box-shadow: 0 4px 12px rgba(102, 126, 234, 0.4);
}

.btn-delete {
  background: linear-gradient(135deg, #fa709a 0%, #fee140 100%);
  color: white;
}

.btn-delete:hover {
  background: linear-gradient(135deg, #fee140 0%, #fa709a 100%);
  transform: scale(1.1);
  box-shadow: 0 4px 12px rgba(250, 112, 154, 0.4);
}

/* Empty State */
.empty-selections {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 60px 20px;
  text-align: center;
  background: white;
  border-radius: 16px;
  border: 2px dashed rgba(102, 126, 234, 0.2);
}

.empty-icon {
  width: 100px;
  height: 100px;
  border-radius: 50%;
  background: linear-gradient(
    135deg,
    rgba(102, 126, 234, 0.1) 0%,
    rgba(118, 75, 162, 0.1) 100%
  );
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 20px;
}

.empty-icon i {
  font-size: 48px;
  color: #667eea;
}

.empty-title {
  font-size: 24px;
  font-weight: 700;
  color: #2d3561;
  margin-bottom: 12px;
}

.empty-text {
  font-size: 16px;
  color: #666;
  margin: 0;
}

/* Sortable Placeholder */
.selection-placeholder {
  margin-bottom: 12px;
  min-height: 80px;
  background: linear-gradient(
    135deg,
    rgba(102, 126, 234, 0.1) 0%,
    rgba(118, 75, 162, 0.1) 100%
  );
  border: 2px dashed #667eea;
  border-radius: 16px;
  box-sizing: border-box;
}

.selection-dragel {
  position: absolute;
  pointer-events: none;
  z-index: 9999;
  opacity: 0.8;
}

.selection-dragel .selection-handle {
  box-shadow: 0 12px 32px rgba(102, 126, 234, 0.4);
  transform: rotate(3deg);
}

/* Responsive Design */
@media (max-width: 992px) {
  .selection-header,
  .selection-content {
    grid-template-columns: 60px 100px 1fr 120px 100px;
    gap: 8px;
    padding: 16px 12px;
  }

  .header-cell,
  .selection-name span {
    font-size: 12px;
  }

  .sequence-badge {
    width: 40px;
    height: 40px;
    font-size: 16px;
  }

  .code-badge {
    font-size: 14px;
    padding: 6px 12px;
  }

  .total-badge {
    padding: 8px 14px;
    font-size: 14px;
  }
}

@media (max-width: 768px) {
  .system-legend {
    flex-direction: column;
    gap: 8px;
  }

  .legend-item {
    padding: 8px 12px;
    font-size: 12px;
  }

  .selection-header {
    display: none;
  }

  .selection-content {
    grid-template-columns: 1fr;
    gap: 12px;
    padding: 16px;
  }

  .selection-sequence,
  .selection-code,
  .selection-name,
  .selection-total,
  .selection-actions {
    justify-content: flex-start;
  }

  .selection-name {
    flex-direction: row-reverse;
  }
}

body.swal2-in:not(.swal2-no-backdrop):not(.swal2-toast-shown) {
  overflow-y: visible !important;
}

.selection-handle {
  cursor: move;
}

.selection-handle:hover {
  cursor: grabbing;
}

.selection-handle:active {
  cursor: grabbing;
}
