/* --- Song Search Specific Styles --- */

.song-search-section {
    padding: 0;
    margin-top: 12px;
    margin-bottom: 12px;
}

.song-search-section h1 {
    margin-top: 0;
    margin-bottom: 16px;
}

/* Unified container for input and tags */
.filter-container {
    display: flex;
    flex-direction: column; /* Stack input row, tags, and clear button vertically */
    gap: 15px; /* Space between the input row and the tags row */
    margin-bottom: 16px;
    padding: 15px;
    background-color: var(--color-neutral-grey); /* The #f0f0f0 background */
    border-radius: 8px;
    box-shadow: 0 2px 5px rgba(0,0,0,0.1);
}

.search-input-row {
    display: flex; /* Keeps input and buttons in one row */
    gap: 10px;
}

#filter-input {
    flex-grow: 1; /* Allows input to take up available space */
    padding: 10px 15px;
    border: 1px solid var(--color-dark-grey);
    border-radius: 5px;
    font-size: 1em;
    min-width: 150px; /* Ensure input is not too small */
}

/* Base style for icon-only buttons */
.icon-button {
    background-color: var(--color-complementary-blue);
    color: var(--color-background-light);
    padding: 10px 15px; /* Adjusted padding for icon button */
    border: none;
    border-radius: 5px;
    cursor: pointer;
    font-size: 1.2em; /* Make icon larger */
    display: flex; /* To center the icon */
    align-items: center;
    justify-content: center;
    transition: background-color 0.3s ease, transform 0.2s ease;
    min-width: 45px; /* Ensure button has a decent width */
}

.icon-button:hover {
    background-color: #0052A3; /* Darker blue on hover */
    transform: translateY(-2px);
}

/* Specific style for the Clear All icon button */
.clear-icon-button {
    background-color: #E53E3E; /* A standard red for 'clear' actions */
}

.clear-icon-button:hover {
    background-color: #C53030; /* Darker red on hover */
}

/* The cta-button class is now only used for the "Learn More" on index.html,
   but we keep its definition as it's a general utility class. */
.cta-button {
    display: inline-block;
    background-color: var(--color-complementary-blue);
    color: var(--color-background-light);
    padding: 15px 30px; /* Reverted to larger padding for general CTA */
    text-decoration: none;
    border-radius: 5px;
    font-weight: bold;
    font-size: 1.1em;
    border: none;
    cursor: pointer;
    transition: background-color 0.3s ease, transform 0.2s ease;
}

.cta-button:hover {
    background-color: #0052A3;
    transform: translateY(-2px);
}


.filter-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    min-height: 20px;
    align-items: center;
}

.filter-tag {
    background-color: var(--color-secondary-orange);
    color: var(--color-text-dark);
    padding: 6px 12px;
    border-radius: 20px;
    display: flex;
    align-items: center;
    gap: 5px;
    font-size: 0.9em;
    white-space: nowrap;
}

.filter-tag .remove-tag {
    background: none;
    border: none;
    color: var(--color-text-dark);
    font-weight: bold;
    cursor: pointer;
    font-size: 0.8em;
    padding: 0 4px;
    border-radius: 50%;
    transition: background-color 0.2s;
}

.filter-tag .remove-tag:hover {
    background-color: rgba(0,0,0,0.1);
}


/* --- Category List Styles --- */
.category-list {
    margin-top: 12px;
}

/* Adjusted for slimmer category header */
.category-header {
    background-color: var(--color-primary-yellow);
    padding: 10px 20px; /* Reduced vertical padding */
    margin-bottom: 5px;
    border-radius: 8px;
    cursor: pointer;
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-weight: bold;
    font-size: 1.2em;
    color: var(--color-text-dark);
    box-shadow: 0 2px 5px rgba(0,0,0,0.1);
    transition: background-color 0.3s ease;
}

.category-header:hover {
    background-color: var(--color-darker-yellow);
}

.category-header .song-count {
    font-size: 0.9em;
    background-color: rgba(0,0,0,0.1);
    padding: 4px 10px;
    border-radius: 15px;
    margin-left: auto; /* Ensure it's pushed to the right */
}

.category-content {
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.3s ease-out, padding 0.3s ease-out;
    background-color: var(--color-background-light);
    border-radius: 0 0 8px 8px;
    margin-bottom: 15px;
    box-shadow: 0 2px 5px rgba(0,0,0,0.05);
}

.category-content.expanded {
    max-height: 200000px; /* Increased to a very large value for effectively unlimited height */
    padding: 15px 20px;
}

