/* World Fantasy Play - Dream11 Inspired Theme */
:root {
    --primary-red: #d1141b;
    --primary-red-hover: #b00e15;
    --dark-bg: #111111;
    --card-bg: #1e1e1e;
    --text-primary: #ffffff;
    --text-secondary: #aaaaaa;
    --accent-blue: #375ee3;
    --accent-green: #00c04b;
    --accent-gold: #ffd700;
    --border-color: #333333;

    /* Aliases for legacy/specific file usage */
    --d11-card-bg: var(--card-bg);
    --d11-card-border: var(--border-color);
    --d11-text-primary: var(--text-primary);
    --d11-text-muted: var(--text-secondary);
}

/* Utilities from live-points.php */
.text-gold {
    color: var(--accent-gold) !important;
}

.text-success {
    color: var(--accent-green) !important;
}

.text-info {
    color: var(--accent-blue) !important;
}

.badge-gold {
    background-color: var(--accent-gold);
    color: #000;
}

.badge-info {
    background-color: var(--accent-blue);
    color: #fff;
}

.badge-live {
    background-color: var(--primary-red);
    color: #fff;
    animation: pulse 2s infinite;
}

.badge-success {
    background-color: var(--accent-green);
    color: #fff;
}

@keyframes pulse {
    0% {
        opacity: 1;
    }

    50% {
        opacity: 0.6;
    }

    100% {
        opacity: 1;
    }
}

.points-positive {
    color: var(--accent-green) !important;
    font-weight: bold;
}

.points-negative {
    color: var(--primary-red) !important;
    font-weight: bold;
}

.points-zero {
    color: var(--text-secondary) !important;
}

body {
    background-color: var(--dark-bg);
    color: var(--text-primary);
    font-family: 'Inter', sans-serif;
    -webkit-font-smoothing: antialiased;
}

/* Navbar */
.navbar {
    background-color: #000000;
    border-bottom: 1px solid var(--border-color);
}

.navbar-brand {
    font-weight: 700;
    color: var(--primary-red) !important;
}

.nav-link {
    color: var(--text-secondary) !important;
    font-weight: 500;
    transition: color 0.2s;
}

.nav-link:hover,
.nav-link.active {
    color: var(--primary-red) !important;
}

/* Cards */
.card {
    background-color: var(--card-bg);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    margin-bottom: 1rem;
}

.card-header {
    background-color: rgba(255, 255, 255, 0.05);
    border-bottom: 1px solid var(--border-color);
    color: var(--text-primary);
}

.card-body {
    color: var(--text-primary);
}

.text-muted {
    color: var(--text-secondary) !important;
}

/* Buttons */
.btn-primary {
    background-color: var(--primary-red);
    border-color: var(--primary-red);
    color: white;
    font-weight: 600;
}

.btn-primary:hover,
.btn-primary:active,
.btn-primary:focus {
    background-color: var(--primary-red-hover);
    border-color: var(--primary-red-hover);
}

.btn-outline-primary {
    color: var(--primary-red);
    border-color: var(--primary-red);
}

.btn-outline-primary:hover {
    background-color: var(--primary-red);
    border-color: var(--primary-red);
    color: white;
}

.btn-success {
    background-color: var(--accent-green);
    border-color: var(--accent-green);
    color: white;
    /* Ensure text is readable */
}

/* Tables */
.table {
    color: var(--text-primary);
    --bs-table-bg: transparent;
    /* Fix bootstrap override */
}

.table-hover tbody tr:hover {
    color: var(--text-primary);
    background-color: rgba(255, 255, 255, 0.05);
}

.table-light {
    background-color: #2a2a2a;
    color: var(--text-primary);
    --bs-table-bg: #2a2a2a;
    /* Fix bootstrap override */
    border-color: var(--border-color);
}

/* List Groups */
.list-group-item {
    background-color: var(--card-bg);
    border-color: var(--border-color);
    color: var(--text-primary);
}

