/* ============================================
   PILA - UI Theme
   Version 4.1 - Dark-Only Design with 60-30-10 Rule
   60% Background: Black #000000
   30% Components: Neon Green #CCFF00 (cards, nav, borders, highlights)
   10% Text/Accent: White #CAC1BD (readability, CTAs)
   ============================================ */

/* ============================================
   TABLE OF CONTENTS
   1. Color System (Variables)
   2. Global Styles
   3. Typography
   4. Bootstrap Overrides
   5. Components (Cards, Forms, Modals, etc.)
   6. Responsive Utilities
   ============================================ */

/* ============================================
   1. COLOR SYSTEM - DARK ONLY
   ============================================ */

:root {
    /* Background Layers (60% - Black) */
    --bg-primary: #333333;
    --bg-surface: #0A0A0A;
    --bg-card: #111111;
    --bg-hover: rgba(204, 255, 0, 0.06);

    /* Text Colors (10% - White for readability) */
    --text-primary: #CAC1BD;
    --text-secondary: rgba(255, 255, 255, 0.70);
    --text-muted: rgba(255, 255, 255, 0.45);
    --text-inverse: #000000;

    /* Borders (30% - Neon Green tints) */
    --border-color: rgba(204, 255, 0, 0.20);
    --border-subtle: rgba(204, 255, 0, 0.10);

    /* Brand / Component Colors - 30% Neon Green */
    --brand-primary: #CCFF00;       /* 30% - Neon Green (components) */
    --brand-secondary: #CCFF00;     /* 30% - Neon Green (unified) */
    --brand-tertiary: #CAC1BD;      /* 10% - White (text/accent) */
    --brand-accent: #CAC1BD;        /* alias for tertiary */
    --brand-success: #CCFF00;
    --brand-warning: #FFD000;
    --brand-error: #FF4D4D;

    /* Semantic Colors */
    --color-winner: #CCFF00;
    --color-loser: #FF4D4D;

    /* Derived transparency */
    --brand-primary-light: rgba(204, 255, 0, 0.12);
    --brand-secondary-light: rgba(204, 255, 0, 0.10);
    --brand-tertiary-light: rgba(255, 255, 255, 0.08);
    --brand-success-light: rgba(204, 255, 0, 0.12);
    --brand-warning-light: rgba(255, 208, 0, 0.12);
    --brand-error-light: rgba(255, 77, 77, 0.12);

    /* Shadows */
    --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.6);
    --shadow-md: 0 2px 8px rgba(0, 0, 0, 0.6);
    --shadow-lg: 0 8px 30px rgba(0, 0, 0, 0.7);

    /* Spacing Scale */
    --space-xs: clamp(0.25rem, 0.5vw, 0.5rem);
    --space-sm: clamp(0.5rem, 1vw, 0.75rem);
    --space-md: clamp(0.75rem, 1.5vw, 1rem);
    --space-lg: clamp(1rem, 2vw, 1.5rem);
    --space-xl: clamp(1.5rem, 3vw, 2.5rem);
    --space-2xl: clamp(2rem, 4vw, 3.5rem);

    /* Border Radius */
    --radius-sm: 6px;
    --radius-md: 8px;
    --radius-lg: 12px;
}

/* ============================================
   2. GLOBAL STYLES
   ============================================ */

body,
.card,
.btn,
.form-control,
.form-select,
.modal-content,
.alert,
.badge,
.list-group-item,
.navbar,
.table {
    transition: background-color 0.3s ease, color 0.3s ease, border-color 0.3s ease;
}

body {
    font-family: 'Helvetica Neue', Tahoma, Geneva, Verdana, sans-serif;
    background-color: var(--bg-primary) !important;
    color: var(--text-primary) !important;
}

input {
    color-scheme: dark;
}

/* ============================================
   3. TYPOGRAPHY - fluid scale via clamp()
   ============================================ */

h1, h2, h3, h4, h5, h6 {
    color: var(--text-primary) !important;
}

/* Fluid heading sizes: min @ 320px - preferred - max @ 1200px */
h1, .h1    { font-size: clamp(1.60rem, 1.20rem + 1.25vw, 2.50rem); }
h2, .h2    { font-size: clamp(1.35rem, 1.05rem + 0.95vw, 2.00rem); }
h3, .h3    { font-size: clamp(1.15rem, 0.95rem + 0.65vw, 1.60rem); }
h4, .h4    { font-size: clamp(1.05rem, 0.90rem + 0.45vw, 1.35rem); }
h5, .h5    { font-size: clamp(0.95rem, 0.85rem + 0.30vw, 1.15rem); }
h6, .h6    { font-size: clamp(0.85rem, 0.80rem + 0.15vw, 0.95rem); }

.display-4 { font-size: clamp(1.75rem, 1.25rem + 1.55vw, 2.75rem); }
.lead      { font-size: clamp(0.95rem, 0.85rem + 0.30vw, 1.15rem); }

