/* Setting base variables */
:root {
    --primary: #2D5A27;
    --secondary: #606C38;
    --accent: #DDA15E;
    --bg-color: #FEFAE0;
    --text-color: #283618;
    --white: #ffffff;
    --bs-primary: var(--primary);
    --bs-primary-rgb: 45, 90, 39;
    --primary-glow: rgba(45, 90, 39, 0.25);
}

/* Bootstrap button overrides */
.btn-primary {
    --bs-btn-bg: var(--primary);
    --bs-btn-border-color: var(--primary);
    --bs-btn-hover-bg: #23471f;
    --bs-btn-hover-border-color: #1e7e34;
    --bs-btn-active-bg: #1e7e34;
}

.btn-outline-primary {
    --bs-btn-color: var(--primary);
    --bs-btn-border-color: var(--primary);
    --bs-btn-hover-bg: var(--primary);
    --bs-btn-hover-border-color: var(--primary);
    --bs-btn-active-bg: var(--primary);
}

body {
    background-color: var(--bg-color);
    color: var(--text-color);
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
}

/* Navbar overrides */
.navbar-custom {
    background-color: var(--primary);
    border-bottom: 4px solid var(--secondary);
}

/* Button Styling */
.btn-primary {
    background-color: var(--primary);
    border-color: var(--primary);
    color: var(--white);
    font-weight: 600;
}

    .btn-primary:hover {
        background-color: var(--secondary);
        border-color: var(--secondary);
    }

.btn-accent {
    background-color: var(--accent);
    color: var(--white);
    border: none;
}

/* Dashboard Cards */
.card {
    position: relative;
    border: none;
    border-radius: 12px;
    box-shadow: 0 4px 6px rgba(0,0,0,0.05);
}

/* Progress Bar */
.progress {
    background-color: #e9ecef;
    border-radius: 10px;
}

.progress-bar {
    background-color: var(--primary);
}

/* Stats Table Styling */
.stats-table-card {
    background: white;
    border-radius: 12px;
    overflow: visible !important; /* was hidden, if something broke FIND THIS*/
    height: 100%;
}

.stats-table {
    table-layout: fixed;
    width: 100%;
}

.stats-table td:nth-child(2) {
    width: auto;
    overflow: hidden;
}

    .stats-table thead th {
        font-size: 0.75rem;
        text-transform: uppercase;
        letter-spacing: 0.05em;
        color: #6c757d; /*darkish grey*/
        cursor: pointer;
        background: #f8f9fa; /*off white*/
        border-top: none;
    }

.stats-table td {
    vertical-align: middle;
    font-size: 0.9rem;
    padding: 10px 6px;
}

.stat-rank {
    width: 40px;
    font-weight: bold;
    color: #adb5bd; /*grey*/
}

.stat-icon {
    width: 45px;
}

    .stat-icon img, .stat-icon span {
        width: 32px;
        height: 32px;
        object-fit: cover;
        border-radius: 4px;
    }

.stat-value {
    text-align: right;
    font-family: 'Monaco', 'Consolas', monospace;
    font-weight: 600;
}

.stat-placeholder-flag {
    background: #e9ecef; /*off white*/
    display: inline-flex;
    align-items: center;
    justify-content: center;
    color: #6c757d; /*darkish grey*/
}

/* Link styles */
.artist-link {
    color: var(--bs-dark);
    transition: color 0.2s;
}

    .artist-link:hover {
        color: var(--primary) !important;
        text-decoration: underline !important;
    }

.album-link {
    color: var(--bs-dark);
    transition: color 0.2s;
}

    .album-link:hover {
        color: var(--primary) !important;
        text-decoration: underline !important;
    }

.track-link {
    color: var(--bs-dark);
    transition: color 0.2s;
}

    .track-link:hover {
        color: var(--primary) !important;
        text-decoration: underline !important;
    }

.view-full-btn {
    display: block;
    width: 100%;
    text-align: center;
    padding: 10px;
    font-size: 0.8rem;
    font-weight: bold;
    color: var(--primary);
    text-decoration: none;
    border-top: 1px solid #f0f0f0; /*darkish white*/
    transition: background 0.2s;
}

    .view-full-btn:hover {
        background: #f8f9fa; /*less darkish white*/
    }

/* Dropdown style */
.form-check-input:checked {
    background-color: var(--primary);
    border-color: var(--primary);
}

.form-check-input:focus {
    border-color: var(--primary);
    outline: 0;
    box-shadow: 0 0 0 0.25rem var(--primary-glow); /*rgba(45, 90, 39, 0.25); */
}

.form-check-input:checked[type="checkbox"] {
    filter: none;
}

.form-select:focus {
    border-color: var(--primary);
    outline: 0;
    box-shadow: 0 0 0 0.25rem rgba(40, 167, 69, 0.25); /*light green but transparent*/
}

.dropdown-item.active, .dropdown-item:active {
    background-color: var(--primary);
    color: white;
}

.dropdown-item:hover {
    background-color: rgba(40, 167, 69, 0.1); /*light green but transparent*/
    color: var(--primary);
}

.btn-outline-secondary.dropdown-toggle:hover,
.btn-outline-secondary.dropdown-toggle:focus,
.show > .btn-outline-secondary.dropdown-toggle {
    background-color: var(--primary);
    border-color: var(--primary);
    color: white;
}

