/* Playlists Container */
.playlists-container {
    margin-top: 20px;
}

/* No Results Message */
.no-results.hidden {
    display: none;
}

/* Playlists Summary */
.playlists-summary {
    margin-bottom: 20px;
}

.playlists-summary.hidden {
    display: none;
}

.playlists-summary h2 {
    font-size: 1.5rem;
    font-weight: 600;
    color: #333;
    margin-bottom: 8px;
}

.playlists-summary p {
    font-size: 1rem;
    color: #666;
}

/* Playlists Grid */
.playlists-grid {
    display: grid;
    grid-template-columns: repeat(8, 1fr);
    gap: 15px;
    margin-top: 20px;
}

.playlists-grid.hidden {
    display: none;
}

/* Playlist Card */
.playlist-card {
    background: white;
    border: 1px solid #e0e0e0;
    border-radius: 10px;
    overflow: hidden;
    transition: all 0.2s ease;
    cursor: default;
}

.playlist-card:hover {
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
    border-color: #667eea;
}

/* Playlist Image */
.playlist-image {
    width: 100%;
    aspect-ratio: 1;
    background: #e0e0e0;
    overflow: hidden;
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
}

.playlist-image img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

.playlist-image img.broken {
    display: none;
}

.playlist-image::before {
    content: '';
    position: absolute;
    width: 40%;
    height: 40%;
    background: #bbb;
    opacity: 0;
    border-radius: 8px;
}

.playlist-image.has-broken-image::before {
    opacity: 1;
}

/* Playlist Info */
.playlist-info {
    padding: 15px;
}

.playlist-name {
    font-size: 1.1rem;
    font-weight: 600;
    margin: 0 0 8px 0;
    line-height: 1.3;
}

.playlist-name a {
    color: #333;
    text-decoration: none;
    transition: color 0.2s ease;
}

.playlist-name a:hover {
    color: #667eea;
}

.playlist-owner {
    font-size: 0.9rem;
    color: #666;
    margin: 0 0 12px 0;
}

.playlist-owner a {
    color: #667eea;
    text-decoration: none;
}

.playlist-owner a:hover {
    text-decoration: underline;
}

/* Playlist Stats */
.playlist-stats {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.playlist-stats .stat {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 0.85rem;
    color: #666;
}

.playlist-stats .stat .material-symbols-outlined {
    font-size: 1.1rem;
    opacity: 0.7;
}

.playlist-stats .play-count {
    color: #333;
    font-weight: 500;
}

.playlist-stats .play-count .material-symbols-outlined {
    color: #667eea;
    opacity: 1;
}

/* Summary row with view toggle */
.playlists-summary-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
}

/* View toggle buttons */
.view-toggle {
    display: flex;
    gap: 4px;
}

.view-toggle-btn {
    background: none;
    border: 1px solid #ddd;
    border-radius: 6px;
    padding: 6px 8px;
    cursor: pointer;
    color: #999;
    transition: all 0.15s;
    display: flex;
    align-items: center;
}

.view-toggle-btn:hover {
    color: #667eea;
    border-color: #667eea;
}

.view-toggle-btn.active {
    color: #667eea;
    border-color: #667eea;
    background: #eef0ff;
}

.view-toggle-btn .material-symbols-outlined {
    font-size: 20px;
}

/* Playlists Table */
.playlists-table-wrap {
    margin-top: 20px;
    overflow-x: auto;
    background: white;
    border: 1px solid #e0e0e0;
    border-radius: 10px;
}

.playlists-table-wrap.hidden {
    display: none;
}

.playlists-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.9rem;
}

.playlists-table thead th {
    background: #f8f9fa;
    color: #333;
    font-weight: 600;
    padding: 12px 14px;
    text-align: left;
    border-bottom: 2px solid #dee2e6;
    white-space: nowrap;
    user-select: none;
}

.playlists-table thead th.sortable {
    cursor: pointer;
    transition: color 0.15s;
}