p, span, div, label {
    color: var(--text-primary);
}

small {
    color: var(--text-secondary);
}

.text-muted {
    color: var(--text-muted) !important;
}

.text-primary {
    color: var(--brand-primary) !important;
}

.text-secondary {
    color: var(--text-secondary) !important;
}

strong, b, .fw-bold {
    font-weight: 600 !important;
    color: var(--text-primary) !important;
}

/* ============================================
   4. BOOTSTRAP OVERRIDES - PRIMARY COLOR (Neon Green - 30%)
   ============================================ */

.btn-primary {
    background-color: var(--brand-primary) !important;
    border-color: var(--brand-primary) !important;
    color: #000000 !important;
    border-radius: var(--radius-sm);
    font-weight: 600;
}

.btn-primary:hover,
.btn-primary:focus,
.btn-primary:active {
    background-color: #B8E600 !important;
    border-color: #B8E600 !important;
    color: #000000 !important;
}

.bg-primary {
    background-color: var(--brand-primary) !important;
    color: #000000 !important;
}

.border-primary {
    border-color: var(--brand-primary) !important;
}

.card-header.bg-primary {
    background-color: var(--brand-primary) !important;
    color: #000000 !important;
}

/* ============================================
   4. BOOTSTRAP OVERRIDES - SECONDARY COLOR (Neon Green - 30%)
   ============================================ */

.btn-secondary {
    background-color: transparent !important;
    border-color: var(--brand-primary) !important;
    color: var(--brand-primary) !important;
    border-radius: var(--radius-sm);
}

.btn-secondary:hover {
    background-color: var(--brand-primary) !important;
    border-color: var(--brand-primary) !important;
    color: #000000 !important;
}

.btn-info {
    background-color: transparent !important;
    border-color: var(--brand-primary) !important;
    color: var(--brand-primary) !important;
    border-radius: var(--radius-sm);
}

.btn-info:hover {
    background-color: var(--brand-primary) !important;
    border-color: var(--brand-primary) !important;
    color: #000000 !important;
}

.bg-secondary {
    background-color: var(--bg-surface) !important;
    color: var(--text-primary) !important;
}

.bg-info {
    background-color: var(--brand-primary) !important;
    color: #000000 !important;
}

.card-header.bg-secondary,
.card-header.bg-info {
    background-color: var(--bg-surface) !important;
    color: var(--text-primary) !important;
}

.border-secondary,
.border-info {
    border-color: var(--brand-primary) !important;
}

/* ============================================
   4. BOOTSTRAP OVERRIDES - SUCCESS COLOR (Neon Green)
   ============================================ */

.btn-success {
    background-color: var(--brand-success) !important;
    border-color: var(--brand-success) !important;
    color: #000000 !important;
    border-radius: var(--radius-sm);
    font-weight: 600;
}

.btn-success:hover {
    background-color: #B8E600 !important;
    border-color: #B8E600 !important;
}

.bg-success {
    background-color: var(--brand-success) !important;
    color: #000000 !important;
}

.card-header.bg-success {
    background-color: var(--brand-success) !important;
    color: #000000 !important;
}

.border-success {
    border-color: var(--brand-success) !important;
}

.badge.bg-success {
    background-color: var(--brand-success) !important;
    color: #000000 !important;
}

.text-success {
    color: var(--brand-success) !important;
}

/* ============================================
   4. BOOTSTRAP OVERRIDES - WARNING COLOR (Gold)
   ============================================ */

.btn-warning {
    background-color: var(--brand-warning) !important;
    border-color: var(--brand-warning) !important;
    color: #000000 !important;
    border-radius: var(--radius-sm);
    font-weight: 600;
}

.btn-warning:hover {
    background-color: #E6BB00 !important;
    border-color: #E6BB00 !important;
}

.bg-warning {
    background-color: var(--brand-warning) !important;
    color: #000000 !important;
}

.card-header.bg-warning {
    background-color: var(--brand-warning) !important;
    color: #000000 !important;
}

.border-warning {
    border-color: var(--brand-warning) !important;
}

.badge.bg-warning {
    background-color: var(--brand-warning) !important;
    color: #000000 !important;
}

.text-warning {
    color: var(--brand-warning) !important;
}

/* ============================================
   4. BOOTSTRAP OVERRIDES - DANGER COLOR (Red)
   ============================================ */

.btn-danger {
    background-color: var(--brand-error) !important;
    border-color: var(--brand-error) !important;
    color: #000000 !important;
    border-radius: var(--radius-sm);
    font-weight: 600;
}

.btn-danger:hover {
    background-color: #E63939 !important;
    border-color: #E63939 !important;
}

.bg-danger {
    background-color: var(--brand-error) !important;
    color: #000000 !important;
}

.card-header.bg-danger {
    background-color: var(--brand-error) !important;
    color: #000000 !important;
}

