:root {
    --bg-color: #121212;
    --card-bg: #1e1e1e;
    --text-primary: #ffffff;
    --text-secondary: #aaaaaa;
    --accent: #ba0000;
    /* Last.fm red */
    --accent-hover: #d40000;
}

body {
    font-family: 'Inter', sans-serif;
    background-color: var(--bg-color);
    color: var(--text-primary);
    margin: 0;
    padding: 0;
    display: flex;
    justify-content: center;
    min-height: 100vh;
}

.container {
    width: 100%;
    max-width: 1200px;
    padding: 2rem;
}

header {
    text-align: center;
    margin-bottom: 3rem;
}

h1 {
    font-size: 2.5rem;
    font-weight: 700;
    margin-bottom: 0.5rem;
    background: linear-gradient(45deg, #ff4b1f, #ff9068);
    background-clip: text;
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

p {
    color: var(--text-secondary);
}

.input-group {
    margin-bottom: 1.5rem;
}

.input-row {
    display: flex;
    gap: 1rem;
}

label {
    display: block;
    margin-bottom: 0.5rem;
    font-weight: 600;
    color: var(--text-secondary);
}

input {
    flex-grow: 1;
    padding: 0.75rem;
    border-radius: 8px;
    border: 1px solid #333;
    background-color: var(--card-bg);
    color: var(--text-primary);
    font-size: 1rem;
    box-sizing: border-box;
    width: auto;
    /* Allow flex to control width */
}

input:focus {
    outline: none;
    border-color: var(--accent);
}

/* Filter Styles */
.filter-section {
    margin-top: 1rem;
    padding-top: 1rem;
    border-top: 1px solid #333;
    display: flex;
    gap: 2rem;
    align-items: center;
    color: var(--text-secondary);
    font-size: 0.9rem;
}

.filter-row {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.inline-label {
    display: inline;
    margin: 0;
    font-weight: 400;
}

.hidden-count {
    color: var(--text-secondary);
    font-size: 0.85rem;
    opacity: 0.8;
}

#filterThreshold {
    width: 60px;
    padding: 0.25rem 0.5rem;
}

button {
    padding: 0.75rem 1.5rem;
    /* adjusted padding */
    background-color: var(--accent);
    color: white;
    border: none;
    border-radius: 8px;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: background-color 0.2s;
    white-space: nowrap;
    /* Prevent button text wrapping */
}

/* User Card Styles */
.user-card {
    background-color: var(--card-bg);
    padding: 1.5rem;
    border-radius: 12px;
    border: 1px solid #333;
    margin-bottom: 2rem;
    animation: fadeIn 0.5s ease;
}

.user-info-content {
    display: flex;
    align-items: center;
    gap: 1.5rem;
}

.user-pfp {
    width: 80px;
    height: 80px;
    border-radius: 50%;
    object-fit: cover;
    border: 2px solid #333;
}

.user-details h3 {
    margin: 0 0 0.25rem 0;
    font-size: 1.5rem;
}

.user-realname {
    color: var(--text-primary);
    font-size: 1rem;
    margin-bottom: 0.25rem;
    font-weight: 500;
}

.user-stat {
    color: var(--text-secondary);
    font-size: 0.9rem;
}

.secondary-btn {
    /* margin-left: auto; Removed, scrobbles will push */
    background-color: transparent;
    border: 1px solid #333;
    padding: 0.5rem 1rem;
}

.user-scrobbles {
    margin-left: auto;
    text-align: right;
    padding-right: 1.5rem;
}

.scrobble-count {
    color: var(--text-primary);
    font-size: 1.75rem;
    font-weight: 700;
    line-height: 1.1;
    margin-bottom: 0.25rem;
}

.scrobble-label {
    color: var(--text-secondary);
    font-size: 0.75rem;
    letter-spacing: 0.05em;
    font-weight: 600;
}

.secondary-btn:hover {
    background-color: rgba(255, 255, 255, 0.05);
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(-10px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

button:hover {
    background-color: var(--accent-hover);
}

.hidden {
    display: none !important;
}

#loading {
    text-align: center;
    margin-top: 2rem;
    color: var(--text-secondary);
}

#error {
    margin-top: 2rem;
    padding: 1rem;
    background-color: rgba(255, 0, 0, 0.1);
    border: 1px solid red;
    border-radius: 8px;
    color: #ff6b6b;
    text-align: center;
}

.warning-box {
    margin-top: 2rem;
    padding: 1rem;
    background-color: rgba(251, 191, 36, 0.1);
    border: 1px solid #fbbf24;
    border-radius: 8px;
    color: #fcd34d;
    text-align: center;
}

#results {
    margin-top: 3rem;
}

.legend {
    display: flex;
    gap: 1rem;
    margin-bottom: 1rem;
    justify-content: flex-end;
    font-size: 0.8rem;
}

.tracks-grid {
    display: grid;
    gap: 1rem;
}

.track-card {
    background-color: var(--card-bg);
    padding: 1rem;
    border-radius: 12px;
    display: flex;
    align-items: center;
    gap: 1rem;
    border: 1px solid #333;
}

.track-image {
    width: 50px;
    height: 50px;
    border-radius: 4px;
    object-fit: cover;
}

.track-info {
    flex-grow: 1;
}

.track-name {
    font-weight: 600;
    display: block;
    margin-bottom: 0.25rem;
    text-decoration: none;
    color: var(--text-primary);
}

.track-meta {
    font-size: 0.85rem;
    color: var(--text-secondary);
}

.score-badge {
    padding: 0.5rem 1rem;
    border-radius: 20px;
    font-weight: 700;
    font-size: 0.9rem;
    min-width: 60px;
    text-align: center;
}

/* Dynamic scoring colors */
.score-high {
    background-color: rgba(0, 255, 0, 0.1);
    color: #4ade80;
}

.score-neutral {
    background-color: rgba(255, 255, 255, 0.1);
    color: #ccc;
}

.score-low {
    background-color: rgba(255, 0, 0, 0.1);
    color: #f87171;
}

.score-exact {
    background-color: rgba(59, 130, 246, 0.1);
    color: #60a5fa;
}

/* Progress Bar */
.progress-container {
    background: var(--card-bg);
    padding: 24px;
    border-radius: 8px;
    margin: 20px 0;
    text-align: center;
    border: 1px solid #333;
}

.progress-status {
    margin-bottom: 12px;
    font-weight: 600;
    color: var(--text-primary);
}

.progress-bar-bg {
    width: 100%;
    height: 8px;
    background: #333;
    border-radius: 4px;
    overflow: hidden;
    margin-bottom: 8px;
}

.progress-bar-fill {
    width: 0%;
    height: 100%;
    background: var(--accent);
    transition: width 0.3s ease;
}

.progress-stats {
    display: flex;
    justify-content: space-between;
    font-size: 0.9em;
    color: var(--text-secondary);
}

/* View Controls */
.view-controls {
    display: flex;
    justify-content: flex-end;
    margin-bottom: 1rem;
}

/* Columns Layout */
.columns-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 1.5rem;
}