.list-group-item:hover {
    background-color: rgba(255, 255, 255, 0.05);
}

/* Modal */
.modal-content {
    background-color: var(--card-bg);
    border: 1px solid var(--border-color);
    color: var(--text-primary);
}

.modal-header,
.modal-footer {
    border-color: var(--border-color);
}

.btn-close {
    filter: invert(1) grayscale(100%) brightness(200%);
}

/* Forms */
.form-control,
.form-select {
    background-color: #000000;
    border-color: var(--border-color);
    color: var(--text-primary);
}

.form-control:focus,
.form-select:focus {
    background-color: #000000;
    border-color: var(--primary-red);
    color: var(--text-primary);
    box-shadow: 0 0 0 0.25rem rgba(209, 20, 27, 0.25);
}

/* Tabs */
.nav-tabs .nav-link {
    color: var(--text-secondary);
    border: none;
    border-bottom: 2px solid transparent;
}

.nav-tabs .nav-link.active {
    background-color: transparent;
    border-color: var(--primary-red);
    color: var(--primary-red);
}

.nav-tabs .nav-link:hover {
    border-color: transparent;
    /* Prevent grey hover border */
    color: var(--primary-red);
}

/* Badges */
.badge.bg-light {
    background-color: #333333 !important;
    color: var(--text-primary) !important;
    border: 1px solid #444444 !important;
}

/* Progress Bars */
.progress {
    background-color: #333333;
}

/* ============================================
   COMPREHENSIVE DARK THEME OVERRIDES
   Fixes all Bootstrap light-themed classes
   that cause invisible text on dark backgrounds
   ============================================ */

/* --- Global Text Color Overrides --- */
body,
p,
span,
div,
label,
li,
td,
th,
dt,
dd,
small,
strong,
em,
blockquote {
    color: #ffffff;
}

h1,
h2,
h3,
h4,
h5,
h6 {
    color: #ffffff !important;
}

/* --- Bootstrap .text-* overrides --- */
.text-dark {
    color: #ffffff !important;
}

.text-body {
    color: #ffffff !important;
}

.text-black {
    color: #ffffff !important;
}

.text-black-50 {
    color: rgba(255, 255, 255, 0.5) !important;
}

.text-secondary {
    color: var(--text-secondary) !important;
}

/* --- Background overrides --- */
.bg-white {
    background-color: var(--card-bg) !important;
    color: #ffffff !important;
}

.bg-light {
    background-color: #2a2a2a !important;
    color: #ffffff !important;
}

.bg-body {
    background-color: var(--dark-bg) !important;
}

.bg-body-secondary {
    background-color: var(--card-bg) !important;
}

/* --- Card specific overrides --- */
.card {
    color: #ffffff;
}

.card-header.bg-white,
.card-header.bg-light {
    background-color: rgba(255, 255, 255, 0.05) !important;
    color: #ffffff !important;
}

.card-title {
    color: #ffffff !important;
}

.card-subtitle {
    color: var(--text-secondary) !important;
}

.card-text {
    color: #ffffff;
}

.card-footer {
    background-color: rgba(255, 255, 255, 0.03);
    border-top: 1px solid var(--border-color);
    color: #ffffff;
}

/* --- Table overrides --- */
.table {
    --bs-table-color: #ffffff;
    --bs-table-bg: transparent;
    --bs-table-border-color: var(--border-color);
    --bs-table-striped-color: #ffffff;
    --bs-table-striped-bg: rgba(255, 255, 255, 0.03);
    --bs-table-hover-color: #ffffff;
    --bs-table-hover-bg: rgba(255, 255, 255, 0.05);
}

.table-light,
.table-light>th,
.table-light>td {
    background-color: #2a2a2a !important;
    color: #ffffff !important;
    --bs-table-bg: #2a2a2a !important;
    --bs-table-color: #ffffff !important;
    border-color: var(--border-color) !important;
}