.border-danger {
    border-color: var(--brand-error) !important;
}

.badge.bg-danger {
    background-color: var(--brand-error) !important;
    color: #000000 !important;
}

.text-danger {
    color: var(--brand-error) !important;
}

/* ============================================
   4. BOOTSTRAP OVERRIDES - ACCENT COLOR (White 10%)
   ============================================ */

.btn-accent {
    background-color: var(--brand-accent) !important;
    border-color: var(--brand-accent) !important;
    color: #000000 !important;
    border-radius: var(--radius-sm);
    font-weight: 600;
}

.btn-accent:hover {
    background-color: #E6E6E6 !important;
    border-color: #E6E6E6 !important;
}

.btn-tertiary {
    background-color: var(--brand-tertiary) !important;
    border-color: var(--brand-tertiary) !important;
    color: #000000 !important;
    border-radius: var(--radius-sm);
    font-weight: 600;
}

.btn-tertiary:hover {
    background-color: #E6E6E6 !important;
    border-color: #E6E6E6 !important;
}

.bg-tertiary {
    background-color: var(--brand-tertiary) !important;
    color: #000000 !important;
}

.text-tertiary {
    color: var(--brand-tertiary) !important;
}

.border-tertiary {
    border-color: var(--brand-tertiary) !important;
}

/* ============================================
   4. BOOTSTRAP OVERRIDES - OUTLINE BUTTONS
   ============================================ */

.btn-outline-primary {
    color: var(--brand-primary) !important;
    border-color: var(--brand-primary) !important;
    border-radius: var(--radius-sm);
}

.btn-outline-primary:hover {
    background-color: var(--brand-primary) !important;
    color: #000000 !important;
}

.btn-outline-secondary {
    color: var(--brand-primary) !important;
    border-color: var(--brand-primary) !important;
    border-radius: var(--radius-sm);
}

.btn-outline-secondary:hover {
    background-color: var(--brand-primary) !important;
    color: #000000 !important;
}

.btn-outline-success {
    color: var(--brand-success) !important;
    border-color: var(--brand-success) !important;
    border-radius: var(--radius-sm);
}

.btn-outline-success:hover {
    background-color: var(--brand-success) !important;
    color: #000000 !important;
}

.btn-outline-danger {
    color: var(--brand-error) !important;
    border-color: var(--brand-error) !important;
    border-radius: var(--radius-sm);
}

.btn-outline-danger:hover {
    background-color: var(--brand-error) !important;
    color: #000000 !important;
}

.btn-outline-warning {
    color: var(--brand-warning) !important;
    border-color: var(--brand-warning) !important;
    border-radius: var(--radius-sm);
}

.btn-outline-warning:hover {
    background-color: var(--brand-warning) !important;
    color: #000000 !important;
}

.btn-outline-info {
    color: var(--brand-primary) !important;
    border-color: var(--brand-primary) !important;
    border-radius: var(--radius-sm);
}

.btn-outline-info:hover {
    background-color: var(--brand-primary) !important;
    color: #000000 !important;
}

.btn-outline-light {
    color: var(--text-secondary) !important;
    border-color: var(--border-color) !important;
    border-radius: var(--radius-sm);
}

.btn-outline-light:hover {
    background-color: var(--bg-hover) !important;
    color: var(--text-primary) !important;
    border-color: var(--text-secondary) !important;
}

.btn-outline-accent {
    color: var(--brand-accent) !important;
    border-color: var(--brand-accent) !important;
    border-radius: var(--radius-sm);
}

.btn-outline-accent:hover {
    background-color: var(--brand-accent) !important;
    color: #000000 !important;
}

/* ============================================
   5. COMPONENTS - CARDS
   ============================================ */

.card {
    background-color: var(--bg-card) !important;
    border: 1px solid var(--border-color) !important;
    border-radius: var(--radius-md) !important;
    box-shadow: var(--shadow-sm);
    transition: box-shadow 0.2s ease;
    color: var(--text-primary) !important;
}

.card:hover {
    box-shadow: var(--shadow-md) !important;
    border-color: var(--brand-primary) !important;
}

.card-body {
    background-color: var(--bg-card) !important;
    color: var(--text-primary) !important;
}

.card-header {
    font-weight: 600;
    border-bottom: 1px solid var(--border-color) !important;
    border-radius: var(--radius-md) var(--radius-md) 0 0 !important;
}

.card-title {
    color: var(--text-primary) !important;
}

/* ============================================
   5. COMPONENTS - FORMS
   ============================================ */

.form-control,
.form-select {
    background-color: var(--bg-card) !important;
    border-color: var(--border-color) !important;
    color: var(--text-primary) !important;
    border-radius: var(--radius-md);
}

