/* --- Google Fonts Import --- */
@import url('https://fonts.googleapis.com/css2?family=Poppins:wght@400;600;700&family=Roboto:wght@400;500&display=swap');

/* --- General Styling & Dark Theme --- */
@keyframes move-background-pattern {
    from {
        background-position: 0 0;
    }
    to {
        background-position: 70.7px 70.7px;
    }
}

@keyframes hero-background-pan {
    0% { background-position: 0% 0%; background-size: 120% 120%; } /* Start slightly zoomed */
    100% { background-position: 100% 100%; background-size: 130% 130%; } /* Pan and subtle zoom */
}

@keyframes text-glow-pulse {
    0%, 100% { text-shadow: 0 0 20px rgba(0,170,255,1), 0 0 35px rgba(0,170,255,0.8); }
    50% { text-shadow: 0 0 25px rgba(0,170,255,1), 0 0 45px rgba(0,170,255,1); }
}

body {
    background-color: #1a1a1a;
    background-image: 
        repeating-linear-gradient(45deg, rgba(255,255,255,0.02) 0, rgba(255,255,255,0.02) 1px, transparent 1px, transparent 50px),
        repeating-linear-gradient(-45deg, rgba(255,255,255,0.02) 0, rgba(255,255,255,0.02) 1px, transparent 1px, transparent 50px);
    background-attachment: fixed; /* Keep background fixed during scroll */
    animation: move-background-pattern 15s linear infinite;
    color: #f0f0f0;
    font-family: 'Roboto', sans-serif;
    display: flex;
    flex-direction: column;
    min-height: 100vh;
}

main {
    flex: 1;
}

/* --- Typography --- */
h1, h2, h3, h4, h5, h6 {
    font-family: 'Poppins', sans-serif;
    font-weight: 600;
    color: #00aaff; /* A vibrant blue accent */
}

/* --- Navbar Styling --- */
.navbar {
    background-color: #2c2c2c !important;
    border-bottom: 2px solid #00aaff;
    padding: 1rem 2rem;
}

.navbar-brand {
    font-family: 'Poppins', sans-serif;
    font-weight: 700;
    font-size: 1.5rem;
    color: #00aaff !important;
}

.nav-link {
    font-family: 'Poppins', sans-serif;
    font-weight: 500;
    color: #f0f0f0 !important;
    margin: 0 10px;
    transition: color 0.3s ease, transform 0.3s ease;
    position: relative; /* For the pseudo-element */
    padding-bottom: 8px; /* Add some space for the underline */
}

@keyframes already-active-nudge {
    0%, 100% { transform: translateY(-2px) translateX(0); }
    25% { transform: translateY(-2px) translateX(-1px); }
    75% { transform: translateY(-2px) translateX(1px); }
}

.nav-link:hover, .nav-link.active {
    color: #00aaff !important;
    transform: translateY(-2px);
}

.nav-link.active:hover {
    animation: already-active-nudge 0.3s ease-in-out;
}

.nav-link::after {
    content: '';
    position: absolute;
    left: 0;
    bottom: 3px; /* Moved slightly higher */
    width: 100%;
    height: 2px;
    background-color: #00aaff;
    transform: scaleX(0);
    transform-origin: left;
    transition: transform 0.4s ease-out;
}

.nav-link:hover::after,
.nav-link.active::after {
    transform: scaleX(1);
}

/* --- Jumbotron / Hero Section --- */
.hero-section {
    background: linear-gradient(rgba(0, 0, 0, 0.4), rgba(0, 0, 0, 0.4)), url('../pictures/index.png') no-repeat center center;
    background-size: cover; /* Maintain aspect ratio */
    animation: hero-background-pan 60s linear infinite alternate; /* Slow pan */
    padding: 100px 0;
    text-align: center;
    color: white;
    border-radius: 0.5rem;
    margin-top: 2rem;
}