.table-striped>tbody>tr:nth-of-type(odd)>* {
    --bs-table-striped-bg: rgba(255, 255, 255, 0.03);
    color: #ffffff;
}

.table-bordered {
    --bs-table-border-color: var(--border-color);
}

thead,
thead th,
thead td {
    color: #ffffff !important;
}

tbody td {
    color: #ffffff;
    border-color: var(--border-color);
}

/* --- Dropdown overrides --- */
.dropdown-menu {
    background-color: var(--card-bg);
    border: 1px solid var(--border-color);
    color: #ffffff;
}

.dropdown-item {
    color: #ffffff;
}

.dropdown-item:hover,
.dropdown-item:focus {
    background-color: rgba(255, 255, 255, 0.1);
    color: #ffffff;
}

.dropdown-divider {
    border-color: var(--border-color);
}

/* --- Pagination overrides --- */
.page-link {
    background-color: var(--card-bg);
    border-color: var(--border-color);
    color: #ffffff;
}

.page-link:hover {
    background-color: rgba(255, 255, 255, 0.1);
    border-color: var(--border-color);
    color: var(--primary-red);
}

.page-item.active .page-link {
    background-color: var(--primary-red);
    border-color: var(--primary-red);
    color: #ffffff;
}

.page-item.disabled .page-link {
    background-color: #1a1a1a;
    border-color: var(--border-color);
    color: #666666;
}

/* --- Breadcrumb overrides --- */
.breadcrumb {
    background-color: transparent;
}

.breadcrumb-item a {
    color: var(--primary-red);
}

.breadcrumb-item.active {
    color: var(--text-secondary);
}

.breadcrumb-item+.breadcrumb-item::before {
    color: var(--text-secondary);
}

/* --- Accordion overrides --- */
.accordion-item {
    background-color: var(--card-bg);
    border-color: var(--border-color);
    color: #ffffff;
}

.accordion-button {
    background-color: var(--card-bg);
    color: #ffffff;
    border-color: var(--border-color);
}

.accordion-button:not(.collapsed) {
    background-color: rgba(255, 255, 255, 0.05);
    color: #ffffff;
}

.accordion-body {
    background-color: var(--card-bg);
    color: #ffffff;
}

/* --- Input Group overrides --- */
.input-group-text {
    background-color: #2a2a2a;
    border-color: var(--border-color);
    color: #ffffff;
}

/* --- Nav Pills overrides --- */
.nav-pills .nav-link {
    color: var(--text-secondary);
}

.nav-pills .nav-link.active {
    background-color: var(--primary-red);
    color: #ffffff;
}

/* --- Popover / Tooltip --- */
.popover {
    background-color: var(--card-bg);
    border-color: var(--border-color);
    color: #ffffff;
}

.popover-header {
    background-color: rgba(255, 255, 255, 0.05);
    color: #ffffff;
    border-color: var(--border-color);
}

.popover-body {
    color: #ffffff;
}

.tooltip-inner {
    background-color: var(--card-bg);
    color: #ffffff;
}

/* --- Borders --- */
.border {
    border-color: var(--border-color) !important;
}

.border-top,
.border-bottom,
.border-start,
.border-end {
    border-color: var(--border-color) !important;
}

/* --- Shadow override for dark theme --- */
.shadow-sm {
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.3) !important;
}

.shadow {
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.4) !important;
}

/* --- Misc text visibility fixes --- */
.fw-bold,
.fw-semibold,
.fw-medium {
    color: inherit;
}

.lead {
    color: var(--text-secondary);
}

.figure-caption {
    color: var(--text-secondary);
}

/* Ensure all heading sizes stay white */
.h1,
.h2,
.h3,
.h4,
.h5,
.h6 {
    color: #ffffff !important;
}

/* Fix any remaining Bootstrap bg-* text issues */
.bg-light *,
.bg-white * {
    color: #ffffff;
}