.form-control:focus,
.form-select:focus {
    border-color: var(--brand-primary) !important;
    box-shadow: 0 0 0 0.2rem var(--brand-primary-light) !important;
    background-color: var(--bg-card) !important;
    color: var(--text-primary) !important;
}

.form-control::placeholder {
    color: var(--text-muted) !important;
    opacity: 0.6;
}

.form-label {
    color: var(--text-primary) !important;
    font-weight: 500;
}

.form-check-input:checked {
    background-color: var(--brand-primary) !important;
    border-color: var(--brand-primary) !important;
}

.form-check-label {
    color: var(--text-primary) !important;
}

.form-control:disabled,
.form-select:disabled {
    background-color: var(--bg-surface) !important;
    opacity: 0.6;
}

/* ============================================
   5. COMPONENTS - BADGES (pill-style)
   ============================================ */

.badge {
    font-weight: 500;
    padding: 0.35em 0.65em;
    border-radius: 10px;
}

.badge.bg-secondary {
    background-color: var(--brand-primary) !important;
    color: #000000 !important;
}

.badge.bg-info {
    background-color: var(--brand-primary) !important;
    color: #000000 !important;
}

.badge.bg-primary {
    background-color: var(--brand-primary) !important;
    color: #000000 !important;
}

/* ============================================
   5. COMPONENTS - MODALS
   ============================================ */

.modal.show {
    display: block;
}

.modal-content {
    background-color: var(--bg-card) !important;
    border: 1px solid var(--border-color) !important;
    border-radius: var(--radius-lg) !important;
    box-shadow: var(--shadow-lg);
}

.modal-header {
    border-bottom: 1px solid var(--border-color) !important;
    background-color: var(--bg-surface) !important;
    border-radius: var(--radius-lg) var(--radius-lg) 0 0 !important;
}

/* Bright modal header — colored bg with black text (e.g. bg-primary, bg-success)
   Add .modal-header-bright alongside bg-* to opt-in */
.modal-header.modal-header-bright {
    background-color: var(--brand-primary) !important;
}

.modal-header-bright,
.modal-header-bright *,
.modal-header-bright .modal-title,
.modal-header-bright h5,
.modal-header-bright i,
.modal-header-bright small {
    color: #000000 !important;
}

.modal-header-bright .btn-close {
    filter: none;
}

.modal-body {
    background-color: var(--bg-card) !important;
    color: var(--text-primary) !important;
}

.modal-footer {
    background-color: var(--bg-surface) !important;
    border-top: 1px solid var(--border-color) !important;
    border-radius: 0 0 var(--radius-lg) var(--radius-lg) !important;
}

.modal-title {
    color: var(--text-primary) !important;
}

/* ============================================
   5. COMPONENTS - ALERTS (left-border accent style)
   ============================================ */

.alert {
    color: var(--text-primary) !important;
    border-radius: var(--radius-md);
    border-left-width: 4px !important;
}

.alert-info {
    background-color: var(--brand-primary-light) !important;
    border-color: var(--brand-primary) !important;
}

.alert-success {
    background-color: var(--brand-success-light) !important;
    border-color: var(--brand-success) !important;
}

.alert-warning {
    background-color: var(--brand-warning-light) !important;
    border-color: var(--brand-warning) !important;
}

.alert-danger {
    background-color: var(--brand-error-light) !important;
    border-color: var(--brand-error) !important;
}

.alert-secondary {
    background-color: var(--brand-primary-light) !important;
    border-color: var(--brand-primary) !important;
}

/* ============================================
   5. COMPONENTS - TABLES
   ============================================ */

.table {
    --bs-table-bg: transparent !important;
    --bs-table-accent-bg: transparent !important;
    --bs-table-striped-color: var(--text-primary);
    --bs-table-striped-bg: rgba(255, 255, 255, 0.05);
    --bs-table-hover-color: var(--text-primary);
    --bs-table-hover-bg: rgba(204, 255, 0, 0.06);
    color: var(--text-primary) !important;
    background-color: transparent !important;
    border-color: var(--border-color) !important;
}

.table > :not(caption) > * > * {
    background-color: transparent !important;
    box-shadow: none !important;
}

.table thead {
    background-color: #1A1A1A !important;
    color: var(--text-primary) !important;
    border-color: var(--border-color) !important;
}

.table thead th {
    color: var(--text-primary) !important;
    background-color: #1A1A1A !important;
}

.table td,
.table th {
    border-color: var(--border-color) !important;
    color: var(--text-primary) !important;
}

.table-striped > tbody > tr:nth-of-type(odd),
.table tbody tr:nth-of-type(odd) {
    color: var(--text-primary) !important;
    background-color: #111111 !important;
}

.table-striped > tbody > tr:nth-of-type(even),
.table tbody tr:nth-of-type(even) {
    color: var(--text-primary) !important;
    background-color: #1A1A1A !important;
}

.table tbody td {
    color: var(--text-primary) !important;
}

.table tbody td strong {
    color: var(--text-primary) !important;
}