.hero-section h1 {
    font-size: 3.5rem;
    font-weight: 700;
    color: white;
    text-shadow: 0 0 15px rgba(0,170,255,0.8), 0 0 25px rgba(0,170,255,0.6); /* Brighter, subtle glow in accent blue */
    animation: text-glow-pulse 3s ease-in-out infinite alternate;
}

.hero-section p {
    font-size: 1.25rem;
}

/* --- Buttons --- */
.btn-primary {
    background-color: #00aaff;
    border-color: #00aaff;
    font-family: 'Poppins', sans-serif;
    font-weight: 600;
    padding: 12px 30px;
    transition: background-color 0.3s ease, transform 0.3s ease;
}

.btn-primary {
    position: relative;
    overflow: hidden;
}

.btn-primary:hover {
    background-color: #0088cc;
    border-color: #0088cc;
    transform: translateY(-3px);
}

.btn-primary::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.4), transparent);
    transition: left 0.5s;
}

.btn-primary:hover::before {
    left: 100%;
}

/* Specific styles for the search icon button */
.btn-primary.position-fixed {
    width: 60px;
    height: 60px;
    border-radius: 50%; /* Start round */
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0;
    font-size: 24px; /* Adjust icon size */
    bottom: 30px; /* Distance from bottom */
    right: 30px; /* Distance from right */
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.2);
    z-index: 1000; /* Ensure it stays on top */
    animation: wobble 1.5s ease-in-out infinite; /* New wobble animation */
    transform-origin: 50% 50%;
    /* no need for position: fixed !important; as it's already in the selector */
}

@keyframes wobble {
    0%, 100% {
        transform: rotate(0deg) scale(1);
        border-radius: 50%;
    }
    15% {
        transform: rotate(-25deg) scale(1.1);
    }
    30% {
        transform: rotate(20deg) scale(1.1);
    }
    45% {
        transform: rotate(-15deg) scale(1.1);
    }
    60% {
        transform: rotate(10deg) scale(1.1);
    }
    75% {
        transform: rotate(-5deg) scale(1.1);
    }
}

.btn-primary.position-absolute:hover {
    animation: none; /* Disable wobble on hover */
    transform: scale(1) rotate(0deg); /* Reset transform on hover */
    border-radius: 50%; /* Ensure it's round on hover */
}

.btn-primary.position-absolute svg {
    width: 24px;
    height: 24px;
}

/* Larger Modal Dialog */
.modal-dialog {
    max-width: 700px; /* Adjust as needed */
}

/* --- Cards (for Team, Shop, etc.) --- */
.card {
    background-color: #2c2c2c;
    border: 1px solid #444;
    transition: transform 0.3s ease, box-shadow 0.3s ease;
    height: 100%;
}

.card:hover {
    transform: translateY(-5px);
    box-shadow: 0 10px 20px rgba(0, 170, 255, 0.1);
}

.card-title {
    color: #00aaff;
}

.card-text {
    color: #ccc;
}

/* Homepage Feature Card Text */
.row.text-center .card p {
    color: #a9a9a9;
}

.text-muted {
    color: #a9a9a9 !important; /* Lighter gray for better readability */
}



/* Original block for rules-list */
.rules-list li {
    background-color: #2c2c2c;
    margin-bottom: 10px;
    padding: 15px;
    border-left: 4px solid #00aaff;
    border-radius: 4px;
}

/* --- Leaderboard Table Styling --- */
.leaderboard-table {
    font-family: 'Poppins', sans-serif;
    border-radius: 0.5rem;
    overflow: hidden; /* Ensures border-radius is respected by children */
    border-collapse: separate;
    border-spacing: 0;
    border: 1px solid #444;
}

.leaderboard-table thead th {
    background-color: #3a3a3a;
    color: #00aaff;
    font-weight: 600;
    font-size: 1.1rem;
    text-align: center;
}

