/**
 * Sale Order Sub-Table V4 - Document Rows
 * Expandable table for document details within SO
 */

/* ==================== Sub-table Row ==================== */
.so-subtable-row {
  display: none;
  background-color: #f8f9fa;
}

.so-subtable-row.expanded {
  display: table-row;
  animation: expandRow 0.3s ease-out;
}

.so-subtable-cell {
  padding: 0 !important;
  border: none !important;
}

/* ==================== Expand Button ==================== */
.so-expand-btn {
  background: linear-gradient(135deg, var(--primary-50) 0%, white 100%);
  border: 2px solid var(--primary-300);
  cursor: pointer;
  padding: 0.25rem;
  color: var(--primary-700);
  transition: all 0.2s ease;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 1.75rem;
  height: 1.75rem;
  border-radius: 0.375rem;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.05);
}

.so-expand-btn:hover {
  background: linear-gradient(135deg, var(--primary-100) 0%, var(--primary-200) 100%);
  border-color: var(--primary-500);
  transform: scale(1.05);
  box-shadow: 0 2px 4px rgba(19, 136, 113, 0.2);
}

.so-expand-icon {
  width: 1rem;
  height: 1rem;
  transition: transform 0.2s;
}

.so-expand-btn.expanded .so-expand-icon {
  transform: rotate(180deg);
}

/* ==================== Sub-table Container ==================== */
.so-subtable-container {
  padding: 1.5rem 2rem;
  background: linear-gradient(135deg, #ffffff 0%, #f8f9fa 100%);
  box-shadow: inset 0 2px 4px rgba(0, 0, 0, 0.05);
}

.so-subtable-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 1rem;
  padding-bottom: 0.75rem;
  border-bottom: 2px solid var(--primary-500);
}

.so-subtable-title {
  font-size: 1rem;
  font-weight: 600;
  color: var(--gray-900);
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.so-subtable-count {
  background: linear-gradient(135deg, var(--secondary-500) 0%, var(--secondary-600) 100%);
  color: white;
  font-size: 0.75rem;
  padding: 0.25rem 0.625rem;
  border-radius: 9999px;
  font-weight: 700;
  box-shadow: 0 2px 4px rgba(52, 211, 153, 0.3);
  min-width: 1.75rem;
  text-align: center;
}

.so-subtable {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.875rem;
  background: white;
  border-radius: 0.5rem;
  overflow: hidden;
  box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
  border: 1px solid var(--gray-200);
}

.so-subtable thead {
  background: linear-gradient(to right, var(--secondary-500), var(--secondary-600));
}

.so-subtable th {
  padding: 0.625rem 0.875rem;
  text-align: left;
  font-size: 0.6875rem;
  font-weight: 600;
  color: white;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  border-right: 1px solid var(--secondary-400);
}

.so-subtable th:last-child {
  border-right: none;
}

.so-subtable tbody tr {
  border-bottom: 1px solid var(--gray-200);
  transition: background-color 0.15s;
}

.so-subtable tbody tr:hover {
  background-color: var(--gray-50);
}

.so-subtable td {
  padding: 0.625rem 0.875rem;
  color: var(--gray-700);
  border-right: 1px solid var(--gray-100);
}

.so-subtable td:last-child {
  border-right: none;
}

@keyframes expandRow {
  from {
    opacity: 0;
  }
  to {
    opacity: 1;
  }
}
