:root {
    /* Custom brand colors for FootyPreds - these override Bootstrap defaults */
    --brand-bg: #0B0692;
    --card-bg: #0B0692;
    --card-text: #ffffff;
    --input-bg: #060270;
}

/* Dark mode overrides for custom brand colors */
[data-bs-theme="dark"] {
    --brand-bg: #09103a;
    --card-bg: #09103a;
    --card-text: #e6e6e6;
    --input-bg: #060270;
    
    /* Make table-secondary rows darker in dark mode for better contrast */
    --bs-table-secondary-bg: #2c3034;
    --bs-table-secondary-color: #e6e6e6;
}

html {
  font-size: 12px;
}

@media (min-width: 768px) {
  html {
    font-size: 16px;
  }
}

html {
  position: relative;
  min-height: 100%;
}

body {
    margin-bottom: 60px;
}

/* form placeholder tweaks */
.form-floating > .form-control-plaintext::placeholder,
.form-floating > .form-control::placeholder {
    text-align: end;
}

.form-floating > .form-control-plaintext:focus::placeholder,
.form-floating > .form-control:focus::placeholder {
    text-align: start;
}

/* --- Shared FootyPreds styling extracted from views --- */

/* Layout container used across pages (predictions, league table, player pages) */
.league-wrapper,
.player-fixtures {
  max-width: 1100px;
  margin: 0 auto;
  padding: 0 1rem;
  box-sizing: border-box;
}

/* Card-like look for tables to match fixture "cards" */
.league-table .table,
.player-fixtures .table {
    background-color: var(--card-bg);
    color: var(--card-text);
    border-radius: 8px;
    overflow: hidden;
}

/* Header row visual */
.league-table .table thead th,
.player-fixtures .table thead th {
    background: var(--bs-secondary-bg);
    color: var(--bs-body-color);
    border-bottom: 1px solid var(--bs-border-color);
    vertical-align: middle;
}

/* Dark mode: header text should be light */
[data-bs-theme="dark"] .league-table .table thead th,
[data-bs-theme="dark"] .player-fixtures .table thead th {
    color: var(--card-text);
}

/* Ensure thead tr inherits proper background */
.league-table .table thead tr,
.player-fixtures .table thead tr {
    background: transparent;
}

/* Row base and hover - uses Bootstrap variables */
.league-table .table tbody tr,
.player-fixtures .table tbody tr {
    background: var(--bs-secondary-bg);
    transition: box-shadow 180ms ease, transform 180ms ease, background-color 160ms ease;
}

/* Hover/active row style */
.league-table .table tbody tr:hover,
.player-fixtures .table tbody tr:hover {
    background: var(--bs-tertiary-bg);
    box-shadow: 0 8px 16px rgba(0,0,0,0.16);
}

/* Highlight the current user row - enhanced styling matching column highlight */
.current-user-row,
.league-table .table tbody tr.current-user-row,
.table tbody tr.current-user-row {
  outline: 2px solid var(--bs-success) !important;
  outline-offset: -2px;
  background: var(--bs-tertiary-bg) !important;
  box-shadow: inset 0 0 10px rgba(0,255,0,0.1), 0 10px 20px rgba(0,0,0,0.24) !important;
}

/* Apply to all td elements within current user row */
.current-user-row > td,
.league-table .table tbody tr.current-user-row > td,
.table tbody tr.current-user-row > td {
  background: var(--bs-tertiary-bg) !important;
}

/* Ensure hover enhances current user row highlight */
.league-table .table tbody tr.current-user-row:hover,
.table tbody tr.current-user-row:hover {
  background: var(--bs-tertiary-bg) !important;
  box-shadow: inset 0 0 10px rgba(0,255,0,0.15), 0 12px 24px rgba(0,0,0,0.3) !important;
}

.league-table .table tbody tr.current-user-row:hover > td,
.table tbody tr.current-user-row:hover > td {
  background: var(--bs-tertiary-bg) !important;
}

