/* 
  T-MUSIC PLAYER v3.0 - PREMIUM DESIGN
  Dark Mode, Glassmorphism, Search, Preview + Full Playback.
*/

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

/* Scrollbar for search results */
#tf-music-search-results::-webkit-scrollbar { width: 4px; }
#tf-music-search-results::-webkit-scrollbar-track { background: transparent; }
#tf-music-search-results::-webkit-scrollbar-thumb { background: rgba(255,255,255,0.2); border-radius: 4px; }

/* Search bar focus */
#tf-music-search-input:focus {
    border-color: rgba(29,185,84,0.6) !important;
    background: rgba(255,255,255,0.15) !important;
    box-shadow: 0 0 0 2px rgba(29,185,84,0.2);
}

/* Preview badge link */
#tf-preview-badge a:hover { text-decoration: underline; }

:root {
    --player-bg: rgba(18, 18, 18, 0.95);
    --spotify-green: #1DB954;
}

/* 1. Mini Player Bar (Fixed Bottom) */
#tf-spotify-mini-player {
    position: fixed;
    bottom: calc(var(--safe-area-bottom, 20px) + 65px); /* Above tab bar */
    left: 10px;
    right: 10px;
    height: 60px;
    background: var(--player-bg);
    backdrop-filter: blur(20px);
    border-radius: 12px;
    border: 1px solid rgba(255, 255, 255, 0.1);
    z-index: 10002;
    display: flex;
    align-items: center;
    padding: 0 12px;
    box-shadow: 0 10px 30px rgba(0,0,0,0.5);
    transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1), opacity 0.3s;
    cursor: pointer;
}

#tf-spotify-mini-player.hidden {
    transform: translateY(150px);
    opacity: 0;
    pointer-events: none;
}

.tf-mini-art {
    width: 44px;
    height: 44px;
    border-radius: 6px;
    object-fit: cover;
    margin-right: 12px;
    box-shadow: 0 4px 10px rgba(0,0,0,0.3);
}

.tf-mini-info {
    flex: 1;
    overflow: hidden;
}

.tf-mini-title {
    font-size: 13px;
    font-weight: 700;
    color: white;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.tf-mini-artist {
    font-size: 11px;
    color: #b3b3b3;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.tf-mini-controls {
    display: flex;
    gap: 15px;
    align-items: center;
}

.tf-mini-btn {
    font-size: 22px;
    color: white;
    cursor: pointer;
    transition: transform 0.1s;
}

.tf-mini-btn:active { transform: scale(0.9); }

/* 2. Expanded Player (Full Screen Overlay) */
#tf-spotify-full-player {
    position: fixed;
    inset: 0;
    background: linear-gradient(to bottom, #2c3e50, #000); /* Dynamic background fallback */
    z-index: 10005;
    display: flex;
    flex-direction: column;
    padding: 60px 30px 40px;
    transform: translateY(100%);
    transition: transform 0.5s cubic-bezier(0.32, 0.72, 0, 1);
}

#tf-spotify-full-player.open {
    transform: translateY(0);
}

.tf-full-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 40px;
}

.tf-full-art-container {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    perspective: 1000px;
}

.tf-full-art {
    width: 85vw;
    height: 85vw;
    max-width: 350px;
    max-height: 350px;
    border-radius: 20px;
    object-fit: cover;
    box-shadow: 0 20px 60px rgba(0,0,0,0.8);
    transition: transform 0.3s;
}

.tf-full-info {
    margin-top: 50px;
    margin-bottom: 30px;
}

.tf-full-title {
    font-size: 26px;
    font-weight: 900;
    color: white;
    margin-bottom: 5px;
}

.tf-full-artist {
    font-size: 18px;
    color: #b3b3b3;
}

/* 3. Progress & Controls Layout */
.tf-full-progress {
    margin-bottom: 30px;
}

.progress-time {
    display: flex;
    justify-content: space-between;
    font-size: 12px;
    color: #b3b3b3;
    margin-top: 10px;
}

.tf-full-controls {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-top: 20px;
}

.tf-ctl-btn {
    font-size: 28px;
    color: white;
    cursor: pointer;
}

.tf-play-main {
    font-size: 70px;
    color: white;
    cursor: pointer;
}

.tf-accent-btn { font-size: 22px; color: #b3b3b3; }
.tf-accent-btn.active { color: var(--spotify-green); }

/* Animation Overlay Canvas */
#tf-spotify-bg-canvas {
    position: absolute;
    inset: 0;
    z-index: -1;
    opacity: 0.6;
    filter: blur(50px);
}

/* Progress Slider Customization */
input[type="range"].form-range {
    -webkit-appearance: none;
    appearance: none; /* Lint Fix */
    width: 100%;
    height: 4px;
    background: rgba(255,255,255,0.2);
    border-radius: 5px;
    outline: none;
}

input[type="range"].form-range::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none; /* Lint Fix */
    width: 12px;
    height: 12px;
    background: white;
    border-radius: 50%;
    cursor: pointer;
    box-shadow: 0 0 10px rgba(0,0,0,0.5);
}

/* Empty State Styling */
#tf-player-empty-state {
    transition: opacity 0.5s ease;
}

.spotify-logo-anim {
    animation: spotifyPulse 3s infinite ease-in-out;
}

@keyframes spotifyPulse {
    0% { transform: scale(1); opacity: 0.8; filter: drop-shadow(0 0 10px rgba(29, 185, 84, 0.2)); }
    50% { transform: scale(1.1); opacity: 1; filter: drop-shadow(0 0 30px rgba(29, 185, 84, 0.6)); }
    100% { transform: scale(1); opacity: 0.8; filter: drop-shadow(0 0 10px rgba(29, 185, 84, 0.2)); }
}

#btn-spotify-connect {
    transition: transform 0.2s, background 0.3s;
}

#btn-spotify-connect:active {
    transform: scale(0.95);
    background: #1ed760;
}

#tf-player-content-view {
    flex: 1;
    display: flex;
    flex-direction: column;
}

/* Footer Section */
.tf-player-footer {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding-top: 20px;
    margin-top: auto;
    border-top: 1px solid rgba(255,255,255,0.05);
}

.tf-player-footer i {
    cursor: pointer;
    transition: color 0.2s;
}

.tf-player-footer i:hover {
    color: white;
}


