/* General Page Styling */
* {
    box-sizing: border-box;
}

body {
    background: linear-gradient(135deg, #0f0f0f 0%, #1a1a1a 100%);
    color: white;
    font-family: 'Arial', sans-serif;
    margin: 0;
    padding: 0;
    min-height: 100vh;
}

/* Title Styling */
h1 {
    font-size: 2.5rem;
    margin: 2rem 0 3rem 0;
    text-align: center;
    background: linear-gradient(45deg, #8B0000, #DC143C, #2F0000, #000000);
    background-size: 400% 400%;
    background-clip: text;
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    animation: gradientShift 3s ease infinite;
}

@keyframes gradientShift {
    0% { background-position: 0% 50%; }
    50% { background-position: 100% 50%; }
    100% { background-position: 0% 50%; }
}

/* Search Container - Centered */
#search-container {
    display: flex;
    justify-content: center;
    margin: 2rem 0 3rem 0;
    padding: 0 20px;
}

/* Search Box */
#search-box {
    position: relative;
    display: flex;
    align-items: center;
    background: linear-gradient(45deg, #8B0000, #DC143C, #2F0000, #000000);
    background-size: 400% 400%;
    padding: 3px;
    border-radius: 30px;
    animation: gradientShift 3s ease infinite;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.5);
    transition: all 0.3s ease;
}

#search-box:hover {
    transform: translateY(-2px);
    box-shadow: 0 12px 40px rgba(139, 0, 0, 0.4);
}

#search-box:focus-within {
    transform: translateY(-2px);
    box-shadow: 0 12px 40px rgba(139, 0, 0, 0.4);
}

/* Search Input */
#search-bar {
    width: 400px;
    padding: 15px 20px;
    font-size: 16px;
    border: none;
    border-radius: 27px;
    background: rgba(15, 15, 15, 0.9);
    color: white;
    backdrop-filter: blur(10px);
    transition: all 0.3s ease;
    outline: none;
    display: block; /* Always visible */
}

#search-bar::placeholder {
    color: rgba(255, 255, 255, 0.6);
}

#search-bar:focus {
    background: rgba(15, 15, 15, 0.95);
    box-shadow: 0 0 20px rgba(139, 0, 0, 0.5);
}

/* Search Icon */
#search-icon {
    position: absolute;
    right: 8px;
    background: linear-gradient(45deg, #8B0000, #2F0000);
    border: none;
    border-radius: 50%;
    width: 40px;
    height: 40px;
    font-size: 18px;
    cursor: pointer;
    color: white;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
}

#search-icon:hover {
    transform: scale(1.1);
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.3);
}

/* Mobile Responsive */
@media (max-width: 768px) {
    #search-container {
        margin: 1.5rem 0 2rem 0;
        padding: 0 10px;
    }

    #search-bar {
        width: 300px;
        padding: 12px 16px;
        font-size: 14px;
    }

    #search-box {
        padding: 2px;
    }

    #search-icon {
        width: 35px;
        height: 35px;
        font-size: 16px;
    }
    
    .play-button {
        width: 45px;
        height: 45px;
        font-size: 16px;
    }

    h1 {
        font-size: 2rem;
        margin: 1rem 0 2rem 0;
    }
    
    #social-icons {
        display: flex;
        justify-content: center;
        align-items: center;
        gap: 12px;
        margin: 15px 0;
    }
    
    .social-icon {
        width: 35px;
        height: 35px;
        transition: transform 0.3s ease, filter 0.3s ease;
    }
    
    .social-icon:hover {
        transform: scale(1.1);
        filter: brightness(1.2);
    }
    
    /* Mobile song container styles */
    .song-container:hover {
        transform: translateY(-3px);
        border-color: rgba(0, 0, 0, 0.8);
        box-shadow: 0 8px 25px rgba(0, 0, 0, 0.3);
    }
    
    .song-container.voted {
        border: 2px solid rgba(255, 255, 255, 0.1);
        box-shadow: 0 0 0 4px rgba(220, 20, 60, 0.6), 0 0 15px rgba(220, 20, 60, 0.3), 0 8px 25px rgba(0, 0, 0, 0.4);
        transform: translateY(-1px);
    }
    
    .song-container.voted:hover {
        border: 2px solid rgba(255, 255, 255, 0.1);
        box-shadow: 0 0 0 4px rgba(220, 20, 60, 0.8), 0 0 20px rgba(220, 20, 60, 0.5), 0 12px 30px rgba(0, 0, 0, 0.5);
        transform: translateY(-5px);
    }
    
    .song-container.playing {
        border-color: rgba(0, 0, 0, 0.8);
        box-shadow: 0 0 0 3px rgba(220, 20, 60, 0.4), 0 8px 25px rgba(0, 0, 0, 0.3);
        transform: translateY(-2px);
    }
    
    .song-container.playing:hover {
        border-color: rgba(0, 0, 0, 0.8);
        box-shadow: 0 0 0 3px rgba(220, 20, 60, 0.6), 0 12px 30px rgba(0, 0, 0, 0.4);
        transform: translateY(-5px);
    }
}