/* Stat pill styling */
.stat-pill {
    background: #f8f9fa; /*light white*/
    border: 1px solid #dee2e6; /*light grey*/
    padding: 10px 20px;
    border-radius: 12px;
    min-width: 120px;
}

    .stat-pill small {
        display: block;
        font-size: 0.7rem;
        font-weight: 800;
        color: #6c757d;
        letter-spacing: 1px;
    }

    .stat-pill strong {
        font-size: 1.4rem;
        color: var(--bs-dark);
    }

/* Artist page styling */
.artist-header-flag {
    font-size: 6rem;
    line-height: 1;
    display: block;
}

/* Rotate chevron when the parent header is expanded */
.album-header-toggle .collapse-chevron {
    transition: transform 0.3s ease;
}

.album-header-toggle[aria-expanded="true"] .collapse-chevron {
    transform: rotate(180deg);
}

/* Faint hover effect on the header to signal it's clickable */
.album-header-toggle:hover {
    background-color: #fcfcfc !important;
}

    .album-header-toggle:hover h5 {
        color: var(--primary);
    }

/* Custom Primary Card Header */
.stats-header-primary {
    background-color: var(--primary) !important;
    color: white !important;
    border-bottom: none !important;
    position: relative;
    overflow: visible !important;
}

/* The Smart Hover Effect */
.stats-table tbody tr:hover td {
    background-color: rgba(0, 0, 0, 0.04) !important;
    transition: background-color 0.15s ease;
}

/* Make the specific text bolder on hover for focus */
.stats-table tbody tr:hover .stat-rank,
.stats-table tbody tr:hover .stat-value {
    color: var(--primary) !important;
    font-weight: bold;
}

@media (max-width: 768px) {
    .display-4 {
        font-size: 2.5rem; /* Shrink the header a bit for phones */
    }
}

/* Might be unneccesary duplication but my CSS is shoddy so leaving it to be safe */
/* Rotate the chevron based on the 'show' class of the collapse element */
.card:has(.collapse.show) .collapse-chevron {
    transform: rotate(180deg);
}

/* Fallback if your browser doesn't support :has */
.collapse.show + .album-header-toggle .collapse-chevron {
    transform: rotate(180deg);
}

/* Pill link effects */
.year-link {
    transition: all 0.2s ease;
    cursor: pointer;
}

    .year-link:hover {
        background-color: var(--primary) !important;
        color: white !important;
        border-color: var(--primary) !important;
        transform: translateY(-1px);
        box-shadow: 0 2px 4px rgba(0,0,0,0.1);
    }

/* Flag Hover Effect */
.country-link .fi {
    transition: transform 0.2s ease, filter 0.2s ease;
    display: inline-block; /* Required for transform to work correctly */
}

.country-link:hover .fi {
    transform: scale(1.2);
    filter: brightness(1.1);
    z-index: 10; /* Ensures the scaled flag sits above others nearby */
}

.album-header-toggle .text-muted {
    font-family: 'Monaco', 'Consolas', monospace;
}

/* Make the year in the header look like a clickable link */
.year-dropdown-btn {
    font-size: inherit; /* Inherit display-4 size */
    line-height: inherit;
    vertical-align: baseline;
    transition: opacity 0.2s, transform 0.2s;
}

    .year-dropdown-btn:hover {
        opacity: 0.8;
        transform: translateY(-2px);
        color: var(--accent) !important; /* Highlights with theme amber */
    }

    /* Style the dropdown menu to match the dark green theme */
    .year-dropdown-btn + .dropdown-menu {
        background-color: var(--white);
        border-radius: 12px;
    }

        .year-dropdown-btn + .dropdown-menu .dropdown-item:hover {
            background-color: var(--primary);
            color: white;
        }

        .year-dropdown-btn + .dropdown-menu .dropdown-item.active {
            background-color: var(--secondary);
            font-weight: bold;
        }

    .year-dropdown-btn::after {
        margin-left: 0.5rem;
        vertical-align: middle;
        opacity: 0.5;
    }

    /* Add glow to the year dropdown so it feels interactive */
    .year-dropdown-btn:focus {
        box-shadow: none;
        color: var(--accent) !important;
    }


/* Home Page */
/* Glass effect for the stats boxes */
.bg-opacity-10 {
    background-color: rgba(255, 255, 255, 0.1) !important;
    backdrop-filter: blur(5px);
}

/* Add this to the row containing your stat boxes in index.html */
.stats-floating-row {
    position: relative;
    z-index: 10;
    margin-bottom: -120px; /* Pulls the stats down so they sit on the transition */
    transform: translateY(60px);
}