.leaderboard-table tbody th,
.leaderboard-table tbody td {
    background-color: #2c2c2c;
    vertical-align: middle;
    text-align: center;
    border-top: 1px solid #444;
}

.leaderboard-table tbody tr:hover td,
.leaderboard-table tbody tr:hover th {
    background-color: #3c3c3c;
    color: #fff;
}

/* --- Footer --- */
.footer {
    background-color: #2c2c2c;
    color: #aaa;
    padding: 20px 0;
    text-align: center;
    margin-top: auto;
    border-top: 1px solid #444;
}

.footer a {
    /* Shimmer Effect Setup */
    background: linear-gradient(90deg, #aaa, #fff, #aaa);
    background-size: 200% auto;
    background-clip: text;
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    text-decoration: none;
    background-position: 200% center; /* Start off-screen to the right */
    transition: background-position 0.8s ease-in-out;
}

.footer a:hover {
    background-position: -200% center; /* Move to the far left */
}

/* --- Wiki Offcanvas Sidebar --- */
.offcanvas-body .list-group-item {
    background-color: transparent;
    border: none;
    color: #f0f0f0;
    border-radius: 0.25rem;
    margin-bottom: 5px;
    transition: background-color 0.2s ease, color 0.2s ease;
}

.offcanvas-body .list-group-item:hover {
    background-color: #444;
    color: #fff;
}

.offcanvas-body .list-group-item.active {
    background-color: #00aaff;
    color: #fff;
}

.offcanvas-body .list-group-submenu .list-group-item {
    padding-left: 2.5rem; /* Indent sub-items */
    font-size: 0.9rem;
}

.wiki-content.card {
    background-color: #2c2c2c;
    border: 1px solid #444;
    padding: 30px;
}

.wiki-subtitle {
    color: #ccc;
    font-size: 1.1rem;
}

.contact-info-box {
    background-color: #444;
    border: 1px solid #555;
    padding: 0.5rem 1rem;
    border-radius: 0.3rem;
    display: inline-block;
}

.text-light-bright {
    color: #ffffff;
}

.wiki-content .card-body p {
    color: #ccc;
}

.wiki-content .card-body code {
    color: #ffffff;
    background-color: #00aaff;
    padding: 2px 5px;
    border-radius: 4px;
}

/* --- Cursor Trail --- */
@keyframes fade-out-trail {
    from {
        opacity: 1;
        transform: translate(-50%, -50%) scale(1);
    }
    to {
        opacity: 0;
        transform: translate(-50%, -50%) scale(0);
    }
}

.trail-dot {
    position: fixed;
    width: 30px;
    height: 30px;
    background: rgba(255, 255, 255, 0.05);
    border-radius: 50%;
    pointer-events: none;
    z-index: 9999;
    backdrop-filter: blur(5px);
    -webkit-backdrop-filter: blur(5px);
    
    /* Apply the animation */
    animation: fade-out-trail 1s forwards;
}

/* --- Accordion (Wiki) Styling --- */
.accordion-item {
    background-color: transparent; /* Let the button/body handle it */
    border: 1px solid #444;
    margin-bottom: 10px;
    border-radius: 0.5rem;
    overflow: hidden; /* Ensures border-radius is respected by children */
}

.accordion-button {
    background-color: #333;
    color: #f0f0f0;
    font-family: 'Poppins', sans-serif;
    transition: background-color 0.3s ease;
}

.accordion-button:not(.collapsed) {
    background-color: #00aaff;
    color: #ffffff;
    box-shadow: inset 0 -1px 0 rgba(0,0,0,.125);
}

.accordion-button:hover {
    background-color: #444;
}

.accordion-button:focus {
    box-shadow: 0 0 0 0.25rem rgba(0, 170, 255, 0.25);
}

/* Customizing the Bootstrap expand/collapse icon for dark theme */
.accordion-button::after {
    filter: invert(1) grayscale(100%) brightness(200%);
}

.accordion-button:not(.collapsed)::after {
    /* On the blue background, the original white icon is fine */
    filter: none;
}

.accordion-body {
    color: #f0f0f0;
    background-image: linear-gradient(#3a3a3a, #2c2c2c);
    padding: 1.5rem;
}

.accordion-body code {
    color: #ffffff;
    background-color: #00aaff;
    padding: 2px 5px;
    border-radius: 4px;
}

@media (max-width: 767.98px) { /* Small devices (landscape phones, less than 768px) */
    .hero-section {
        padding: 50px 0; /* Reduce height on mobile */
        background-size: cover; /* Fill the box, cropping top/bottom */
        background-repeat: no-repeat;
        background-position: center; /* Center the image */
        animation: none; /* Disable animation on mobile for clarity */
    }

    .hero-section h1 {
        font-size: 1.8rem; /* Even smaller font size for mobile */
    }
}

/* --- Wiki Sidebar Dropdown Animation --- */
.offcanvas-body .list-group-item[data-bs-toggle="collapse"] .bi-chevron-down {
    transition: transform 0.35s ease;
}

.offcanvas-body .list-group-item[data-bs-toggle="collapse"][aria-expanded="true"] .bi-chevron-down {
    transform: rotate(180deg);
}

/* --- Loader --- */
#loader-wrapper {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(26, 26, 26, 0.95);
    z-index: 999999;
    display: flex;
    justify-content: center;
    align-items: center;
    transition: opacity 0.5s ease;
}

.loader {
    --size: 150px;
    --color: #00aaff;
    --glow-color: rgba(0, 170, 255, 0.5);
    
    position: relative;
    width: var(--size);
    height: var(--size);
}

.loader::before,
.loader::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    border-radius: 50%;
    border: 2px solid var(--color);
    animation: orbit 3s linear infinite;
}