/* Social Media Icons */
#social-icons {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 15px;
    margin: 20px 0;
}

/* Song Grid Container */
#song-list {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(350px, 1fr));
    gap: 30px;
    padding: 20px;
    max-width: 1400px;
    margin: 0 auto;
}

.social-icon {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s ease;
    text-decoration: none;
    background: rgba(255, 255, 255, 0.1);
    border: 2px solid rgba(255, 255, 255, 0.2);
}

.social-icon:hover {
    transform: translateY(-3px) scale(1.1);
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.3);
}

.discord-icon:hover {
    background: rgba(88, 101, 242, 0.2);
    border-color: #5865F2;
    box-shadow: 0 8px 25px rgba(88, 101, 242, 0.3);
}

.twitter-icon {
    color: #1DA1F2;
}

.twitter-icon:hover {
    background: rgba(29, 161, 242, 0.2);
    border-color: #1DA1F2;
    box-shadow: 0 8px 25px rgba(29, 161, 242, 0.3);
}

.tiktok-icon {
    color: #000000;
}

.tiktok-icon:hover {
    background: rgba(0, 0, 0, 0.2);
    border-color: #000000;
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.3);
}

/* Song Container */
.song-container {
    background: rgba(255, 255, 255, 0.05);
    border: 2px solid rgba(255, 255, 255, 0.1);
    border-radius: 20px;
    padding: 25px;
    transition: all 0.3s ease;
    backdrop-filter: blur(10px);
    position: relative;
    overflow: hidden;
    display: flex;
    flex-direction: column;
}

/* Voted Song Emphasis */
.song-container.voted {
    border: 2px solid rgba(255, 255, 255, 0.1);
    box-shadow: 0 0 0 6px rgba(220, 20, 60, 0.6), 0 0 20px rgba(220, 20, 60, 0.3), 0 10px 30px rgba(0, 0, 0, 0.4);
    transform: translateY(-2px);
}

.song-container.voted:hover {
    border: 2px solid rgba(255, 255, 255, 0.1);
    box-shadow: 0 0 0 6px rgba(220, 20, 60, 0.8), 0 0 25px rgba(220, 20, 60, 0.5), 0 15px 35px rgba(0, 0, 0, 0.5);
    transform: translateY(-7px);
}

.song-container::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: linear-gradient(135deg, rgba(139, 0, 0, 0.1) 0%, rgba(47, 0, 0, 0.1) 100%);
    opacity: 0;
    transition: opacity 0.3s ease;
    z-index: -1;
}

.song-container:hover {
    transform: translateY(-5px);
    border-color: rgba(0, 0, 0, 0.8);
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.3);
}

.song-container:hover::before {
    opacity: 1;
}

/* Song Header with Icon and Title */
.song-header {
    display: flex;
    align-items: center;
    margin-bottom: 20px;
    gap: 15px;
}

/* Icon Container */
.song-icon-container {
    position: relative;
    width: 60px;
    height: 60px;
    flex-shrink: 0;
}

/* Square Icon Space */
.song-icon {
    width: 60px;
    height: 60px;
    background: linear-gradient(135deg, #8B0000, #2F0000);
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.5rem;
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.3);
    transition: all 0.3s ease;
}

/* Song Icon Image */
.song-icon-img {
    width: 60px;
    height: 60px;
    border-radius: 12px;
    object-fit: cover;
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.3);
    transition: all 0.3s ease;
}

/* Fallback icon when image fails to load */
.song-icon-fallback {
    width: 60px;
    height: 60px;
    background: linear-gradient(135deg, #8B0000, #2F0000);
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.5rem;
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.3);
    transition: all 0.3s ease;
}

.song-container:hover .song-icon,
.song-container:hover .song-icon-img,
.song-container:hover .song-icon-fallback {
    transform: scale(1.1) rotate(5deg);
}

/* Song Title */
.song-title {
    font-size: 1.3rem;
    font-weight: bold;
    color: #ffffff;
    margin: 0;
    flex: 1;
}

/* Song Controls Section */
.song-controls {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 20px;
    padding: 15px;
    background: rgba(255, 255, 255, 0.05);
    border-radius: 12px;
    border: 1px solid rgba(255, 255, 255, 0.1);
}

/* Play Button */
.play-button {
    background: linear-gradient(45deg, #8B0000, #2F0000);
    border: none;
    border-radius: 50%;
    width: 50px;
    height: 50px;
    font-size: 18px;
    font-weight: bold;
    cursor: pointer;
    color: white;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.3);
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.5);
}

.play-button:hover {
    transform: scale(1.1);
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.4);
}

/* Song Duration */
.song-duration {
    font-size: 0.9rem;
    color: rgba(255, 255, 255, 0.7);
    font-weight: 500;
}