.hero-section {
    position: relative;
    /* deep forest mesh gradient */
    background-color: #1a3a17;
    background-image: radial-gradient(at 0% 0%, hsla(125,40%,20%,1) 0, transparent 50%), radial-gradient(at 100% 0%, hsla(130,45%,25%,1) 0, transparent 50%);
    padding: 40px 0 70px 0;
    color: white;
    border-radius: 60px;
    width: 96%;
    margin: 10px auto 50px auto; /* 10px from navbar, centered, 50px from bottom content */

    overflow: hidden;
    box-shadow: 0 15px 40px rgba(0,0,0,0.2);
    border: 1px solid rgba(255, 255, 255, 0.05); /* Very faint border to catch highlights */
}

    /* Subtle "Data Beam" at the bottom */
    .hero-section::after {
        content: "";
        position: absolute;
        bottom: 0;
        left: 15%;
        right: 15%;
        height: 2px;
        background: linear-gradient(to right, transparent, var(--accent), transparent);
        opacity: 0.3;
        filter: blur(1px);
    }

    /* Grit Pattern */
    .hero-section::before {
        content: "";
        position: absolute;
        top: 0;
        left: 0;
        right: 0;
        bottom: 0;
        background-image: url("data:image/svg+xml,%3Csvg width='60' height='60' viewBox='0 0 60 60' xmlns='http://www.w3.org/2000/svg'%3E%3Cg fill='none' fill-rule='evenodd'%3E%3Cg fill='%23ffffff' fill-opacity='0.015'%3E%3Cpath d='M36 34v-4h-2v4h-4v2h4v4h2v-4h4v-2h-4zm0-30V0h-2v4h-4v2h4v4h2V6h4V4h-4zM6 34v-4H4v4H0v2h4v4h2v-4h4v-2H6zM6 4V0H4v4H0v2h4v4h2V6h4V4H6z'/%3E%3C/g%3E%3C/g%3E%3C/svg%3E");
        pointer-events: none;
        z-index: 1;
    }

/* Stats Ribbon */
.stats-ribbon {
    display: inline-flex;
    background: rgba(255, 255, 255, 0.06);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 40px;
    padding: 8px 25px;
    margin-bottom: 25px;
    z-index: 2;
    position: relative;
}

.stat-group {
    padding: 2px 12px;
}

    .stat-group small {
        display: block;
        text-transform: uppercase;
        font-size: 0.55rem;
        font-weight: 800;
        letter-spacing: 2px;
        opacity: 0.5;
        margin-bottom: -2px;
    }

    .stat-group strong {
        font-size: 1.1rem;
        font-family: 'Courier New', Courier, monospace;
    }

.stat-divider {
    width: 1px;
    height: 20px;
    background: rgba(255, 255, 255, 0.1);
}


/* Mobile adjustments */
@media (max-width: 768px) {
    .hero-section {
        border-bottom-left-radius: 40px;
        border-bottom-right-radius: 40px;
        padding: 40px 0 60px 0;
    }

    .stats-ribbon {
        flex-wrap: wrap;
        border-radius: 20px;
        padding: 15px;
    }

    .stat-divider {
        display: none;
    }
}

/* The wrapper inside the TD that provides the anchor */
.cell-action-wrapper {
    position: relative;
    display: block; /* Ensures it takes up the full width of the cell */
    width: 100%;
}

/* Report Button for Match Fix */
.report-match-btn {
    position: absolute;
    top: 50%;
    right: 0;
    transform: translateY(-50%);
    visibility: hidden;
    opacity: 0;
    transition: all 0.2s ease;
    color: var(--bs-gray-400);
    padding: 0;
    line-height: 1;
    cursor: pointer;
    z-index: 10;
    border: none;
    background: transparent;
}

/* When hovering over the cell wrapper, show the button */
.cell-action-wrapper:hover .report-match-btn {
    visibility: visible;
    opacity: 1;
}

.report-match-btn:hover {
    color: var(--accent) !important;
    transform: translateY(-50%) scale(1.3);
}

.ps-4 .bi {
    width: 18px; /* Fixed width ensures text aligns even if icons vary slightly in width */
    text-align: center;
}

/* Arena Mapping */
.drop-zone {
    transition: background-color 0.2s, border-color 0.2s;
}

    .drop-zone.drag-over {
        background-color: rgba(13, 110, 253, 0.1) !important;
        border-color: #0d6efd !important;
    }

.draggable-card {
    cursor: grab;
    transition: transform 0.1s, box-shadow 0.1s;
}

    .draggable-card:active {
        cursor: grabbing;
        transform: scale(0.98);
    }

/* Map Page */
#world-map {
    height: 80vh;
    min-height: 400px;
    background: #cbe4eb !important; /* CHANGE THE COLOR OF OCEAN/SEA/BACKGROUND BLUE HERE!! Backups: very light: #f0f8fa darker light blue: #aad3df*/
    border-radius: 0 0 8px 8px;
    outline: none !important;
}

.leaflet-interactive {
    stroke-linejoin: round;
    stroke-linecap: round;
    /* This ensures that even when zoomed out, the borders remain tiny */
    vector-effect: non-scaling-stroke;
}
path.leaflet-interactive:focus {
    outline: none !important;
}

/* FAQ Sections */
/* Change the background and text color when the FAQ is expanded */
.accordion-button:not(.collapsed) {
    background-color: rgba(45, 90, 39, 0.1); /* Light green tint */
    color: var(--primary);
}

/* Change that blue "glow" (box-shadow) to a green one */
.accordion-button:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 0.25rem var(--primary-glow); /*rgba(45, 90, 39, 0.25); */
}