@media (max-width: 768px) {
    .columns-grid {
        grid-template-columns: 1fr;
    }
}

.column {
    background: rgba(255, 255, 255, 0.03);
    padding: 1rem;
    border-radius: 12px;
    border: 1px solid #333;
}

.column-header {
    font-size: 1.1rem;
    font-weight: 700;
    margin-bottom: 0.25rem;
    text-align: center;
    color: var(--text-primary);
}

.column-subtext {
    font-size: 0.8rem;
    color: var(--text-secondary);
    text-align: center;
    margin-bottom: 1.25rem;
    font-weight: 400;
}

/* Column-specific coloring (optional subtle tint) */
.column-positive .column-header {
    color: #4ade80;
}

.column-neutral .column-header {
    color: #ccc;
}

.column-negative .column-header {
    color: #f87171;
}

/* Adjust card styles for smaller columns */
.column {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.column .track-card {
    padding: 0.75rem;
    gap: 0.75rem;
    align-items: center;
    /* Row layout by default */
}

.column .track-image {
    width: 44px;
    height: 44px;
    flex-shrink: 0;
}

.column .track-name {
    font-size: 0.9rem;
    line-height: 1.2;
}

.column .track-meta {
    font-size: 0.75rem;
}

.column .score-badge {
    padding: 0.4rem;

    min-width: 45px;
    font-size: 0.8rem;
}

/* Artist Info Container */
.artist-info-container {
    background: linear-gradient(135deg, rgba(255, 255, 255, 0.05), rgba(255, 255, 255, 0.02));
    padding: 2rem;
    border-radius: 12px;
    margin-bottom: 2rem;
    display: flex;
    align-items: center;
    gap: 2rem;
    border: 1px solid rgba(255, 255, 255, 0.1);
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
}

.artist-header-image {
    width: 120px;
    height: 120px;
    border-radius: 50%;
    object-fit: cover;
    border: 3px solid var(--accent);
    box-shadow: 0 0 15px rgba(186, 0, 0, 0.3);
}

.artist-details {
    flex-grow: 1;
}

.artist-name {
    font-size: 2.5rem;
    font-weight: 700;
    margin: 0 0 0.5rem 0;
    color: var(--text-primary);
    line-height: 1.1;
}

.artist-stats {
    display: flex;
    gap: 2rem;
    margin-top: 1rem;
}

.stat-item {
    display: flex;
    flex-direction: column;
}

.stat-value {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--text-primary);
}