/* Dark mode enhancement for current user row */
[data-bs-theme="dark"] .current-user-row,
[data-bs-theme="dark"] .league-table .table tbody tr.current-user-row,
[data-bs-theme="dark"] .table tbody tr.current-user-row {
  background: rgba(25, 135, 84, 0.15) !important;
  box-shadow: inset 0 0 12px rgba(0,255,0,0.2), 0 10px 20px rgba(0,0,0,0.24) !important;
}

[data-bs-theme="dark"] .current-user-row > td,
[data-bs-theme="dark"] .league-table .table tbody tr.current-user-row > td,
[data-bs-theme="dark"] .table tbody tr.current-user-row > td {
  background: rgba(25, 135, 84, 0.15) !important;
}

[data-bs-theme="dark"] .league-table .table tbody tr.current-user-row:hover,
[data-bs-theme="dark"] .table tbody tr.current-user-row:hover {
  background: rgba(25, 135, 84, 0.2) !important;
  box-shadow: inset 0 0 15px rgba(0,255,0,0.25), 0 12px 24px rgba(0,0,0,0.3) !important;
}

[data-bs-theme="dark"] .league-table .table tbody tr.current-user-row:hover > td,
[data-bs-theme="dark"] .table tbody tr.current-user-row:hover > td {
  background: rgba(25, 135, 84, 0.2) !important;
}

/* Highlight the current user column in predictions table */
.current-user-column {
  outline: 2px solid var(--bs-success);
  outline-offset: -2px;
  background: var(--bs-tertiary-bg) !important;
  box-shadow: inset 0 0 10px rgba(0,255,0,0.1);
}

/* Remove default outline for grouped fixtures */
.first-in-group .current-user-column,
.middle-in-group .current-user-column,
.last-in-group .current-user-column {
  outline: none;
  border-left: 2px solid var(--bs-success);
  border-right: 2px solid var(--bs-success);
}

/* Add top border to first fixture in group */
.first-in-group .current-user-column {
  border-top: 2px solid var(--bs-success);
  border-top-left-radius: 4px;
  border-top-right-radius: 4px;
}

/* Add bottom border to last fixture in group */
.last-in-group .current-user-column {
  border-bottom: 2px solid var(--bs-success);
  border-bottom-left-radius: 4px;
  border-bottom-right-radius: 4px;
}

/* Ensure hover doesn't override current user column highlight */
.player-fixtures .table tbody tr:hover .current-user-column {
  background: var(--bs-tertiary-bg) !important;
  box-shadow: inset 0 0 10px rgba(0,255,0,0.15), 0 8px 16px rgba(0,0,0,0.16);
}

/* Dark mode enhancement for current user column */
[data-bs-theme="dark"] .current-user-column {
  background: rgba(25, 135, 84, 0.15) !important;
  box-shadow: inset 0 0 12px rgba(0,255,0,0.2);
}

/* Dark mode for grouped fixtures */
[data-bs-theme="dark"] .first-in-group .current-user-column,
[data-bs-theme="dark"] .middle-in-group .current-user-column,
[data-bs-theme="dark"] .last-in-group .current-user-column {
  background: rgba(25, 135, 84, 0.15) !important;
  box-shadow: inset 0 0 12px rgba(0,255,0,0.2);
}


[data-bs-theme="dark"] .player-fixtures .table tbody tr:hover .current-user-column {
  background: rgba(25, 135, 84, 0.2) !important;
  box-shadow: inset 0 0 15px rgba(0,255,0,0.25), 0 8px 16px rgba(0,0,0,0.16);
}

/* Trophies and small image helpers */
.trophies-cell {
  max-width: 100px;
}

.trophies {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  justify-content: left;
}

.trophies img {
  width: 16px;
  height: 16px;
  vertical-align: middle;
}

.trophies-sm img {
  width: 8px;
  height: 16px;
  vertical-align: middle;
}

/* Player name cell with inline trophies */
.player-name-cell {
  vertical-align: middle;
}

.player-name-wrapper {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
  min-height: 2.5rem;
  justify-content: center;
}

.player-name-wrapper a {
  line-height: 1.2;
}

.trophies-inline {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  min-height: 18px;
  align-items: center;
}

.trophies-inline img {
  width: 16px;
  height: 16px;
  vertical-align: middle;
}

