* {
    box-sizing: border-box;
}

:root {
    --primary-color: #1976d2;
    --primary-dark: #0d47a1;
    --primary-light: #42a5f5;
    --accent-color: #ff6f00;
    --text-primary: rgba(0, 0, 0, 0.87);
    --text-secondary: rgba(0, 0, 0, 0.54);
    --divider-color: rgba(0, 0, 0, 0.12);
    --background: #fafafa;
    --surface: #ffffff;
}

body {
    margin: 0;
    padding: 0;
    font-family: 'Roboto', sans-serif;
    background-color: var(--background);
    color: var(--text-primary);
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

.app-container {
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

/* App Bar */
.mdc-top-app-bar {
    background-color: var(--primary-color);
    color: white;
    z-index: 7;
}

.mdc-top-app-bar__title {
    font-size: 20px;
    font-weight: 500;
    letter-spacing: 0.15px;
    cursor: pointer;
    transition: opacity 0.2s ease;
}

.mdc-top-app-bar__title:hover {
    opacity: 0.8;
}

.mdc-top-app-bar .mdc-icon-button {
    color: white;
}

/* Main Content */
.main-content {
    flex: 1;
    max-width: 800px;
    width: 100%;
    margin: 0 auto;
    padding: 0;
}

/* Filters Section */
.filters-container {
    background-color: var(--surface);
    padding: 0;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
    border-bottom: 1px solid var(--divider-color);
    position: sticky;
    top: 56px;
    z-index: 5;
    margin-top: 0;
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.3s ease-in-out, padding 0.3s ease-in-out, overflow 0s 0.3s;
}

.filters-container.expanded {
    max-height: 500px;
    padding: 16px;
    overflow: visible;
    transition: max-height 0.3s ease-in-out, padding 0.3s ease-in-out, overflow 0s 0s;
}

@media (min-width: 600px) {
    .filters-container {
        top: 64px;
    }
}

/* Ensure content starts below app bar */
.mdc-top-app-bar--fixed-adjust {
    padding-top: 56px;
}

@media (min-width: 600px) {
    .mdc-top-app-bar--fixed-adjust {
        padding-top: 64px;
    }
}

.filter-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 16px;
    max-width: 600px;
    margin: 0 auto;
}

.filter-row:first-child {
    grid-template-columns: 1fr;
    margin-bottom: 16px;
}

.filter-item {
    min-width: 0;
}

.keyword-filter {
    width: 100%;
}

.mdc-text-field {
    width: 100%;
}

.mdc-text-field--filled {
    background-color: rgba(0, 0, 0, 0.04);
}

.mdc-text-field--filled:not(.mdc-text-field--disabled) {
    background-color: rgba(0, 0, 0, 0.04);
}

.mdc-text-field--filled:not(.mdc-text-field--disabled):hover {
    background-color: rgba(0, 0, 0, 0.08);
}

.mdc-select {
    width: 100%;
}

.mdc-select--filled {
    background-color: rgba(0, 0, 0, 0.04);
}

.mdc-select--filled:not(.mdc-select--disabled) .mdc-select__anchor {
    background-color: rgba(0, 0, 0, 0.04);
}

.mdc-select--filled:not(.mdc-select--disabled):hover .mdc-select__anchor {
    background-color: rgba(0, 0, 0, 0.08);
}

.mdc-select__selected-text {
    font-size: 16px;
}

/* Songs Container */
.songs-container {
    background-color: var(--surface);
    min-height: calc(100vh - 200px);
}

.mdc-list {
    padding: 0;
}

.mdc-list-item {
    display: flex;
    align-items: center;
    height: auto;
    min-height: 72px;
    padding: 12px 16px;
    border-bottom: 1px solid var(--divider-color);
    cursor: pointer;
    transition: background-color 0.15s ease;
}

.mdc-list-item.playing {
    position: relative;
    background-color: rgba(25, 118, 210, 0.05) !important;
}

.mdc-list-item.playing::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    right: 0;
    bottom: 0;
    background: linear-gradient(
        90deg,
        transparent 0%,
        rgba(25, 118, 210, 0.2) 50%,
        transparent 100%
    );
    animation: playingSlide 2s linear infinite;
    pointer-events: none;
    z-index: 0;
}

.mdc-list-item.playing > * {
    position: relative;
    z-index: 1;
}

.mdc-list-item.playing .mdc-list-item__ripple {
    display: none;
}

.mdc-list-item:not(.playing):hover {
    background-color: rgba(0, 0, 0, 0.04);
}

.mdc-list-item:not(.playing):active {
    background-color: rgba(0, 0, 0, 0.08);
}