.table tbody td span {
    color: var(--text-primary) !important;
}

.table tbody td div {
    color: var(--text-primary) !important;
}

.table-hover tbody tr:hover {
    background-color: rgba(204, 255, 0, 0.06) !important;
}

.table .badge {
    color: #000000 !important;
}

/* Waiting Players Modal Specific */
.waiting-players-table {
    background-color: var(--bg-card) !important;
}

.waiting-players-table tbody td {
    color: var(--text-primary) !important;
    background-color: var(--bg-card) !important;
}

.waiting-players-table tbody tr {
    background-color: var(--bg-card) !important;
}

.waiting-players-table tbody td strong,
.waiting-players-table tbody td div strong {
    color: var(--text-primary) !important;
    display: inline !important;
    opacity: 1 !important;
    visibility: visible !important;
}

.waiting-players-table tbody tr:nth-of-type(even) {
    background-color: var(--bg-surface) !important;
}

/* Player name visibility */
.player-name-visible {
    color: var(--text-primary) !important;
    display: inline !important;
    opacity: 1 !important;
    visibility: visible !important;
    font-size: 1rem !important;
    font-weight: 600 !important;
}

.waiting-players-table .player-name-visible {
    color: var(--text-primary) !important;
}

/* ============================================
   Text & Background overrides
   ============================================ */

.text-dark {
    color: var(--text-primary) !important;
}

.bg-light {
    background-color: var(--bg-surface) !important;
    color: var(--text-primary) !important;
}

.bg-white {
    background-color: var(--bg-card) !important;
    color: var(--text-primary) !important;
}

/* Opacity Variants for Queue Cards */
.bg-primary.bg-opacity-10 {
    background-color: var(--brand-primary-light) !important;
}

.bg-primary.bg-opacity-25 {
    background-color: rgba(204, 255, 0, 0.25) !important;
}

.bg-success.bg-opacity-10 {
    background-color: var(--brand-success-light) !important;
}

.bg-success.bg-opacity-25 {
    background-color: rgba(204, 255, 0, 0.25) !important;
}

.bg-danger.bg-opacity-10 {
    background-color: var(--brand-error-light) !important;
}

.bg-danger.bg-opacity-25 {
    background-color: rgba(255, 77, 77, 0.25) !important;
}

.bg-warning.bg-opacity-10 {
    background-color: var(--brand-warning-light) !important;
}

.bg-warning.bg-opacity-25 {
    background-color: rgba(255, 208, 0, 0.25) !important;
}

.bg-secondary.bg-opacity-10 {
    background-color: var(--brand-primary-light) !important;
}

.bg-secondary.bg-opacity-25 {
    background-color: rgba(204, 255, 0, 0.25) !important;
}

/* Border Enhancements */
.border-primary {
    border-color: rgba(204, 255, 0, 0.5) !important;
}

.border-success {
    border-color: rgba(204, 255, 0, 0.5) !important;
}

.border-danger {
    border-color: rgba(255, 77, 77, 0.5) !important;
}

.border-warning {
    border-color: rgba(255, 208, 0, 0.5) !important;
}

/* Dropdown */
.dropdown-menu {
    background-color: var(--bg-card) !important;
    color: var(--text-primary) !important;
    border-color: var(--border-color) !important;
}

.dropdown-item {
    color: var(--text-primary) !important;
}

.dropdown-item:hover {
    background-color: var(--bg-surface) !important;
}

/* List Group */
.list-group-item {
    background-color: var(--bg-card) !important;
    border-color: var(--border-color) !important;
    color: var(--text-primary) !important;
}

.list-group-item:hover {
    background-color: var(--bg-primary) !important;
}

.list-group-item.active {
    background-color: var(--brand-primary) !important;
    border-color: var(--brand-primary) !important;
    color: #000000 !important;
}

.list-group-item.active * {
    color: #000000 !important;
}

/* ============================================
   6. RESPONSIVE UTILITIES
   ============================================ */

@media (max-width: 767.98px) {
.card-body {
    padding: 0.875rem;
}

    .modal-fullscreen-md-down {
        width: 100vw;
        max-width: none;
        height: 100vh;
        margin: 0;
    }
    
    .modal-fullscreen-md-down .modal-content {
        height: 100vh;
        border: 0;
        border-radius: 0;
    }
}

/* ============================================
   NAVBAR RESPONSIVE
   ============================================ */

.navbar {
    background: transparent !important;
}

.navbar-brand {
    font-size: 2rem;
    font-weight: 500;
    color: var(--text-primary) !important;
}

.navbar-toggler {
    background-color: var(--brand-primary) !important;
    border: 2px solid var(--brand-primary) !important;
    padding: 0.5rem 0.75rem;
    border-radius: 0.375rem;
}

.navbar-toggler:focus {
    box-shadow: 0 0 0 0.25rem var(--brand-primary-light);
}

