/* =====================================================
   tables.css — Genel tablo stilleri (kayıt listesi)
   ===================================================== */

/* ============================================
   Table
   ============================================ */
.table-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 14px;
  gap: 12px;
}

.table-header input[type="search"] {
  padding: 8px 12px;
  border: 1px solid var(--border-strong);
  border-radius: var(--r-sm);
  font-size: 13px;
  width: 280px;
  background: var(--card);
  font-family: inherit;
  transition: border-color 0.15s, box-shadow 0.15s;
}

.table-header input[type="search"]:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px var(--primary-soft);
}

.table-wrapper {
  overflow-x: auto;
  border-radius: var(--r-sm);
  border: 1px solid var(--border-soft);
}

table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
  table-layout: auto;
}

thead th {
  background: #f3f4f6;
  text-align: left;
  padding: 12px 14px;
  font-weight: 700;
  font-size: 11px;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  color: var(--text-2);
  border-bottom: 2px solid var(--border-strong);
  border-right: 1px solid var(--border);
  white-space: nowrap;
  position: sticky;
  top: 0;
}

thead th:last-child { border-right: none; }

thead th[data-sort],
thead th[data-tr-sort] {
  cursor: pointer;
  user-select: none;
}

thead th[data-sort]:hover,
thead th[data-tr-sort]:hover {
  background: var(--border-soft);
  color: var(--text-2);
}

thead th[data-sort]::after,
thead th[data-tr-sort]::after {
  content: "↕";
  margin-left: 4px;
  opacity: 0.35;
  font-size: 10px;
}

thead th.sort-asc::after { content: "▲"; opacity: 1; color: var(--primary); }
thead th.sort-desc::after { content: "▼"; opacity: 1; color: var(--primary); }

tbody td {
  padding: 12px 14px;
  border-bottom: 1px solid var(--border);
  border-right: 1px solid var(--border);
  vertical-align: middle;
  color: var(--text-2);
  white-space: nowrap;
  background: var(--card);
}

tbody td:last-child { border-right: none; }
tbody tr:last-child td { border-bottom: none; }

tbody tr:nth-child(even) td { background: #fafbfc; }

tbody tr:hover td { background: #eef4fb; }

tbody tr.row-iptal td {
  opacity: 0.55;
  text-decoration: line-through;
  text-decoration-color: rgba(220, 38, 38, 0.4);
  text-decoration-thickness: 1px;
}

tbody tr.row-iptal td:has(.badge),
tbody tr.row-iptal td:last-child {
  text-decoration: none;
}

/* Alış table */
#kayitTablosu tbody td:nth-child(1),
#kayitTablosu tbody td:nth-child(3) {
  white-space: normal;
  word-break: break-word;
  min-width: 140px;
  max-width: 220px;
  line-height: 1.4;
}

#kayitTablosu thead th:nth-child(2),
#kayitTablosu thead th:nth-child(4),
#kayitTablosu thead th:nth-child(5),
#kayitTablosu thead th:nth-child(6),
#kayitTablosu tbody td:nth-child(2),
#kayitTablosu tbody td:nth-child(4),
#kayitTablosu tbody td:nth-child(5),
#kayitTablosu tbody td:nth-child(6) {
  text-align: right;
  font-variant-numeric: tabular-nums;
}

/* Sipariş tablosu (6 kolon: Sipariş No, Tarih, Ürün, Adet, Tutar, Durum) */
#trTablo tbody td:nth-child(3) {
  white-space: normal;
  word-wrap: break-word;
  min-width: 280px;
  max-width: 420px;
  line-height: 1.4;
}
#trTablo thead th:nth-child(4),
#trTablo thead th:nth-child(5),
#trTablo tbody td:nth-child(4),
#trTablo tbody td:nth-child(5) {
  text-align: right;
  font-variant-numeric: tabular-nums;
}
#trTablo thead th:nth-child(6),
#trTablo tbody td:nth-child(6) {
  text-align: center;
}
