
/* Library Styles */
.library-container {
    width: 800px;
    max-width: 95%;
    margin: 100px auto;
    padding-bottom: 50px;
}

.library-container h2 {
    margin-bottom: 20px;
    color: var(--text-color);
}

.track-library {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 20px;
}

.library-item {
    background: white;
    border-radius: 15px;
    padding: 15px;
    box-shadow: 0 5px 15px rgba(0,0,0,0.05);
    display: flex;
    flex-direction: column;
    transition: transform 0.2s;
}

.lib-content-wrapper {
    display: flex;
    flex-direction: column;
}

.library-item:hover {
    transform: translateY(-5px);
}

.lib-artwork {
    width: 100%;
    height: auto;
    aspect-ratio: 1 / 1;
    object-fit: cover;
    border-radius: 10px;
    margin-bottom: 15px;
}

.lib-info {
    margin-bottom: 15px;
}

.lib-title {
    font-weight: bold;
    font-size: 1.1rem;
    margin-bottom: 5px;
}

.lib-artist {
    color: var(--text-secondary);
    font-size: 0.9rem;
    margin-bottom: 10px;
}

.lib-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 15px;
    font-size: 0.8rem;
    color: #888;
    margin-bottom: 15px;
}

.lib-meta span {
    display: flex;
    align-items: center;
    gap: 8px;
    white-space: nowrap;
}

.track-library.grid-view .lib-meta {
    justify-content: space-between;
    gap: 10px;
}

.track-library.grid-view .lib-meta span {
    font-size: 0.75rem;
}

.lib-actions {
    display: flex;
    gap: 10px;
    margin-top: auto;
    flex-wrap: wrap;
}

.track-library.grid-view .btn-lib {
    flex: 1 1 calc(50% - 10px);
    min-width: 100px;
    padding: 8px 10px;
    font-size: 0.85rem;
}

.btn-lib {
    padding: 10px 15px;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    font-size: 0.9rem;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    transition: all 0.2s;
    font-weight: 500;
}

.lib-meta svg {
    opacity: 0.7;
    flex-shrink: 0;
}

.btn-play-now {
    background: #6c5ce7;
    color: white;
}

.btn-play-now:hover {
    background: #5b4bc4;
}

.btn-add-playlist {
    background-color: var(--secondary-color);
    color: white;
}

.btn-add-playlist:hover {
    background-color: var(--primary-color);
}

.btn-download {
    background-color: #55efc4;
    color: white;
}

.btn-download:hover {
    background-color: #00b894;
}

.btn-basket {
    background-color: #fab1a0;
    color: white;
}

.btn-basket:hover {
    background-color: #e17055;
}

/* Fixed Player Styles */
body.fixed-player {
    padding-top: 170px; /* Adjusted to match nav (60px) + player (110px) */
}

body.fixed-player .player-container {
    position: fixed;
    top: 60px; /* Below nav */
    left: 0;
    width: 100%;
    height: auto;
    min-height: 110px; /* Reduced from 140px */
    max-width: 100%;
    border-radius: 0;
    z-index: 1999;
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(10px);
    box-shadow: 0 5px 20px rgba(0,0,0,0.1);
    margin: 0;
    overflow: visible !important;
    transition: none !important; /* Prevent transition issues */
    opacity: 1 !important;
    visibility: visible !important;
}

body.fixed-player .playlist-wrapper {
    display: none; /* Hide playlist in mini mode by default */
    position: absolute;
    top: 100%;
    left: 0;
    width: 100%;
    height: 550px;
    background: white;
    box-shadow: 0 5px 15px rgba(0,0,0,0.1);
    border-radius: 0 0 10px 10px;
    z-index: 999;
}

body.fixed-player .playlist-wrapper.active {
    display: flex;
    flex-direction: column;
}

body.fixed-player .player-content-row {
    width: 80px;
    margin-bottom: 0;
    justify-content: center;
    gap: 0;
    flex-shrink: 0;
    order: 1;
}

body.fixed-player .artwork-container {
    width: 60px;
    height: 60px;
    margin-bottom: 0;
    margin-right: 0;
    position: relative;
    z-index: 5;
}

body.fixed-player .player-wrapper {
    flex-direction: row;
    flex-wrap: wrap;
    padding: 15px 30px;
    justify-content: center;
    align-items: center;
    overflow: visible !important;
    height: auto;
    min-height: 110px; /* Reduced from 140px */
    box-sizing: border-box;
    gap: 20px 40px;
}

body.fixed-player .track-info {
    text-align: left;
    margin-bottom: 0;
    flex: 0 1 auto;
    margin-right: 0;
    position: relative;
    z-index: 5;
    min-width: 180px;
    order: 2;
}

body.fixed-player .track-info h2 {
    font-size: 1.2rem;
    margin-bottom: 2px;
}

body.fixed-player .track-info h3 {
    font-size: 0.9rem;
}

body.fixed-player .progress-container {
    position: relative;
    width: 100%;
    height: 35px;
    margin-bottom: 0;
    border-radius: 0;
    z-index: 100;
    overflow: visible !important;
    order: 10;
    margin-top: 10px;
}