@keyframes playingSlide {
    0% {
        left: -100%;
        right: 100%;
    }
    50% {
        left: 0%;
        right: 0%;
    }
    100% {
        left: 100%;
        right: -100%;
    }
}

.mdc-list-item__text {
    display: flex;
    flex-direction: column;
    width: 100%;
}

.mdc-list-item__primary-text {
    font-size: 18px;
    font-weight: 500;
    color: var(--text-primary);
    margin-bottom: 4px;
    line-height: 1.5;
}

.mdc-list-item__secondary-text {
    font-size: 14px;
    color: var(--text-secondary);
    line-height: 1.4;
    white-space: normal;
}

.song-meta {
    display: flex;
    gap: 12px;
    margin-top: 4px;
}

.song-key,
.song-genre {
    font-size: 12px;
    font-weight: 500;
    padding: 2px 8px;
    border-radius: 12px;
    background-color: rgba(25, 118, 210, 0.1);
    color: var(--primary-color);
}

.song-genre {
    background-color: rgba(255, 111, 0, 0.1);
    color: var(--accent-color);
}

.play-button {
    flex-shrink: 0;
    margin-left: 16px;
    color: var(--primary-color);
    width: 64px;
    height: 64px;
    font-size: 48px;
    padding: 0;
}

.play-button.disabled {
    color: rgba(0, 0, 0, 0.26);
    cursor: not-allowed;
}

.no-results {
    text-align: center;
    padding: 48px 24px;
    color: var(--text-secondary);
}

.no-results p {
    font-size: 16px;
    margin: 0;
}

/* Compact Player Bar */
.player-container {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    background-color: var(--surface);
    box-shadow: 0 -2px 8px rgba(0, 0, 0, 0.15);
    z-index: 10;
    max-width: 800px;
    margin: 0 auto;
    animation: slideUp 0.25s ease-out;
}

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

.player-bar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 8px 16px;
    min-height: 56px;
    background: linear-gradient(to right, rgba(25, 118, 210, 0.05), rgba(25, 118, 210, 0.02));
    border-top: 2px solid var(--primary-color);
}

.player-info {
    display: flex;
    align-items: center;
    gap: 12px;
    flex: 1;
    min-width: 0;
}

.player-icon {
    color: var(--primary-color);
    font-size: 24px;
    flex-shrink: 0;
}

.player-text {
    display: flex;
    flex-direction: column;
    min-width: 0;
    flex: 1;
}

.player-title {
    font-size: 14px;
    font-weight: 500;
    color: var(--text-primary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    line-height: 1.4;
}

.player-status {
    font-size: 12px;
    color: var(--text-secondary);
    line-height: 1.3;
}

.player-controls {
    display: flex;
    align-items: center;
    gap: 4px;
    flex-shrink: 0;
}

.player-controls .mdc-icon-button {
    color: var(--primary-color);
}

#close-player {
    color: var(--text-secondary);
}

#youtube-player {
    display: none;
}

#youtube-player iframe {
    width: 1px;
    height: 1px;
    opacity: 0;
    pointer-events: none;
}

/* Responsive Design */
@media (max-width: 600px) {
    .filter-row {
        grid-template-columns: 1fr;
        gap: 12px;
    }

    .filters-container.expanded {
        padding: 12px;
    }

    .mdc-list-item {
        padding: 12px;
    }

    .song-meta {
        gap: 8px;
    }
}

@media (min-width: 800px) {
    .player-container {
        left: 50%;
        transform: translateX(-50%);
    }
}

/* Loading State */
.loading {
    text-align: center;
    padding: 48px 24px;
    color: var(--text-secondary);
}

/* Accessibility */
.mdc-list-item:focus {
    outline: 2px solid var(--primary-color);
    outline-offset: -2px;
}

.visually-hidden {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

/* Custom scrollbar */
::-webkit-scrollbar {
    width: 8px;
}

::-webkit-scrollbar-track {
    background: var(--background);
}

::-webkit-scrollbar-thumb {
    background: rgba(0, 0, 0, 0.2);
    border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
    background: rgba(0, 0, 0, 0.3);
}

/* Genre Filter Checkboxes */
.genre-filter {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.filter-label {
    font-size: 12px;
    font-weight: 500;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.genre-checkboxes {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.genre-checkboxes .mdc-form-field {
    display: flex;
    align-items: center;
    gap: 8px;
    margin: 0;
}

.genre-checkboxes .mdc-form-field label {
    font-size: 16px;
    color: var(--text-primary);
    cursor: pointer;
    user-select: none;
}

.genre-checkboxes .mdc-checkbox {
    flex-shrink: 0;
}

@media (min-width: 600px) {
    .genre-checkboxes {
        flex-direction: row;
        gap: 16px;
    }
}