.stat-label {
    font-size: 0.8rem;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.05em;
    font-weight: 600;
}

@media (max-width: 600px) {
    .artist-info-container {
        flex-direction: column;
        text-align: center;
        padding: 1.5rem;
        gap: 1.5rem;
    }

    .artist-stats {
        flex-direction: column;
        gap: 1rem;
        align-items: center;
    }
}

/* User Stat Highlight */
.user-stat-highlight {
    background-color: rgba(186, 0, 0, 0.1);
    /* Subtle red background matching accent */
    padding: 0.5rem 1rem;
    border-radius: 8px;
    border: 1px solid rgba(186, 0, 0, 0.3);
    margin: -0.5rem 0;
    /* Offset padding to align baseline roughly */
}

.user-stat-highlight .stat-value {
    color: var(--accent);
    text-shadow: 0 0 10px rgba(186, 0, 0, 0.2);
}

.user-stat-highlight .stat-label {
    color: var(--text-primary);
    opacity: 0.9;
}


.icon-btn {
    background: transparent;
    border: 1px solid #333;
    border-radius: 50%;
    color: var(--text-secondary);
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
    cursor: pointer;
}

.info-btn-small {
    padding: 2px;
    width: 22px;
    height: 22px;
    vertical-align: middle;
    margin-left: 4px;
    margin-top: -2px;
    display: inline-flex;
    border: 1px solid rgba(255, 255, 255, 0.1);
}

.icon-btn:hover {
    background: rgba(255, 255, 255, 0.1);
    color: var(--text-primary);
    border-color: var(--text-secondary);
}

/* Footer Styles */
footer {
    margin-top: 4rem;
    padding: 2rem 0;
    border-top: 1px solid #333;
    text-align: center;
    color: var(--text-secondary);
}

footer p {
    margin-bottom: 1rem;
    font-size: 0.9rem;
}

footer strong {
    color: var(--text-secondary);
}

.footer-links {
    display: flex;
    justify-content: center;
    gap: 2rem;
}

.footer-links a {
    color: var(--text-secondary);
    text-decoration: none;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.9rem;
    transition: color 0.2s;
}

.footer-links a:hover {
    color: var(--accent);
}

/* Modal Styles */
.modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 1000;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 2rem;
    box-sizing: border-box;
}

.modal-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.85);
    backdrop-filter: blur(4px);
}

.modal-content {
    position: relative;
    background: var(--card-bg);
    max-width: 600px;
    width: 100%;
    border-radius: 16px;
    border: 1px solid #333;
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.4);
    animation: modalSlideUp 0.3s ease-out;
}

.modal-header {
    padding: 1.5rem;
    border-bottom: 1px solid #333;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.modal-header h2 {
    margin: 0;
    font-size: 1.5rem;
}

.close-btn {
    background: transparent;
    border: none;
    color: var(--text-secondary);
    font-size: 1.5rem;
    cursor: pointer;
    line-height: 1;
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    transition: all 0.2s;
}

.close-btn:hover {
    background-color: var(--accent);
    color: white;
}

.modal-body {
    padding: 1.5rem;
    max-height: 70vh;
    overflow-y: auto;
}

.modal-body section {
    margin-bottom: 2rem;
}

.note-box {
    background: rgba(251, 191, 36, 0.1);
    border: 1px solid rgba(251, 191, 36, 0.4);
    border-radius: 8px;
    padding: 1rem 1.25rem;
    margin-bottom: 1.5rem;
    font-size: 0.9rem;
    line-height: 1.5;
}

.note-box strong {
    color: #fbbf24;
}

.modal-body h3 {
    margin-top: 0;
    color: var(--accent);
    font-size: 1.1rem;
    margin-bottom: 0.75rem;
}

.modal-body p {
    font-size: 0.95rem;
    line-height: 1.6;
    margin-bottom: 1rem;
}

.modal-body ul {
    padding-left: 1.25rem;
    margin-bottom: 1rem;
}