/* Make the chevron arrow turn green when expanded */
.accordion-button:not(.collapsed)::after {
    filter: invert(27%) sepia(51%) saturate(488%) hue-rotate(65deg) brightness(93%) contrast(92%);
}

.text-accent {
    color: var(--accent);
}

/* More Mapping Arena */
/* Ensure the headers stay pinned to the top of the card */
.arena-card-header {
    position: sticky;
    top: 0;
    z-index: 10;
    /* Match background to avoid transparency issues during scroll */
}

/* Define the shared scrollable area properties */
.arena-scroll-area {
    height: 75vh;
    min-height: 400px;
    overflow-y: auto;
    overflow-x: hidden;
}

    /* Make the scrollbar a bit thinner for the tight left column */
    .arena-scroll-area::-webkit-scrollbar {
        width: 6px;
    }

    .arena-scroll-area::-webkit-scrollbar-thumb {
        background: #dee2e6;
        border-radius: 10px;
    }

/* Album Page */
.album-art-container {
    position: relative;
    display: inline-block;
}

.art-refresh-btn {
    position: absolute;
    bottom: 10px;
    right: 10px;
    opacity: 0;
    transition: opacity 0.2s;
}

.album-art-container:hover .art-refresh-btn {
    opacity: 1;
}

/* Genre Pill Styling */
.genre-pill {
    border-radius: 20px;
    font-size: 0.75rem;
    font-weight: 600;
    padding: 5px 12px;
    display: inline-flex;
    align-items: center;
    transition: all 0.2s ease-in-out;
    text-decoration: none !important;
    margin-bottom: 4px;
}

.genre-pill-main {
    flex-shrink: 0;
    white-space: nowrap;
}

/* Voted Styles */
/* Community Positive, User hasn't voted (Blue) */
.genre-comm-plus {
    background-color: #0d6efd;
    color: white;
    border: 1px solid #0d6efd;
}

/* User Upvoted (Green) */
.genre-user-plus {
    background-color: #198754;
    color: white;
    border: 1px solid #198754;
}

/* User Downvoted (Red) */
.genre-user-minus {
    background-color: #dc3545;
    color: white;
    border: 1px solid #dc3545;
}

/* Ghost Green (User upvoted, but community is <= 0) */
.genre-ghost-plus {
    background-color: rgba(25, 135, 84, 0.15);
    color: #198754;
    border: 1px dashed rgba(25, 135, 84, 0.5);
}

/* Ghost Red (User downvoted, but community is <= 0) */
.genre-ghost-minus {
    background-color: rgba(220, 53, 69, 0.15);
    color: #dc3545;
    border: 1px dashed rgba(220, 53, 69, 0.5);
}

/* Suggested (Cold Start) Styles */
.genre-suggested {
    background-color: #f8f9fa;
    color: #495057 !important; /* Darker gray for contrast */
    border: 1px dashed #adb5bd;
    opacity: 0.8;
}

    .genre-suggested:hover {
        opacity: 1;
        background-color: #e9ecef;
        border-color: #0d6efd;
        color: #0d6efd !important;
        transform: translateY(-1px);
    }

/* Container to hold the main pill and hidden buttons */
.genre-pill-wrapper {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s ease;
    margin-right: 12px;
    margin-bottom: 8px;
    vertical-align: middle;
    position: relative;
}
    /* Ensure the wrapper maintains its area briefly during DOM updates */
    .genre-pill-wrapper:hover {
        z-index: 10;
    }

/* The buttons that slide out */
.pill-vote-btn {
    width: 0;
    opacity: 0;
    overflow: hidden;
    transition: all 0.25s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    height: 32px; /* Matches badge height */
    cursor: pointer;
    border: none;
    color: white;
    font-size: 0.9rem;
}
    /* Ensure buttons don't flicker on click */
    .pill-vote-btn:active {
        transform: scale(0.95);
    }

.btn-plus {
    background-color: #198754;
    border-radius: 20px 0 0 20px;
}

.btn-minus {
    background-color: #dc3545;
    border-radius: 0 20px 20px 0;
}

/* Show buttons on hover */
.genre-pill-wrapper:hover .pill-vote-btn {
    width: 30px;
    opacity: 1;
}

/* The main pill body */
.genre-pill-main {
    border-radius: 20px;
    padding: 5px 15px;
    font-size: 0.85rem;
    font-weight: 600;
    z-index: 2;
    height: 32px;
    display: flex;
    align-items: center;
    transition: border-radius 0.25s ease;
}

/* Flatten corners when buttons are out */
.genre-pill-wrapper:hover .genre-pill-main {
    border-radius: 0;
}

.vote-active {
    box-shadow: inset 0 0 10px rgba(0,0,0,0.3);
    font-weight: bold;
}

/* Control the width specifically during the hover transition */
.genre-pill-wrapper:hover .pill-vote-btn {
    width: 30px;
    opacity: 1;
}

    .genre-pill-wrapper:hover .pill-vote-btn.vote-active {
        width: 35px;
    }

/* Autocomplete tweak */
#genre-input {
    border: 1px solid #dee2e6;
    padding-left: 15px;
}

    #genre-input:focus {
        box-shadow: none;
        border-color: #0d6efd;
    }