body.fixed-player .time-info {
    position: absolute;
    bottom: 2px;
    left: 10px;
    right: 10px;
    margin-top: 0;
    z-index: 2;
    pointer-events: none;
}

body.fixed-player #waveform {
    height: 35px;
    display: block;
    margin-bottom: 0 !important;
    padding-bottom: 0 !important;
}

body.fixed-player .progress {
    border-radius: 0;
    height: 4px;
}

body.fixed-player .controls {
    gap: 40px;
    position: relative;
    z-index: 5;
    order: 3;
}

body.fixed-player .player-extra-controls {
    display: flex;
    flex-direction: row;
    flex-wrap: wrap;
    align-items: center;
    justify-content: center;
    margin-top: 0;
    gap: 60px;
    z-index: 5;
    flex-shrink: 0;
    order: 4;
}

body.fixed-player .volume-container {
    width: 160px;
    max-width: 100%;
    flex-shrink: 1;
    display: flex;
    align-items: center;
}

body.fixed-player .secondary-controls {
    display: flex;
    gap: 35px;
    align-items: center;
    flex-shrink: 1;
}

body.fixed-player .drop-zone {
    display: none;
}

/* Library Controls */
.library-controls {
    margin-bottom: 30px;
    background: white;
    padding: 20px;
    border-radius: 15px;
    box-shadow: 0 5px 15px rgba(0,0,0,0.05);
    position: sticky;
    top: 70px;
    z-index: 1100;
}

.control-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 15px;
    gap: 20px;
    flex-wrap: wrap;
}

.control-row:last-child {
    margin-bottom: 0;
}

.search-box {
    position: relative;
    flex: 1;
    min-width: 200px;
}

.search-box input {
    width: 100%;
    padding: 10px 15px 10px 40px;
    border: 1px solid #ddd;
    border-radius: 25px;
    font-size: 0.9rem;
    transition: border-color 0.2s;
}

.search-box input:focus {
    outline: none;
    border-color: var(--primary-color);
}

.search-box svg {
    position: absolute;
    left: 12px;
    top: 50%;
    transform: translateY(-50%);
    color: #999;
}

.view-toggles {
    display: flex;
    background: #f0f0f0;
    border-radius: 8px;
    padding: 3px;
}

.view-btn {
    background: none;
    border: none;
    padding: 8px;
    cursor: pointer;
    border-radius: 6px;
    color: #666;
    display: flex;
    align-items: center;
    justify-content: center;
}

.view-btn.active {
    background: white;
    color: var(--primary-color);
    box-shadow: 0 2px 5px rgba(0,0,0,0.05);
}

.filters {
    display: flex;
    gap: 15px;
    flex-wrap: wrap;
}

.filters select {
    padding: 8px 15px;
    border: 1px solid #ddd;
    border-radius: 8px;
    background: white;
    cursor: pointer;
    font-size: 0.9rem;
    color: var(--text-color);
}

.active-filters {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    margin-top: 15px;
}

.filter-chip {
    background: var(--secondary-color);
    color: white;
    padding: 5px 12px;
    border-radius: 15px;
    font-size: 0.8rem;
    display: flex;
    align-items: center;
    gap: 8px;
}

.filter-chip .remove-filter {
    cursor: pointer;
    font-weight: bold;
    opacity: 0.8;
}

.filter-chip .remove-filter:hover {
    opacity: 1;
}

