/* Spotify Looper — dark theme inspired by the Web Playback SDK how-to */

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'CircularSp', 'Helvetica Neue', Helvetica, Arial, sans-serif;
    background-color: #121212;
    color: #ffffff;
    -webkit-font-smoothing: antialiased;
}

.container {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
    padding: 24px;
}

.main-wrapper {
    display: flex;
    flex-direction: column;
    align-items: center;
    width: 100%;
    max-width: 480px;
    text-align: center;
}

.hidden {
    display: none;
}

/* ---------- Login view ---------- */

.app-title {
    font-size: 48px;
    font-weight: 700;
    margin-bottom: 16px;
    color: #1db954;
}

.app-subtitle {
    font-size: 16px;
    color: #b3b3b3;
    margin-bottom: 32px;
    line-height: 1.5;
}

/* ---------- Buttons ---------- */

.btn-spotify {
    display: inline-block;
    background-color: #1db954;
    color: #000000;
    font-size: 14px;
    font-weight: 700;
    letter-spacing: 1px;
    text-transform: uppercase;
    text-decoration: none;
    border: none;
    border-radius: 500px;
    padding: 14px 32px;
    margin: 8px;
    cursor: pointer;
    transition: background-color 0.2s ease;
    font-family: inherit;
    width: 180px;
    height: 48px;
    line-height: 1;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    font-size: 13px;
    padding: 14px 16px;
}

.btn-spotify:hover {
    background-color: #1ed760;
}

.btn-spotify:active {
    transform: none;
}

/* Login button — override fixed dimensions from .btn-spotify */
.btn-login {
    width: auto;
    height: auto;
    padding: 16px 40px;
    font-size: 16px;
    white-space: nowrap;
    overflow: visible;
    text-overflow: unset;
}

/* ---------- Search ---------- */

.search-bar {
    display: flex;
    justify-content: center;
    width: 100%;
    margin-bottom: 16px;
}

.search-bar .search-input-wrapper {
    width: 100%;
    max-width: 480px;
}

.search-input {
    flex: 1;
    background-color: #282828;
    color: #ffffff;
    border: 1px solid #404040;
    border-radius: 500px;
    padding: 12px 20px;
    font-size: 14px;
    font-family: inherit;
    outline: none;
    transition: border-color 0.2s ease;
}

.search-input::placeholder {
    color: #b3b3b3;
}

.search-input:focus {
    border-color: #1db954;
}

.search-input-wrapper {
    position: relative;
    flex: 1;
}

.autocomplete-list {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    background-color: #282828;
    border-radius: 0 0 8px 8px;
    max-height: 200px;
    overflow-y: auto;
    z-index: 100;
    box-shadow: 0 4px 12px rgba(0,0,0,0.4);
}

.autocomplete-item {
    display: flex;
    align-items: center;
    padding: 10px 16px;
    cursor: pointer;
    transition: background-color 0.15s ease;
}

.autocomplete-item:hover {
    background-color: #383838;
}

.autocomplete-item__cover {
    width: 36px;
    height: 36px;
    border-radius: 4px;
    object-fit: cover;
    margin-right: 12px;
    flex-shrink: 0;
}

.autocomplete-item__info {
    display: flex;
    flex-direction: column;
    min-width: 0;
}