/* Autocomplete Dropdown */
#genre-search-results {
    position: absolute;
    top: 100%; /* Force it below the input */
    left: 0;
    z-index: 1060; /* Higher than any pill or card */
    width: 250px; /* Fixed width so it's readable */
    max-height: 250px;
    overflow-y: auto;
    background: white;
    box-shadow: 0 4px 12px rgba(0,0,0,0.15);
}

    /* Ensure the results look like a clean list */
    #genre-search-results .list-group-item {
        border-left: none;
        border-right: none;
        cursor: pointer;
    }

        #genre-search-results .list-group-item:hover {
            background-color: var(--primary);
            border-color: var(--primary);
            color: white;
        }
    #genre-search-results .disabled {
        pointer-events: none;
        background-color: #f8f9fa;
        color: #6c757d;
        font-size: 0.7rem;
        text-transform: uppercase;
        letter-spacing: 0.5px;
    }

    #genre-search-results .list-group-item.active {
        background-color: var(--primary);
        border-color: var(--primary);
        color: white;
    }

/* Parent container needs to be visible to children */
#genre-container {
    overflow: visible !important;
}


/* Hover Utilities for Genre Detail */
.transition-all {
    transition: all 0.2s ease-in-out;
}

/* Subgenre Pills Hover */
.hover-shadow:hover {
    border-color: var(--primary) !important;
    color: white !important; /*var(--primary) !important;*/
    box-shadow: 0 4px 12px rgba(0,0,0,0.08);
    transform: translateY(-2px);
    background-color: var(--primary) !important; /*#f8f9fa !important;*/
}

/* Parent Link Hover */
.hover-primary:hover {
    color: var(--primary) !important;
    transform: translateY(-1px);
}

.badge-glass {
    background-color: rgba(255, 255, 255, 0.8);
    border: 1px solid rgba(0, 0, 0, 0.1);
    color: #555;
    font-weight: 600;
    letter-spacing: 0.05em;
    font-size: 0.65rem;
}

.badge-ghost {
    background: transparent;
    border: 1px solid #dee2e6;
    color: #6c757d;
    font-weight: 500;
    opacity: 0.8;
}

.badge.bg-light.text-muted {
    transition: all 0.15s ease-in-out;
    background-color: #fcfcfc !important;
}

    .badge.bg-light.text-muted:hover {
        background-color: var(--primary) !important; /*#f0f0f0 !important;*/
        color: white !important; /*var(--primary) !important;*/
        border-color: var(--primary) !important; /*#ced4da !important;*/
        transform: translateY(-1px);
        box-shadow: 0 2px 4px rgba(0,0,0,0.1);
    }

/* More Match-Fix Button */
.match-fix-small {
    transition: all 0.2s cubic-bezier(0.175, 0.885, 0.32, 1.275); /* Slight "bounce" effect */
    opacity: 0.7;
    cursor: pointer;
}

    .match-fix-small:hover {
        transform: scale(1.3); /* Grow significantly */
        opacity: 1;
        color: #ffc107 !important; /* Keep it yellow */
        filter: drop-shadow(0 0 8px rgba(255, 193, 7, 0.6)); /* Soft golden glow */
    }

        /* Add a slight rotation to make it feel like a "repair" tool */
        .match-fix-small:hover i {
            display: inline-block;
            animation: wiggle 0.5s ease-in-out infinite;
        }

@keyframes wiggle {
    0%, 100% {
        transform: rotate(0deg);
    }

    25% {
        transform: rotate(-10deg);
    }

    75% {
        transform: rotate(10deg);
    }
}

/* Custom class for searchable inputs to avoid breaking standard buttons */
.search-select {
    padding-right: 25px !important;
    background-image: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16'%3e%3cpath fill='none' stroke='%23343a40' stroke-linecap='round' stroke-linejoin='round' stroke-width='2' d='m2 5 6 6 6-6'/%3e%3c/svg%3e");
    background-repeat: no-repeat;
    background-position: right 0.75rem center;
    background-size: 16px 12px;
}

/* Hover state for our custom dropdown items */
.dropdown-item:hover {
    background-color: var(--bs-primary) !important;
    color: white !important;
}

/* Specific styling for the searchable menus */
#genre-menu, #country-menu {
    border: 1px solid #dee2e6;
    box-shadow: 0 0.5rem 1rem rgba(0, 0, 0, 0.15);
}

/* Hide the standard caret on search inputs specifically */
.search-select.dropdown-toggle::after {
    display: none !important;
}

/* Allow the menu to be wider than the narrow 140px/150px input */
#genre-menu, #country-menu {
    min-width: 250px;
    width: max-content;
    max-width: 400px; /* Safety cap */
}

/* Force ellipsis on the input boxes */
.search-select {
    text-overflow: ellipsis;
    white-space: nowrap;
    overflow: hidden;
}

/* Ensure dropdown items also show ellipsis if they are insanely long */
.dropdown-item {
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}


/* General Theme Mappings */
.form-select:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 0.25rem rgba(49, 97, 49, 0.25);
}

.form-control-sm:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 0.25rem rgba(49, 97, 49, 0.25);
}

.btn-group:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 0.25rem rgba(49, 97, 49, 0.25);
}

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

.btn-outline-theme {
    color: var(--primary);
    border-color: var(--primary);
}

    .btn-outline-theme:hover {
        background-color: var(--primary);
        border-color: var(--primary);
        color: #fff;
    }

