/* ==========================================================================
   NBA Stats & cPanel Database Web App — Stylesheet
   ========================================================================== */

:root {
  --primary: #2563eb;
  --primary-hover: #1d4ed8;
  --primary-light: #eff6ff;
  --bg-main: #f8fafc;
  --bg-card: #ffffff;
  --text-main: #0f172a;
  --text-muted: #64748b;
  --border-color: #e2e8f0;
  --accent-green: #22c55e;
  --accent-orange: #ea580c;
  --accent-blue: #38bdf8;
  --radius-sm: 6px;
  --radius-md: 10px;
  --radius-lg: 14px;
  --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.05);
  --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.08), 0 2px 4px -2px rgba(0, 0, 0, 0.05);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  padding: 0;
  background-color: var(--bg-main);
  color: var(--text-main);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

.app-container {
  width: 95%;
  max-width: 1420px;
  margin: 1.5rem auto;
  padding: 0 1.25rem 3rem 1.25rem;
  transition: max-width 0.65s cubic-bezier(0.16, 1, 0.3, 1), width 0.65s cubic-bezier(0.16, 1, 0.3, 1);
  animation: widenIntro 0.85s cubic-bezier(0.16, 1, 0.3, 1) forwards;
}

.app-container.is-compact-width {
  max-width: 1040px;
  width: 88%;
}

.app-container.is-full-width {
  max-width: 98vw;
  width: 98%;
}

@keyframes widenIntro {
  0% {
    max-width: 960px;
    width: 82%;
    opacity: 0.92;
  }
  100% {
    max-width: 1420px;
    width: 95%;
    opacity: 1;
  }
}

/* -------------------------------------------------------------------------
   Header & Personal Greeting
   ------------------------------------------------------------------------- */
.header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 1.25rem;
  margin-bottom: 1.5rem;
  padding-bottom: 1.25rem;
  border-bottom: 2px solid var(--border-color);
}

.title {
  margin: 0;
  font-size: 2rem;
  font-weight: 800;
  display: flex;
  align-items: center;
  gap: 0.6rem;
  color: var(--text-main);
  letter-spacing: -0.02em;
}

.subtitle {
  margin: 0.4rem 0 0 0;
  color: var(--text-muted);
  font-size: 0.95rem;
}

.subtitle code {
  background: #f1f5f9;
  padding: 0.2rem 0.45rem;
  border-radius: var(--radius-sm);
  font-weight: 600;
  color: var(--primary);
  font-size: 0.88rem;
}

.status-badge {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  padding: 0.45rem 0.95rem;
  border-radius: 9999px;
  font-size: 0.88rem;
  font-weight: 600;
  box-shadow: var(--shadow-sm);
  transition: all 0.2s ease;
}

.status-badge.live {
  background-color: #dcfce7;
  color: #166534;
  border: 1px solid #bbf7d0;
}

.status-badge.demo {
  background-color: #fef3c7;
  color: #92400e;
  border: 1px solid #fde68a;
}

/* Calina's Greeting Component (MyComp) */
.my-comp {
  background: linear-gradient(135deg, #eff6ff 0%, #e0f2fe 100%);
  border: 1px solid #bfdbfe;
  border-left: 4px solid var(--primary);
  border-radius: var(--radius-md);
  padding: 0.9rem 1.25rem;
  margin-bottom: 1.5rem;
  box-shadow: var(--shadow-sm);
}

.my-comp p {
  margin: 0;
  color: #1e3a8a;
  font-size: 0.95rem;
}

.my-comp strong {
  font-size: 1.02rem;
  color: #1e40af;
}

/* Banner */
.banner {
  background-color: #f0fdf4;
  border: 1px solid #bbf7d0;
  border-radius: var(--radius-md);
  padding: 0.85rem 1.25rem;
  margin-bottom: 1.5rem;
  font-size: 0.92rem;
  color: #166534;
  line-height: 1.5;
}

.banner code {
  background: #dcfce7;
  padding: 0.15rem 0.4rem;
  border-radius: 4px;
  font-family: monospace;
}

/* -------------------------------------------------------------------------
   Controls & Tabs
   ------------------------------------------------------------------------- */
.controls-bar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 1rem;
  margin-bottom: 1.75rem;
}

.tab-group {
  display: inline-flex;
  gap: 0.35rem;
  background: #e2e8f0;
  padding: 0.3rem;
  border-radius: var(--radius-md);
}

.tab-btn {
  background: transparent;
  border: none;
  padding: 0.55rem 1.1rem;
  border-radius: var(--radius-sm);
  font-size: 0.92rem;
  font-weight: 600;
  color: #475569;
  cursor: pointer;
  transition: all 0.15s ease;
  user-select: none;
}

.tab-btn:hover {
  color: var(--text-main);
}