/* Close buttons visible on dark backgrounds */
.btn-close {
    filter: invert(1) grayscale(100%) brightness(200%);
}

/* ============================================
   PREMIUM UI/UX ENHANCEMENTS
   Smooth animations, glassmorphism, micro-interactions
   ============================================ */

/* --- Page Load Animation --- */
@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(20px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes fadeIn {
    from {
        opacity: 0;
    }

    to {
        opacity: 1;
    }
}

@keyframes slideInRight {
    from {
        opacity: 0;
        transform: translateX(30px);
    }

    to {
        opacity: 1;
        transform: translateX(0);
    }
}

@keyframes scaleIn {
    from {
        opacity: 0;
        transform: scale(0.95);
    }

    to {
        opacity: 1;
        transform: scale(1);
    }
}

body {
    animation: fadeIn 0.4s ease-out;
}

/* Staggered card animations */
.card {
    animation: fadeInUp 0.5s ease-out both;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.row .col-md-6:nth-child(1) .card,
.row .col-lg-4:nth-child(1) .card,
.row .col-md-4:nth-child(1) .card {
    animation-delay: 0.05s;
}

.row .col-md-6:nth-child(2) .card,
.row .col-lg-4:nth-child(2) .card,
.row .col-md-4:nth-child(2) .card {
    animation-delay: 0.1s;
}

.row .col-md-6:nth-child(3) .card,
.row .col-lg-4:nth-child(3) .card,
.row .col-md-4:nth-child(3) .card {
    animation-delay: 0.15s;
}

.row .col-md-6:nth-child(4) .card,
.row .col-lg-4:nth-child(4) .card {
    animation-delay: 0.2s;
}

.row .col-md-6:nth-child(5) .card,
.row .col-lg-4:nth-child(5) .card {
    animation-delay: 0.25s;
}

.row .col-md-6:nth-child(6) .card,
.row .col-lg-4:nth-child(6) .card {
    animation-delay: 0.3s;
}

/* --- Glassmorphism Navbar --- */
.navbar {
    background: rgba(0, 0, 0, 0.85) !important;
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border-bottom: 1px solid rgba(255, 255, 255, 0.08);
    transition: all 0.3s ease;
}

/* --- Enhanced Card Hover Effects --- */
.card:hover {
    transform: translateY(-4px);
    box-shadow: 0 12px 40px rgba(0, 0, 0, 0.4),
        0 0 0 1px rgba(255, 255, 255, 0.05);
}

.match-card:hover {
    transform: translateY(-6px) !important;
    box-shadow: 0 16px 48px rgba(209, 20, 27, 0.15),
        0 0 0 1px rgba(209, 20, 27, 0.2) !important;
}

/* --- Smooth Button Effects --- */
.btn {
    transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
    position: relative;
    overflow: hidden;
}

.btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.3);
}

.btn:active {
    transform: translateY(0) scale(0.98);
}

.btn-primary {
    background: linear-gradient(135deg, #d1141b, #a00e13);
    box-shadow: 0 2px 8px rgba(209, 20, 27, 0.3);
}

.btn-primary:hover {
    background: linear-gradient(135deg, #e52028, #b00e15);
    box-shadow: 0 6px 20px rgba(209, 20, 27, 0.4);
}

.btn-success {
    background: linear-gradient(135deg, #00c04b, #009e3d);
    box-shadow: 0 2px 8px rgba(0, 192, 75, 0.3);
}

.btn-success:hover {
    box-shadow: 0 6px 20px rgba(0, 192, 75, 0.4);
}

/* --- Badge Animations --- */
.badge {
    transition: all 0.2s ease;
}

.badge:hover {
    transform: scale(1.05);
}

.badge.bg-danger {
    animation: pulse 2s infinite;
}

/* --- Smooth Tab Transitions --- */
.tab-content>.tab-pane {
    transition: opacity 0.2s ease-in-out;
}

.nav-tabs .nav-link {
    transition: all 0.3s ease;
    position: relative;
}

.nav-tabs .nav-link::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 50%;
    width: 0;
    height: 2px;
    background: var(--primary-red);
    transition: all 0.3s ease;
    transform: translateX(-50%);
}

.nav-tabs .nav-link:hover::after,
.nav-tabs .nav-link.active::after {
    width: 100%;
}

/* --- Table Row Animations --- */
.table tbody tr {
    transition: all 0.2s ease;
}

.table-hover tbody tr:hover {
    background-color: rgba(255, 255, 255, 0.05);
    transform: scale(1.005);
}

/* --- Form Input Focus Effects --- */
.form-control,
.form-select {
    transition: all 0.3s ease;
}

.form-control:focus,
.form-select:focus {
    transform: scale(1.01);
    box-shadow: 0 0 0 3px rgba(209, 20, 27, 0.15),
        0 4px 12px rgba(0, 0, 0, 0.2);
}

/* --- Player Card Selection Effect --- */
.player-card {
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1) !important;
}

.player-card:hover {
    transform: translateY(-4px) scale(1.02);
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.3);
}