/* Pagination */
.page-link {
    color: var(--primary) !important;
    border-color: #dee2e6;
}

    .page-link:hover {
        color: var(--primary) !important;
        background-color: #e9ecef;
        border-color: #dee2e6;
        filter: brightness(85%);
    }

.page-item.active .page-link {
    background-color: var(--primary) !important;
    border-color: var(--primary) !important;
    color: #fff !important;
}

.page-link:focus {
    box-shadow: 0 0 0 0.25rem rgba(0, 0, 0, 0.075) !important;
}

#scrobble-pagination .btn-outline-secondary,
#pagination-controls .btn-outline-secondary {
    color: var(--primary);
    border-color: var(--primary);
}

    #scrobble-pagination .btn-outline-secondary:hover,
    #pagination-controls .btn-outline-secondary:hover {
        background-color: var(--primary);
        color: #fff;
    }

#jump-page-input:focus,
#jump-page-input-genres:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 0.25rem rgba(0, 0, 0, 0.05);
}

#scrobble-pagination,
#pagination-controls {
    display: flex;
    align-items: center;
    justify-content: center;
}

#jump-page-input::-webkit-inner-spin-button,
#jump-page-input::-webkit-outer-spin-button,
#jump-page-input-genres::-webkit-inner-spin-button,
#jump-page-input-genres::-webkit-outer-spin-button {
    -webkit-appearance: none;
    margin: 0;
}

/* Scrobble Browser */
.badge.bg-success-subtle:hover {
    background-color: var(--primary) !important;
    color: white !important;
    border-color: var(--primary) !important;
    transition: all 0.2s ease;
}

#scrobble-browser-table td {
    white-space: nowrap;
}
.artist-cell {
    text-align: center !important;
}

.album-cell {
    text-align: center !important;
}
.actions-cell {
    text-align: center !important;
}
#scrobble-browser-table thead {
    display: table-header-group;
    text-align: center !important;
}

/* Switch Scrobble Browser Table to Cards on Mobile */
@media (max-width: 767px) {
    #scrobble-browser-table,
    #scrobble-browser-table tbody,
    #scrobble-browser-table tr,
    #scrobble-browser-table td {
        display: block !important;
        overflow-y: hidden;
    }

        #scrobble-browser-table thead {
            display: none;
        }

        #scrobble-browser-table tr {
            display: block !important;
            /*flex-direction: column;*/
            position: relative !important;
            padding: 15px 50px 15px 15px !important;
            border-bottom: 1px solid #eee;
            /*height: auto !important;*/
            min-height: 80px;
            /*overflow: visible !important;*/
            background: #fff;
        }

        #scrobble-browser-table td {
            display: block !important;
            width: 100% !important;
            text-align: left !important;
            padding: 0 !important;
            border: none !important;
            text-align: left !important;
            background: transparent !important;
            /*line-height: 1.5 !important;
            overflow: visible !important;*/
        }

    /* Formatting specific cells */
    .timestamp-cell {
        /*order: 1 !important;*/
        font-size: 0.7rem !important;
        color: #888 !important;
        display: block !important;
        /*margin-bottom: 1px;*/
    }

    .track-cell {
        /*order: 2 !important;*/
        font-weight: bold !important;
        font-size: 1rem !important;
        color: #000 !important;
        display: block !important;
        white-space: normal !important;
    }

    .artist-cell {
        /*order: 3 !important;*/
        font-size: 0.85rem !important;
        color: #333 !important;
        display: block !important;
    }

    .album-cell {
        /*order: 4 !important;*/
        font-size: 0.85rem !important;
        font-style: italic !important;
        color: #666 !important;
        display: block !important;
    }

    .mapped-cell {
        display: none !important;
        visibility: hidden !important;
        height: 0px;
    }

    .actions-cell {
        position: absolute !important;
        top: 0 !important;
        bottom: 0 !important;
        right: 0 !important;
        left: auto !important;
        width: 50px !important;
        height: 100% !important;
        display: flex !important;
        align-items: center !important;
        justify-content: center !important;
        margin: 0 !important;
        background: transparent !important;
        border: none !important;
        z-index: 5;
    }
        .actions-cell button {
            position: absolute !important;
            top: 0 !important;
            bottom: 0 !important;
            right: 0 !important;
            left: auto !important;
            margin: 0 !important;
            padding: 10px !important;
            display: flex !important;
            align-items: center !important;
            justify-content: center !important;
        }
}

@media (min-width: 768px) and (max-width: 1024px) {
    #scrobble-browser-table {
        font-size: 0.78rem !important;
    }

        #scrobble-browser-table th,
        #scrobble-browser-table td {
            padding-left: 0.5rem !important;
            padding-right: 0.5rem !important;
        }

    .timestamp-cell {
        font-size: 0.7rem !important;
        width: 130px;
        white-space: normal !important;
    }

    .track-cell, .artist-cell, .album-cell {
        max-width: 120px;
        overflow: hidden;
        text-overflow: ellipsis;
        white-space: nowrap;
    }

    .mapped-cell .badge {
        padding: 2px 4px !important;
        font-size: 0.65rem !important;
    }
}

