/* Vinyl records and turntable styles */

/* Bookshelf Styles */
.bookshelf {
    background: linear-gradient(180deg, #8B4513 0%, #A0522D 50%, #8B4513 100%);
    border-radius: 15px;
    padding: 30px 20px 140px 20px;
    margin: 40px auto;
    max-width: 900px;
    box-shadow: 
        0 10px 30px rgba(0,0,0,0.5),
        inset 0 5px 15px rgba(255,255,255,0.1),
        inset 0 -5px 15px rgba(0,0,0,0.3);
    position: relative;
}

.bookshelf::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 10px;
    background: linear-gradient(90deg, #654321, #8B4513, #654321);
    border-radius: 15px 15px 0 0;
}

.bookshelf::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    height: 15px;
    background: linear-gradient(90deg, #654321, #8B4513, #654321);
    border-radius: 0 0 15px 15px;
    box-shadow: 0 2px 10px rgba(0,0,0,0.5);
}

.vinyl-collection {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 30px;
    padding: 20px 0;
    min-height: 300px;
    max-height: 600px;
    overflow-y: auto;
}

.vinyl-record {
    position: relative;
    cursor: pointer;
    transition: all 0.5s ease;
    transform-style: preserve-3d;
    justify-self: center;
    width: 200px;
    height: 200px;
    z-index: 1;
}

.vinyl-record:hover {
    transform: translateY(-10px) scale(1.05);
    z-index: 100;
}

.vinyl-record.disabled {
    cursor: not-allowed;
    opacity: 0.6;
}

.vinyl-record.disabled:hover {
    transform: none;
}

/* Album Cover (default state) */
.album-cover {
    width: 200px;
    height: 200px;
    border-radius: 10px;
    overflow: hidden;
    transition: all 0.5s ease;
    box-shadow: 0 10px 30px rgba(0,0,0,0.5);
    border: 3px solid #FFD700;
    position: relative;
}

.album-cover img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: all 0.5s ease;
}