/* Ensure all table rows have consistent height */
.league-table .table tbody tr {
  height: 3.5rem;
}

.league-table .table tbody td {
  vertical-align: middle;
}

/* Table cell spacing */
.league-table .table td,
.league-table .table th,
.player-fixtures .table td,
.player-fixtures .table th {
  padding: .65rem .3rem;
}

/* Fixture list / card layout (Predictions page) */
.fixture-list {
  display: grid;
  grid-template-columns: 1fr;
  gap: 1rem;
  max-width: 1100px;
  margin: 0 auto;
  padding: 0 1rem;
  box-sizing: border-box;
}

/* Desktop and larger: two fixtures side-by-side */
@media (min-width: 992px) {
  .fixture-list {
    grid-template-columns: repeat(2, 1fr);
  }
}

.fixture {
    background-color: var(--brand-bg);
    padding: 1rem;
    border-radius: 8px;
    box-shadow: 0 12px 24px rgba(0,0,0,0.25), 0 4px 8px rgba(0,0,0,0.18);
    display: flex;
    flex-direction: column;
    height: 100%;
    transition: box-shadow 180ms ease, transform 180ms ease;
}

.fixture:hover {
  box-shadow: 0 18px 36px rgba(0,0,0,0.35), 0 6px 14px rgba(0,0,0,0.22);
  transform: translateY(-3px);
}

.teams {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 0.5rem;
  gap: 0.5rem;
}

.team {
    flex: 1;
    text-align: center;
    font-weight: bold;
    word-break: break-word;
    color: var(--card-text);
}

.teams img {
  display: block;
  margin: 0.5rem auto 0;
  max-height: 48px;
  max-width: 100%;
  height: auto;
}

.kickoff {
  text-align: center;
  color: var(--card-text);
  font-size: 0.9rem;
  margin-bottom: 0.5rem;
  font-weight: bold;
}

.predictions {
  display: flex;
  justify-content: center;
  gap: 1rem;
  margin-top: 0.5rem;
}

/* Inputs styling for numeric predictions */
.predictions input[type="number"] {
    width: 60px;
    background-color: var(--input-bg);
    color: var(--card-text);
    padding: 0.3rem;
    font-size: 16px;
    -webkit-text-size-adjust: 100%;
    border: 1px solid var(--bs-border-color);
    border-radius: 4px;
    text-align: center;
    box-sizing: border-box;
}

/* WebKit (Chrome, Safari, Edge Chromium) - style the spin buttons */
.predictions input[type="number"]::-webkit-outer-spin-button,
.predictions input[type="number"]::-webkit-inner-spin-button {
  background-color: var(--input-bg);
  color: var(--card-text);
  height: auto;
  width: 18px;
  margin: 0;
  box-shadow: none;
  border-left: 1px solid var(--bs-border-color);
}

/* Firefox numeric spin pseudo-elements (if present) */
.predictions input[type="number"]::-moz-number-spin-up-button,
.predictions input[type="number"]::-moz-number-spin-down-button {
    background-color: var(--input-bg);
    color: var(--card-text);
    box-shadow: none;
    border-left: 1px solid var(--bs-border-color);
}

/* On very small screens, slightly larger inputs for tap targets */
@media (max-width: 400px) {
  input[type="number"] {
    width: 80px;
  }
}

/* Player page header and spinner (HTMX) */
.player-header {
  display: grid;
  grid-template-columns: auto 1fr auto;
  align-items: center;
  gap: .5rem;
}

.player-header .nav-left {
    justify-self: start;
}

.player-header .nav-right {
    justify-self: end;
}

.player-header .player-name {
    margin: 0;
    justify-self: center;
    text-align: center;
    font-weight: 600;
}

.htmx-indicator {
  display: none;
  margin-left: 8px;
}

.htmx-indicator.htmx-request {
  display: inline-block;
}

.spinner {
  width: 16px;
  height: 16px;
  border: 2px solid var(--bs-border-color);
  border-top-color: var(--bs-emphasis-color);
  border-radius: 50%;
  animation: spin 0.6s linear infinite;
  display: inline-block;
  vertical-align: middle;
}

