/* Page base */
:root {
  --bg: #0e0e0f;
  --bg-2: #0f0f10;
  --text: #c8c4bc;
  --muted: #888780;
  --accent: #c4882a;
  --accent-hover: #d4952e;
  --card: #141415;
  --border: #1e1e1e;
  --success: #1f9d55;
  --error: #d64545;
  --warning: #f59e0b;
}

* { box-sizing: border-box; }

html, body { 
  height: 100%; 
  margin: 0;
}

body {
  background: var(--bg);
  color: var(--text);
  font-family: system-ui, -apple-system, Segoe UI, Roboto, Ubuntu, Cantarell, 'Helvetica Neue', Arial, 'Noto Sans', sans-serif;
  line-height: 1.5;
}

.container {
  max-width: 1400px;
  margin: 0 auto;
  padding: 24px 16px 64px;
}

/* Header */
.header {
  margin-bottom: 24px;
}

.header h1 {
  margin: 0 0 6px 0;
  font-weight: 700;
  font-size: 2rem;
  letter-spacing: 0.2px;
}

.subtitle {
  margin: 0;
  color: var(--muted);
  font-size: 0.95rem;
}

/* Card */
.card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 20px;
  margin: 16px 0;
}

/* Status messages */
.status {
  padding: 12px 16px;
  border-radius: 8px;
  margin: 16px 0;
  font-size: 0.95rem;
}

.status.success {
  background: rgba(31, 157, 85, 0.1);
  color: var(--success);
  border: 1px solid rgba(31, 157, 85, 0.3);
}

.status.error {
  background: rgba(214, 69, 69, 0.1);
  color: var(--error);
  border: 1px solid rgba(214, 69, 69, 0.3);
}

.hidden { display: none !important; }

/* Filters */
.filters {
  margin-bottom: 20px;
}

.filter-title {
  margin: 0 0 16px 0;
  font-size: 1.25rem;
  font-weight: 600;
}

.filter-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 16px;
  margin-bottom: 16px;
}

.filter-group {
  display: flex;
  flex-direction: column;
}

.label {
  font-size: 0.875rem;
  font-weight: 500;
  margin-bottom: 6px;
  color: var(--muted);
}

.input, select.input {
  background: var(--bg-2);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 8px 12px;
  color: var(--text);
  font-size: 0.95rem;
  transition: border-color 0.2s;
}

.input:focus, select.input:focus {
  outline: none;
  border-color: var(--accent);
}

.input::placeholder {
  color: var(--muted);
}

.filter-actions {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
}

.btn {
  padding: 10px 20px;
  border-radius: 6px;
  border: none;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s;
  font-size: 0.95rem;
}

.btn-primary {
  background: var(--accent);
  color: #100c04;
}

.btn-primary:hover:not(:disabled) {
  background: var(--accent-hover);
}

.btn-secondary {
  background: var(--bg-2);
  color: var(--text);
  border: 1px solid var(--border);
}

.btn-secondary:hover:not(:disabled) {
  background: var(--border);
}

.btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.record-count {
  color: var(--muted);
  font-size: 0.9rem;
  margin-left: auto;
}

/* Table */
.table-container {
  overflow: hidden;
  padding: 0;
}

.table-wrapper {
  overflow-x: auto;
}

.log-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.9rem;
}

.log-table thead {
  background: var(--bg-2);
  position: sticky;
  top: 0;
  z-index: 10;
}

.log-table th {
  padding: 12px 16px;
  text-align: left;
  font-weight: 600;
  color: var(--muted);
  white-space: nowrap;
  border-bottom: 2px solid var(--border);
}

.log-table th.sortable {
  cursor: pointer;
  user-select: none;
  transition: color 0.2s;
}

.log-table th.sortable:hover {
  color: var(--accent);
}

.sort-indicator {
  display: inline-block;
  margin-left: 6px;
  opacity: 0.3;
}

.log-table th.sort-asc .sort-indicator::after {
  content: '▲';
  opacity: 1;
  color: var(--accent);
}

.log-table th.sort-desc .sort-indicator::after {
  content: '▼';
  opacity: 1;
  color: var(--accent);
}

.log-table tbody tr {
  border-bottom: 1px solid var(--border);
  transition: background-color 0.15s;
}

.log-table tbody tr:hover {
  background: var(--bg-2);
}

.log-table td {
  padding: 12px 16px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 200px;
}

.log-table td.damage {
  color: var(--error);
  font-weight: 600;
}

.log-table td.bullet-yes {
  color: var(--warning);
}

.log-table td.bullet-no {
  color: var(--success);
}

.loading-row td {
  text-align: center;
  padding: 40px;
  color: var(--muted);
  font-style: italic;
}

/* Pagination */
.pagination-controls {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 16px;
  margin-top: 20px;
  flex-wrap: wrap;
}

.page-info {
  color: var(--muted);
  font-size: 0.95rem;
  min-width: 120px;
  text-align: center;
}

.page-size {
  width: auto;
  min-width: 140px;
}

/* Responsive */
@media (max-width: 768px) {
  .header h1 {
    font-size: 1.5rem;
  }

  .filter-grid {
    grid-template-columns: 1fr;
  }

  .log-table {
    font-size: 0.85rem;
  }

  .log-table th, .log-table td {
    padding: 8px 12px;
  }

  .pagination-controls {
    flex-direction: column;
  }
}
