/* General Body Styles */
body {
    background-image: url("bg.jpg");
    background-repeat: no-repeat;
    background-position: center center;
    background-size: cover;
    background-attachment: fixed;
    font-family: Arial, sans-serif;
    -webkit-tap-highlight-color: transparent;
    
    /* Layout voor sticky header */
    display: flex;
    flex-direction: column;
    height: 100vh;
    margin: 0;
    padding: 0;
    overflow: hidden;
}

/* Sticky Header Wrapper */
.main-header {
    flex-shrink: 0;
    padding: 1em;
    /* AANGEPAST: De achtergrond is transparanter gemaakt (van 0.9 naar 0.6) */
    background-color: rgba(26, 26, 26, 0.1);
    backdrop-filter: blur(5px);
    -webkit-backdrop-filter: blur(5px);
    box-shadow: 0 2px 5px rgba(0,0,0,0.3);
    z-index: 100;
}

/* Search & Sort Styles */
.search-container {
    text-align: center;
    margin-bottom: 10px;
}
#zoekbalk {
    width: 90%;
    max-width: 400px;
    padding: 12px 20px;
    border-radius: 25px;
    border: 1px solid #444;
    background-color: rgba(0,0,0,0.4);
    color: white;
    font-size: 16px;
    outline: none;
    transition: background-color 0.3s;
}
#zoekbalk:focus {
    background-color: rgba(0,0,0,0.6);
}
#zoekbalk::placeholder {
    color: #bbb;
}

.controls-container {
    text-align: center;
    margin-bottom: 20px;
}

.sort-container {
    margin-bottom: 15px;
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 5px;
}

.sort-button {
    background-color: rgba(0,0,0,0.2);
    border: 1px solid #555;
    color: #ccc;
    padding: 8px 16px;
    margin: 0 5px;
    border-radius: 20px;
    cursor: pointer;
    font-size: 14px;
    transition: all 0.2s;
}
.sort-button:hover {
    background-color: rgba(0,0,0,0.4);
    border-color: #777;
}
.sort-button.active {
    background-color: #2ecc71;
    color: white;
    border-color: #2ecc71;
    font-weight: bold;
}

/* Stijlen voor volumeregelaar */
.volume-container {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 10px;
    color: #ccc;
    font-size: 20px;
}
#volume-slider {
    width: 150px;
    cursor: pointer;
}

/* Soundboard Grid */
.soundboard-grid {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 10px;
    padding: 10px;
    
    /* Layout voor scrollable grid */
    flex-grow: 1;
    overflow-y: auto;
}

/* Individual sound tile */
.soundboard {
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    text-align: center;
    padding: 15px 5px 5px 5px;
    height: 125px;
    width: 125px;
    border-width: 0;
    outline: none;
    border-radius: 8px;
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.3);
    background-color: #2ecc71;
    color: #ecf0f1;
    font-size: 15px;
    font-weight: bold;
    cursor: pointer;
    user-select: none;
    transition: all 0.2s, transform 0.3s ease-out, opacity 0.3s ease-out, box-shadow 0.3s ease-in-out;
}
.soundboard.is-sorting {
    box-shadow: 0 0 15px rgba(46, 204, 113, 0.8);
}
.soundboard:focus {
    box-shadow: 0 0 10px 3px #3498db;
    border-color: #3498db;
}

.soundboard:hover {
    background-color: #27ae60;
}
.soundboard:active {
    transform: scale(0.95);
}

.soundboard.is-sharing, .soundboard.is-playing {
    background-color: #3498db;
}
.soundboard.is-playing {
    animation: pulse 1.5s infinite;
}
@keyframes pulse {
    0% { transform: scale(1); }
    50% { transform: scale(1.03); }
    100% { transform: scale(1); }
}

/* Favorite System Styles */
.favorite-star {
    position: absolute;
    top: 5px;
    right: 5px;
    z-index: 2;
}
.favorite-star svg {
    width: 22px;
    height: 22px;
    stroke: white;
    stroke-width: 1.5;
    fill: rgba(0,0,0,0.2);
    transition: fill 0.2s, transform 0.2s;
}
.favorite-star:hover svg {
    transform: scale(1.2);
}
.soundboard.is-favorite .favorite-star svg {
    fill: #ffd700;
    stroke: #ffc700;
}

/* Download link stijlen */
.download-link {
    position: absolute;
    bottom: 5px;
    left: 8px;
    z-index: 2;
    opacity: 0.6;
    transition: opacity 0.2s, transform 0.2s;
}
.download-link:hover {
    opacity: 1;
    transform: scale(1.1);
}
.download-link svg {
    width: 20px;
    height: 20px;
    stroke: white;
}

/* Play count stijlen */
.sound-play-count {
    position: absolute;
    bottom: 8px;
    right: 8px;
    font-size: 12px;
    font-weight: normal;
    color: white;
    opacity: 0.7;
    z-index: 2;
}

