/* ==========================================================================
   Sheet / Table View - Excel-like Inline Fast Editing & Pro Badges
   ========================================================================== */

.table-container {
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  overflow: hidden;
  box-shadow: var(--shadow-sm);
  display: flex;
  flex-direction: column;
  flex: 1;
  min-height: 0;
}

.table-header-title {
  padding: 12px 20px;
  background: rgba(255, 255, 255, 0.02);
  border-bottom: 1px solid var(--border-subtle);
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-shrink: 0;
}

.table-header-title h3 {
  font-size: 14px;
  font-weight: 700;
  color: #fff;
  display: flex;
  align-items: center;
  gap: 8px;
}

.sheet-table-wrapper {
  overflow-x: auto;
  overflow-y: auto;
  flex: 1;
  min-height: 0;
}

.sheet-table {
  width: 100%;
  border-collapse: collapse;
  text-align: left;
  font-size: 12.5px;
  white-space: nowrap;
}

.sheet-table th {
  background-color: #151822;
  color: var(--text-muted);
  font-weight: 700;
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.6px;
  padding: 10px 14px;
  border-bottom: 1px solid var(--border-medium);
  border-right: 1px solid var(--border-subtle);
  position: sticky;
  top: 0;
  z-index: 10;
  user-select: none;
}

.sheet-table td {
  padding: 8px 12px;
  border-bottom: 1px solid var(--border-subtle);
  border-right: 1px solid var(--border-subtle);
  color: var(--text-secondary);
  vertical-align: middle;
  background-color: var(--bg-card);
  transition: background-color var(--anim-fast);
}

.sheet-table tr:hover td {
  background-color: rgba(255, 255, 255, 0.035);
}

/* Alignments */
.col-center { text-align: center; }
.col-right { text-align: right; }
.col-left { text-align: left; }

/* Status Badges */
.status-pill {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 5px;
  padding: 4px 12px;
  border-radius: var(--radius-pill);
  font-size: 11.5px;
  font-weight: 700;
  border: 1px solid transparent;
  white-space: nowrap;
}

select.status-pill {
  cursor: pointer;
  appearance: none;
  -webkit-appearance: none;
  -moz-appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='10' fill='%23cbd5e1' viewBox='0 0 16 16'%3E%3Cpath d='M7.247 11.14 2.451 5.658C1.885 5.013 2.345 4 3.204 4h9.592a1 1 0 0 1 .753 1.659l-4.796 5.48a1 1 0 0 1-1.506 0z'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 8px center;
  padding: 4px 24px 4px 10px;
  width: auto;
  min-width: 148px;
  box-sizing: border-box;
  text-align: left;
}

/* Priority Badges & Subtle Row Tinting */
.priority-pill {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 4px;
  padding: 3px 8px;
  border-radius: var(--radius-pill);
  font-size: 11px;
  font-weight: 700;
  border: 1px solid transparent;
  white-space: nowrap;
}

select.priority-pill {
  cursor: pointer;
  appearance: none;
  -webkit-appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='10' fill='%2394a3b8' viewBox='0 0 16 16'%3E%3Cpath d='M7.247 11.14 2.451 5.658C1.885 5.013 2.345 4 3.204 4h9.592a1 1 0 0 1 .753 1.659l-4.796 5.48a1 1 0 0 1-1.506 0z'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 5px center;
  padding-right: 18px;
}

.priority-pill.priority-cao {
  background: rgba(239, 68, 68, 0.16);
  color: #f87171;
  border-color: rgba(239, 68, 68, 0.4);
}

.priority-pill.priority-vua {
  background: rgba(245, 158, 11, 0.16);
  color: #fbbf24;
  border-color: rgba(245, 158, 11, 0.4);
}

.priority-pill.priority-thap {
  background: rgba(16, 185, 129, 0.16);
  color: #34d399;
  border-color: rgba(16, 185, 129, 0.4);
}

/* Subtle, Elegant Row Backgrounds based on Priority */
tr.row-priority-cao > td {
  background-color: rgba(239, 68, 68, 0.04) !important;
}
tr.row-priority-cao:hover > td {
  background-color: rgba(239, 68, 68, 0.08) !important;
}

tr.row-priority-vua > td {
  background-color: rgba(245, 158, 11, 0.035) !important;
}
tr.row-priority-vua:hover > td {
  background-color: rgba(245, 158, 11, 0.07) !important;
}

tr.row-priority-thap > td {
  background-color: rgba(16, 185, 129, 0.025) !important;
}
tr.row-priority-thap:hover > td {
  background-color: rgba(16, 185, 129, 0.06) !important;
}

tr.row-done > td {
  opacity: 0.82;
  background-color: rgba(52, 211, 153, 0.02) !important;
}

/* ==========================================================================
   CENTERED ACTION BADGES & BUTTONS
   ========================================================================== */

.action-cell-wrap {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 26px;
  width: 100%;
}

.action-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 4px;
  padding: 3px 8px;
  border-radius: var(--radius-pill);
  font-size: 11px;
  font-weight: 700;
  line-height: 1;
  white-space: nowrap;
}

.action-badge.my-task {
  background: rgba(52, 211, 153, 0.15);
  color: #34d399;
  border: 1px solid rgba(52, 211, 153, 0.35);
}

.action-badge.read-only {
  background: rgba(255, 255, 255, 0.05);
  color: var(--text-muted);
  border: 1px solid var(--border-subtle);
  font-weight: 600;
}

