
/* Base styles */
:root {
    color-scheme: dark;
    --accent-green: #34D399;
    --accent-light: #a7f3d0;
    --favorite-color: #fbbf24;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;
    margin: 0;
    padding: 0;
    background-color: #000;
    color: #fff;
    line-height: 1.5;
}

/* Container */
.container {
    width: 95%;
    max-width: 1400px;
    margin: 0 auto;
    padding: 0 15px;
}

/* Header */
header {
    background-color: #000;
    border-bottom: 1px solid #333;
    padding: 20px 0;
    margin-bottom: 20px;
}

.site-title {
    font-size: 28px;
    font-weight: bold;
    margin: 0;
}

/* Filter toggle */
.filter-toggle {
    display: flex;
    justify-content: space-between;
    align-items: center;
    background-color: #111;
    padding: 15px;
    border-radius: 8px;
    margin-bottom: 20px;
    cursor: pointer;
    transition: background-color 0.2s;
    border: 1px solid #333;
}

.filter-toggle:hover {
    background-color: #1a1a1a;
}

.filter-toggle-title {
    font-weight: 600;
    font-size: 16px;
    color: var(--accent-green);
    margin: 0;
}

.filter-toggle-icon {
    transition: transform 0.3s ease;
}

.filter-toggle-icon.open {
    transform: rotate(180deg);
}

/* Filters */
.filters {
    background-color: #111;
    padding: 15px;
    border-radius: 0 0 8px 8px;
    margin-bottom: 25px;
    border: 1px solid #333;
    border-top: none;
    overflow: hidden;
    transition: max-height 0.3s ease;
}

.filter-row {
    display: flex;
    flex-wrap: wrap;
    gap: 15px;
    margin-bottom: 15px;
}

.filter-group {
    flex: 1;
    min-width: 180px;
}

.filter-label {
    display: block;
    margin-bottom: 5px;
    font-size: 14px;
    color: #ccc;
}

.filter-input {
    width: 100%;
    padding: 8px 12px;
    background-color: #222;
    border: 1px solid #444;
    border-radius: 4px;
    color: white;
    font-size: 14px;
}

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

select.filter-input {
    appearance: none;
    background-image: url("data:image/svg+xml;charset=UTF-8,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='white' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3e%3cpolyline points='6 9 12 15 18 9'%3e%3c/polyline%3e%3c/svg%3e");
    background-repeat: no-repeat;
    background-position: right 12px center;
    background-size: 16px;
    padding-right: 40px;
}

.filter-reset {
    background-color: #333;
    color: white;
    border: none;
    padding: 8px 16px;
    border-radius: 4px;
    cursor: pointer;
    font-size: 14px;
    transition: background-color 0.2s;
}

.filter-reset:hover {
    background-color: #444;
}

/* Loading state */
.loading {
    display: flex;
    justify-content: center;
    align-items: center;
    height: 200px;
    font-size: 18px;
    color: #aaa;
}

/* Error message */
.error {
    text-align: center;
}

/* Albums grid */
.albums-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
    gap: 20px;
    margin-bottom: 40px;
}

/* Album card */
.album-card {
    background-color: #1f1f1f;
    border-radius: 8px;
    overflow: hidden;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
    transition: transform 0.3s ease, box-shadow 0.3s ease, outline 0.2s ease;
    height: 100%;
    display: flex;
    flex-direction: column;
    outline: 2px solid transparent;
    outline-offset: 2px;
}

.album-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 10px 15px rgba(0, 0, 0, 0.2);
    outline: 2px solid var(--accent-green);
}

/* Special styling for favorite albums */
.album-card.favorite {
    outline: 2px solid transparent;
}

.album-card.favorite:hover {
    box-shadow: 0 10px 20px rgba(251, 191, 36, 0.3);
    outline: 2px solid var(--favorite-color);
}

.album-favorite-badge {
    position: absolute;
    top: 8px;
    left: 8px;
    color: var(--favorite-color);
    z-index: 1;
    font-size: 16px;
    background-color: rgba(0, 0, 0, 0.5);
    width: 24px;
    height: 24px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
}

/* Styles for albums without artwork */
.album-card.no-artwork {
    /* Ensure no-artwork cards match standard album card styling */
    background-color: #1f1f1f; 
    display: flex;
    flex-direction: column;
}

.album-card.no-artwork .album-image-container {
    /* Maintain a dark background for missing artwork */
    background-color: #111 !important;
}

