/* Reset and Base Styles */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    overscroll-behavior-y: none;
    touch-action: auto;
    -webkit-tap-highlight-color: transparent;
}

/* Scrollable Containers */
#ViTune-results, #home-content, #playlists-list, #likes-list, #offline-list, #settings-content {
    overscroll-behavior-y: contain;
    overflow-y: auto;
    scrollbar-width: none;
    -ms-overflow-style: none;
    padding-bottom: 80px; /* Ensure content isn't hidden under audio player */
}

#ViTune-results::-webkit-scrollbar,
#home-content::-webkit-scrollbar,
#playlists-list::-webkit-scrollbar,
#likes-list::-webkit-scrollbar,
#offline-list::-webkit-scrollbar,
#settings-content::-webkit-scrollbar {
    display: none;
}

/* Tab Navigation */
.tab-nav {
    position: sticky;
    top: 64px; /* Below navbar */
    z-index: 30;
    background: rgba(31, 41, 55, 0.8); /* Match navbar backdrop */
    padding: 8px 0;
    margin-bottom: 16px;
}

/* Load More Button */
#loadmore {
    display: block;
    margin: 20px auto;
    width: fit-content;
    background-color: #2dd4bf; /* Match accent color */
    color: white;
    padding: 8px 16px;
    border-radius: 9999px;
    font-size: 0.875rem;
    transition: background-color 0.2s ease;
}

#loadmore:hover {
    background-color: #5eead4;
}

/* Ensure Search Tab Layout */
#search-tab {
    padding-top: 0; /* Prevent extra padding */
}

/* Grid for Search Results */
#ViTune-results {
    position: relative;
    padding-bottom: 20px; /* Space for Load More button */
}

/* Song Container */
.song-container {
    background-color: #1f2937;
    border-radius: 8px;
    padding: 16px;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
    transition: box-shadow 0.3s ease, transform 0.3s ease;
    cursor: pointer;
}

.song-container:hover {
    box-shadow: 0 10px 15px rgba(0, 0, 0, 0.3);
    transform: translateY(-2px);
}

/* Control Buttons */
.control-btn {
    transition: color 0.2s ease, transform 0.1s ease;
}

.control-btn:active {
    transform: scale(0.95);
}

/* Settings Content */
#settings-content {
    min-height: calc(100vh - 64px); /* Account for navbar */
    padding: 16px;
}

/* Infinity Icon */
.infinity-icon {
    font-size: 1.2em;
    display: inline-block;
    transition: color 0.2s;
}

#loop-btn.active .infinity-icon {
    color: #2dd4bf;
}

/* Loop State Label */
.loop-state-label {
    position: absolute;
    top: -20px;
    left: 50%;
    transform: translateX(-50%);
    background-color: #2dd4bf;
    color: white;
    font-size: 0.7em;
    padding: 2px 6px;
    border-radius: 10px;
    z-index: 10;
    opacity: 1;
    transition: opacity 0.5s;
}

/* No Scrollbar */
.no-scrollbar::-webkit-scrollbar {
    display: none;
}

.no-scrollbar {
    -ms-overflow-style: none;
    scrollbar-width: none;
}