.playlists-table thead th.sortable:hover {
    color: #667eea;
}

.playlists-table thead th.sort-active {
    color: #667eea;
}

.playlists-table thead th .sort-arrow {
    font-size: 0.75rem;
    margin-left: 4px;
}

.playlists-table tbody td {
    padding: 10px 14px;
    border-bottom: 1px solid #eee;
    vertical-align: middle;
}

.playlists-table tbody tr:hover {
    background: #f8f9fa;
}

.playlists-table tbody tr:last-child td {
    border-bottom: none;
}

/* Image cell */
.playlists-table .pl-img {
    width: 40px;
    height: 40px;
    border-radius: 4px;
    object-fit: cover;
    display: block;
}

/* Playlist name cell */
.playlists-table .pl-name-cell a {
    color: #333;
    text-decoration: none;
    font-weight: 500;
}

.playlists-table .pl-name-cell a:hover {
    color: #667eea;
}

/* Owner cell */
.playlists-table .pl-owner-cell a {
    color: #667eea;
    text-decoration: none;
}

.playlists-table .pl-owner-cell a:hover {
    text-decoration: underline;
}

/* Number cells — header stays in normal table font, only data cells use monospace */
.playlists-table th.pl-num {
    text-align: right;
}

.playlists-table td.pl-num {
    text-align: right;
    font-family: 'Courier New', monospace;
    font-size: 0.8rem;
    color: #aaa;
}

/* Unresolved source cards */
.playlist-card.unresolved {
    background: #f5f5f5;
    border-color: #e0e0e0;
}

.playlist-card.unresolved:hover {
    box-shadow: none;
    border-color: #e0e0e0;
}

.playlist-card.unresolved .playlist-image {
    background: #e8e8e8;
    display: flex;
    align-items: center;
    justify-content: center;
}

.playlist-card.unresolved .playlist-image .unresolved-icon {
    font-size: 3rem;
    color: #999;
}

.playlist-card.unresolved .playlist-name {
    color: #666;
}

/* Unresolved table rows */
.playlists-table tbody tr.unresolved td {
    font-style: italic;
    color: #888;
}

.playlists-table tbody tr.unresolved:hover {
    background: #fafafa;
}

/* Date cells in playlist tracks table */
.playlists-table .pl-date {
    white-space: nowrap;
    font-family: 'Courier New', monospace;
    font-size: 0.8rem;
    color: #aaa;
}

/* Artist link in playlist tracks table — plain, not blue */
.playlists-table .pl-artist-link {
    color: #555;
    text-decoration: none;
}

.playlists-table .pl-artist-link:hover {
    color: #667eea;
}

/* Playlist Search Page — detail header */
.playlist-detail-header {
    display: flex;
    align-items: flex-start;
    gap: 20px;
    padding: 16px 0 20px;
}

.playlist-detail-image {
    width: 90px;
    height: 90px;
    border-radius: 8px;
    background: #e0e0e0;
    flex-shrink: 0;
    overflow: hidden;
}

.playlist-detail-image img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

.playlist-detail-info {
    flex: 1;
}

.playlist-detail-name {
    font-size: 1.4rem;
    font-weight: 700;
    color: #333;
    margin-bottom: 4px;
}

.playlist-detail-owner {
    font-size: 0.95rem;
    color: #666;
    margin-bottom: 2px;
}

.playlist-detail-followers {
    font-size: 0.85rem;
    color: #999;
    margin-bottom: 8px;
}

.playlist-detail-spotify.hidden {
    display: none;
}

/* Responsive Design */
@media (max-width: 1200px) {
    .playlists-grid {
        grid-template-columns: repeat(4, 1fr);
    }
}

@media (max-width: 768px) {
    .playlists-grid {
        grid-template-columns: repeat(3, 1fr);
        gap: 12px;
    }
    
    .playlist-info {
        padding: 12px;
    }
    
    .playlist-name {
        font-size: 1rem;
    }
}

@media (max-width: 480px) {
    .playlists-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}