.album-card.no-artwork .album-image {
    /* Ensure image fills the container completely */
    background-color: transparent;
    opacity: 1 !important;
    object-fit: cover !important; /* Fills entire container like standard artwork */
}

.album-card.no-artwork .album-info {
    /* Restore standard padding and layout for album information */
    padding: 12px;
}

.album-card.no-artwork .album-title {
    /* Match standard title styling with ellipsis for long titles */
    font-weight: 600;
    font-size: 14px;
    margin: 0 0 4px 0;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.album-card.no-artwork .album-artist {
    /* Match standard artist name styling */
    font-size: 14px;
    color: #9ca3af;
    margin: 0 0 8px 0;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.album-card.no-artwork .album-meta {
    /* Ensure meta information (year, genre) is consistently displayed */
    display: flex;
    justify-content: space-between;
    font-size: 13px;
    margin-top: auto;
    gap: 8px;
    overflow: hidden;
}

.album-card.no-artwork:hover .album-title {
    /* Add hover effect to title for consistency */
    color: var(--accent-green);
}

.album-missing-overlay {
    /* Overlay for displaying album info when no artwork is available */
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    padding: 12px;
    box-sizing: border-box;
    text-align: center;
    z-index: 2;
    pointer-events: none;
}

.album-missing-artist {
    /* Styling for artist name in missing artwork overlay */
    font-weight: 700;
    font-size: 18px;
    color: #1a1a1a;
    margin-bottom: 6px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    width: 90%;
}

.album-missing-title {
    /* Styling for album title in missing artwork overlay */
    font-size: 16px;
    color: #1a1a1a;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    width: 90%;
}
}
.album-card.no-artwork:hover .album-image {
    transform: none;
}
/* For long titles that need to adjust on smaller screens */
@media (max-width: 240px) {
    .album-missing-artist {
        font-size: 14px;
    }
    
    .album-missing-title {
        font-size: 12px;
    }
}

/* Special Styling for EP */

.album-ep-tag {
    position: absolute;
    bottom: 8px;
    right: 8px;
    background-color: rgba(0, 0, 0, 0.7);
    color: #fbbf24;
    font-size: 12px;
    padding: 4px 8px;
    border-radius: 4px;
    z-index: 1;
    font-weight: 600;
    border: 1px solid #fbbf24;
    text-shadow: 0px 0px 2px rgba(0, 0, 0, 0.8);
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.3);
}

.album-card:hover .album-image {
    transform: scale(1.05);
}

.album-category {
    position: absolute;
    top: 8px;
    right: 8px;
    background-color: rgba(0, 0, 0, 0.7);
    color: white;
    font-size: 12px;
    padding: 4px 8px;
    border-radius: 4px;
    z-index: 1;
}

.album-favorite-badge {
    position: absolute;
    top: 8px;
    left: 8px;
    color: var(--favorite-color);
    z-index: 1;
    font-size: 16px;
    background-color: rgba(0, 0, 0, 0.5);
    width: 24px;
    height: 24px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
}

.album-info {
    padding: 12px;
    flex-grow: 1;
    display: flex;
    flex-direction: column;
}

.album-title {
    font-weight: 600;
    font-size: 14px;
    margin: 0 0 4px 0;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    transition: color 0.3s ease;
}

.album-card:hover .album-title {
    color: var(--accent-green);
}

.album-card.favorite:hover .album-title {
    color: var(--favorite-color);
}

