
/* --- SPOTIFY PLAYER STYLES --- */
#spotify-element {
    /* Position logic is handled by script.js draggable system now */
    width: 320px;
    max-width: 90vw;
    /* Match the theme of Timer/Text elements */
    background: rgba(59, 46, 37, 0.95);
    border: 2px solid #ff914d;
    border-radius: 12px;
    padding: 15px;
    display: flex;
    flex-direction: column;
    gap: 12px;
    z-index: 600;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.8);
    color: #fff;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
    /* Allow touch interactions inside, but prevent scroll on drag areas */
    touch-action: none; 
}

/* Device Bar */
.sp-device-bar {
    display: flex;
    gap: 10px;
    margin-bottom: 5px;
}

.sp-device-select {
    flex: 1;
    background: rgba(30, 30, 30, 0.8);
    color: #ff914d;
    border: 1px solid #ff914d;
    padding: 5px;
    border-radius: 4px;
    font-size: 0.8rem;
    outline: none;
    cursor: pointer;
    /* Ensure interaction */
    pointer-events: auto;
}

#sp-refresh-btn {
    color: #ff914d;
    font-size: 1.2rem;
    background: none;
    border: none;
    cursor: pointer;
}

/* Header */
.sp-header {
    display: flex;
    align-items: center;
    gap: 15px;
    padding-bottom: 10px;
    border-bottom: 1px solid rgba(255, 145, 77, 0.2);
}

.sp-vinyl-art {
    width: 70px;
    height: 70px;
    flex-shrink: 0;
    border-radius: 50%;
    background: #222;
    position: relative;
    border: 2px solid #181818;
    display: flex;
    align-items: center;
    justify-content: center;
    animation: sp-spin 6s linear infinite;
    animation-play-state: paused;
    box-shadow: 0 4px 10px rgba(0,0,0,0.5);
}
.sp-vinyl-art.spinning { animation-play-state: running; }
@keyframes sp-spin { 100% { transform: rotate(360deg); } }

.sp-vinyl-art img { width: 100%; height: 100%; border-radius: 50%; object-fit: cover; }
.sp-vinyl-art::after { content: ''; position: absolute; width: 10px; height: 10px; background: #000; border-radius: 50%; z-index: 2; }

.sp-info { overflow: hidden; flex: 1; min-width: 0; }
.sp-title { font-weight: 700; color: #fff; font-size: 1rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.sp-artist { color: #ffb380; font-size: 0.85rem; }
#sp-status-text { font-size: 0.7rem; color: #888; margin-top: 2px; text-transform: uppercase; }
.syncing #sp-status-text { color: #ff914d; animation: pulse 1s infinite; }

/* Progress Bar */
.sp-progress-wrapper { width: 100%; margin-top: 5px; }
.sp-progress-bg { 
    width: 100%; 
    height: 10px; /* Taller for easier clicking */
    background: rgba(0,0,0,0.3); 
    border-radius: 5px; 
    cursor: pointer; 
    position: relative; 
    overflow: hidden;
    /* Ensure click events pass through */
    pointer-events: auto;
}
.sp-progress-fill { 
    height: 100%; 
    background: #ff914d; 
    width: 0%; 
    border-radius: 5px; 
    pointer-events: none; 
    transition: width 0.1s linear;
}
.sp-time { display: flex; justify-content: space-between; color: #ffb380; font-size: 0.7rem; margin-top: 4px; }

/* Controls */
.sp-controls { display: flex; justify-content: center; gap: 20px; align-items: center; margin: 10px 0; }
.sp-ctrl-btn { 
    background: transparent; border: 1px solid #ff914d; color: #ff914d; 
    width: 40px; height: 40px; border-radius: 50%; 
    display: flex; align-items: center; justify-content: center; 
    cursor: pointer; transition: all 0.2s;
}
.sp-ctrl-btn:hover { background: #ff914d; color: #000; }
.sp-ctrl-btn.main { width: 50px; height: 50px; background: #ff914d; color: #000; border: none; font-size: 1.2rem; }
.sp-ctrl-btn.main:hover { transform: scale(1.1); }

/* Tabs & Input */
.sp-tabs { display: flex; gap: 10px; margin-bottom: 10px; }
.sp-tab-btn { flex: 1; background: rgba(0,0,0,0.3); border: none; color: #888; padding: 8px; border-radius: 6px; cursor: pointer; font-size: 0.8rem;}
.sp-tab-btn.active { background: #ff914d; color: #000; font-weight: bold; }

.sp-tab-content { display: none; }
.sp-tab-content.active { display: block; }

#sp-search-input { 
    width: 100%; background: rgba(0,0,0,0.3); border: 1px solid #555; 
    color: white; padding: 10px; border-radius: 6px; 
    box-sizing: border-box; margin-bottom: 10px; outline: none;
    /* Ensure typing */
    pointer-events: auto; 
    cursor: text;
}
#sp-search-input:focus { border-color: #ff914d; }

.sp-list { max-height: 150px; overflow-y: auto; display: flex; flex-direction: column; gap: 6px; }
.sp-list::-webkit-scrollbar { width: 4px; }
.sp-list::-webkit-scrollbar-thumb { background: #ff914d; border-radius: 2px; }

.sp-item { display: flex; align-items: center; gap: 10px; padding: 6px; background: rgba(255,255,255,0.05); border-radius: 6px; transition: background 0.2s; }
.sp-item:hover { background: rgba(255,255,255,0.1); }
.sp-item img { width: 35px; height: 35px; border-radius: 4px; object-fit: cover;}
.sp-item-info { flex: 1; min-width: 0; }
.sp-item-title { font-size: 0.85rem; font-weight: 600; color: #fff; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.sp-item-sub { font-size: 0.75rem; color: #ccc; }

/* Action Buttons (Queue/Play) */
.sp-actions { display: flex; gap: 5px; }
.sp-action-small { 
    background: transparent; border: 1px solid #555; color: #ccc; 
    width: 28px; height: 28px; border-radius: 4px; 
    cursor: pointer; display: flex; align-items: center; justify-content: center;
    font-size: 0.8rem;
}
.sp-action-small:hover { border-color: #ff914d; color: #ff914d; }
.sp-action-small.play { border-color: #1db954; color: #1db954; }
.sp-action-small.play:hover { background: #1db954; color: #000; }

/* Playlist Navigation */
.sp-back-btn { background: none; border: none; color: #ff914d; cursor: pointer; padding: 5px 0; font-size: 0.9rem; }
.sp-back-btn:hover { text-decoration: underline; }
.sp-playlist-item { cursor: pointer; }

/* Queue Specifics */
.sp-queue-hint { font-size: 0.7rem; color: #666; text-align: center; margin-bottom: 5px; }
.sp-queue-item { cursor: grab; background: rgba(255, 145, 77, 0.1); border: 1px solid transparent; }
.sp-queue-item.sortable-ghost { opacity: 0.5; background: #44332a; }
.sp-queue-item.sortable-drag { background: #ff914d; color: #000; }
.sp-remove-btn { color: #dc3545; border-color: #dc3545; }
.sp-remove-btn:hover { background: #dc3545; color: white; }

/* Login */
.sp-login-container { text-align: center; padding: 30px 0; }
.sp-action-btn { background: #1db954; color: #000; border: none; padding: 12px 30px; border-radius: 50px; cursor: pointer; font-weight: bold; }