@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

.btn-outline-secondary {
  padding: 0.35rem 0.6rem;
  font-size: 0.9rem;
  text-decoration: none;
  display: inline-block;
}

/* Small badges used for points */
.points-badge {
  display:inline-block;
  font-size: 0.6rem;
  min-width:1.5rem;
  text-align:center;
  padding:.2rem .5rem;
  border-radius:.25rem;
}

/* Points colours */
.points-zero {
    background-color: var(--bs-danger);
    color: white;
}

.points-one {
    background-color: var(--bs-warning);
    color: #212529;
}

.points-many {
    background-color: var(--bs-success);
    color: white;
}

/* Scoped small badge column: fixed 24px width, prevent wrapping/overflow */
.badge-cell {
    padding: 0;
    overflow: hidden;
    white-space: nowrap;
    vertical-align: middle;
    display: table-cell;
    text-align: center;
}

/* Left-align content for home badge cell */
.badge-cell.home {
    text-align: right;
    padding-left: 0.25rem;
}

/* Right-align content for away badge cell */
.badge-cell.away {
    text-align: left;
    padding-right: 0.25rem;
}

/* If the badge helper outputs an inline element that should be centered vertically, use this */
.badge-cell .badge,
.badge-cell > * {
    display: inline-block;
    vertical-align: middle;
}

/* Ensure any img inside the badge-cell is aligned/ spaced appropriately */
.badge-cell.home img {
    display: inline-block;
    vertical-align: middle;
    margin-right: 0.25rem;
}

.badge-cell.away img {
    display: inline-block;
    vertical-align: middle;
    margin-left: 0.25rem;
}

.v-cell {
    width: 24px;
    min-width: 24px;
    max-width: 24px;
    padding: 0;
    white-space: nowrap;
    overflow: hidden;
    text-align: center;
}

@media (max-width: 576px) {
    .league-wrapper,
    .player-fixtures {
        padding-left: 0.5rem;
        padding-right: 0.5rem;
    }

    /* Make mobile navigation easier to use with larger touch targets */
    .navbar-toggler {
        padding: 0.5rem 0.75rem;
        font-size: 1.5rem;
        min-width: 50px;
        min-height: 50px;
    }

    .navbar-toggler-icon {
        width: 2rem;
        height: 2rem;
    }

    /* Larger nav links on mobile */
    .navbar-nav .nav-link {
        font-size: 1.1rem;
        padding: 0.75rem 1rem;
        min-height: 48px;
        display: flex;
        align-items: center;
    }

    /* Larger dropdown items on mobile */
    .dropdown-menu .dropdown-item {
        font-size: 1.05rem;
        padding: 0.75rem 1.25rem;
        min-height: 48px;
    }

    /* Larger dropdown toggle on mobile */
    .navbar-nav .dropdown-toggle {
        font-size: 1.1rem;
        padding: 0.75rem 1rem;
    }

    /* More spacing between nav items */
    .navbar-nav .nav-item {
        margin-bottom: 0.25rem;
    }

    /* Larger theme toggle button on mobile */
    #themeToggle {
        min-width: 44px;
        min-height: 44px;
        font-size: 1.2rem;
        padding: 0.5rem;
    }

    /* Larger brand text */
    .navbar-brand {
        font-size: 1.3rem;
    }
}

/* Override Bootstrap's default cell background so rows use our variables */
.league-table .table > :not(caption) > tbody > tr > td,
.player-fixtures .table > :not(caption) > tbody > tr > td {
    background-color: var(--bs-secondary-bg);
}

.league-table .table > :not(caption) > tbody > tr:hover > td,
.player-fixtures .table > :not(caption) > tbody > tr:hover > td {
    background-color: var(--bs-tertiary-bg);
}

/* Keep the header styling */
.league-table .table thead th,
.player-fixtures .table thead th {
    background: var(--bs-secondary-bg);
}