.tab-btn.active {
  background: #ffffff;
  color: var(--primary);
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
}

.filter-group {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  font-size: 0.9rem;
  font-weight: 600;
  color: #475569;
}

.game-select {
  padding: 0.5rem 0.85rem;
  border-radius: var(--radius-sm);
  border: 1px solid #cbd5e1;
  font-size: 0.9rem;
  background: #ffffff;
  color: var(--text-main);
  outline: none;
  cursor: pointer;
  transition: border-color 0.15s ease;
}

.game-select:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 2px rgba(37, 99, 235, 0.15);
}

.btn-width-toggle {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  background: #ffffff;
  border: 1px solid #cbd5e1;
  color: #334155;
  padding: 0.48rem 0.9rem;
  border-radius: var(--radius-sm);
  font-size: 0.88rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s ease;
  box-shadow: var(--shadow-sm);
  user-select: none;
}

.btn-width-toggle:hover {
  background: #f8fafc;
  border-color: var(--primary);
  color: var(--primary);
  transform: translateY(-1px);
}

.btn-width-toggle:active {
  transform: translateY(0);
}

.btn-width-toggle.spinning #refresh-icon {
  display: inline-block;
  animation: spin 0.6s linear infinite;
}

/* Floating Toast Notification */
.toast-notification {
  position: fixed;
  bottom: 2rem;
  right: 2rem;
  background: #0f172a;
  color: #ffffff;
  padding: 0.9rem 1.4rem;
  border-radius: var(--radius-md);
  box-shadow: 0 10px 20px -3px rgba(0, 0, 0, 0.25);
  font-size: 0.92rem;
  font-weight: 600;
  z-index: 9999;
  opacity: 0;
  transform: translateY(12px);
  transition: all 0.25s cubic-bezier(0.16, 1, 0.3, 1);
  pointer-events: none;
  border: 1px solid #334155;
}

.toast-notification.show {
  opacity: 1;
  transform: translateY(0);
}

/* -------------------------------------------------------------------------
   Game Matchup Cards & Scoreboard
   ------------------------------------------------------------------------- */
.games-container {
  display: flex;
  flex-direction: column;
  gap: 2rem;
}

.game-card {
  background: var(--bg-card);
  border-radius: var(--radius-lg);
  border: 1px solid var(--border-color);
  box-shadow: var(--shadow-md);
  overflow: hidden;
  transition: transform 0.15s ease;
}

.scoreboard-header {
  background: linear-gradient(135deg, #1e293b 0%, #0f172a 100%);
  color: white;
  padding: 1.5rem 1.75rem;
}

.game-meta {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 1.25rem;
  font-size: 0.85rem;
  color: #94a3b8;
  font-weight: 600;
}

.game-badge {
  background: rgba(255, 255, 255, 0.15);
  padding: 0.25rem 0.65rem;
  border-radius: var(--radius-sm);
  font-weight: 700;
  color: #f8fafc;
  letter-spacing: 0.04em;
}

.matchup-banner {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  gap: 1.5rem;
}

.team-box {
  display: flex;
  flex-direction: column;
}

.team-box.away {
  align-items: flex-start;
  text-align: left;
}

.team-box.home {
  align-items: flex-end;
  text-align: right;
}

.team-role {
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  color: #94a3b8;
}

.team-title {
  margin: 0.2rem 0;
  font-size: 1.45rem;
  font-weight: 800;
  color: #f8fafc;
}

.team-score {
  font-size: 2.35rem;
  font-weight: 800;
  color: var(--accent-blue);
  font-variant-numeric: tabular-nums;
  line-height: 1.1;
}

.vs-divider {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.4rem;
}

.vs-pill {
  background: rgba(255, 255, 255, 0.12);
  width: 36px;
  height: 36px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 0.9rem;
  color: #cbd5e1;
}

.final-label {
  font-size: 0.72rem;
  font-weight: 800;
  letter-spacing: 0.12em;
  color: var(--accent-green);
}

.boxscore-section {
  padding: 1.25rem 1.75rem 1.75rem;
}

.section-title {
  margin: 0 0 1rem 0;
  font-size: 1.1rem;
  font-weight: 700;
  color: var(--text-main);
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

/* -------------------------------------------------------------------------
   Sortable Tables & Fixed-Slot Headers (No Column Widening)
   ------------------------------------------------------------------------- */
.card {
  background: var(--bg-card);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-md);
  border: 1px solid var(--border-color);
  overflow: hidden;
}

.card-header {
  padding: 1.5rem 1.75rem 0.75rem;
  border-bottom: 1px solid #f1f5f9;
}

.card-title {
  margin: 0;
  font-size: 1.35rem;
  font-weight: 800;
  color: var(--text-main);
}

.card-subtitle {
  margin: 0.4rem 0 0.5rem;
  font-size: 0.9rem;
  color: var(--text-muted);
}

.table-wrapper {
  overflow-x: auto;
  width: 100%;
}

table {
  width: 100%;
  border-collapse: collapse;
  text-align: left;
  font-size: 0.95rem;
}

th {
  background-color: #f8fafc;
  color: #475569;
  font-weight: 700;
  padding: 0.9rem 1.1rem;
  border-bottom: 1px solid var(--border-color);
  text-transform: uppercase;
  font-size: 0.78rem;
  letter-spacing: 0.05em;
  white-space: nowrap;
}

th.sortable {
  cursor: pointer;
  user-select: none;
  transition: background-color 0.15s ease, color 0.15s ease;
}

th.sortable:hover,
th.sortable:focus-visible {
  background-color: #f1f5f9;
  color: var(--text-main);
  outline: none;
}

.th-content {
  display: inline-flex;
  align-items: center;
  white-space: nowrap;
}

/* Fixed-width sort arrow slot prevents column header expansion on click */
.sort-arrow-slot {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 0.85rem;
  height: 0.85rem;
  margin-left: 0.25rem;
  flex-shrink: 0;
}

.sort-arrow {
  display: inline-block;
  font-size: 0.68rem;
  color: var(--primary);
  line-height: 1;
}

td {
  padding: 0.95rem 1.1rem;
  border-bottom: 1px solid #f1f5f9;
  color: #334155;
}

tr:last-child td {
  border-bottom: none;
}

tr:hover td {
  background-color: #f8fafc;
}

.player-name {
  font-weight: 700;
  color: var(--text-main);
}

.team-pill {
  display: inline-block;
  padding: 0.2rem 0.55rem;
  border-radius: 4px;
  font-size: 0.8rem;
  font-weight: 700;
  background-color: #f1f5f9;
  color: #334155;
}

.points-highlight {
  font-weight: 800;
  color: var(--accent-orange);
}

/* -------------------------------------------------------------------------
   cPanel SQL Database Explorer Tab
   ------------------------------------------------------------------------- */
.sql-dashboard {
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
}

.sql-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 1rem;
}