/* Missing Genre Mobile Adjsutments */
@media (max-width: 576px) {
    #missing-genre-table thead th {
        font-size: 0.75rem !important;
        padding: 0.5rem 0.25rem !important;
    }

    #missing-genre-table td {
        font-size: 0.75rem !important;
        padding: 0.5rem 0.25rem !important;
    }

        #missing-genre-table td a.fw-bold {
            font-size: 0.75rem;
        }

    #missing-genre-table .badge {
        font-size: 0.6rem;
        padding: 0.25em 0.5em;
    }

    #missing-genre-table .btn-sm {
        font-size: 0.65rem;
        padding: 0.25rem 0.5rem !important;
    }

    #missing-genre-toggle.text-uppercase {
        font-size: 0.65rem !important;
        margin-bottom: 4px !important;
    }

    /* Shrink the button text and tighten the internal padding */
    #missing-genre-toggle.btn-group .btn {
        font-size: 0.7rem !important;
        padding-left: 4px !important;
        padding-right: 4px !important;
        letter-spacing: -0.02em; /* Tightens the letters just a hair */
    }
    #missing-genre-header.fw-bold {
        font-size: 1.55rem !important;
        letter-spacing: -0.01em;
    }

    /* Shrink the description text */
    #missing-genre-subheader.text-muted {
        font-size: 0.8rem !important;
        margin-bottom: 0 !important;
        line-height: 1.2;
    }

    /* Shrink the badge (overriding the fs-6 class) */
    #total-count-badge {
        font-size: 0.6rem !important;
        padding: 0.4em 0.7em !important;
    }
}

@media (min-width: 768px) and (max-width: 1024px) {
    #missing-genre-table .btn-sm {
        font-size: 0.60rem;
        /*padding: 0.25rem 0.5rem !important;*/
        text-wrap: nowrap;
    }
}
/* NavBar Search Container & Input */
.search-wrapper {
    transition: all 0.3s ease;
}

#global-search {
    background-color: rgba(255, 255, 255, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.1);
    color: #fff;
    border-radius: 8px;
    padding-left: 35px;
    font-size: 0.9rem;
}

    #global-search:focus {
        background-color: rgba(255, 255, 255, 0.15);
        box-shadow: 0 0 0 3px rgba(49, 97, 49, 0.4);
        border-color: var(--primary);
    }

    #global-search::placeholder {
        color: rgba(255, 255, 255, 0.4);
    }

.search-icon-overlay {
    position: absolute;
    left: 12px;
    top: 50%;
    transform: translateY(-50%);
    z-index: 5;
    color: rgba(255, 255, 255, 0.4);
}

/* Results Dropdown */
#search-results {
    background-color: #ffffff;
    border-radius: 12px;
    box-shadow: 0 10px 25px rgba(0,0,0,0.2);
    margin-top: 10px;
    border: 1px solid rgba(0,0,0,0.05);
}

