/* ── Reset ── */
* { margin: 0; padding: 0; box-sizing: border-box; }

/* ── Base ── */
body {
  background: #1a1a2e;
  color: #f0e6d3;
  font-family: system-ui, -apple-system, sans-serif;
  min-height: 100vh;
}

/* ── Login ── */
.login-container {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  min-height: 100vh;
  padding: 2rem;
}

.login-container h1 {
  font-size: 1.5rem;
  margin-bottom: 2rem;
  color: #b8a9c9;
}

.login-form {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  width: 100%;
  max-width: 320px;
}

.login-form label {
  font-size: 0.85rem;
  color: #b8a9c9;
}

.login-form input {
  padding: 0.6rem 0.75rem;
  border: 1px solid #2a2a4a;
  border-radius: 6px;
  background: #12121f;
  color: #f0e6d3;
  font-size: 0.95rem;
}

.login-form input:focus {
  outline: none;
  border-color: #b8a9c9;
}

.login-form button {
  margin-top: 0.5rem;
  padding: 0.6rem;
  border: none;
  border-radius: 6px;
  background: #b8a9c9;
  color: #1a1a2e;
  font-weight: 600;
  font-size: 0.95rem;
  cursor: pointer;
}

.login-form button:hover {
  background: #c9bada;
}

.error {
  color: #e57373;
  font-size: 0.85rem;
  text-align: center;
}

/* ── Header ── */
.header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 1rem 1.5rem;
  border-bottom: 1px solid #2a2a4a;
}

.header h1 {
  font-size: 1.2rem;
  color: #b8a9c9;
}

.logout-form button {
  padding: 0.4rem 1rem;
  border: 1px solid #2a2a4a;
  border-radius: 6px;
  background: transparent;
  color: #b8a9c9;
  font-size: 0.8rem;
  cursor: pointer;
}

.logout-form button:hover {
  border-color: #b8a9c9;
}

/* ── Dashboard ── */
.dashboard {
  max-width: 960px;
  margin: 0 auto;
  padding: 1.5rem;
}

/* ── Cards ── */
.cards {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  gap: 1rem;
  margin-bottom: 1.5rem;
}

.card {
  background: #12121f;
  border: 1px solid #2a2a4a;
  border-radius: 8px;
  padding: 1.25rem;
  text-align: center;
}

.card-value {
  display: block;
  font-size: 2rem;
  font-weight: 700;
  color: #f0e6d3;
}

.card-label {
  font-size: 0.8rem;
  color: #b8a9c9;
  margin-top: 0.25rem;
}

/* ── Live indicator ── */
.live-dot {
  display: inline-block;
  width: 8px;
  height: 8px;
  background: #4caf50;
  border-radius: 50%;
  margin-left: 6px;
  vertical-align: middle;
  animation: pulse-dot 1.5s ease-in-out infinite;
}

@keyframes pulse-dot {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.3; }
}

.card-live {
  border-color: #3a3a5a;
}

.card-live .card-value {
  color: #b8a9c9;
}

/* ── Live chart ── */
.live-chart-container {
  background: #12121f;
  border: 1px solid #2a2a4a;
  border-radius: 8px;
  padding: 0.5rem;
  overflow: hidden;
}

.live-chart-container canvas {
  display: block;
  width: 100%;
}

/* ── Controls ── */
.controls {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  flex-wrap: wrap;
  margin-bottom: 1.5rem;
}

.controls label {
  font-size: 0.85rem;
  color: #b8a9c9;
}

.controls select,
.controls input[type="text"] {
  padding: 0.4rem 0.6rem;
  border: 1px solid #2a2a4a;
  border-radius: 6px;
  background: #12121f;
  color: #f0e6d3;
  font-size: 0.85rem;
}

.controls select:focus,
.controls input:focus {
  outline: none;
  border-color: #b8a9c9;
}

.controls button {
  padding: 0.4rem 1rem;
  border: none;
  border-radius: 6px;
  background: #b8a9c9;
  color: #1a1a2e;
  font-weight: 600;
  font-size: 0.85rem;
  cursor: pointer;
}

.controls button:hover {
  background: #c9bada;
}

/* ── Bar chart ── */
.chart-section {
  margin-bottom: 1.5rem;
}

.chart-section h2 {
  font-size: 1rem;
  color: #b8a9c9;
  margin-bottom: 0.75rem;
}

.bar-chart {
  display: flex;
  align-items: flex-end;
  gap: 2px;
  height: 140px;
  background: #12121f;
  border: 1px solid #2a2a4a;
  border-radius: 8px;
  padding: 0.75rem;
}

.bar {
  flex: 1;
  min-width: 4px;
  background: #b8a9c9;
  border-radius: 2px 2px 0 0;
  position: relative;
  transition: background 0.2s;
}

.bar:hover {
  background: #c9bada;
}

.bar[title]::after {
  content: attr(title);
  position: absolute;
  bottom: 100%;
  left: 50%;
  transform: translateX(-50%);
  background: #2a2a4a;
  color: #f0e6d3;
  font-size: 0.65rem;
  padding: 2px 6px;
  border-radius: 4px;
  white-space: nowrap;
  display: none;
}

.bar:hover::after {
  display: block;
}

/* ── Table ── */
.table-section h2 {
  font-size: 1rem;
  color: #b8a9c9;
  margin-bottom: 0.75rem;
}

.events-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.85rem;
  background: #12121f;
  border: 1px solid #2a2a4a;
  border-radius: 8px;
  overflow: hidden;
}

.events-table th,
.events-table td {
  padding: 0.5rem 0.75rem;
  text-align: left;
  border-bottom: 1px solid #2a2a4a;
}

.events-table th {
  background: #0f0f1a;
  color: #b8a9c9;
  font-weight: 600;
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.events-table td {
  color: #f0e6d3;
}

.events-table td:last-child {
  font-family: 'Courier New', monospace;
  font-size: 0.75rem;
  color: #8a8a9a;
  max-width: 300px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.events-table tbody tr:hover {
  background: #1e1e35;
}

/* ── Pagination ── */
.pagination {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 1rem;
  margin-top: 1rem;
}

.pagination button {
  padding: 0.35rem 0.75rem;
  border: 1px solid #2a2a4a;
  border-radius: 6px;
  background: transparent;
  color: #b8a9c9;
  font-size: 0.8rem;
  cursor: pointer;
}

.pagination button:hover:not(:disabled) {
  border-color: #b8a9c9;
}

.pagination button:disabled {
  opacity: 0.3;
  cursor: default;
}

#page-info {
  font-size: 0.8rem;
  color: #8a8a9a;
}

/* ── Empty state ── */
.empty {
  text-align: center;
  color: #8a8a9a;
  padding: 2rem;
  font-size: 0.9rem;
}