.sql-info-box {
  background: #ffffff;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 1.1rem;
  box-shadow: var(--shadow-sm);
}

.sql-info-title {
  font-size: 0.78rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-muted);
  margin-bottom: 0.35rem;
}

.sql-info-value {
  font-size: 1.15rem;
  font-weight: 700;
  color: var(--text-main);
  word-break: break-all;
}

.code-card {
  background: #0f172a;
  border-radius: var(--radius-md);
  color: #f8fafc;
  overflow: hidden;
  box-shadow: var(--shadow-md);
}

.code-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0.75rem 1.25rem;
  background: #1e293b;
  border-bottom: 1px solid #334155;
}

.code-title {
  font-size: 0.88rem;
  font-weight: 700;
  color: #cbd5e1;
}

.btn-copy {
  background: var(--primary);
  color: white;
  border: none;
  padding: 0.4rem 0.85rem;
  border-radius: var(--radius-sm);
  cursor: pointer;
  font-size: 0.82rem;
  font-weight: 600;
  transition: background 0.15s ease;
}

.btn-copy:hover {
  background: var(--primary-hover);
}

.code-content {
  margin: 0;
  padding: 1.25rem;
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
  font-size: 0.86rem;
  line-height: 1.6;
  overflow-x: auto;
  max-height: 380px;
  color: #e2e8f0;
}

/* -------------------------------------------------------------------------
   Buttons, States & Footer
   ------------------------------------------------------------------------- */
.btn {
  background: var(--primary);
  color: white;
  border: none;
  padding: 0.55rem 1.2rem;
  border-radius: var(--radius-sm);
  cursor: pointer;
  font-size: 0.92rem;
  font-weight: 600;
  transition: background 0.15s ease;
}

.btn:hover {
  background: var(--primary-hover);
}

.footer {
  margin-top: 3rem;
  text-align: center;
  color: var(--text-muted);
  font-size: 0.88rem;
  border-top: 1px solid var(--border-color);
  padding-top: 1.5rem;
}

.spinner {
  width: 36px;
  height: 36px;
  border: 3px solid #e2e8f0;
  border-top-color: var(--primary);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
  margin: 0 auto;
}

@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

/* Responsive adjustments */
@media (max-width: 680px) {
  .header {
    flex-direction: column;
    align-items: flex-start;
  }
  .matchup-banner {
    grid-template-columns: 1fr;
    text-align: center;
  }
  .team-box.away,
  .team-box.home {
    align-items: center;
    text-align: center;
  }
  .vs-divider {
    margin: 0.5rem 0;
  }
  .controls-bar {
    flex-direction: column;
    align-items: stretch;
  }
  .tab-group {
    width: 100%;
    justify-content: center;
  }
}