/* Responsive two-column layout for songs in category-content.expanded */
.category-content.expanded {
    display: grid;
    grid-template-columns: 1fr;
    gap: 0;
    border-radius: 8px;
    background: var(--color-background-light, #fff);
    padding: 0;
}
@media (min-width: 768px) {
    .category-content.expanded {
        grid-template-columns: 1fr 1fr;
        border-left: 1px solid var(--color-neutral-grey, #eee);
        border-right: 1px solid var(--color-neutral-grey, #eee);
    }
}

.song-item {
    padding: 16px 24px 16px 24px;
    text-align: center;
    overflow: visible;
    word-break: break-word;
    border-bottom: 1px solid var(--color-neutral-grey, #eee);
    background: transparent;
    box-sizing: border-box;
}

/* Remove last border in each column */
.category-content.expanded .song-item:last-child {
    border-bottom: none;
}

@media (min-width: 768px) {
    .category-content.expanded {
        position: relative;
    }
    /* Vertical divider between columns */
    .category-content.expanded::before {
        content: "";
        position: absolute;
        top: 0;
        bottom: 0;
        left: 50%;
        width: 1px;
        background: var(--color-neutral-grey, #eee);
        z-index: 1;
    }
    .category-content.expanded .song-item {
        border-right: none;
        border-bottom: 1px solid var(--color-neutral-grey, #eee);
    }
    /* Remove last border in each column (for even split) */
    .category-content.expanded .song-item:nth-last-child(-n+2) {
        border-bottom: none;
    }
}

.difficulties {
    display: block;
    width: 100%;
    text-align: center;
}
.difficulty-single {
    display: block !important;
    width: 100%;
    margin: 0 auto 0 auto;
    text-align: center;
    float: none;
}
.difficulty-double {
    display: block !important;
    width: 100%;
    margin: 0 auto 0 0 auto;
    text-align: center;
    float: none;
}
.difficulty {
    margin: 0 auto 4px auto;
    text-align: center;
    float: none;
}
.difficulty-double {
    margin-top: 10px;
    border-top: none;
    padding-top: 0;
}


/* Styles for the new Letter Filter Bar */
.letter-filter-bar {
    display: flex; /* Use flexbox for horizontal layout */
    flex-wrap: wrap; /* Allow wrapping to next line on smaller screens */
    justify-content: center; /* Center the buttons */
    gap: 0; /* Remove gap for pipe separation */
    padding-bottom: 15px; /* Space between filter and first song */
    border-bottom: 1px dashed var(--color-neutral-grey);
    margin-bottom: 15px;
    font-size: 0.9em; /* Adjust font size for the bar */
}

.letter-filter-button {
    background-color: transparent; /* No background */
    color: var(--color-dark-grey); /* Dark grey text */
    border: none; /* No border */
    padding: 5px 8px;
    cursor: pointer;
    font-size: 1em; /* Standard font size for buttons */
    font-weight: bold;
    min-width: auto; /* Allow buttons to size based on content */
    text-align: center;
    transition: color 0.2s, background-color 0.2s;
    /* Add a right border to create the '|' separator effect */
    border-right: 1px solid var(--color-neutral-grey);
    border-radius: 0; /* Remove border radius for pipe effect */
}

.letter-filter-button:last-child {
    border-right: none; /* No separator for the last button */
}

.letter-filter-button:hover {
    background-color: transparent; /* No background on hover */
    color: var(--color-complementary-blue); /* Blue text on hover */
    border-color: var(--color-neutral-grey); /* Keep border color consistent */
}

.letter-filter-button.active {
    background-color: transparent; /* No background */
    color: var(--color-primary-yellow); /* Yellow text for active */
    border-color: var(--color-neutral-grey); /* Keep border color consistent */
}


.song-item {
    display: flex;
    flex-direction: column;
    padding: 10px 0;
    border-bottom: 1px dashed var(--color-neutral-grey);
    color: var(--color-dark-grey);
}

.song-item:last-child {
    border-bottom: none;
}

.song-item .title {
    font-weight: bold;
    color: var(--color-text-dark);
    font-size: 1.1em;
}

.song-item .artist {
    font-style: italic;
    color: var(--color-secondary-orange);
    font-size: 0.95em;
    margin-top: 2px;
}

.song-item .subtitle {
    font-size: 0.9em;
    color: var(--color-dark-grey);
    margin-top: 2px;
}

.song-item .difficulties {
    font-size: 0.85em;
    margin-top: 5px;
    display: flex;
    flex-wrap: wrap;
    gap: 0px;
}

.song-item .difficulty-level {
    background-color: var(--color-neutral-grey);
    padding: 3px 8px;
    border-radius: 5px;
    white-space: nowrap;
}

.loading-message {
    text-align: center;
    padding: 50px;
    font-size: 1.2em;
    color: var(--color-dark-grey);
}

/* Hide search UI by default, show with .visible */
#search-ui-wrapper {
    display: none;
}
#search-ui-wrapper.visible {
    display: block;
}

#search-page-title {
    text-align: center;
    margin-top: 0;
    margin-bottom: 16px;
    font-size: 2em;
    font-weight: bold;
    width: 100%;
}

/* --- Responsive improvements for search bar on mobile --- */
@media (max-width: 768px) {
    .search-input-row {
        flex-direction: column;
        align-items: stretch;
        gap: 8px;
    }
    #filter-input, .icon-button, .clear-icon-button {
        width: 100%;
        min-width: 0;
        box-sizing: border-box;
        font-size: 1.1em;
    }
    .icon-button, .clear-icon-button {
        padding: 12px 0;
        font-size: 1.3em;
        margin-top: 0;
    }
    .filter-container {
        padding: 10px 5px;
        gap: 10px;
    }
    .filter-tags {
        justify-content: flex-start;
        gap: 6px;
    }
}

/* --- Game Selection Styles --- */
.game-selection {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: flex-start;
    margin-top: 12px; /* Reduced from 32px */
    margin-bottom: 12px;
    min-height: unset; /* Remove min-height for compactness */
    padding: 0;
}

.game-selection h2 {
    font-size: 1.5em;
    margin-bottom: 16px; /* Less space below title */
    margin-top: 0;
}

.game-list {
    display: flex;
    flex-wrap: wrap;
    gap: 18px; /* Slightly reduced gap for compactness */
    justify-content: center;
    align-items: center;
    width: 100%;
    padding: 0;
}

.game-btn {
    position: relative;
    min-width: 208px; /* 20% smaller than 260px */
    min-height: 72px; /* 20% smaller than 90px */
    padding: 19px 29px; /* 20% smaller than 24px 36px */
    font-size: 1.04em; /* 20% smaller than 1.3em */
    font-weight: bold;
    color: #fff;
    background: rgba(0,0,0,0.55);
    border: none;
    border-radius: 6px;
    box-shadow: 0 4px 18px rgba(0,0,0,0.12);
    cursor: pointer;
    overflow: hidden;
    transition: transform 0.18s cubic-bezier(.4,2,.6,1), box-shadow 0.18s, background 0.18s;
    z-index: 1;
    text-shadow: 0 2px 8px rgba(0,0,0,0.25);
    outline: none;
    display: flex;
    align-items: center;
    justify-content: center;
    text-align: center;
}

.game-btn-label {
    position: relative;
    z-index: 3;
    color: var(--color-background-light);
    opacity: 1;
    text-shadow: 0 3px 16px rgba(0,0,0,0.7), 0 1px 0 #222;
    font-weight: bold;
    font-size: 1.04em;
    pointer-events: none;
    white-space: normal;
    word-break: break-word;
    text-align: center;
    width: 100%;
    display: block;
}

.game-btn::before {
    content: '';
    position: absolute;
    top: 0; left: 0; right: 0; bottom: 0;
    background-size: cover;
    background-position: center;
    opacity: 0.35;
    z-index: 0;
    transition: opacity 0.2s;
}

.game-btn::after {
    content: '';
    position: absolute;
    top: 0; left: 0; right: 0; bottom: 0;
    background-size: cover;
    background-position: center;
    opacity: 0.35;
    z-index: 1;
    transition: opacity 0.2s;
}

/* Set background images for each game button */
.game-btn[data-game="Dance Dance Revolution"]::before {
    background-image: url('../images/ddr_bg.jpg');
}
.game-btn[data-game="YARG"]::before {
    background-image: url('../images/yarg_bg.jpg');
}
.game-btn[data-game="Project Diva"]::before {
    background-image: url('../images/diva_bg.jpg');
}
.game-btn[data-game="Taiko no Tatsujin"]::before {
    background-image: url('../images/taiko_bg.jpg');
}

.game-btn:hover, .game-btn:focus {
    transform: scale(1.06) translateY(-2px);
    box-shadow: 0 8px 32px rgba(0,0,0,0.18);
    background: rgba(0,0,0,0.70);
}

.game-btn:hover::before, .game-btn:focus::before {
    opacity: 0.55;
}

.game-btn:active {
    transform: scale(0.98) translateY(1px);
    box-shadow: 0 2px 8px rgba(0,0,0,0.10);
    background: rgba(0,0,0,0.45);
}

.game-btn:active::before {
    opacity: 0.25;
}

.game-btn.selected {
    border: 2.5px solid var(--color-primary-yellow);
    box-shadow: 0 0 0 4px rgba(247,205,0,0.28);
    background: rgba(0,0,0,0.85);
    color: var(--color-background-light);
    z-index: 5;
}

@media (max-width: 600px) {
    .game-list {
        flex-direction: column;
        gap: 12px;
        align-items: stretch;
    }
    .game-btn {
        min-width: 0;
        width: 100%;
        max-width: 98vw;
        min-height: 56px;
        padding: 16px 10px;
        font-size: 0.98em;
        border-radius: 8px;
    }
    .game-btn-label {
        font-size: 0.98em;
    }
    .game-selection {
        margin-top: 6px;
        margin-bottom: 6px;
    }
}

#search-page-title, .game-selection h2 {
    font-size: 1.5em;
    font-weight: bold;
}
.category-header h2 {
    font-size: 0.9em;
    margin: 0;
}
.category-header {
    padding: 6px 10px;
    margin-bottom: 5px;
    border-radius: 8px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-weight: bold;
    font-size: 0.9em;
    color: var(--color-text-dark);
    box-shadow: 0 2px 5px rgba(0,0,0,0.1);
    transition: background-color 0.3s ease;
}
.song-count {
    font-size: 0.72em; /* 20% smaller than .category-header */
    background: none !important;
    color: inherit;
    padding: 0 6px;
    border-radius: 0;
    margin-left: 8px;
}
.song-item,
.song-item .title,
.song-item .artist,
.song-item .subtitle,
.song-item .difficulties {
    font-size: 0.83em;
}