.action-btn-del {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 26px;
  height: 26px;
  padding: 0;
  border-radius: var(--radius-xs);
  border: 1px solid rgba(248, 113, 113, 0.3);
  background: rgba(248, 113, 113, 0.08);
  color: #f87171;
  cursor: pointer;
  font-size: 12px;
  transition: all var(--anim-fast);
}

.action-btn-del:hover {
  background: rgba(248, 113, 113, 0.25);
  border-color: rgba(248, 113, 113, 0.6);
  transform: scale(1.1);
}

.status-pill.dang-trien-khai {
  background: rgba(212, 175, 55, 0.12);
  color: #e5be48;
  border-color: rgba(212, 175, 55, 0.35);
}

.status-pill.chua-trien-khai {
  background: rgba(148, 163, 184, 0.12);
  color: #cbd5e1;
  border-color: rgba(148, 163, 184, 0.3);
}

.status-pill.da-xong {
  background: rgba(52, 211, 153, 0.12);
  color: #34d399;
  border-color: rgba(52, 211, 153, 0.35);
}

/* Inline Edit Controls */
.inline-select, .inline-input {
  background: transparent;
  border: 1px solid transparent;
  color: inherit;
  font-family: inherit;
  font-size: 12.5px;
  padding: 4px 8px;
  border-radius: var(--radius-xs);
  outline: none;
  width: 100%;
  transition: all var(--anim-fast);
  cursor: text;
}

.inline-select {
  cursor: pointer;
}

.sheet-table td:hover .inline-input,
.sheet-table td:hover .inline-select {
  background: rgba(255, 255, 255, 0.04);
  border-color: rgba(255, 255, 255, 0.12);
}

.inline-select:focus, .inline-input:focus {
  background: var(--bg-input) !important;
  border-color: var(--accent-gold) !important;
  box-shadow: 0 0 0 1px var(--accent-gold);
  color: #fff;
}

.inline-select option {
  background-color: #171b26;
  color: #fff;
  padding: 6px;
}

/* Custom Date & Number Inputs */
input[type="date"].inline-input::-webkit-calendar-picker-indicator {
  filter: invert(0.8);
  cursor: pointer;
  opacity: 0.6;
}
input[type="date"].inline-input:hover::-webkit-calendar-picker-indicator {
  opacity: 1;
}

/* Hide default browser number spin buttons */
input[type="number"]::-webkit-inner-spin-button,
input[type="number"]::-webkit-outer-spin-button {
  -webkit-appearance: none;
  margin: 0;
}
input[type="number"] {
  -moz-appearance: textfield;
}

/* Transparent Progress Stepper (No Background, Pure Up/Down Triangles) */
.progress-stepper {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  background: transparent;
}

.stepper-value-wrap {
  display: inline-flex;
  align-items: center;
  gap: 1px;
}

.progress-stepper .stepper-input {
  width: 32px;
  background: transparent;
  border: 1px solid transparent;
  color: var(--accent-emerald);
  font-weight: 800;
  font-family: var(--font-mono);
  font-size: 13.5px;
  text-align: right;
  padding: 2px 0;
  outline: none;
  border-radius: var(--radius-xs);
}

.progress-stepper .stepper-input:focus {
  background: var(--bg-input);
  border-color: var(--accent-emerald);
  color: #fff;
}

.progress-stepper .stepper-unit {
  font-size: 12.5px;
  color: var(--accent-emerald);
  font-weight: 800;
  font-family: var(--font-mono);
  opacity: 0.9;
}

.progress-stepper .stepper-arrows {
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 2px;
  user-select: none;
}

.progress-stepper .stepper-arrow-btn {
  background: transparent;
  border: none;
  color: var(--text-dim);
  cursor: pointer;
  padding: 1px 2px;
  margin: 0;
  line-height: 0.8;
  font-size: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all var(--anim-fast);
  opacity: 0.75;
}

.progress-stepper .stepper-arrow-btn:hover {
  color: var(--accent-emerald);
  opacity: 1;
  transform: scale(1.35);
}

/* Progress bar inside table cell */
.cell-progress-bar {
  display: flex;
  align-items: center;
  gap: 8px;
  width: 120px;
}

.progress-track {
  flex: 1;
  height: 6px;
  background-color: rgba(255, 255, 255, 0.08);
  border-radius: var(--radius-pill);
  overflow: hidden;
}

.progress-fill {
  height: 100%;
  background: linear-gradient(90deg, #d4af37, #34d399);
  border-radius: var(--radius-pill);
  transition: width var(--anim-normal);
}

.progress-pct {
  font-size: 11px;
  font-weight: 700;
  color: var(--text-muted);
  width: 32px;
  text-align: right;
}

/* Urgent / Due badges */
.deadline-badge {
  font-size: 11px;
  font-weight: 600;
  padding: 2px 7px;
  border-radius: var(--radius-xs);
  display: inline-block;
}

.deadline-badge.overdue {
  background: var(--accent-danger-subtle);
  color: var(--accent-danger);
  border: 1px solid var(--accent-danger-border);
}

.deadline-badge.due-soon {
  background: rgba(251, 146, 60, 0.15);
  color: #fb923c;
  border: 1px solid rgba(251, 146, 60, 0.35);
}

.deadline-badge.normal {
  color: var(--text-muted);
}