.navbar-toggler-icon {
    background-image: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 30 30'%3e%3cpath stroke='rgba(0, 0, 0, 1)' stroke-linecap='round' stroke-miterlimit='10' stroke-width='2' d='M4 7h22M4 15h22M4 23h22'/%3e%3c/svg%3e") !important;
}

.nav-btn {
    white-space: nowrap;
    font-size: 0.9rem;
    color: var(--text-primary) !important;
}

/* ============================================
   SESSION ACTION BAR (contextual toolbar)
   ============================================ */

.session-action-bar {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    padding: 12px 16px;
    background-color: #1A1A1A;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
}

@media (min-width: 992px) {
    .navbar-collapse {
        display: flex !important;
        flex-basis: auto;
    }

    .navbar-nav {
        flex-direction: row;
        gap: 0.5rem;
    }
}

@media (max-width: 991px) {
    .navbar-collapse {
        background-color: var(--bg-card);
        border-radius: 0.5rem;
        padding: 1rem;
        margin-top: 1rem;
        box-shadow: var(--shadow-md);
        border: 1px solid var(--border-color);
    }

    .navbar-nav {
        gap: 0.5rem;
    }

    .nav-btn {
        width: 100%;
        text-align: center;
    }

    .navbar-brand {
        font-size: 1.5rem;
    }
}

/* ============================================
   MOBILE STATUS STRIP
   ============================================ */

.mobile-status-strip {
    padding: 0 0 4px 0;
}

.status-strip-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    width: 100%;
    padding: 10px 12px;
    border: 1px solid var(--border-color);
    border-radius: 10px;
    background-color: var(--bg-card);
    color: var(--text-primary);
    font-size: 0.85rem;
    cursor: pointer;
    -webkit-tap-highlight-color: transparent;
    transition: background-color 0.15s;
}

.status-strip-btn:active {
    background-color: var(--bg-hover);
}

.status-chip {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    white-space: nowrap;
}

.status-chip i {
    font-size: 0.8rem;
    opacity: 0.7;
}

.status-divider {
    color: var(--text-secondary);
    opacity: 0.5;
    font-weight: bold;
}

/* ============================================
   COURT CARD HEADER STATES
   ============================================ */

/* Active court (game in progress) — neon green bg, black text */
.court-header-active {
    background-color: var(--brand-success) !important;
    border-bottom-color: var(--brand-success) !important;
}

.court-header-active .court-header-title,
.court-header-active h5 {
    color: #000000 !important;
}

.court-header-active .court-header-summary {
    color: rgba(0, 0, 0, 0.6) !important;
}

.court-header-active i {
    color: #000000 !important;
}

/* Available court — subtle contrasting header */
.court-header-available {
    background-color: #1A1A1A !important;
    border-bottom-color: var(--border-color) !important;
}

.court-header-available .court-header-title {
    color: var(--text-primary) !important;
}

.court-header-available .court-header-summary {
    color: var(--text-muted) !important;
}

/* Badge inside available header */
.court-badge-available {
    background-color: var(--brand-primary-light) !important;
    color: var(--brand-primary) !important;
    border: 1px solid var(--brand-primary) !important;
}

/* ============================================
   MOBILE COLLAPSIBLE COURT CARDS
   ============================================ */

.court-card-header {
    cursor: default;
}

