/* ─── สไตล์ชีทเฉพาะหน้าค้นหาบริษัทนิติบุคคล: companies.css ─── */

.cs-page {
  max-width: 1200px;
  margin: 0 auto;
  padding: 2.5rem 1.5rem 4rem;
  min-height: 80vh;
  box-sizing: border-box;
}

/* Header */
.cs-header {
  text-align: center;
  margin-bottom: 2rem;
}

.cs-header h1 {
  font-size: 2rem;
  font-weight: 700;
  color: #111;
  margin: 0 0 0.5rem;
}

.cs-header p {
  color: #666;
  font-size: 1rem;
  margin: 0;
}

/* Search Box */
.cs-search-box {
  background: #fff;
  border: 1px solid #e5e7eb;
  padding: 1.5rem;
  box-shadow: 0 2px 12px rgba(0,0,0,.06);
  margin-bottom: 2rem;
}

.cs-search-row {
  display: flex;
  gap: 0.75rem;
  flex-wrap: wrap;
  align-items: center;
}

.cs-input-wrap {
  position: relative;
  flex: 1;
  min-width: 240px;
}

.cs-input-wrap .cs-icon {
  position: absolute;
  left: 0.75rem;
  top: 50%;
  transform: translateY(-50%);
  color: #9ca3af;
  font-size: 1.2rem;
}

.cs-input-wrap input {
  width: 100%;
  padding: 0.75rem 2.5rem 0.75rem 2.5rem;
  border: 1px solid #d1d5db;
  font-size: 0.95rem;
  outline: none;
  font-family: inherit;
  box-sizing: border-box;
}

.cs-input-wrap input:focus {
  border-color: #111;
}

.cs-input-wrap .cs-clear {
  position: absolute;
  right: 0.5rem;
  top: 50%;
  transform: translateY(-50%);
  background: none;
  border: none;
  cursor: pointer;
  color: #9ca3af;
  display: flex;
  align-items: center;
  padding: 0;
}

.cs-input-wrap .cs-clear .material-icons {
  font-size: 1.1rem;
}

.cs-input-wrap .cs-clear:hover {
  color: #111;
}

.cs-search-row select {
  padding: 0.75rem 1rem;
  border: 1px solid #d1d5db;
  font-size: 0.95rem;
  font-family: inherit;
  outline: none;
  background: #ffffff !important;
  color: #000000 !important;
  min-width: 180px;
  cursor: pointer;
  height: 44px;
  border-radius: 6px;
}

.cs-search-row select option {
  background: #ffffff !important;
  color: #000000 !important;
  padding: 8px;
}

.btn-search {
  padding: 0.75rem 1.75rem;
  background: #111;
  color: #fff;
  border: none;
  font-size: 0.95rem;
  font-weight: 600;
  cursor: pointer;
  font-family: inherit;
  transition: background 0.2s;
  height: 44px;
  border-radius: 6px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.btn-search:hover {
  background: #333;
}

.btn-clear {
  padding: 0.75rem 1.25rem;
  background: none;
  color: #6b7280;
  border: 1px solid #d1d5db;
  font-size: 0.95rem;
  cursor: pointer;
  font-family: inherit;
  height: 42px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.btn-clear:hover {
  background: #f9fafb;
}

/* Loading */
.cs-loading {
  text-align: center;
  padding: 4rem;
  color: #9ca3af;
}

.cs-loading .spin {
  animation: spin 1s linear infinite;
  font-size: 2rem;
  display: inline-block;
}

.cs-loading p {
  margin: 0.5rem 0 0;
}

@keyframes spin { to { transform: rotate(360deg); } }

/* Summary */
.cs-summary {
  margin-bottom: 1rem;
  color: #6b7280;
  font-size: 0.9rem;
}

.cs-summary strong {
  color: #111;
}

/* Table */
.cs-table-wrap {
  overflow-x: auto;
  border: 1px solid #e5e7eb;
  box-shadow: 0 1px 4px rgba(0,0,0,.05);
  background-color: #fff;
}

.cs-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.88rem;
}

.cs-table thead {
  background: #f9fafb;
}

.cs-table thead th {
  padding: 0.85rem 1rem;
  text-align: left;
  font-weight: 600;
  color: #374151;
  border-bottom: 1px solid #e5e7eb;
  white-space: nowrap;
}

.cs-table tbody tr {
  border-bottom: 1px solid #f3f4f6;
  transition: background 0.15s;
}

.cs-table tbody tr:hover {
  background: #f9fafb;
}

.cs-table tbody tr:last-child {
  border-bottom: none;
}

.cs-table td {
  padding: 0.8rem 1rem;
  color: #374151;
  vertical-align: middle;
}

.cs-table .td-num {
  color: #9ca3af;
  width: 50px;
}

.cs-table .td-reg {
  font-family: monospace;
  font-size: 0.82rem;
  white-space: nowrap;
}

.cs-table .td-name {
  font-weight: 500;
  color: #111;
  min-width: 200px;
  position: relative;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.cs-table .td-date {
  white-space: nowrap;
}

.cs-table .td-capital {
  text-align: right;
  white-space: nowrap;
}

.cs-table .td-province {
  white-space: nowrap;
}

.cs-table .td-arrow {
  font-size: 1rem;
  color: #d1d5db;
  vertical-align: middle;
  margin-left: 0.25rem;
  transition: color 0.15s, transform 0.15s;
}

.clickable-row {
  cursor: pointer;
}

.clickable-row:hover {
  background: #f0f9ff !important;
}

.clickable-row:hover .td-name {
  color: #15519d;
}

.clickable-row:hover .td-arrow {
  color: #15519d;
  transform: translateX(3px);
}

/* Pagination */
.cs-pagination {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  margin-top: 1.5rem;
  flex-wrap: wrap;
}

.cs-pagination a,
.cs-pagination button {
  min-width: 36px;
  height: 36px;
  padding: 0 0.5rem;
  border: 1px solid #d1d5db;
  background: #fff;
  font-size: 0.88rem;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: inherit;
  transition: all 0.15s;
  text-decoration: none;
  color: #111;
  box-sizing: border-box;
}

.cs-pagination a:hover:not(.disabled),
.cs-pagination button:hover:not(:disabled) {
  border-color: #111;
  background: #f9fafb;
}

.cs-pagination .disabled {
  opacity: 0.4;
  cursor: not-allowed;
  pointer-events: none;
}

.cs-pagination a.active,
.cs-pagination button.active {
  background: #111;
  color: #fff;
  border-color: #111;
  font-weight: 600;
}

.cs-pagination a .material-icons,
.cs-pagination button .material-icons {
  font-size: 1.1rem;
}

.cs-pagination .page-info {
  margin-left: 0.5rem;
  color: #9ca3af;
  font-size: 0.85rem;
}

/* Empty */
.cs-empty {
  text-align: center;
  padding: 5rem 1rem;
  color: #d1d5db;
}

.cs-empty .material-icons {
  font-size: 4rem;
  display: block;
  margin-bottom: 1rem;
}

.cs-empty p {
  color: #9ca3af;
  font-size: 1rem;
  margin: 0;
}

/* Responsive */
@media (max-width: 600px) {
  .cs-page {
    padding-top: 6rem;
  }
  .cs-search-row {
    flex-direction: column;
  }
  .cs-input-wrap {
    min-width: unset;
    width: 100%;
  }
  .cs-search-row select,
  .btn-search,
  .btn-clear {
    width: 100%;
  }
  .cs-table {
    font-size: 0.8rem;
  }
  .cs-table td,
  .cs-table th {
    padding: 0.6rem;
  }
}