.autocomplete-item__name {
    font-size: 13px;
    font-weight: 600;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

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

.btn-search {
    margin: 0;
    padding: 12px 24px;
    flex-shrink: 0;
}

.search-results {
    width: 100%;
    max-height: 300px;
    overflow-y: auto;
    background-color: #181818;
    border-radius: 8px;
    margin-bottom: 16px;
}

.search-result {
    display: flex;
    align-items: center;
    padding: 10px 16px;
    cursor: pointer;
    transition: background-color 0.15s ease;
    text-align: left;
}

.search-result:hover {
    background-color: #282828;
}

.search-result__cover {
    width: 48px;
    height: 48px;
    border-radius: 4px;
    object-fit: cover;
    margin-right: 14px;
    flex-shrink: 0;
}

.search-result__info {
    display: flex;
    flex-direction: column;
    min-width: 0;
}

.search-result__name {
    font-size: 14px;
    font-weight: 600;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.search-result__artist {
    font-size: 12px;
    color: #b3b3b3;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* ---------- Player view ---------- */

.now-playing {
    display: flex;
    align-items: center;
    width: 100%;
    background-color: #181818;
    border-radius: 8px;
    padding: 16px;
    margin-bottom: 24px;
}

.now-playing__cover {
    width: 120px;
    height: 120px;
    border-radius: 4px;
    object-fit: cover;
    margin-right: 20px;
    background-color: #282828;
}

.now-playing__side {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    text-align: left;
    min-width: 0;
}

.now-playing__name {
    font-size: 20px;
    font-weight: 700;
    margin-bottom: 6px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 100%;
}

.now-playing__artist {
    font-size: 14px;
    color: #b3b3b3;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 100%;
}

#save-btn {
    margin-left: auto;
    flex-shrink: 0;
    width: auto;
    height: auto;
    padding: 10px 20px;
    font-size: 12px;
}

/* ---------- Saved songs ---------- */

.saved-songs {
    width: 100%;
    background-color: #181818;
    border-radius: 8px;
    padding: 16px;
    margin-top: 16px;
}

.saved-songs__title {
    font-size: 16px;
    font-weight: 700;
    margin-bottom: 12px;
    color: #ffffff;
}

.saved-songs__list {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.saved-song {
    display: flex;
    align-items: center;
    padding: 10px 12px;
    background-color: #282828;
    border-radius: 6px;
    cursor: pointer;
    transition: background-color 0.15s ease;
}

.saved-song:hover {
    background-color: #383838;
}

.saved-song__cover {
    width: 40px;
    height: 40px;
    border-radius: 4px;
    object-fit: cover;
    margin-right: 12px;
    flex-shrink: 0;
}

.saved-song__info {
    display: flex;
    flex-direction: column;
    min-width: 0;
}

.saved-song__name {
    font-size: 13px;
    font-weight: 600;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

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

.saved-song__interval {
    font-size: 10px;
    color: #1db954;
    margin-top: 2px;
}

.saved-song__delete {
    background: none;
    border: none;
    color: #b3b3b3;
    font-size: 18px;
    cursor: pointer;
    padding: 4px 8px;
    margin-left: auto;
    flex-shrink: 0;
    line-height: 1;
    transition: color 0.15s ease;
}

.saved-song__delete:hover {
    color: #ff4444;
}

/* ---------- Controls ---------- */

.controls {
    display: flex;
    align-items: center;
    justify-content: center;
}

.controls .btn-spotify {
    min-width: 72px;
}

/* ---------- Loop controls ---------- */

.loop-controls {
    width: 100%;
    background-color: #181818;
    border-radius: 8px;
    padding: 16px;
    margin-top: 16px;
}

/* Dual range slider */
.dual-range-slider {
    position: relative;
    width: 100%;
    height: 40px;
    display: flex;
    align-items: center;
}

.dual-range-track {
    position: absolute;
    width: 100%;
    height: 6px;
    background: #404040;
    border-radius: 3px;
}

.dual-range-fill {
    position: absolute;
    height: 6px;
    background: #1db954;
    border-radius: 3px;
    left: 0%;
    right: 0%;
}

/* Playhead as a range input */
.playhead-input {
    position: absolute;
    width: 100%;
    height: 40px;
    -webkit-appearance: none;
    appearance: none;
    background: transparent;
    pointer-events: none;
    margin: 0;
    padding: 0;
    z-index: 30;
}

.playhead-input::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 4px;
    height: 20px;
    border-radius: 2px;
    background: #ffffff;
    cursor: grab;
    pointer-events: auto;
    box-shadow: 0 0 4px rgba(0,0,0,0.5);
    position: relative;
    z-index: 35;
}

.playhead-input::-moz-range-thumb {
    width: 4px;
    height: 20px;
    border-radius: 2px;
    background: #ffffff;
    cursor: grab;
    pointer-events: auto;
    border: none;
    box-shadow: 0 0 4px rgba(0,0,0,0.5);
    position: relative;
    z-index: 35;
}

.playhead-input::-webkit-slider-thumb:active {
    cursor: grabbing;
}

.playhead-input::-moz-range-thumb:active {
    cursor: grabbing;
}

.dual-range-input {
    position: absolute;
    width: 100%;
    height: 40px;
    -webkit-appearance: none;
    appearance: none;
    background: transparent;
    pointer-events: none;
    margin: 0;
    padding: 0;
}

.dual-range-input::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 20px;
    height: 20px;
    border-radius: 50%;
    background: #1db954;
    cursor: pointer;
    pointer-events: auto;
    border: 2px solid #121212;
    box-shadow: 0 0 4px rgba(0,0,0,0.5);
}

.dual-range-input::-moz-range-thumb {
    width: 20px;
    height: 20px;
    border-radius: 50%;
    background: #1db954;
    cursor: pointer;
    pointer-events: auto;
    border: 2px solid #121212;
    box-shadow: 0 0 4px rgba(0,0,0,0.5);
}

.dual-range-input:disabled {
    opacity: 0.4;
    cursor: not-allowed;
}

.dual-range-input:disabled::-webkit-slider-thumb {
    cursor: not-allowed;
}

.dual-range-input:disabled::-moz-range-thumb {
    cursor: not-allowed;
}

.loop-markers {
    display: flex;
    justify-content: space-between;
    margin-top: 4px;
}

.loop-time {
    font-size: 12px;
    color: #b3b3b3;
    font-variant-numeric: tabular-nums;
}
