/* Base styles */
body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    background-color: #f0f0f0;
    margin: 0;
    padding: 0;
    color: #333;
}

/* Top Navigation Bar */
.top-nav {
    position: sticky;
    top: 0;
    z-index: 1002;
    background: linear-gradient(135deg, #1a1a1a, #0a0a0a);
    border-bottom: 2px solid lime;
    padding: 10px 20px;
    box-shadow: 0 2px 10px rgba(0,0,0,0.5);
    display: flex;
    gap: 15px;
    align-items: center;
}

.top-nav-link {
    color: deepskyblue;
    text-decoration: none;
    padding: 8px 16px;
    border-radius: 4px;
    transition: all 0.2s ease;
    font-weight: 500;
    font-size: 15px;
}

.top-nav-link:hover {
    background: rgba(0, 255, 127, 0.2);
    color: lime;
}

.top-nav-link.active {
    background: rgba(0, 255, 127, 0.3);
    color: lime;
    border: 1px solid lime;
}

/* Breadcrumb Navigation */
.breadcrumb {
    position: sticky;
    top: 44px; /* Position below top-nav */
    z-index: 1001;
    background: linear-gradient(135deg, #0f0f0f, #1a1a1a);
    border-bottom: 2px solid #333;
    padding: 12px 20px;
    box-shadow: 0 2px 10px rgba(0,0,0,0.3);
    font-size: 16px;
}

.breadcrumb-link {
    color: deepskyblue;
    text-decoration: none;
    padding: 5px 10px;
    border-radius: 4px;
    transition: all 0.2s ease;
}

.breadcrumb-link:hover {
    background: rgba(0, 191, 255, 0.2);
    color: lime;
}

/* Search Bar Styles */
.search-container {
    position: sticky;
    top: 90px; /* Position below top-nav + breadcrumb */
    z-index: 1000;
    background: linear-gradient(135deg, #1a1a1a, #2d2d2d);
    border-bottom: 3px solid #333;
    padding: 15px 20px;
    box-shadow: 0 4px 20px rgba(0,0,0,0.3);
    margin-bottom: 20px;
}

.search-bar {
    width: 100%;
    max-width: 800px;
    margin: 0 auto;
    position: relative;
    display: flex;
    align-items: center;
    gap: 10px;
}

.search-input {
    flex: 1;
    padding: 15px 50px 15px 20px;
    font-size: 18px;
    border: 2px solid #444;
    border-radius: 25px;
    background: #000;
    color: deepskyblue;
    outline: none;
    transition: all 0.3s ease;
    box-shadow: inset 0 2px 5px rgba(0,0,0,0.3);
}

.search-input:focus {
    border-color: deepskyblue;
    box-shadow: 0 0 20px rgba(0, 191, 255, 0.3);
}

.search-input::placeholder {
    color: #666;
    font-style: italic;
}

.search-icon {
    position: absolute;
    right: 20px;
    color: #666;
    font-size: 20px;
    pointer-events: none;
}

.search-results-count {
    color: lime;
    font-size: 14px;
    margin-left: 10px;
    white-space: nowrap;
}

.clear-search {
    background: #333;
    border: none;
    color: deepskyblue;
    padding: 8px 15px;
    border-radius: 20px;
    cursor: pointer;
    transition: all 0.2s ease;
    font-size: 14px;
}

.clear-search:hover {
    background: #555;
    color: lime;
}

.rescan-button {
    background: #333;
    border: none;
    color: lime;
    padding: 8px 15px;
    border-radius: 20px;
    cursor: pointer;
    transition: all 0.2s ease;
    font-size: 14px;
}

.rescan-button:hover {
    background: #555;
    color: #0f0;
}

.rescan-button:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

/* Hide filtered items */
.link.search-hidden {
    display: none !important;
}

.song-row.search-hidden {
    display: none !important;
}

/* Highlight search matches */
.search-highlight {
    background: rgba(255, 215, 0, 0.4);
    color: #000;
    font-weight: bold;
    padding: 2px 4px;
    border-radius: 3px;
}

/* Existing styles with enhancements */
.container {
    display: block;
    background-color: #fafafa;
    padding: 40px;
    padding-top: 20px; /* Reduced top padding since search bar adds spacing */
    max-width: 1200px;
    margin: 0 auto;
}

/* Song row container for link + direct link button */
.song-row {
    display: flex;
    align-items: stretch;
    margin-bottom: 15px;
    gap: 5px;
}

/* Folder row styling */
.folder-row {
    margin-bottom: 15px;
}

.folder-link {
    display: block;
    padding: 18px 20px;
    border: 2px solid #ccc;
    border-radius: 5px;
    background-color: #fff;
    text-decoration: none;
    transition: all 0.2s ease-in-out;
    font-size: 20px;
    color: #333;
    font-weight: 600;
    cursor: pointer;
    background: linear-gradient(135deg, #ffffff, #f5f5f5);
}

.folder-link:hover {
    background: linear-gradient(135deg, #f0f8ff, #e6f3ff);
    border-color: deepskyblue;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0,191,255,0.2);
}

/* Direct link button */
.direct-link {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0 15px;
    background-color: #fff;
    border: 1px solid #ccc;
    border-radius: 5px;
    text-decoration: none;
    font-size: 20px;
    transition: all 0.2s ease-in-out;
    cursor: pointer;
    flex-shrink: 0;
    min-width: 50px;
}

.direct-link:hover {
    background-color: #f5f5f5;
    border-color: #666;
    transform: translateY(-1px);
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
}

.videocontainer {
    max-width: 1200px;
    margin: 0 auto;
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
    grid-gap: 20px;
}

.video {
    width: 320px;
}

/* Style the links */
.link {
    display: block;
    height: auto;
    padding: 15px 20px;
    border: 1px solid #ccc;
    border-radius: 5px;
    background-color: #fff;
    background-size: contain;
    background-repeat: no-repeat;
    background-position: right center;
    text-decoration: none;
    transition: all 0.2s ease-in-out;
    word-wrap: break-word;
    word-break: break-word;
    text-align: left;
    font-size: 18px;
    color: #000;
    font-weight: 500;
    line-height: 1.4;
    cursor: pointer;
    flex: 1;
}

/* Add a hover effect to the links */
.link:hover {
    background-color: #f5f5f5;
    border-color: #666;
    text-decoration: none;
    transform: translateY(-1px);
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
}

/* Style for folder paths */
.folder-path {
    display: block;
    color: #666;
    font-size: 14px;
    margin-top: 5px;
    font-weight: normal;
    letter-spacing: 0;
}

/* Make the links responsive */
@media screen and (max-width: 768px) {
    .search-container {
        padding: 10px 15px;
    }

    .search-bar {
        flex-wrap: wrap;
        gap: 8px;
    }

    .search-input {
        font-size: 16px;
        padding: 12px 40px 12px 15px;
        min-width: 0; /* Allow input to shrink */
    }

    .search-results-count {
        font-size: 12px;
        order: 3; /* Move to next line */
        width: 100%;
        text-align: center;
        margin: 0;
        padding-top: 5px;
    }

    .clear-search {
        order: 2;
        padding: 6px 12px;
        font-size: 12px;
        flex-shrink: 0; /* Don't shrink the button */
    }

    .rescan-button {
        order: 2;
        padding: 6px 12px;
        font-size: 12px;
        flex-shrink: 0;
    }

    .container {
        grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
        grid-gap: 10px;
        padding: 20px;
    }

    .song-row {
        margin-bottom: 10px;
        gap: 3px;
    }

    .link {
        padding: 12px 15px;
        font-size: 16px;
    }

    .direct-link {
        padding: 0 12px;
        min-width: 45px;
        font-size: 18px;
    }

    .folder-path {
        font-size: 12px;
        margin-top: 3px;
    }

    .audio-player-wrapper {
        flex-direction: column;
        align-items: stretch;
        gap: 10px;
    }

    .speed-control {
        justify-content: center;
        padding: 8px 12px;
        font-size: 13px;
    }

    .speed-slider {
        width: 100px;
    }
}

audio {
    max-width: 100%;
    max-height: 100%;
}

/* Audio player wrapper with speed control */
.audio-player-wrapper {
    display: flex;
    align-items: center;
    gap: 15px;
    margin: 10px 0;
}

/* Speed control styles */
.speed-control {
    display: flex;
    align-items: center;
    gap: 8px;
    background: linear-gradient(135deg, #2d2d2d, #1a1a1a);
    padding: 10px 15px;
    border-radius: 8px;
    color: deepskyblue;
    font-size: 14px;
    white-space: nowrap;
    box-shadow: 0 2px 8px rgba(0,0,0,0.3);
}

.speed-value {
    font-weight: bold;
    color: lime;
    min-width: 45px;
    text-align: center;
}

.speed-slider {
    -webkit-appearance: none;
    appearance: none;
    width: 120px;
    height: 6px;
    background: linear-gradient(to right, #444, #666);
    border-radius: 3px;
    outline: none;
    cursor: pointer;
}

.speed-slider::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 18px;
    height: 18px;
    background: deepskyblue;
    border-radius: 50%;
    cursor: pointer;
    box-shadow: 0 2px 4px rgba(0,0,0,0.3);
    transition: all 0.2s ease;
}

.speed-slider::-webkit-slider-thumb:hover {
    background: lime;
    transform: scale(1.1);
}

.speed-slider::-moz-range-thumb {
    width: 18px;
    height: 18px;
    background: deepskyblue;
    border-radius: 50%;
    cursor: pointer;
    border: none;
    box-shadow: 0 2px 4px rgba(0,0,0,0.3);
    transition: all 0.2s ease;
}

.speed-slider::-moz-range-thumb:hover {
    background: lime;
    transform: scale(1.1);
}

/* Loading indicator for search */
.search-loading {
    display: none;
    color: #666;
    font-size: 14px;
    margin-left: 10px;
}

.search-loading.active {
    display: inline-block;
}

/* Sticky Audio Player */
.sticky-audio-player {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    z-index: 2000;
    background: linear-gradient(135deg, #0f0f0f, #1a1a1a);
    border-top: 3px solid #333;
    box-shadow: 0 -4px 20px rgba(0, 0, 0, 0.5);
    padding: 15px 20px;
    transition: transform 0.3s ease-in-out;
}

.sticky-audio-player.hidden {
    transform: translateY(100%);
}

.sticky-audio-player .now-playing-metadata {
    display: flex;
    align-items: center;
    background: linear-gradient(135deg, #1e3c72, #2a5298);
    color: white;
    padding: 15px;
    border-radius: 8px;
    margin-bottom: 10px;
    box-shadow: 0 4px 15px rgba(0,0,0,0.3);
}

.sticky-audio-player .now-playing-metadata img {
    width: 80px;
    height: 80px;
    border-radius: 4px;
    margin-right: 15px;
    object-fit: cover;
}

.sticky-audio-player .audio-player-wrapper {
    display: flex;
    align-items: center;
    gap: 15px;
    justify-content: center;
}

.sticky-audio-player audio {
    flex: 1;
    max-width: 600px;
}

/* Add padding to body to prevent content from being hidden behind sticky player */
body {
    padding-bottom: 0;
    transition: padding-bottom 0.3s ease-in-out;
}

body.player-active {
    padding-bottom: 200px;
}

/* Mobile responsive for sticky player - make everything 50% smaller */
@media screen and (max-width: 768px) {
    .sticky-audio-player {
        padding: 5px 8px;
    }

    .sticky-audio-player .now-playing-metadata {
        padding: 6px 8px;
        margin-bottom: 5px;
        border-radius: 4px;
    }

    .sticky-audio-player .now-playing-metadata img {
        width: 40px;
        height: 40px;
        border-radius: 3px;
        margin-right: 8px;
        margin-bottom: 0;
    }

    .sticky-audio-player .now-playing-metadata > div {
        flex: 1;
        min-width: 0;
    }

    .sticky-audio-player .now-playing-metadata > div > div:nth-child(1) {
        font-size: 11px;
        font-weight: bold;
        margin-bottom: 2px;
        white-space: nowrap;
        overflow: hidden;
        text-overflow: ellipsis;
    }

    .sticky-audio-player .now-playing-metadata > div > div:nth-child(2) {
        font-size: 10px;
        opacity: 0.9;
        margin-bottom: 1px;
        white-space: nowrap;
        overflow: hidden;
        text-overflow: ellipsis;
    }

    .sticky-audio-player .now-playing-metadata > div > div:nth-child(3) {
        font-size: 9px;
        opacity: 0.7;
        white-space: nowrap;
        overflow: hidden;
        text-overflow: ellipsis;
    }

    .sticky-audio-player .now-playing-metadata a {
        font-size: 9px !important;
        padding: 2px 5px !important;
        margin-top: 2px !important;
    }

    .sticky-audio-player .audio-player-wrapper {
        flex-direction: row;
        align-items: center;
        gap: 5px;
        flex-wrap: wrap;
    }

    .sticky-audio-player audio {
        flex: 1;
        min-width: 180px;
        max-width: 100%;
        height: 32px;
    }

    .sticky-audio-player .speed-control {
        padding: 4px 8px;
        border-radius: 4px;
        font-size: 10px;
        gap: 4px;
    }

    .sticky-audio-player .speed-control label {
        margin-right: 4px;
    }

    .sticky-audio-player .speed-value {
        min-width: 32px;
        font-size: 10px;
    }

    .sticky-audio-player .speed-slider {
        width: 60px;
        height: 4px;
    }

    .sticky-audio-player .speed-slider::-webkit-slider-thumb {
        width: 12px;
        height: 12px;
    }

    .sticky-audio-player .speed-slider::-moz-range-thumb {
        width: 12px;
        height: 12px;
    }

    body.player-active {
        padding-bottom: 95px;
    }
}