/* Force table-secondary rows to be darker in dark mode - MOST SPECIFIC RULES */
[data-bs-theme="dark"] .table-secondary,
[data-bs-theme="dark"] .table-striped .table-secondary,
[data-bs-theme="dark"] .league-table .table .table-secondary,
[data-bs-theme="dark"] .player-fixtures .table .table-secondary,
[data-bs-theme="dark"] .table > tbody > tr.table-secondary {
    --bs-table-bg: #2c3034 !important;
    --bs-table-color: #e6e6e6 !important;
    --bs-table-striped-bg: #2c3034 !important;
    --bs-table-striped-color: #e6e6e6 !important;
    --bs-table-active-bg: #2c3034 !important;
    --bs-table-active-color: #e6e6e6 !important;
    --bs-table-hover-bg: #2c3034 !important;
    --bs-table-hover-color: #e6e6e6 !important;
    background-color: #2c3034 !important;
    color: #e6e6e6 !important;
}

/* Target odd rows specifically with maximum specificity */
[data-bs-theme="dark"] .table-striped > tbody > tr.table-secondary:nth-of-type(odd),
[data-bs-theme="dark"] .table.table-striped > tbody > tr.table-secondary:nth-of-type(odd),
[data-bs-theme="dark"] .league-table .table-striped > tbody > tr.table-secondary:nth-of-type(odd),
[data-bs-theme="dark"] .player-fixtures .table-striped > tbody > tr.table-secondary:nth-of-type(odd) {
    --bs-table-bg: #2c3034 !important;
    --bs-table-color: #e6e6e6 !important;
    --bs-table-striped-bg: #2c3034 !important;
    --bs-table-striped-color: #e6e6e6 !important;
    background-color: #2c3034 !important;
    color: #e6e6e6 !important;
}

/* Target even rows specifically */
[data-bs-theme="dark"] .table-striped > tbody > tr.table-secondary:nth-of-type(even),
[data-bs-theme="dark"] .table.table-striped > tbody > tr.table-secondary:nth-of-type(even),
[data-bs-theme="dark"] .league-table .table-striped > tbody > tr.table-secondary:nth-of-type(even),
[data-bs-theme="dark"] .player-fixtures .table-striped > tbody > tr.table-secondary:nth-of-type(even) {
    --bs-table-bg: #2c3034 !important;
    --bs-table-color: #e6e6e6 !important;
    --bs-table-striped-bg: #2c3034 !important;
    --bs-table-striped-color: #e6e6e6 !important;
    background-color: #2c3034 !important;
    color: #e6e6e6 !important;
}

/* Also target the td elements inside table-secondary rows */
[data-bs-theme="dark"] .table-secondary > td,
[data-bs-theme="dark"] .table-striped .table-secondary > td,
[data-bs-theme="dark"] .league-table .table .table-secondary > td,
[data-bs-theme="dark"] .player-fixtures .table .table-secondary > td,
[data-bs-theme="dark"] .table > tbody > tr.table-secondary > td {
    background-color: #2c3034 !important;
    color: #e6e6e6 !important;
}

/* Target td elements in odd table-secondary rows */
[data-bs-theme="dark"] .table-striped > tbody > tr.table-secondary:nth-of-type(odd) > td,
[data-bs-theme="dark"] .table.table-striped > tbody > tr.table-secondary:nth-of-type(odd) > td,
[data-bs-theme="dark"] .league-table .table-striped > tbody > tr.table-secondary:nth-of-type(odd) > td,
[data-bs-theme="dark"] .player-fixtures .table-striped > tbody > tr.table-secondary:nth-of-type(odd) > td {
    background-color: #2c3034 !important;
    color: #e6e6e6 !important;
}

/* Target td elements in even table-secondary rows */
[data-bs-theme="dark"] .table-striped > tbody > tr.table-secondary:nth-of-type(even) > td,
[data-bs-theme="dark"] .table.table-striped > tbody > tr.table-secondary:nth-of-type(even) > td,
[data-bs-theme="dark"] .league-table .table-striped > tbody > tr.table-secondary:nth-of-type(even) > td,
[data-bs-theme="dark"] .player-fixtures .table-striped > tbody > tr.table-secondary:nth-of-type(even) > td {
    background-color: #2c3034 !important;
    color: #e6e6e6 !important;
}