.album-cover.placeholder {
    background: linear-gradient(45deg, #333, #555);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 3rem;
    color: #999;
}

/* Vinyl Disc (appears on hover) */
.vinyl-disc {
    position: absolute;
    top: 0;
    left: 0;
    width: 200px;
    height: 200px;
    border-radius: 50%;
    background: 
        radial-gradient(circle at center, #000 15%, #111 16%, #111 30%, #000 31%, #000 45%, #111 46%, #111 60%, #000 61%),
        conic-gradient(from 0deg, #000, #222, #000, #222, #000);
    box-shadow: 
        0 10px 30px rgba(0,0,0,0.7),
        inset 0 0 0 3px #333,
        inset 0 0 20px rgba(0,0,0,0.8);
    opacity: 0;
    transform: scale(0.8);
    transition: all 0.5s ease;
}

.vinyl-record:hover .vinyl-disc {
    opacity: 1;
    transform: scale(1) rotate(45deg);
}

.vinyl-record:hover .album-cover {
    border-radius: 50%;
}

.vinyl-record:hover .album-cover img {
    border-radius: 50%;
    opacity: 0.3;
}

/* Center Label */
.vinyl-label {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 80px;
    height: 80px;
    border-radius: 50%;
    background: linear-gradient(45deg, #8B0000, #DC143C);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    font-size: 0.7rem;
    font-weight: bold;
    text-align: center;
    color: white;
    text-shadow: 1px 1px 2px rgba(0,0,0,0.8);
    box-shadow: 
        0 0 0 2px #FFD700,
        0 2px 10px rgba(0,0,0,0.5);
    opacity: 0;
    transition: all 0.5s ease;
    z-index: 10;
}

.vinyl-record:hover .vinyl-label {
    opacity: 1;
}

/* Album Info */
.album-info {
    position: absolute;
    bottom: -140px; /* Increased to accommodate multi-line genres */
    left: 50%;
    transform: translateX(-50%);
    text-align: center;
    opacity: 0;
    transition: all 0.5s ease;
    background: rgba(0,0,0,0.9);
    padding: 15px 20px 20px 20px; /* Added more bottom padding */
    border-radius: 15px;
    min-width: 250px;
    backdrop-filter: blur(10px);
    border: 2px solid #FFD700;
    z-index: 110;
    max-width: 300px; /* Prevent it from getting too wide */
}

.vinyl-record:hover .album-info {
    opacity: 1;
    bottom: -115px; /* Adjusted for the new height */
}

/* Playlist records always show info */
.vinyl-record[data-type="playlist"] .album-info {
    opacity: 1;
    bottom: -115px;
}

.vinyl-record[data-type="playlist"]:hover .album-info {
    bottom: -110px; /* Slight lift on hover */
    transform: translateX(-50%) scale(1.02);
}

.album-title {
    font-size: 1.1rem;
    font-weight: bold;
    margin-bottom: 5px;
    color: #FFD700;
}

.album-artist {
    font-size: 0.9rem;
    opacity: 0.8;
    margin-bottom: 5px;
    color: #F5DEB3;
}

.genre-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 4px;
    margin: 8px 0 12px 0;
    max-height: none; /* Remove height restriction */
    overflow: visible; /* Allow content to show */
    line-height: 1.3; /* Better line spacing */
}

.genre-tag {
    background: rgba(255, 215, 0, 0.2);
    color: #FFD700;
    border: 1px solid rgba(255, 215, 0, 0.3);
    border-radius: 12px;
    padding: 3px 8px; /* Slightly more padding for better readability */
    font-size: 0.7rem;
    white-space: nowrap;
    font-weight: bold;
    text-transform: capitalize;
    margin: 2px 0; /* Add vertical margin for multi-line support */
}

.genre-tag:first-child {
    background: rgba(255, 215, 0, 0.3);
    border-color: rgba(255, 215, 0, 0.5);
}

.album-tracks {
    font-size: 0.8rem;
    opacity: 0.7;
    color: #DDD;
    margin-top: 8px; /* Add spacing above album tracks */
    margin-bottom: 4px; /* Add spacing below album tracks */
}

.playlist-description {
    font-size: 0.75rem;
    opacity: 0.6;
    color: #CCC;
    margin-top: 5px;
    margin-bottom: 8px;
    line-height: 1.3;
    max-height: 2.6rem; /* Limit to 2 lines */
    overflow: hidden;
    text-overflow: ellipsis;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    line-clamp: 2;
    -webkit-box-orient: vertical;
}

/* Turntable Styles */
.turntable-section {
    display: flex;
    justify-content: center;
    align-items: flex-start;
    gap: 40px;
    margin: 40px 0;
    position: relative;
    max-width: 1000px;
    margin-left: auto;
    margin-right: auto;
}

.turntable {
    width: 350px;
    height: 350px;
    background: 
        radial-gradient(circle at center, #2c2c2c 0%, #1a1a1a 30%, #333 31%, #1a1a1a 70%, #2c2c2c 100%);
    border-radius: 50%;
    position: relative;
    box-shadow: 
        0 20px 60px rgba(0,0,0,0.8),
        inset 0 0 0 10px #444,
        inset 0 0 0 15px #222,
        inset 0 0 50px rgba(0,0,0,0.5);
    border: 5px solid #333;
}

.turntable::before {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 20px;
    height: 20px;
    background: #888;
    border-radius: 50%;
    box-shadow: 
        0 0 0 3px #666,
        0 0 0 6px #444,
        0 2px 10px rgba(0,0,0,0.8);
    z-index: 20;
}

.tonearm {
    position: absolute;
    top: 20px;
    right: 20px;
    width: 220px;
    height: 4px;
    background: linear-gradient(90deg, #666, #888, #666);
    border-radius: 2px;
    transform-origin: right center;
    transform: rotate(-85deg); /* Resting position - extends down and right to touch far outer edge at bottom-right of record */
    box-shadow: 0 2px 10px rgba(0,0,0,0.5);
    z-index: 30;
    transition: all 0.8s ease;
    --tonearm-progress: 0; /* Track progress: 0 (start) to 1 (end) */
}

.tonearm::before {
    content: '';
    position: absolute;
    right: -10px;
    top: -8px;
    width: 20px;
    height: 20px;
    background: radial-gradient(circle, #888, #555);
    border-radius: 50%;
    box-shadow: 0 2px 8px rgba(0,0,0,0.6);
}

.tonearm::after {
    content: '';
    position: absolute;
    left: -5px;
    top: -2px;
    width: 8px;
    height: 8px;
    background: #444;
    border-radius: 50%;
}

.tonearm.playing {
    /* Dynamic rotation based on progress through album/playlist */
    /* -85deg = far outer edge at bottom-right (start), -50deg = near center but not past it (end) */
    transform: rotate(calc(-85deg + (35deg * var(--tonearm-progress))));
}

.turntable-vinyl {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 280px;
    height: 280px;
    border-radius: 50%;
    opacity: 0;
    transition: opacity 0.8s ease;
    z-index: 15;
    display: block;
}

.turntable-vinyl.active {
    opacity: 1 !important;
}

.turntable-vinyl.spinning {
    animation: spin 2s linear infinite !important;
}

@keyframes spin {
    from { transform: translate(-50%, -50%) rotate(0deg); }
    to { transform: translate(-50%, -50%) rotate(360deg); }
}

.turntable-vinyl .vinyl-disc {
    width: 100%;
    height: 100%;
    border-radius: 50%;
    background: 
        radial-gradient(circle at center, #000 15%, #111 16%, #111 30%, #000 31%, #000 45%, #111 46%, #111 60%, #000 61%),
        conic-gradient(from 0deg, #000, #222, #000, #222, #000);
    box-shadow: 
        0 10px 30px rgba(0,0,0,0.7),
        inset 0 0 0 3px #333,
        inset 0 0 20px rgba(0,0,0,0.8);
    position: relative;
    display: block;
    opacity: 1;
}

.turntable-vinyl .vinyl-disc.with-album {
    background-image: 
        radial-gradient(circle at center, transparent 15%, rgba(0,0,0,0.3) 16%, rgba(0,0,0,0.3) 30%, transparent 31%, transparent 45%, rgba(0,0,0,0.3) 46%, rgba(0,0,0,0.3) 60%, transparent 61%),
        var(--album-image, none);
    background-size: cover, cover;
    background-position: center, center;
    background-blend-mode: multiply;
}

.turntable-vinyl .vinyl-label {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 70px;
    height: 70px;
    border-radius: 50%;
    background: linear-gradient(45deg, #8B0000, #DC143C);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.7rem;
    font-weight: bold;
    text-align: center;
    color: white;
    text-shadow: 1px 1px 2px rgba(0,0,0,0.8);
    box-shadow: 
        0 0 0 2px #FFD700,
        0 2px 10px rgba(0,0,0,0.5);
    z-index: 25;
}

/* Animation for vinyl moving to turntable */
.vinyl-record.playing {
    position: fixed;
    z-index: 1000;
    pointer-events: none;
}

.vinyl-record.moving-to-turntable {
    transition: all 1.2s cubic-bezier(0.25, 0.46, 0.45, 0.94);
}

/* Track List Styles */
.track-list-container {
    width: 300px;
    height: auto;
    max-height: 400px;
    background: rgba(0, 0, 0, 0.4);
    border-radius: 15px;
    border: 2px solid #FFD700;
    backdrop-filter: blur(10px);
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.5);
    overflow: visible;
    display: flex;
    flex-direction: column;
}

.track-list-header {
    background: rgba(255, 215, 0, 0.1);
    border-bottom: 2px solid rgba(255, 215, 0, 0.3);
    padding: 15px 20px;
    text-align: center;
}

.track-list-header h4 {
    color: #FFD700;
    font-size: 1.1rem;
    margin: 0;
    text-shadow: 1px 1px 2px rgba(0, 0, 0, 0.8);
}

.track-list {
    flex: 1;
    overflow-y: auto;
    padding: 10px 0;
    max-height: 280px;
}

.track-list::-webkit-scrollbar {
    width: 8px;
}

.track-list::-webkit-scrollbar-track {
    background: rgba(0, 0, 0, 0.3);
    border-radius: 4px;
}

.track-list::-webkit-scrollbar-thumb {
    background: rgba(255, 215, 0, 0.6);
    border-radius: 4px;
}

.track-list::-webkit-scrollbar-thumb:hover {
    background: rgba(255, 215, 0, 0.8);
}

.track-item {
    padding: 12px 20px;
    margin: 2px 10px;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.3s ease;
    border-left: 3px solid transparent;
    background: rgba(255, 255, 255, 0.05);
    display: flex;
    align-items: center;
    gap: 10px;
}

.track-item:hover {
    background: rgba(255, 215, 0, 0.2);
    border-left-color: #FFD700;
    transform: translateX(5px);
}

.track-item.current-track {
    background: rgba(255, 215, 0, 0.3);
    border-left-color: #FFD700;
    box-shadow: 0 2px 10px rgba(255, 215, 0, 0.3);
}

.track-number {
    color: #FFD700;
    font-weight: bold;
    font-size: 0.9rem;
    margin-right: 10px;
    display: inline-block;
    width: 25px;
}

.track-info {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 2px;
    overflow: hidden;
}

.track-name {
    color: white;
    font-size: 0.95rem;
    line-height: 1.4;
    word-wrap: break-word;
}

.track-artist {
    color: rgba(255, 255, 255, 0.6);
    font-size: 0.85rem;
    line-height: 1.2;
    word-wrap: break-word;
}

.track-duration {
    color: rgba(255, 255, 255, 0.7);
    font-size: 0.85rem;
    margin-left: auto;
}

.no-album-message {
    text-align: center;
    color: rgba(255, 255, 255, 0.6);
    padding: 40px 20px;
    font-style: italic;
    line-height: 1.6;
}

.track-item.playing {
    background: rgba(29, 185, 84, 0.3);
    border-left-color: #1db954;
    animation: pulse 2s ease-in-out infinite alternate;
}

@keyframes pulse {
    from {
        box-shadow: 0 2px 10px rgba(29, 185, 84, 0.3);
    }
    to {
        box-shadow: 0 2px 20px rgba(29, 185, 84, 0.6);
    }
}



/* Spine View Styles - Record Spines Like Cratedigger */
.crate-view {
    background: linear-gradient(180deg, #8B4513 0%, #A0522D 50%, #654321 100%);
    border-radius: 15px;
    padding: 40px 20px 60px 20px;
    margin: 40px auto;
    max-width: 1000px;
    box-shadow: 
        0 15px 40px rgba(0,0,0,0.6),
        inset 0 5px 15px rgba(255,255,255,0.1),
        inset 0 -5px 15px rgba(0,0,0,0.4);
    position: relative;
    overflow-x: auto;
    overflow-y: hidden;
}

.crate-view::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: 
        repeating-linear-gradient(
            90deg,
            transparent 0px,
            transparent 48px,
            rgba(0,0,0,0.1) 50px,
            rgba(0,0,0,0.1) 52px
        );
    pointer-events: none;
    border-radius: 15px;
}

.crate-records-container {
    display: flex;
    align-items: flex-end;
    gap: 2px;
    padding: 20px 0;
    height: 300px;
    overflow-x: auto;
    overflow-y: hidden;
    scrollbar-width: thin;
    scrollbar-color: rgba(255,255,255,0.3) transparent;
}

.crate-records-container::-webkit-scrollbar {
    height: 8px;
}

.crate-records-container::-webkit-scrollbar-track {
    background: rgba(0,0,0,0.2);
    border-radius: 4px;
}

.crate-records-container::-webkit-scrollbar-thumb {
    background: rgba(255,255,255,0.3);
    border-radius: 4px;
}

.crate-record {
    flex-shrink: 0;
    width: 8px;
    height: 280px;
    position: relative;
    cursor: pointer;
    transition: all 0.3s ease;
    border-radius: 2px;
    overflow: hidden;
    box-shadow: 
        2px 0 4px rgba(0,0,0,0.3),
        inset 1px 0 2px rgba(255,255,255,0.2);
}

.crate-record:hover {
    width: 200px;
    z-index: 10;
    transform: translateY(-20px);
    box-shadow: 
        0 10px 30px rgba(0,0,0,0.5),
        2px 0 8px rgba(0,0,0,0.4);
}

.crate-record-spine {
    width: 100%;
    height: 100%;
    background: #333;
    position: relative;
    overflow: hidden;
}

.crate-record-image {
    width: 100%;
    height: 100%;
    object-fit: cover;
    object-position: left center;
    transition: all 0.3s ease;
}

.crate-record:hover .crate-record-image {
    object-position: center center;
}

.crate-record-image.placeholder {
    background: linear-gradient(135deg, #444, #666, #444);
    display: flex;
    align-items: center;
    justify-content: center;
    color: #999;
    font-size: 20px;
}

.crate-record-overlay {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    background: linear-gradient(transparent, rgba(0,0,0,0.9));
    padding: 15px;
    transform: translateY(100%);
    transition: all 0.3s ease;
    opacity: 0;
}

.crate-record:hover .crate-record-overlay {
    transform: translateY(0);
    opacity: 1;
}

.crate-record-title {
    font-weight: bold;
    font-size: 14px;
    color: #fff;
    margin-bottom: 4px;
    line-height: 1.2;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.crate-record-artist {
    font-size: 12px;
    color: #ccc;
    margin-bottom: 8px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.crate-play-button {
    background: linear-gradient(45deg, #1db954, #1ed760);
    border: none;
    border-radius: 15px;
    padding: 6px 12px;
    color: white;
    font-size: 11px;
    font-weight: bold;
    cursor: pointer;
    transition: all 0.3s ease;
    width: 100%;
    box-shadow: 0 2px 8px rgba(29, 185, 84, 0.4);
}

.crate-play-button:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(29, 185, 84, 0.6);
}

.crate-play-button:disabled {
    background: #666;
    cursor: not-allowed;
    transform: none;
    box-shadow: none;
}

/* Spine text for non-hovered state */
.crate-record-spine-text {
    position: absolute;
    bottom: 20px;
    left: 50%;
    transform: translateX(-50%) rotate(-90deg);
    transform-origin: center;
    white-space: nowrap;
    font-size: 10px;
    font-weight: bold;
    color: rgba(255,255,255,0.8);
    text-shadow: 0 1px 2px rgba(0,0,0,0.8);
    pointer-events: none;
    transition: opacity 0.3s ease;
}

.crate-record:hover .crate-record-spine-text {
    opacity: 0;
}

/* Hide list view when crate view is active */
.view-crate .bookshelf {
    display: none;
}

.view-crate .crate-view {
    display: block;
}

.view-list .crate-view {
    display: none;
}

.view-list .bookshelf {
    display: block;
}