.loader::before {
    width: var(--size);
    height: var(--size);
    border-top-color: transparent;
    border-bottom-color: transparent;
    box-shadow: 0 0 20px var(--glow-color);
}

.loader::after {
    width: calc(var(--size) * 0.7);
    height: calc(var(--size) * 0.7);
    border-left-color: transparent;
    border-right-color: transparent;
    animation-duration: 2s;
    animation-direction: reverse;
    box-shadow: 0 0 15px var(--glow-color);
}

.loader::first-child {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 10px;
    height: 10px;
    background-color: var(--color);
    border-radius: 50%;
    box-shadow: 0 0 30px 10px var(--glow-color);
}

@keyframes orbit {
    from {
        transform: translate(-50%, -50%) rotate(0deg);
    }
    to {
        transform: translate(-50%, -50%) rotate(360deg);
    }
}

@keyframes slide-fade-in {
    from {
        opacity: 0;
        transform: translateY(-10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.collapse.show .list-group-submenu .list-group-item {
    animation: slide-fade-in 0.5s ease forwards;
    opacity: 0; /* Start hidden */
}

/* Apply stagger delay */
.collapse.show .list-group-submenu .list-group-item:nth-child(1) { animation-delay: 0.05s; }
.collapse.show .list-group-submenu .list-group-item:nth-child(2) { animation-delay: 0.1s; }
.collapse.show .list-group-submenu .list-group-item:nth-child(3) { animation-delay: 0.15s; }
.collapse.show .list-group-submenu .list-group-item:nth-child(4) { animation-delay: 0.2s; }
.collapse.show .list-group-submenu .list-group-item:nth-child(5) { animation-delay: 0.25s; }
.collapse.show .list-group-submenu .list-group-item:nth-child(6) { animation-delay: 0.3s; }
.collapse.show .list-group-submenu .list-group-item:nth-child(7) { animation-delay: 0.35s; }
.collapse.show .list-group-submenu .list-group-item:nth-child(8) { animation-delay: 0.4s; }
.collapse.show .list-group-submenu .list-group-item:nth-child(9) { animation-delay: 0.45s; }

/* --- Wiki Offcanvas Item Scanner Animation --- */
@keyframes scanner-wipe {
  0% {
    left: 0;
    width: 2px;
    opacity: 0.7;
  }
  40% {
    opacity: 1;
  }
  100% {
    left: 100%;
    width: 20px; /* Bar expands as it moves */
    opacity: 0;
  }
}

@keyframes text-focus-in {
  0% {
    filter: blur(4px);
    opacity: 0;
  }
  100% {
    filter: blur(0);
    opacity: 1;
  }
}

.list-group-item.play-scanner-animation {
  position: relative; /* For pseudo-element positioning */
  overflow: hidden; /* Hide scanner bar overflow */
  opacity: 0; /* Start invisible */
  animation: text-focus-in 0.6s cubic-bezier(0.550, 0.085, 0.680, 0.530) forwards;
}


.list-group-item.play-scanner-animation::after {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  height: 100%;
  width: 2px;
  background: rgba(0, 170, 255, 0.8);
  box-shadow: 0 0 5px #00aaff, 0 0 10px #00aaff;
  animation: scanner-wipe 0.6s cubic-bezier(0.550, 0.085, 0.680, 0.530) forwards;
}

/* --- Modal Styles --- */
.modal-content {
    background-color: #2c2c2c;
    border: 1px solid #444;
    position: relative;
    /* overflow: hidden; Removed to allow dropdown to extend */
}

/* --- Autocomplete Suggestions --- */
#player-search-form {
    position: relative; /* Provide positioning context for absolute children */
}

.autocomplete-suggestions {
    display: none;
    position: absolute;
    background-color: #3a3a3a;
    border: 1px solid #444;
    border-radius: 0.25rem;
    z-index: 1060; /* Higher than modal's z-index */
    width: 100%;
    max-height: 250px;
    overflow-y: auto;
    top: 100%;
    left: 0;
}


.suggestion-item {
    padding: 0.5rem 1rem;
    color: #f0f0f0;
    cursor: pointer;
}

.suggestion-item:hover {
    background-color: #4f4f4f;
}

/* --- Modal Animations --- */
@keyframes slide-down-fade-in {
    from {
        opacity: 0;
        transform: translateY(-100px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.modal.fade .modal-dialog {
    transform: translateY(-100px);
    transition: transform 0.5s ease-out;
}

.modal.show .modal-dialog {
    transform: translateY(0);
}

#player-search-input:focus {
    border-color: #00aaff;
    box-shadow: 0 0 0 0.25rem rgba(0, 170, 255, 0.25);
    transition: border-color 0.3s ease, box-shadow 0.3s ease;
}

@keyframes fade-in-slow {
    from {
        opacity: 0;
    }
    to {
        opacity: 1;
    }
}

#player-search-results .card {
    animation: fade-in-slow 1s ease;
}

/* --- Changelog Styling --- */
#changelog-content .list-group-item {
    background-color: #2c2c2c !important;
    color: #f0f0f0 !important;
    border: none; /* Remove general border */
    margin-bottom: 10px; /* Add margin for spacing between items */
    padding: 15px; /* Add padding inside the item */
    border-radius: 4px; /* Add border-radius for rounded corners */
}

#changelog-content .list-group-item.list-group-item-addition {
    border-left: 5px solid #28a745; /* Green for additions */
}

#changelog-content .list-group-item.list-group-item-removal {
    border-left: 5px solid #dc3545; /* Red for removals */
}

/* --- Chart Legend Styling --- */
.chart-legend-list {
    padding: 0;
    list-style: none;
    margin-top: 20px;
}

.chart-legend-list li {
    display: flex;
    align-items: center;
    margin-bottom: 8px;
    font-size: 1.1rem;
    color: #f0f0f0; /* Ensure text color matches theme */
}

.chart-legend-list li span:first-child { /* Color box */
    width: 18px;
    height: 18px;
    border-radius: 4px;
    margin-right: 10px;
}