.court-header-summary {
    font-size: 0.8rem;
    color: rgba(255, 255, 255, 0.6);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* On mobile, court card body is collapsed by default */
@media (max-width: 767.98px) {
    .court-card-header {
        cursor: pointer;
        -webkit-tap-highlight-color: transparent;
    }

    .court-collapse {
        max-height: 0;
        overflow: hidden;
        transition: max-height 0.3s ease;
    }

    .court-collapse.court-expanded {
        max-height: 800px;
        overflow: visible;
    }
}

/* On desktop, court cards are always expanded */
@media (min-width: 768px) {
    .court-collapse {
        max-height: none !important;
        overflow: visible !important;
    }
}

/* ============================================
   COURT ACTION BUTTONS (responsive)
   ============================================ */

.court-actions {
    display: flex;
    gap: 0.5rem;
    margin-top: 0.5rem;
}

.court-actions .btn {
    flex: 1;
}

@media (min-width: 768px) {
    .court-actions {
        display: grid;
        gap: 0.5rem;
        margin-top: 1rem;
    }
}

/* ============================================
   MOBILE BOTTOM ACTION BAR
   ============================================ */

.mobile-bottom-bar {
    position: fixed;
    bottom: 56px; /* sits above the global tab bar */
    left: 0;
    right: 0;
    z-index: 1040;
    display: flex;
    justify-content: space-around;
    align-items: stretch;
    background-color: var(--bg-card);
    border-top: 1px solid var(--border-color);
    box-shadow: 0 -2px 10px rgba(0, 0, 0, 0.5);
    padding: 0;
    padding-bottom: 0;
}

.mobile-bottom-btn {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 2px;
    padding: 8px 4px;
    min-height: 56px;
    border: none;
    background: transparent;
    color: var(--text-secondary);
    font-size: 0.65rem;
    font-weight: 500;
    cursor: pointer;
    transition: color 0.2s, background-color 0.2s;
    -webkit-tap-highlight-color: transparent;
}

.mobile-bottom-btn i {
    font-size: 1.25rem;
}

.mobile-bottom-btn:active {
    background-color: var(--bg-hover);
}

.mobile-bottom-btn-primary {
    color: var(--brand-primary);
    font-weight: 600;
}

.mobile-bottom-btn-primary i {
    font-size: 1.4rem;
}

/* Context-aware badge wrapper */
.mobile-btn-icon-wrapper {
    position: relative;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

/* Numeric badge on bottom bar buttons */
.mobile-btn-badge {
    position: absolute;
    top: -6px;
    right: -10px;
    min-width: 16px;
    height: 16px;
    padding: 0 4px;
    border-radius: 8px;
    background-color: var(--brand-primary);
    color: #000000;
    font-size: 0.6rem;
    font-weight: 700;
    line-height: 16px;
    text-align: center;
    pointer-events: none;
}

/* Court-count badge variant */
.mobile-btn-badge-court {
    background-color: var(--brand-success);
}

/* Muted badge variant (games played) */
.mobile-btn-badge-muted {
    background-color: var(--text-secondary);
    opacity: 0.8;
}

/* Dot indicator (auto-start active) */
.mobile-btn-dot {
    position: absolute;
    top: -3px;
    right: -6px;
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background-color: var(--brand-success);
    pointer-events: none;
}

/* Pulse animation when game can start */
.mobile-bottom-btn-ready i {
    animation: startPulse 2s ease-in-out infinite;
}

@keyframes startPulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.5; }
}

/* Body padding to prevent content from being hidden behind bottom bars */
@media (max-width: 767.98px) {
    .mobile-body-padding {
        /* global tab bar (~56px) + session action bar (~56px) + safe area */
        padding-bottom: 130px !important;
    }
}

/* ============================================
   MOBILE OFF-CANVAS MENU
   ============================================ */

.mobile-offcanvas-backdrop {
    position: fixed;
    inset: 0;
    z-index: 1050;
    background-color: rgba(0, 0, 0, 0.7);
    animation: fadeIn 0.2s ease;
}

.mobile-offcanvas {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    z-index: 1055;
    background-color: var(--bg-card);
    border-top-left-radius: 16px;
    border-top-right-radius: 16px;
    box-shadow: 0 -4px 20px rgba(0, 0, 0, 0.5);
    max-height: 70vh;
    overflow-y: auto;
    transform: translateY(100%);
    animation: slideUp 0.25s ease forwards;
}

.mobile-offcanvas-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 16px 20px 12px;
    border-bottom: 1px solid var(--border-color);
    position: sticky;
    top: 0;
    background-color: var(--bg-card);
    z-index: 1;
}

.mobile-offcanvas-body {
    padding: 8px 12px 20px;
    padding-bottom: calc(20px + env(safe-area-inset-bottom, 0));
}

.mobile-menu-item {
    display: flex;
    align-items: center;
    gap: 14px;
    width: 100%;
    padding: 14px 16px;
    border: none;
    background: transparent;
    color: var(--text-primary);
    font-size: 0.95rem;
    font-weight: 500;
    border-radius: 10px;
    cursor: pointer;
    transition: background-color 0.15s;
    -webkit-tap-highlight-color: transparent;
}

.mobile-menu-item i {
    font-size: 1.2rem;
    width: 24px;
    text-align: center;
}

.mobile-menu-item:active {
    background-color: var(--bg-hover);
}

.mobile-menu-item-danger {
    color: var(--brand-error);
}

.mobile-menu-toggle {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 14px 16px;
    color: var(--text-primary);
    font-size: 0.95rem;
    font-weight: 500;
    border-radius: 10px;
}

.mobile-menu-toggle i {
    font-size: 1.2rem;
    width: 24px;
    text-align: center;
}

@keyframes slideUp {
    from { transform: translateY(100%); }
    to { transform: translateY(0); }
}

@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

/* ============================================
   MOBILE TOUCH TARGETS & SPACING
   ============================================ */