/* Seek Bar Container */
.seek-bar-container {
    height: 4px;
    background: linear-gradient(90deg, transparent, #DC143C, #2F0000, transparent);
    margin: 20px 0;
    border-radius: 2px;
    cursor: pointer;
    position: relative;
    overflow: hidden;
    transition: all 0.3s ease;
}

.seek-bar-container:hover {
    height: 6px;
    background: linear-gradient(90deg, transparent, #DC143C, #2F0000, #000000, transparent);
}

/* Seek Bar Progress */
.seek-bar-progress {
    height: 100%;
    background: linear-gradient(90deg, #8B0000, #DC143C, #2F0000);
    width: 0%;
    border-radius: 2px;
    transition: width 0.1s ease;
    position: relative;
}

.seek-bar-progress::after {
    content: '';
    position: absolute;
    right: -2px;
    top: -2px;
    width: 8px;
    height: 8px;
    background: white;
    border-radius: 50%;
    box-shadow: 0 0 5px rgba(0, 0, 0, 0.3);
    opacity: 0;
    transition: opacity 0.3s ease;
}

.seek-bar-container:hover .seek-bar-progress::after {
    opacity: 1;
}

/* Vote Section */
.vote-section {
    margin-top: auto;
}

/* Vote Count */
.vote-count {
    text-align: center;
    font-size: 1.2rem;
    margin-bottom: 15px;
    font-weight: bold;
    color: #DC143C;
}

/* Crown for #1 */
.crown {
    display: inline-block;
    margin-left: 10px;
    font-size: 1.5rem;
    animation: crownGlow 2s ease-in-out infinite alternate;
}

@keyframes crownGlow {
    from { text-shadow: 0 0 5px #ffd700; }
    to { text-shadow: 0 0 20px #ffd700, 0 0 30px #ffd700; }
}

/* Vote Button */
.vote-btn {
    background: linear-gradient(135deg, #DC143C, #2F0000);
    color: white;
    border: none;
    padding: 15px 30px;
    font-size: 1.1rem;
    font-weight: bold;
    border-radius: 25px;
    cursor: pointer;
    transition: all 0.3s ease;
    width: 100%;
    text-transform: uppercase;
    letter-spacing: 1px;
    position: relative;
    overflow: hidden;
}

.vote-btn::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(220, 20, 60, 0.3), transparent);
    transition: left 0.5s ease;
}

.vote-btn:hover::before {
    left: 100%;
}

.vote-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 10px 25px rgba(78, 205, 196, 0.4);
}

.vote-btn:active {
    transform: translateY(0);
}

.vote-btn:disabled {
    background: linear-gradient(135deg, #2F0000, #8B0000);
    cursor: not-allowed;
    transform: none;
}

.vote-btn:disabled:hover {
    transform: none;
    box-shadow: none;
}

/* Error Message */
.error {
    color: #8B0000;
    text-align: center;
    margin-top: 10px;
    font-weight: bold;
}

/* Success Animation */
.vote-success {
    animation: voteSuccess 0.6s ease;
}

@keyframes voteSuccess {
    0% { transform: scale(1); }
    50% { transform: scale(1.05); background: linear-gradient(135deg, #000000, #DC143C); }
    100% { transform: scale(1); }
}

/* Highlight search matches */
.highlight {
    background: linear-gradient(135deg, #8B0000, #DC143C);
    color: #fff;
    font-weight: bold;
    padding: 2px 6px;
    border-radius: 4px;
    box-shadow: 0 2px 5px rgba(139, 0, 0, 0.5);
}

/* Filter Dropdown Styling */
#filter-dropdown {
    background: rgba(0, 0, 0, 0.8);
    color: white;
    border: 2px solid rgba(255, 255, 255, 0.2);
}

#filter-dropdown option {
    background: #1a1a1a;
    color: white;
    padding: 10px;
}

/* Footer */
footer {
    text-align: center;
    margin: 50px 0 20px;
    padding: 20px;
    color: rgba(255, 255, 255, 0.6);
}

footer a {
    color: #DC143C;
    text-decoration: none;
    transition: color 0.3s ease;
}

footer a:hover {
    color: #2F0000;
}

/* Loading Animation */
.loading {
    display: inline-block;
    width: 20px;
    height: 20px;
    border: 3px solid rgba(255, 255, 255, 0.3);
    border-radius: 50%;
    border-top-color: #DC143C;
    animation: spin 1s ease-in-out infinite;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

/* Responsive Design */
@media (max-width: 480px) {
    #song-list {
        grid-template-columns: 1fr;
        padding: 10px;
        gap: 20px;
    }
    
    .song-container {
        padding: 20px;
    }
    
    .song-title {
        font-size: 1.3rem;
    }
    
    .vote-btn {
        padding: 12px 25px;
        font-size: 1rem;
    }
}