.album-artist {
    font-size: 14px;
    color: #9ca3af;
    margin: 0 0 8px 0;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.album-meta {
    display: flex;
    justify-content: space-between;
    font-size: 13px;
    margin-top: auto;
    gap: 8px; /* Add space between year and genre */
    overflow: hidden; /* Prevent text from overflowing */
}

.album-year, .album-genre {
    white-space: nowrap; /* Prevent text wrapping */
    overflow: hidden;
    text-overflow: ellipsis; /* Add ellipsis if text is too long */
    max-width: 50%; /* Ensure each takes up roughly half the space */
}

.album-year {
    font-weight: 600;
    color: var(--accent-light);
    background-color: rgba(52, 211, 153, 0.1);
    padding: 2px 6px;
    border-radius: 4px;
}

.album-genre {
    font-weight: 600;
    color: var(--accent-light);
    background-color: rgba(52, 211, 153, 0.1);
    padding: 2px 6px;
    border-radius: 4px;
}

/* Spotify-enabled cursor */
.spotify-enabled {
    cursor: pointer;
}

/* Footer */
footer {
    background-color: #000;
    border-top: 1px solid #333;
    padding: 20px 0;
    margin-top: 40px;
    color: #9ca3af;
    font-size: 14px;
}

.counter {
    font-size: 14px;
    color: #9ca3af;
    margin-bottom: 20px;
}

/* No results message */
.no-results {
    grid-column: 1 / -1;
    text-align: center;
    padding: 30px;
    background-color: #111;
    border-radius: 8px;
    color: #9ca3af;
}

/* Responsive adjustments */
@media (max-width: 768px) {
    .albums-grid {
        grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
        gap: 15px;
    }
    
    .filter-row {
        flex-direction: column;
        gap: 10px;
    }
    
    .filter-group {
        width: 100%;
    }
    
    .site-title {
        font-size: 24px;
    }
}

@media (max-width: 480px) {
    .albums-grid {
        grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
        gap: 12px;
    }
}

/* Force square album artwork - eliminate any remaining issues */
.album-image-container {
    position: relative !important;
    width: 100% !important;
    height: 0 !important; /* Important for padding-based aspect ratio */
    padding-top: 100% !important; /* Creates square aspect ratio */
    padding-bottom: 0 !important; /* Override any other padding */
    background-color: #111 !important;
    overflow: hidden !important;
}

/* Reset all album image styles */
.album-image {
    position: absolute !important;
    top: 0 !important;
    left: 0 !important;
    width: 100% !important;
    height: 100% !important;
    object-fit: cover !important;
    object-position: center !important;
    transition: transform 0.3s ease;
}

/* Only show the missing overlay on no-artwork cards */
.album-missing-overlay {
    display: none;
}

.album-card.no-artwork .album-missing-overlay {
    display: flex;
}

.album-image.loading {
    opacity: 0.7;
}

.album-image.error {
    opacity: 0.5;
}

.album-image-container::before {
    content: "";
    position: absolute;
    top: 50%;
    left: 50%;
    width: 30px;
    height: 30px;
    border: 3px solid #f3f3f3;
    border-top: 3px solid #555;
    border-radius: 50%;
    transform: translate(-50%, -50%);
    animation: spin 1s linear infinite;
    opacity: 0;
}

.album-image-container:has(.loading)::before {
    opacity: 1;
}

@keyframes spin {
    0% { transform: translate(-50%, -50%) rotate(0deg); }
    100% { transform: translate(-50%, -50%) rotate(360deg); }
}

/* Enhanced image loading states */
.album-image {
    position: absolute !important;
    top: 0 !important;
    left: 0 !important;
    width: 100% !important;
    height: 100% !important;
    object-fit: cover !important;
    object-position: center !important;
    transition: transform 0.3s ease, opacity 0.3s ease;
    background-color: #121212; /* Dark background while loading */
    will-change: transform, opacity; /* Optimize for animations */
}

.album-image.loading {
    opacity: 0.7;
    animation: pulse 1.5s infinite alternate;
}

.album-image.loaded {
    opacity: 1;
}

.album-image.error {
    opacity: 0.5;
}

/* Create a gentle loading pulse animation */
@keyframes pulse {
    0% { opacity: 0.6; }
    100% { opacity: 0.8; }
}

/* Optimize for mobile devices */
@media (max-width: 768px) {
    .album-image-container {
        position: relative !important;
        overflow: hidden !important;
        width: 100% !important;
        height: 0 !important;
        padding-top: 100% !important; /* 1:1 Aspect Ratio */
        padding-bottom: 0 !important;
        background-color: #121212 !important;
    }
    
    .album-card {
        transition: transform 0.2s ease-in-out; /* Faster transitions on mobile */
    }
    
    /* Optimized spinner for mobile */
    .album-image-container::before {
        width: 24px;
        height: 24px;
        border-width: 2px;
    }
}

/* Header layout with stats button */
.header-content {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

/* Ensure proper spacing for stats button */
.stats-button-container {
    margin-left: 15px;
}

/* Responsive adjustments */
@media (max-width: 768px) {
    .header-content {
        flex-direction: row;
        align-items: center;
    }
    
    .site-title {
        font-size: 22px;
        margin-right: 10px;
    }
    
    .stats-button span {
        display: none; /* Hide button text on small screens */
    }
}