/* List View Styles */
.track-library.list-view {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.track-library.list-view .library-item {
    flex-direction: row;
    align-items: center;
    justify-content: space-between;
    padding: 12px 20px;
    gap: 15px;
    background: #fff;
    border: 1px solid #eee;
    box-shadow: 0 2px 8px rgba(0,0,0,0.02);
}

.lib-content-wrapper {
    display: flex;
    align-items: center;
    flex: 1;
    min-width: 0;
    gap: 20px;
}

.track-library.list-view .lib-artwork {
    width: 50px;
    height: 50px;
    margin-bottom: 0;
    margin-right: 0;
    flex-shrink: 0;
    border-radius: 50%;
    border: 1px solid #eee;
}

.track-library.list-view .lib-info {
    flex: 1;
    margin-bottom: 0;
    display: flex;
    flex-direction: column;
    justify-content: center;
    min-width: 150px;
    gap: 2px;
}

.track-library.list-view .lib-title {
    font-size: 1rem;
    font-weight: 700;
    margin-bottom: 0;
    color: #333;
}

.track-library.list-view .lib-artist {
    font-size: 0.85rem;
    margin-bottom: 0;
    color: #777;
}

.lib-description {
    font-size: 0.75rem;
    color: #999;
    margin-top: 2px;
    line-height: 1.2;
    word-break: break-word;
    min-height: 1.2em; /* Prevent collapse when empty */
    transition: opacity 0.4s ease;
}

.lib-description.lazy-content {
    opacity: 0;
}

.track-library.list-view .lib-description {
    display: -webkit-box;
    -webkit-line-clamp: 1;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.lib-description iframe,
.lib-description video,
.lib-description embed,
.lib-description object {
    width: 100% !important;
    max-width: 100%;
    height: auto !important;
    aspect-ratio: 16 / 9;
    border-radius: 8px;
    margin-top: 8px;
    display: block;
    border: none;
}

.lib-description div, 
.lib-description p {
    max-width: 100%;
    height: auto !important;
    width: auto !important;
}

.track-library.list-view .lib-description iframe,
.track-library.list-view .lib-description video,
.track-library.list-view .lib-description embed,
.track-library.list-view .lib-description object {
    display: none; /* Hide video in list view to keep rows compact */
}

.track-library.list-view .lib-meta {
    display: flex;
    flex-direction: row;
    gap: 20px;
    margin-bottom: 0;
    justify-content: flex-start;
    min-width: 180px;
    flex-shrink: 0;
    color: #999;
    font-size: 0.85rem;
}

.lib-meta span {
    display: flex;
    align-items: center;
    gap: 8px;
    white-space: nowrap;
}

.lib-meta svg {
    width: 14px;
    height: 14px;
    opacity: 0.6;
}

.track-library.list-view .lib-actions {
    flex-shrink: 0;
    display: flex;
    gap: 8px;
}

.track-library.list-view .btn-lib {
    padding: 8px 14px;
    font-size: 0.8rem;
    font-weight: 600;
    border-radius: 6px;
}

.btn-download {
    background: #00b894;
    color: white;
}

.btn-download:hover {
    background: #00947a;
}

.btn-basket {
    background: #ff7675;
    color: white;
}

.btn-basket:hover {
    background: #d63031;
}

.track-library.list-view .lib-title {
    font-size: 1rem;
    width: auto;
    min-width: 150px;
    flex: 1;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.track-library.list-view .lib-artist {
    width: auto;
    min-width: 100px;
    flex: 0.8;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.track-library.list-view .lib-meta {
    display: flex;
    gap: 15px;
    flex-shrink: 0;
}

.track-library.list-view .lib-actions {
    flex-direction: row;
    gap: 8px;
    flex-shrink: 0;
}

.track-library.list-view .btn-lib {
    width: auto;
    padding: 8px 12px;
    font-size: 0.85rem;
    white-space: nowrap;
}

@media (max-width: 900px) {
    .track-library.list-view .library-item {
        flex-direction: column;
        align-items: stretch;
        padding: 15px;
    }
    
    .lib-content-wrapper {
        margin-bottom: 15px;
    }

    .track-library.list-view .lib-meta {
        min-width: 0;
        margin-bottom: 15px;
    }
    
    .track-library.list-view .lib-actions {
        width: 100%;
        flex-wrap: wrap;
    }
    
    .track-library.list-view .btn-lib {
        flex: 1;
    }
}

@media (max-width: 600px) {
    .track-library.list-view .lib-content-wrapper {
        flex-direction: column;
        align-items: center;
        text-align: center;
    }
    
    .track-library.list-view .lib-artwork {
        width: 120px;
        height: 120px;
        margin-right: 0;
        margin-bottom: 10px;
    }

    .track-library.list-view .lib-meta {
        justify-content: center;
    }
}

@media (max-width: 600px) {
    body.fixed-player {
        padding-top: 280px;
    }
    
    body.fixed-player .player-wrapper {
        gap: 10px;
        padding: 10px;
    }
    
    body.fixed-player .player-content-row {
        width: 60px;
    }
    
    body.fixed-player .artwork-container {
        width: 50px;
        height: 50px;
    }

    body.fixed-player .track-info {
        min-width: 200px;
        flex: 1;
    }

    body.fixed-player .track-info h2 {
        font-size: 1rem;
    }

    body.fixed-player .track-info h3 {
        font-size: 0.8rem;
    }
    
    body.fixed-player .player-extra-controls {
        gap: 10px;
        width: 100%;
        justify-content: space-around;
    }
    
    body.fixed-player .controls {
        gap: 15px;
    }
    
    body.fixed-player .volume-container {
        width: 120px;
        max-width: 45%;
        gap: 5px;
    }

    body.fixed-player .secondary-controls {
        gap: 15px;
    }
}

/* Drag and Drop Playlist Styles */
.playlist li.dragging {
    opacity: 0.5;
    background: #e0e0e0;
    border: 2px dashed #999;
}

/* Basket Styles */
.basket-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 15px;
    background: white;
    border-radius: 10px;
    margin-bottom: 10px;
    box-shadow: 0 2px 5px rgba(0,0,0,0.05);
}

.license-options {
    margin: 0 20px;
}

.license-select {
    padding: 8px;
    border-radius: 5px;
    border: 1px solid #ddd;
    background-color: #f8f9fa;
    cursor: pointer;
}

.item-price {
    font-weight: bold;
    color: var(--primary-color);
    font-size: 1.1rem;
    min-width: 60px;
    text-align: right;
}