/* Loader */
.loader {
    border: 4px solid #f3f3f3;
    border-top: 4px solid #3498db;
    border-radius: 50%;
    width: 32px;
    height: 32px;
    animation: spin 1s linear infinite;
    display: block;
    margin: 20px auto;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* Float Button */
.float-button {
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 9999px;
    background-color: #1f2937;
    color: #2dd4bf;
    transition: background-color 0.2s ease, color 0.2s ease, transform 0.1s ease;
}

.float-button:active {
    transform: scale(0.95);
}

.float-button:hover {
    background-color: #374151;
    color: #5eead4;
}

/* Modal Popup */
.mpopup {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: rgba(0, 0, 0, 0.5);
    z-index: 1000;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: opacity 0.3s ease;
}

.mpopup.hidden {
    display: none;
}

.modal-content {
    background-color: #1f2937;
    padding: 24px;
    width: 91.666667%;
    max-width: 500px;
    border-radius: 8px;
    box-shadow: 0 10px 15px rgba(0, 0, 0, 0.3);
    transition: transform 0.3s ease-in-out;
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding-bottom: 10px;
}

.modal-body {
    padding: 16px;
    max-height: 320px;
    overflow-y: auto;
}

.modal-footer {
    padding-top: 16px;
    text-align: right;
}

.close {
    color: #9ca3af;
    font-size: 1.5rem;
    font-weight: bold;
    cursor: pointer;
    transition: color 0.2s ease;
}

.close:hover {
    color: #ffffff;
}

.nobullets {
    list-style: none;
    padding: 0;
    margin: 0;
}

/* Theme Styles */
.dark {
    background-color: #1f2937;
    color: #f3f4f6;
    transition: background-color 0.3s ease, color 0.3s ease;
}

.light-mode {
    background-color: #e5e7eb;
    color: #111827;
    transition: background-color 0.3s ease, color 0.3s ease;
}

/* Font Styles */
.font-poppins { font-family: 'Poppins', sans-serif; }
.font-roboto { font-family: 'Roboto', sans-serif; }
.font-open-sans { font-family: 'Open Sans', sans-serif; }
.font-lato { font-family: 'Lato', sans-serif; }
.font-montserrat { font-family: 'Montserrat', sans-serif; }
.font-arial { font-family: Arial, sans-serif; }
.font-times { font-family: 'Times New Roman', Times, serif; }

/* Font Sizes */
.font-xsmall { font-size: 0.75rem; line-height: 1rem; }
.font-small { font-size: 0.875rem; line-height: 1.25rem; }
.font-medium { font-size: 1rem; line-height: 1.5rem; }
.font-large { font-size: 1.125rem; line-height: 1.75rem; }
.font-xlarge { font-size: 1.25rem; line-height: 1.875rem; }

/* Transparency */
.transparent-on {
    background-color: rgba(31, 41, 55, 0.5);
}

.transparent-off {
    background-color: rgba(31, 41, 55, 1);
}

.song-transparent {
    background-color: rgba(31, 41, 55, 0.5) !important;
}

/* Progress Bar Colors */
.progress-bar-teal { background-color: #2dd4bf; }
.progress-bar-red { background-color: #ef4444; }
.progress-bar-blue { background-color: #3b82f6; }
.progress-bar-purple { background-color: #a855f7; }
.progress-bar-pink { background-color: #ec4899; }

/* Progress Bar Styles */
.progress-bar-simple {
    background-image: none;
}

.progress-bar-gradient {
    background-image: linear-gradient(to right, #2dd4bf, #3b82f6);
}

.progress-bar-wave {
    background: linear-gradient(45deg, #ff6b6b, #4ecdc4, #45b7d1, #ff6b6b);
    background-size: 200% 100%;
    animation: waveAnimation 2s linear infinite;
}

@keyframes waveAnimation {
    0% { background-position: 0% 50%; }
    100% { background-position: 200% 50%; }
}

/* Tab Buttons */
.tab-btn {
    transition: background-color 0.2s ease, color 0.2s ease, transform 0.1s ease;
}

.tab-btn:active {
    transform: scale(0.95);
}

/* Accent Colors */
.accent-teal {
    color: #2dd4bf;
}

.accent-teal:hover {
    color: #5eead4;
}

.accent-purple {
    color: #a855f7;
}

.accent-purple:hover {
    color: #c084fc;
}

.accent-pink {
    color: #ec4899;
}

.accent-pink:hover {
    color: #f472b6;
}

/* Navbar */
nav {
    background: linear-gradient(to right, #1f2937, #374151);
    z-index: 50;
}

/* Setting Card */
.setting-card {
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
    transition: box-shadow 0.3s ease;
}

.setting-card:hover {
    box-shadow: 0 8px 12px rgba(0, 0, 0, 0.2);
}

/* Select Elements */
select {
    transition: background-color 0.2s ease, box-shadow 0.2s ease;
}

select:hover {
    background-color: #4b5563;
    box-shadow: 0 0 0 2px rgba(45, 212, 191, 0.3);
}

/* Animation Speeds */
.animation-fast {
    transition-duration: 0.1s;
}

.animation-normal {
    transition-duration: 0.3s;
}

.animation-slow {
    transition-duration: 0.5s;
}

/* Mood Toggle */
.mood-toggle {
    position: relative;
    width: 48px;
    height: 24px;
}

.mood-toggle input {
    display: none;
}

.mood-toggle-label {
    position: absolute;
    top: 0;
    left: 0;
    width: 48px;
    height: 24px;
    background-color: #4b5563;
    border-radius: 12px;
    cursor: pointer;
    transition: background-color 0.3s ease;
}

.mood-toggle-inner {
    position: absolute;
    top: 2px;
    left: 2px;
    width: 20px;
    height: 20px;
    background-color: #ffffff;
    border-radius: 50%;
    transition: transform 0.3s ease;
}

.mood-toggle-switch {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    color: #ffffff;
    font-size: 10px;
    transition: opacity 0.3s ease;
}

.mood-toggle input:checked + .mood-toggle-label {
    background-color: #2dd4bf;
}

.mood-toggle input:checked + .mood-toggle-label .mood-toggle-inner {
    transform: translateX(24px);
}

.mood-toggle input:checked + .mood-toggle-label::before {
    content: 'ON';
    position: absolute;
    left: 8px;
    top: 50%;
    transform: translateY(-50%);
    color: #ffffff;
    font-size: 10px;
}

.mood-toggle input:not(:checked) + .mood-toggle-label::before {
    content: 'OFF';
    position: absolute;
    right: 8px;
    top: 50%;
    transform: translateY(-50%);
    color: #ffffff;
    font-size: 10px;
}

/* Search Bar */
#search-tab .relative {
    margin-top: 16px; /* Space below tabs */
    z-index: 40;
}

/* Audio Player */
#audio-player {
    z-index: 40;
    bottom: 0;
}

/* Responsive Design */
@media (max-width: 640px) {
    .song-container {
        width: 100%;
        max-width: 100%;
    }
    .modal-content {
        width: 95%;
        max-width: 95%;
    }
    #player-detailed {
        flex-direction: column;
        gap: 10px;
    }
    #player-minimal .max-w-\[150px\] {
        max-width: 100px;
    }
}

@media (min-width: 640px) and (max-width: 1023px) {
    .song-container {
        width: calc(50% - 1rem);
        min-width: 180px;
    }
}

@media (min-width: 1024px) {
    .song-container {
        width: calc(20% - 1rem);
        min-width: 200px;
    }
    #audio-player {
        padding: 0 10%;
    }
}