/* assets/css/components.css - Component Specific Styles (Light Mode) */

/* Table Scroll and Layout */
.financial-table-wrapper {
  overflow-x: auto;
  max-height: 740px;
  position: relative;
  background: #ffffff;
  border-radius: 0.75rem;
  box-shadow: 0 1px 3px 0 rgba(0, 0, 0, 0.08), 0 1px 2px 0 rgba(0, 0, 0, 0.04);
}

.financial-table {
  width: 100%;
  border-collapse: separate;
  border-spacing: 0;
  font-size: 0.8125rem;
  white-space: nowrap;
}

.financial-table th,
.financial-table td {
  padding: 0.625rem 0.875rem;
  border-bottom: 1px solid #e2e8f0;
  border-right: 1px solid #f1f5f9;
}

.financial-table th {
  background: #f8fafc;
  color: #475569;
  font-weight: 700;
  text-transform: uppercase;
  font-size: 0.72rem;
  letter-spacing: 0.04em;
  position: sticky;
  top: 0;
  z-index: 20;
  user-select: none;
  border-bottom: 2px solid #cbd5e1;
}

.financial-table th.sortable {
  cursor: pointer;
  transition: color 0.15s ease, background-color 0.15s ease;
}

.financial-table th.sortable:hover {
  color: #0f172a;
  background-color: #e2e8f0;
}

.financial-table td {
  font-family: 'JetBrains Mono', monospace;
  font-size: 0.78rem;
  text-align: right;
  color: #1e293b;
}

/* Sticky Columns */
.col-sticky-loai {
  position: sticky;
  left: 0;
  z-index: 10;
  text-align: center !important;
  width: var(--w-col-loai);
  min-width: var(--w-col-loai);
  max-width: var(--w-col-loai);
}

.col-sticky-bank {
  position: sticky;
  left: var(--w-col-loai);
  z-index: 10;
  text-align: center !important;
  font-weight: 700;
  color: #1d4ed8;
  width: var(--w-col-bank);
  min-width: var(--w-col-bank);
  max-width: var(--w-col-bank);
}

.col-sticky-field {
  position: sticky;
  left: calc(var(--w-col-loai) + var(--w-col-bank));
  z-index: 10;
  text-align: left !important;
  font-family: 'Inter', system-ui, sans-serif !important;
  font-weight: 600;
  color: #0f172a;
  width: var(--w-col-field);
  min-width: var(--w-col-field);
  max-width: var(--w-col-field);
  overflow: hidden;
  text-overflow: ellipsis;
}

.col-sticky-formula {
  text-align: left !important;
  font-family: 'JetBrains Mono', monospace !important;
  font-size: 0.72rem;
  color: #64748b;
  width: var(--w-col-formula);
  min-width: var(--w-col-formula);
  max-width: var(--w-col-formula);
}

/* Sticky Column Headers Higher Z-Index */
th.col-sticky-loai,
th.col-sticky-bank,
th.col-sticky-field {
  z-index: 30;
  background: #f1f5f9;
}

/* Row Distinction & Backgrounds (Light Mode) */
.row-fill {
  background-color: #ffffff;
}

.row-fill:nth-child(even) {
  background-color: #f8fafc;
}

.row-tinh {
  background-color: #f0f7ff;
}

.row-tinh:nth-child(even) {
  background-color: #e6f0fc;
}

.financial-table tbody tr:hover {
  background-color: #dbeafe !important;
}

.financial-table tbody tr:hover td.col-sticky-loai,
.financial-table tbody tr:hover td.col-sticky-bank,
.financial-table tbody tr:hover td.col-sticky-field {
  background-color: #dbeafe !important;
}

/* TD sticky backgrounds matched to row */
.row-fill td.col-sticky-loai,
.row-fill td.col-sticky-bank,
.row-fill td.col-sticky-field {
  background-color: #ffffff;
}

.row-fill:nth-child(even) td.col-sticky-loai,
.row-fill:nth-child(even) td.col-sticky-bank,
.row-fill:nth-child(even) td.col-sticky-field {
  background-color: #f8fafc;
}

.row-tinh td.col-sticky-loai,
.row-tinh td.col-sticky-bank,
.row-tinh td.col-sticky-field {
  background-color: #f0f7ff;
}

.row-tinh:nth-child(even) td.col-sticky-loai,
.row-tinh:nth-child(even) td.col-sticky-bank,
.row-tinh:nth-child(even) td.col-sticky-field {
  background-color: #e6f0fc;
}

/* Values Styling */
.val-positive {
  color: #0f172a;
}

.val-negative {
  color: #dc2626;
}

.val-zero {
  color: #94a3b8;
}

.val-empty {
  color: #cbd5e1;
}

/* Editable Cell Highlights */
.cell-editable {
  position: relative;
  cursor: pointer;
  transition: background-color 0.15s ease;
}

.cell-editable:hover {
  background-color: rgba(37, 99, 235, 0.08) !important;
  outline: 1px dashed rgba(37, 99, 235, 0.4);
}

.cell-modified {
  background-color: rgba(245, 158, 11, 0.12) !important;
  color: #b45309 !important;
  font-weight: 600;
  position: relative;
}

.cell-modified::after {
  content: '';
  position: absolute;
  top: 2px;
  right: 2px;
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background-color: #f59e0b;
}

/* Badges */
.badge-loai-fill {
  display: inline-block;
  padding: 0.15rem 0.45rem;
  border-radius: 4px;
  font-size: 0.68rem;
  font-weight: 700;
  background-color: #f1f5f9;
  color: #475569;
  border: 1px solid #cbd5e1;
  text-transform: uppercase;
}

.badge-loai-tinh {
  display: inline-block;
  padding: 0.15rem 0.45rem;
  border-radius: 4px;
  font-size: 0.68rem;
  font-weight: 700;
  background-color: #dbeafe;
  color: #1d4ed8;
  border: 1px solid #93c5fd;
  text-transform: uppercase;
}

/* Formula Link Style */
.formula-link {
  color: #2563eb;
  cursor: pointer;
  text-decoration: underline;
  text-decoration-style: dotted;
  transition: color 0.15s ease;
}

.formula-link:hover {
  color: #1d4ed8;
}

/* Toast Notification (Light Mode) */
#toastNotification {
  position: fixed;
  bottom: 1.5rem;
  right: 1.5rem;
  z-index: 100;
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.75rem 1.25rem;
  border-radius: 0.75rem;
  background-color: #ffffff;
  color: #0f172a;
  border: 1px solid #cbd5e1;
  box-shadow: 0 10px 25px -5px rgba(0, 0, 0, 0.1), 0 8px 10px -6px rgba(0, 0, 0, 0.1);
  font-size: 0.8125rem;
  font-weight: 600;
  transition: opacity 0.3s ease, transform 0.3s ease;
  opacity: 0;
  transform: translateY(1rem);
  pointer-events: none;
}

#toastNotification.show {
  opacity: 1;
  transform: translateY(0);
  pointer-events: auto;
}
