/* Game Tables Manager – Minimal, Modern UI */

:root {
  --gtm-bg: #ffffff;
  --gtm-card: #ffffff;
  --gtm-text: #111827;
  --gtm-muted: #6b7280;
  --gtm-border: #e5e7eb;
  --gtm-header-bg: #f9fafb;
  --gtm-hover: #f5f7fb;
  --gtm-primary: #2563eb;

  --gtm-pill-bg: #f1f5f9;
  --gtm-pill-bg-hover: #e2e8f0;
  --gtm-pill-text: #0f172a;

  --gtm-radius: 12px;
  --gtm-radius-sm: 8px;
  --gtm-shadow: 0 1px 2px rgba(0,0,0,.06), 0 6px 24px rgba(0,0,0,.06);

  --gtm-cell-pad-y: 10px;
  --gtm-cell-pad-x: 12px;
}

@media (prefers-color-scheme: dark) {
  :root {
    --gtm-bg: #0b1220;
    --gtm-card: #0f172a;
    --gtm-text: #e5e7eb;
    --gtm-muted: #94a3b8;
    --gtm-border: #1f2937;
    --gtm-header-bg: #111827;
    --gtm-hover: rgba(255,255,255,0.03);

    --gtm-pill-bg: #111827;
    --gtm-pill-bg-hover: #0b1220;
    --gtm-pill-text: #e5e7eb;

    --gtm-shadow: 0 1px 2px rgba(0,0,0,.5), 0 10px 32px rgba(0,0,0,.35);
  }
}

/* Standalone route page */
body.gtm-view {
  margin: 24px;
  background: var(--gtm-bg);
  color: var(--gtm-text);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  font: 16px/1.6 ui-sans-serif, system-ui, -apple-system, Segoe UI, Roboto, Inter, Helvetica, Arial, "Apple Color Emoji", "Segoe UI Emoji";
}

/* Notices */
.gtm-notice {
  background: var(--gtm-card);
  border: 1px solid var(--gtm-border);
  border-radius: var(--gtm-radius);
  padding: 12px 14px;
  color: var(--gtm-muted);
}

/* Generic Table (gtm-table) */
.gtm-table-container {
  background: var(--gtm-card);
  border: 1px solid var(--gtm-border);
  border-radius: var(--gtm-radius);
  box-shadow: var(--gtm-shadow);
  padding: 8px 0 0;
  margin: 20px 0;
  color: var(--gtm-text);
  overflow: hidden;
}

.gtm-table-header {
  padding: 12px 16px 10px;
  border-bottom: 1px solid var(--gtm-border);
}

.gtm-table-header h3 {
  margin: 0;
  font-size: 1.05rem;
  font-weight: 600;
  letter-spacing: 0.2px;
  color: var(--gtm-text);
}

.gtm-table-responsive {
  width: 100%;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  position: relative;
}

.gtm-table {
  width: 100%;
  border-collapse: separate;
  border-spacing: 0;
  font-size: 0.95rem;
}

.gtm-table th,
.gtm-table td {
  padding: var(--gtm-cell-pad-y) var(--gtm-cell-pad-x);
  vertical-align: middle;
  border-bottom: 1px solid var(--gtm-border);
  color: var(--gtm-text);
  white-space: normal;
}

.gtm-table thead th {
  position: sticky;
  top: 0;
  z-index: 2;
  background: var(--gtm-header-bg);
  text-align: left;
  font-weight: 600;
}

.gtm-table tbody tr:hover {
  background: var(--gtm-hover);
}

.gtm-table tbody tr:last-child td {
  border-bottom: 0;
}

.gtm-table td a {
  color: var(--gtm-primary);
  text-decoration: none;
}

.gtm-table td a:hover {
  text-decoration: underline;
}

/* Year Grid (gtm-year-grid) */
.gtm-year-grid-wrapper {
  background: var(--gtm-card);
  border: 1px solid var(--gtm-border);
  border-radius: var(--gtm-radius);
  box-shadow: var(--gtm-shadow);
  padding: 5px;
  margin: 20px 0;
  overflow: auto;
}

.gtm-year-grid {
  width: 100%;
  border-collapse: separate;
  border-spacing: 0;
  font-size: 0.95rem;
  table-layout: fixed;
}

.gtm-year-grid th,
.gtm-year-grid td {
  padding: 10px 8px;
  border-bottom: 1px solid var(--gtm-border);
  text-align: center;
  vertical-align: middle;
  width: 120px;
}

.gtm-year-grid thead th {
  background: var(--gtm-header-bg);
  font-weight: 600;
  white-space: nowrap;
}

.gtm-year-grid tbody tr:hover {
  background: var(--gtm-hover);
}

.gtm-year-grid .gtm-year-col {
  width: 84px;
  text-align: left;
  color: var(--gtm-muted);
  font-weight: 600;
}

.gtm-year-link {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 56px;
  padding: 6px 10px;
  border-radius: 999px;
  background: var(--gtm-pill-bg);
  color: var(--gtm-pill-text);
  text-decoration: none;
  border: 1px solid var(--gtm-border);
  transition: background .2s ease, transform .06s ease, box-shadow .2s ease, border-color .2s ease;
  box-shadow: 0 1px 0 rgba(0,0,0,.04);
  font-weight: 600;
}

.gtm-year-link:hover {
  background: var(--gtm-pill-bg-hover);
  transform: translateY(-1px);
  border-color: var(--gtm-border);
  /* If supported, a subtle tint on hover */
  border-color: color-mix(in srgb, var(--gtm-border), var(--gtm-primary) 30%);
}

.gtm-year-link:active {
  transform: translateY(0);
}

.gtm-year-link:focus {
  outline: none;
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--gtm-primary) 25%, transparent);
}

.gtm-missing {
  color: var(--gtm-muted);
}

/* Rounded corners for table headers */
.gtm-table thead th:first-child,
.gtm-year-grid thead th:first-child {
  border-top-left-radius: var(--gtm-radius-sm);
}
.gtm-table thead th:last-child,
.gtm-year-grid thead th:last-child {
  border-top-right-radius: var(--gtm-radius-sm);
}

/* Compact on small screens */
@media (max-width: 640px) {
  .gtm-table th, .gtm-table td,
  .gtm-year-grid th, .gtm-year-grid td {
    padding: 8px 10px;
    font-size: 0.9rem;
    
  }
  .gtm-year-grid .gtm-year-col {
    width: 72px;
  }
  .gtm-year-link {
    min-width: 48px;
    padding: 5px 8px;
  }
}

/* Reduced motion */
@media (prefers-reduced-motion: reduce) {
  .gtm-year-link {
    transition: none;
  }
}

/* Print-friendly */
@media print {
  .gtm-year-grid-wrapper,
  .gtm-table-container {
    box-shadow: none !important;
    border: 1px solid #999 !important;
  }
  .gtm-year-link {
    color: #000 !important;
    background: transparent !important;
    border: 0 !important;
    padding: 0 !important;
    min-width: 0;
  }
}

/* Year grid states */
.gtm-year-grid .gtm-year-link { color: #2aa4ff; font-weight: 700; text-decoration: none; }
.gtm-year-grid .gtm-year-link:hover { text-decoration: underline; }
.gtm-year-grid .gtm-na-year { color: #a6afbd; opacity: .8; font-weight: 700; }
.gtm-year-grid th.gtm-year-col { font-weight: 800; }