@media (max-width: 767.98px) {
    /* --- Touch targets: 44px minimum (Apple HIG / WCAG 2.5.8) --- */
    .btn {
        min-height: 44px;
        padding: 0.5rem 1rem;
        font-size: 0.95rem;
    }

    .btn-sm {
        min-height: 36px;
        padding: 0.35rem 0.75rem;
        font-size: 0.85rem;
    }

    .btn-lg {
        min-height: 52px;
    }

    /* Prevent iOS zoom on input focus (requires >= 16px) */
    .form-control,
    .form-select {
        min-height: 44px;
        font-size: 16px;
    }

    .form-check-input {
        width: 1.25em;
        height: 1.25em;
        margin-top: 0.15em;
    }

    /* List items need tappable height */
    .list-group-item {
        padding: 0.75rem 1rem;
        min-height: 48px;
    }

    /* Disable card hover lift on touch devices */
    .card:hover {
        transform: none;
    }

    /* Tighter card header */
    .card-header {
        padding: 0.625rem 0.875rem;
    }

    /* Modal footer buttons */
    .modal-footer .btn {
        min-height: 44px;
        padding: 0.5rem 1.25rem;
    }

    /* Modal header spacing */
    .modal-header {
        padding: 0.75rem 1rem;
    }

    /* Badge readability */
    .badge {
        padding: 0.4em 0.7em;
        font-size: 0.75rem;
    }

    /* Table breathing room */
    .table td,
    .table th {
        padding: 0.625rem 0.5rem;
        font-size: 0.875rem;
    }

    /* Alert compact padding */
    .alert {
        padding: 0.625rem 0.875rem;
        font-size: 0.9rem;
    }

    /* Tighten container side padding */
    .container-fluid {
        padding-left: 12px;
        padding-right: 12px;
    }
}

/* ============================================
   LOADING SPINNER
   ============================================ */

.loading-spinner {
    border: 4px solid var(--bg-surface);
    border-top: 4px solid var(--brand-primary);
    border-radius: 50%;
    width: 40px;
    height: 40px;
    animation: spin 1s linear infinite;
    margin: 20px auto;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* ============================================
   BLAZOR ERROR UI
   ============================================ */

#blazor-error-ui {
    background: #1a1a00;
    bottom: 0;
    box-shadow: 0 -1px 5px rgba(0,0,0,0.5);
    display: none;
    left: 0;
    padding: 0.6rem 1.25rem 0.7rem 1.25rem;
    position: fixed;
    width: 100%;
    z-index: 1000;
    color: var(--brand-primary);
}

#blazor-error-ui .dismiss {
    cursor: pointer;
    position: absolute;
    right: 0.75rem;
    top: 0.5rem;
}

/* ============================================
   GAME-SPECIFIC COMPONENTS
   ============================================ */

/* Match History - Winner/Loser specific styling */
.winner-label {
    color: var(--color-winner) !important;
}

.winner-name {
    color: var(--text-primary) !important;
}

.winner-score {
    color: var(--color-winner) !important;
}

.loser-label {
    color: var(--color-loser) !important;
}

.loser-name {
    color: var(--text-secondary) !important;
}

.loser-score {
    color: var(--color-loser) !important;
}

/* Match History - Team column specific */
.team-column .player-name.winner {
    color: var(--color-winner) !important;
    font-weight: 600 !important;
}

.team-column .player-name.loser {
    color: var(--text-secondary) !important;
}

.score-badge {
    background-color: var(--bg-surface) !important;
    color: var(--text-primary) !important;
    padding: 0.35rem 0.65rem;
    border-radius: var(--radius-sm);
    font-weight: 600;
}

.winner-score.score-badge {
    background-color: var(--brand-success-light) !important;
    color: var(--color-winner) !important;
    border: 1px solid rgba(204, 255, 0, 0.5);
}

.loser-score.score-badge {
    background-color: var(--brand-error-light) !important;
    color: var(--text-secondary) !important;
    border: 1px solid var(--border-color);
}

/* Waiting/Queue Player Cards */
.waiting-player-card {
    background-color: var(--bg-surface) !important;
    border-color: var(--border-color) !important;
}

/* Stat Cards */
.stat-card {
    background-color: var(--bg-surface) !important;
    border-color: var(--border-color) !important;
}

/* Toast Notifications */
.toast {
    background-color: var(--bg-card) !important;
    color: var(--text-primary) !important;
}

.toast-header {
    background-color: var(--bg-surface) !important;
    color: var(--text-primary) !important;
}

.toast-body {
    color: var(--text-primary) !important;
}

/* Input Group */
.input-group-text {
    background-color: var(--brand-primary) !important;
    border-color: var(--brand-primary) !important;
    color: #000000 !important;
}

/* Placeholder Text */
::placeholder {
    color: var(--text-muted) !important;
    opacity: 0.7;
}

/* Details/Summary Elements */
summary {
    color: var(--text-primary) !important;
}

details[open] summary {
    border-bottom: 1px solid var(--border-color);
}

/* min-width-0 utility */
.min-width-0 {
    min-width: 0;
}

/* ============================================
   PAGE LOADER
   ============================================ */

.page-loader-overlay {
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 60vh;
}

.page-loader-content {
    text-align: center;
}

.page-loader-spinner {
    width: 3rem;
    height: 3rem;
}