.modal-body li {
    margin-bottom: 0.5rem;
    font-size: 0.9rem;
    color: var(--text-secondary);
}

.modal-body strong {
    color: var(--text-primary);
}

@keyframes modalSlideUp {
    from {
        opacity: 0;
        transform: translateY(20px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Mobile Responsive Styles */
@media (max-width: 600px) {
    .container {
        padding: 1rem;
    }

    h1 {
        font-size: 1.75rem;
    }

    header {
        margin-bottom: 1.5rem;
    }

    /* Input rows - stack vertically on mobile */
    .input-row {
        flex-direction: column;
        gap: 0.75rem;
    }

    .input-row input {
        width: 100%;
    }

    .input-row button {
        width: 100%;
    }

    /* User card - stack vertically */
    .user-info-content {
        flex-direction: column;
        text-align: center;
        gap: 1rem;
    }

    .user-scrobbles {
        margin-left: 0;
        text-align: center;
        padding-right: 0;
    }

    .user-card {
        padding: 1rem;
    }

    /* Filter section - stack vertically */
    .filter-section {
        flex-direction: column;
        gap: 1rem;
        align-items: flex-start;
    }

    .footer-links {
        gap: 1.5rem;
    }

    footer {
        margin-top: 2rem;
        padding: 1.5rem 0;
    }

    /* Modal adjustments */
    .modal {
        padding: 1rem;
    }

    .modal-content {
        border-radius: 12px;
    }

    .modal-header h2 {
        font-size: 1.25rem;
    }

    .modal-body {
        padding: 1rem;
    }

    /* Track cards in columns - match complete list style on mobile */
    .column .track-card {
        flex-direction: row;
        text-align: left;
        padding: 0.75rem;
        gap: 0.75rem;
    }

    .column .track-image {
        width: 40px;
        height: 40px;
        flex-shrink: 0;
    }

    .column .track-info {
        flex: 1;
        min-width: 0;
        /* Allow text truncation */
    }

    .column .track-name {
        font-size: 0.85rem;
        white-space: nowrap;
        overflow: hidden;
        text-overflow: ellipsis;
        display: block;
    }

    .column .track-meta {
        font-size: 0.7rem;
        white-space: nowrap;
        overflow: hidden;
        text-overflow: ellipsis;
    }

    .column .score-badge {
        padding: 0.3rem 0.5rem;
        min-width: 40px;
        font-size: 0.75rem;
        flex-shrink: 0;
    }

    /* Results header */
    #resultHeader {
        font-size: 1.25rem;
    }

    /* View controls */
    .view-controls {
        justify-content: center;
    }

    #viewToggleBtn {
        width: 100%;
    }
}

/* Top Artists Grid */
.top-artists-header {
    text-align: center;
    font-size: 1.25rem;
    font-weight: 600;
    margin-bottom: 1.5rem;
    color: var(--text-primary);
}

.top-artists-grid {
    display: grid;
    grid-template-columns: repeat(5, 1fr);
    gap: 1rem;
    margin-bottom: 2rem;
}

.top-artist-card {
    background-color: var(--card-bg);
    border: 1px solid #333;
    border-radius: 12px;
    padding: 0.75rem;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.5rem;
    cursor: pointer;
    transition: all 0.2s ease;
    text-align: center;
}

.top-artist-card:hover {
    border-color: var(--accent);
    background-color: rgba(186, 0, 0, 0.1);
    transform: translateY(-2px);
}

.top-artist-image {
    width: 60px;
    height: 60px;
    border-radius: 50%;
    object-fit: cover;
    border: 2px solid #444;
    transition: border-color 0.2s;
}

.top-artist-card:hover .top-artist-image {
    border-color: var(--accent);
}

.top-artist-name {
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--text-primary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 100%;
}

.top-artist-scrobbles {
    font-size: 0.75rem;
    color: var(--text-secondary);
}

/* Mobile: Single column layout */
@media (max-width: 600px) {
    .top-artists-grid {
        grid-template-columns: 1fr;
        gap: 0.75rem;
    }

    .top-artist-card {
        flex-direction: row;
        padding: 0.5rem 0.75rem;
        gap: 0.75rem;
        text-align: left;
    }

    .top-artist-image {
        width: 48px;
        height: 48px;
        flex-shrink: 0;
    }

    .top-artist-info {
        flex: 1;
        min-width: 0;
    }

    .top-artist-name {
        font-size: 0.9rem;
    }

    .top-artist-scrobbles {
        font-size: 0.8rem;
    }
}