.player-card.selected {
    animation: scaleIn 0.2s ease-out;
    box-shadow: 0 0 20px rgba(209, 20, 27, 0.3);
}

/* --- Loading Skeleton Animation --- */
@keyframes shimmer {
    0% {
        background-position: -200% 0;
    }

    100% {
        background-position: 200% 0;
    }
}

.skeleton {
    background: linear-gradient(90deg,
            rgba(255, 255, 255, 0.05) 25%,
            rgba(255, 255, 255, 0.1) 50%,
            rgba(255, 255, 255, 0.05) 75%);
    background-size: 200% 100%;
    animation: shimmer 1.5s infinite;
    border-radius: 4px;
}

/* --- Smooth Scrollbar --- */
* {
    scroll-behavior: smooth;
}

/* --- Alert Animations --- */
.alert {
    animation: slideInRight 0.4s ease-out;
}

/* --- Progress Bar Enhancement --- */
.credits-bar {
    position: relative;
    overflow: hidden;
}

.credits-fill {
    transition: width 0.4s cubic-bezier(0.4, 0, 0.2, 1) !important;
    position: relative;
}

.credits-fill::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: linear-gradient(90deg,
            transparent,
            rgba(255, 255, 255, 0.2),
            transparent);
    animation: shimmer 2s infinite;
    background-size: 200% 100%;
}

/* --- Floating Action Glow --- */
.btn-primary.w-100 {
    position: relative;
}

.btn-primary.w-100:not(:disabled)::before {
    content: '';
    position: absolute;
    inset: -2px;
    border-radius: inherit;
    background: linear-gradient(135deg, #d1141b, #ff4444, #d1141b);
    z-index: -1;
    filter: blur(8px);
    opacity: 0.5;
    animation: pulse 3s infinite;
}

/* --- Avatar Circle Glow --- */
.avatar-circle {
    transition: all 0.3s ease;
}

.avatar-circle:hover {
    box-shadow: 0 0 12px rgba(209, 20, 27, 0.3);
}

/* --- Responsive Improvements --- */
@media (max-width: 768px) {
    .container-fluid {
        padding: 0.75rem;
    }

    .card {
        border-radius: 10px;
    }

    h4,
    h5 {
        font-size: 1.1rem;
    }

    .btn-sm {
        font-size: 0.8rem;
        padding: 0.3rem 0.6rem;
    }
}

/* --- Smooth Image Loading --- */
img {
    transition: opacity 0.3s ease;
}

img[loading="lazy"] {
    opacity: 0;
}

img.loaded {
    opacity: 1;
}

/* --- Custom Selection Color --- */
::selection {
    background: rgba(209, 20, 27, 0.3);
    color: #ffffff;
}

/* --- Focus Visible for Accessibility --- */
:focus-visible {
    outline: 2px solid var(--primary-red);
    outline-offset: 2px;
}