/* Loading Indicator */
.spinner {
    display: none;
    width: 30px;
    height: 30px;
    border: 4px solid rgba(255, 255, 255, 0.3);
    border-radius: 50%;
    border-top-color: #fff;
    animation: spin 1s ease-in-out infinite;
}
@keyframes spin {
    to { transform: rotate(360deg); }
}
.soundboard.is-loading .sound-name, .soundboard.is-loading .favorite-star, .soundboard.is-loading .download-link {
    display: none;
}
.soundboard.is-loading .spinner {
    display: block;
}

/* Hidden class for search & scroll-to-top */
.hidden {
    display: none !important;
}

/* "No results" message */
#no-results-message {
    color: white;
    font-size: 18px;
    opacity: 0.8;
    text-align: center;
    width: 100%;
    padding: 40px 20px;
}

/* Stop, Info, en Scroll-to-Top knoppen */
/* Let hier goed op de 'bottom' berekeningen voor de juiste stapeling */
.soundboard.stop {
    background-color: #e74c3c;
    height: 50px;
    width: 50px;
    position: fixed;
    bottom: 1.5em;
    right: 1.5em;
    border-radius: 50%;
    font-size: 24px;
    z-index: 10;
    padding: 0; 
}
.soundboard.stop:hover, .soundboard.stop:active {
    background-color: #c0392b;
}

.soundboard.info {
    background-color: #3498db;
    height: 50px;
    width: 50px;
    position: fixed;
    bottom: calc(1.5em + 50px + 10px);
    right: 1.5em;
    border-radius: 50%;
    font-size: 24px;
    z-index: 10;
    padding: 0;
}
.soundboard.info:hover {
    background-color: #2980b9;
}

.soundboard.scroll-to-top {
    background-color: #8e44ad;
    height: 50px;
    width: 50px;
    position: fixed;
    bottom: calc(1.5em + 50px + 10px + 50px + 10px); 
    right: 1.5em;
    border-radius: 50%;
    font-size: 24px;
    font-weight: bold;
    z-index: 10;
    padding: 0;
    opacity: 0;
    transform: translateY(20px);
    transition: opacity 0.3s, transform 0.3s;
}
.soundboard.scroll-to-top:not(.hidden) {
    opacity: 1;
    transform: translateY(0);
}
.soundboard.scroll-to-top.hidden {
    /* override display:none met pointer-events voor een soepele animatie */
    pointer-events: none; 
    display: flex !important;
}
.soundboard.scroll-to-top:hover {
    background-color: #7D3C98;
}


/* Popup styles */
.popup-container {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.7);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 1000;
}
.popup-content {
    background-color: #333;
    color: #fff;
    padding: 20px 30px;
    border-radius: 10px;
    width: 90%;
    max-width: 500px;
    position: relative;
    box-shadow: 0 5px 15px rgba(0,0,0,0.5);
    border: 1px solid #555;
}
.popup-content h2 {
    margin-top: 0;
    color: #2ecc71;
}
.popup-content ul {
    list-style: none;
    padding-left: 0;
}
.popup-content ul li {
    margin-bottom: 10px;
    line-height: 1.5;
}
.popup-content ul li b {
    color: #2ecc71;
}
.popup-close {
    position: absolute;
    top: 10px;
    right: 15px;
    background: none;
    border: none;
    color: #aaa;
    font-size: 30px;
    cursor: pointer;
    padding: 0;
    line-height: 1;
}
.popup-close:hover {
    color: white;
}

/* Visualizer & Result text */
.result-container {
    position: relative;
    text-align: center;
    height: 60px;
    margin-bottom: 20px;
    display: flex;
    align-items: center;
    justify-content: center;
}
#visualizer {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 1;
}
.result {
    position: relative;
    z-index: 2;
    color: white;
    font-weight: bold;
    font-size: 28px;
    text-shadow: 1px 1px 2px rgba(0,0,0,0.5);
    margin: 0;
}

/* Versienummer */
.version-info {
    position: fixed;
    bottom: 1.5em;
    left: 1.5em;
    color: white;
    font-size: 12px;
    opacity: 0.6;
    text-shadow: 1px 1px 2px rgba(0,0,0,0.5);
    z-index: 10;
}
.version-info a {
    color: inherit;
    text-decoration: none;
}

/* Responsive styles */
@media only screen and (max-width: 600px) {
    .soundboard {
        width: calc(33.33% - 10px);
        height: 100px;
        font-size: 14px;
    }
    .sort-button { font-size: 12px; padding: 6px 12px; }
    
    .soundboard.stop, .soundboard.info, .soundboard.scroll-to-top {
        height: 60px;
        width: 60px;
        padding: 0; 
    }
    .soundboard.info {
        bottom: calc(1.5em + 60px + 10px);
    }
    .soundboard.scroll-to-top {
        bottom: calc(1.5em + 60px + 10px + 60px + 10px);
    }

    .version-info { font-size: 10px; }
    .popup-content { width: 95%; padding: 15px 20px; }
    #volume-slider { width: 120px; }
}