.search-result-item {
    padding: 10px 15px;
    border-radius: 6px;
    margin: 1px 6px;
    transition: all 0.15s ease-in-out; /*background 0.2s;*/
    color: #333;
    text-decoration: none;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

    .search-result-item:hover {
        background-color: #f0f4f0; /* Soft primary tint */
        color: var(--primary);
    }

.search-avatar {
    width: 28px;
    height: 28px;
    object-fit: cover;
    background-color: #f8f9fa;
}

/* Ensure the category headers are distinct but subtle */
.search-category-header {
    font-size: 0.65rem;
    color: var(--primary);
    background: #f8f9fa;
    padding: 6px 12px;
    margin-bottom: 4px;
    border-radius: 4px;
    opacity: 0.8;
}

/* Text clipping for long titles */
.text-truncate {
    max-width: 100%;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.force-wrap {
    overflow-wrap: anywhere;
    word-break: break-word;
    line-height: 1.1;
    font-size: clamp(1.8rem, 8vw, 3.5rem) !important;
    line-height: 1.1;
}

.name-heading {
    display: inline;
}

.filter-dropdown-genre {
    width: 150px;
}

.filter-dropdown-country {
    width: 140px;
}

/* Custom Breakpoint: 1200px */
@media (max-width: 1199px) {
    .navbar-expand-custom .navbar-toggler {
        display: block;
    }

    .navbar-expand-custom .navbar-collapse {
        display: none !important;
    }

        .navbar-expand-custom .navbar-collapse.show {
            display: block !important;
        }

    .navbar-expand-custom .navbar-nav {
        flex-direction: column;
        align-items: flex-start;
    }

    /* Make search full width inside the mobile menu */
    .search-wrapper {
        max-width: 100% !important;
        margin: 1rem 0;
    }

    .filter-dropdown-genre {
        width: 110px;
    }

    .filter-dropdown-country {
        width: 105px;
    }
    #filter-year, #filter-type {
        max-width: 100px;
    }

    /* Ensure the row wraps nicely on phones */
    .flex-wrap {
        row-gap: 10px !important;
    }
}

/* Desktop Expandable Search Effect (Above 1200px) */
@media (min-width: 1200px) {
    .navbar-expand-custom .navbar-collapse {
        display: flex !important;
        flex-basis: auto;
        align-items: center;
    }

    .navbar-expand-custom .navbar-toggler {
        display: none !important;
    }

    .navbar-expand-custom .navbar-nav {
        flex-direction: row !important;
    }

    .navbar-expand-custom .nav-link {
        padding-right: .5rem;
        padding-left: .5rem;
    }

    /* Smooth growth when clicking search */
    .search-wrapper {
        transition: max-width 0.3s ease-in-out;
    }

        .search-wrapper:focus-within {
            max-width: 700px !important;
        }
}

.responsive-warning {
    display: block;
    font-size: clamp(0.65rem, 1.5vw, 0.75rem);
    line-height: 1.3;
    opacity: 0.9;
}

/* Lightning Bolt Styles */
.speed-bolt {
    position: absolute;
    top: 20px;
    right: 5px;
    z-index: 10;
    cursor: pointer;
    font-size: 0.6rem;
    transition: all 0.3s ease;
    color: #6c757d; /* Default Grey */
}

    .speed-bolt.active {
        color: #ffc107; /* Bright Yellow */
        filter: drop-shadow(0 0 8px rgba(255, 193, 7, 0.8));
        transform: scale(1.2);
    }

    .speed-bolt:hover {
        transform: scale(1.1);
    }

/* I don't remember... Awkward */
.border-danger-subtle {
    border: 1px solid #f8d7da !important;
}

.bg-light-subtle {
    background-color: #fdfdfe;
}

.text-truncate-desc {
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    text-overflow: ellipsis;
}

.nav-pills .nav-link.active,
.nav-pills .show > .nav-link {
    background-color: var(--primary) !important;
    color: #ffffff !important;
}

.nav-pills .nav-link {
    color: var(--primary);
}

    .nav-pills .nav-link:hover {
        color: #2d662f;
        background-color: #f8f9fa;
    }

.nav-tabs .nav-link {
    color: #6c757d;
    border: none;
    border-bottom: 3px solid transparent;
    padding: 1rem 1.5rem;
    transition: 0.2s;
}

    .nav-tabs .nav-link.active {
        color: var(--primary);
        background: none;
        border-bottom-color: #1e4620;
    }

/* Mobile Changes for Guilds */
@media (max-width: 576px) {
    .nav-tabs .nav-link {
        overflow-x: auto;
        padding: 0.75rem 0.5rem;
        font-size: 0.95rem;
        letter-spacing: -0.02em;
    }

    /* Ensure the guild title doesn't swallow the whole screen */
    h1 {
        font-size: 1.75rem !important;
    }

    /* Make the header image a bit shorter on mobile */
    .col-md-3.bg-light {
        min-height: 150px !important;
    }
    
    #members .table {
        font-size: 0.85rem;
    }

        #members .table th,
        #members .table td {
            padding-left: 0.75rem !important;
            padding-right: 0.75rem !important;
        }

    #members .small {
        font-size: 0.75rem !important;
        white-space: nowrap;
    }

    #members td a {
        font-size: 0.85rem;
    }
}

.guild-description {
    white-space: pre-wrap;
    line-height: 1.6;
    font-weight: 400;
    font-size: 0.95rem;
}

#billboards .d-flex.gap-2,
#charts .d-flex.gap-2 {
    overflow-x: auto;
    padding-bottom: 10px;
    -webkit-overflow-scrolling: touch;
}

#billboards .btn-sm,
#charts .btn-sm {
    white-space: nowrap;
}

@media (min-width: 768px) {
    .guild-description {
        font-size: 1.15rem;
    }
}

/* Mobile Optimization for Guild Tables */
@media (max-width: 576px) {
    .guild-table {
        font-size: 0.62rem !important;
        table-layout: fixed;
        width: 100% !important;
    }

        .guild-table th, .guild-table td {
            padding: 0.25rem 0.1rem !important;
            line-height: 1.2;
        }

    /* Column Widths - Hardcoded for Mobile */
    .col-rank {
        width: 22px !important;
        text-align: center;
        padding-left: 0.1rem !important;
    }

    .col-change {
        width: 38px !important;
        text-align: center;
    }

    .col-plays {
        width: 45px !important;
        text-align: right;
    }

    .col-time {
        width: 62px !important;
        text-align: right;
        padding-right: 0.2rem !important;
    }

    .guild-duration {
        font-size: 0.67rem !important;
    }
    /* The Title Column takes the rest */
    .col-title {
        width: auto !important;
    }

    /* Shrink icons/flags for mobile */
    .guild-table .stat-icon img,
    .guild-table .stat-icon .fi,
    .guild-table .stat-placeholder-flag {
        width: 18px !important;
        height: 18px !important;
    }

    .guild-table .stat-icon {
        margin-right: 0.15rem !important;
        width: 18px !important;
    }

    /* Hide secondary text on mobile to prevent "Title Drift" */
    .guild-table .text-muted.text-truncate {
        display: none !important;
    }

    /* Badge sizing */
    .guild-table .badge {
        font-size: 0.5rem !important;
        padding: 0.1rem 0.15rem !important;
    }
}


.guild-duration {
    color: #adb5bd !important;
}
.col-rank {
    width: 40px;
    font-weight: bold;
    color: #adb5bd;
}
.guild-table tbody tr:hover .col-rank {
    color: var(--primary) !important;
    font-weight: bold;
}