/* General Styles */
body {
    font-family: Arial, sans-serif;
    background-color: #f4f4f4;
    color: #333;
    margin: 0;
    padding: 0;
}

.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 20px;
}

header {
    text-align: center;
    margin-bottom: 20px;
}

header h1 {
    color: #582C5E;
    font-size: 2rem;
}

/* Section Styling */
.library-section,
.playlist-section,
.saved-playlist-section {
    margin-top: 20px;
    background: #fff;
    padding: 20px;
    border: 1px solid #ddd;
    border-radius: 5px;
}

h3 {
    color: #582C5E;
    margin-bottom: 10px;
}

/* Flex Layout for Library and Playlist */
.library-playlist-container {
    display: flex;
    justify-content: space-between;
    gap: 20px; /* Adds space between the two sections */
    flex-wrap: wrap; /* Allow wrapping on smaller screens */
}

.library-section,
.playlist-section {
    flex: 1 1 48%; /* Take equal width but allow for wrapping on smaller screens */
    min-width: 48%; /* Ensure there's enough space between the two tables */
}

/* Library Table Styles */
#libraryTable,
#playlistTable {
    width: 100%;
    border-collapse: collapse;
    margin-top: 10px;
}

#libraryTable thead,
#playlistTable thead {
    display: table;
    width: 100%;
    table-layout: fixed;
}

#libraryTable tbody,
#playlistTable tbody {
    display: block;
    max-height: 400px;
    overflow-y: auto;
    width: 100%;
}

#libraryTable tbody tr,
#playlistTable tbody tr {
    display: table;
    width: 100%;
    table-layout: fixed;
}

#libraryTable thead th,
#playlistTable thead th {
    background-color: #582C5E;
    color: white;
    padding: 10px;
    text-align: left;
    cursor: pointer;
}

#libraryTable thead th:hover,
#playlistTable thead th:hover {
    background-color: #582C5E;
}

#libraryTable tbody tr:nth-child(odd),
#playlistTable tbody tr:nth-child(odd) {
    background-color: #f9f9f9;
}

#libraryTable tbody tr:nth-child(even),
#playlistTable tbody tr:nth-child(even) {
    background-color: #ffffff;
}

#libraryTable tbody td,
#playlistTable tbody td {
    padding: 10px;
    border-bottom: 1px solid #ddd;
}

#libraryTable tbody tr:hover,
#playlistTable tbody tr:hover {
    background-color: #f1f1f1;
    cursor: pointer;
}

/* Buttons */
button {
    display: inline-block;
    margin-top: 10px;
    padding: 10px 20px;
    background-color: #582C5E;
    color: white;
    border: none;
    border-radius: 5px;
    font-size: 1rem;
    cursor: pointer;
}

button:hover {
    background-color: #582C5E;
}

/* Playlist Section */
#playlistArea {
    border: 3px dashed #582C5E;
    text-align: center;
    min-height: 100px;
    padding: 20px;
    font-style: italic;
    color: #666;
    transition: background-color 0.3s ease, border-color 0.3s ease;
}

#playlistDisplay.dragover {
    background-color: #f0f0f0;
    border: 2px dashed #582C5E;
    color: #333;
}

/* For smaller screens, stack the tables vertically */
@media screen and (max-width: 900px) {
    .library-playlist-container {
        flex-direction: column;
        align-items: center;
    }

    .library-section,
    .playlist-section {
        min-width: 100%;
        margin-bottom: 20px; /* Add space between the stacked sections */
    }
}

.loading-spinner {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    height: 100vh;
    text-align: center;
    font-size: 18px;
    color: #555;
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    background: rgba(255, 255, 255, 0.9); /* Optional background overlay */
    z-index: 9999; /* Ensure it's above all other content */
}

.spinner-icon {
    width: 60px; /* Adjusted to half the size */
    height: 60px;
    animation: spin 1.5s linear infinite;
    margin-bottom: 10px; /* Space between icon and text */
}

@keyframes spin {
    from {
        transform: rotate(0deg);
    }
    to {
        transform: rotate(360deg);
    }
}

.loading-spinner p {
    font-size: 16px;
    color: #333;
}

th.active {
    color: #FFE500; /* Change the color of the active column */
    font-weight: bold; /* Optional: Make the active column bold */
}

th.active.asc::after {
    content: " ↑"; /* Up arrow for ascending */
    font-size: 12px;
}

th.active.desc::after {
    content: " ↓"; /* Down arrow for descending */
    font-size: 12px;
}
