/* ---- Header ---- */
.album-ranking-page {
    padding: 100px 0 80px;
    min-height: 100vh;
    background: #f5f5f5;
}

.ranking-header {
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    margin-bottom: 40px;
}

.ranking-header-text {
    width: 100%;
    text-align: center;
}

.ranking-header-text h1 {
    font-size: clamp(2.5rem, 6vw, 4.5rem);
    font-weight: 900;
    letter-spacing: -2px;
    line-height: 1;
    color: #000;
}

.ranking-subtitle {
    font-size: 1.1rem;
    font-weight: 400;
    color: #666;
    margin-top: 8px;
    font-style: italic;
}

.ranking-description {
    font-size: 0.9rem;
    color: #888;
    margin: 6px auto 0;
    max-width: 520px;
    line-height: 1.55;
}

.ranking-description strong {
    color: #333;
    font-weight: 700;
}

/* ---- Status Bar: albums · votes · daily left — one horizontal strip ---- */
.ranking-status-bar {
    display: inline-flex;
    align-items: stretch;
    background: #000;
    border: 3px solid #000;
    margin-top: 22px;
    overflow: hidden;
    gap: 3px;
}

.ranking-stat-pill {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 10px 24px;
}

/* Votes-left pill has a faint left accent */
.votes-left-pill {
    background: #0d0d0d;
}

.votes-left-pill svg {
    color: #FFD700;
    flex-shrink: 0;
}

.ranking-stat-value {
    font-size: 1.35rem;
    font-weight: 900;
    line-height: 1;
    color: #FFD700;
    letter-spacing: -0.5px;
    font-variant-numeric: tabular-nums;
    transition: color 0.3s;
}

.ranking-stat-value[data-empty="true"] {
    color: #c0392b;
}

.ranking-stat-label {
    font-size: 0.62rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 1.5px;
    color: #666;
}

.ranking-status-sep {
    width: 2px;
    background: #222;
    flex-shrink: 0;
    align-self: stretch;
}

/* Vote pip dots on cards */
.votes-left-bar {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 4px;
    padding: 4px 10px 8px;
}

.vote-pip {
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: #ddd;
    transition: background 0.3s;
}

.vote-pip.active {
    background: #FFD700;
}


/* Search toggle button — bar style below text */
.ranking-search-toggle {
    background: #000;
    color: #fff;
    border: 3px solid #000;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    cursor: pointer;
    transition: all 0.2s ease;
    margin-top: 20px;
    padding: 12px 28px;
    font-family: 'Inter', sans-serif;
    font-size: 0.85rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 1px;
}

.ranking-search-toggle:hover {
    background: #FFD700;
    color: #000;
}


/* ---- Search Panel ---- */
.ranking-search-panel {
    display: none;
    margin-bottom: 40px;
    animation: slideDown 0.3s ease;
}

.ranking-search-panel.active {
    display: block;
}

@keyframes slideDown {
    from { opacity: 0; transform: translateY(-12px); }
    to   { opacity: 1; transform: translateY(0); }
}

.ranking-search-wrapper {
    display: flex;
    gap: 0;
    border: 3px solid #000;
    background: #fff;
}

.ranking-search-input {
    flex: 1;
    padding: 16px 20px;
    font-size: 1.1rem;
    font-family: 'Inter', sans-serif;
    border: none;
    outline: none;
    background: transparent;
}

.ranking-search-close {
    background: #000;
    color: #fff;
    border: none;
    padding: 0 20px;
    font-size: 1.2rem;
    cursor: pointer;
    transition: background 0.2s;
    font-family: 'Inter', sans-serif;
}

.ranking-search-close:hover {
    background: #333;
}

/* Search Results Dropdown */
.ranking-search-results {
    border: 3px solid #000;
    border-top: none;
    background: #fff;
    max-height: 420px;
    overflow-y: auto;
}

.ranking-search-results:empty {
    display: none;
}

.ranking-search-result-item {
    display: flex;
    align-items: center;
    gap: 16px;
    padding: 12px 16px;
    cursor: pointer;
    transition: background 0.15s;
    border-bottom: 1px solid #eee;
}

.ranking-search-result-item:last-child {
    border-bottom: none;
}

.ranking-search-result-item:hover {
    background: #FFD700;
}

.ranking-search-result-item img {
    width: 56px;
    height: 56px;
    object-fit: cover;
    border: 2px solid #000;
    flex-shrink: 0;
}

.ranking-search-result-item .no-cover {
    width: 56px;
    height: 56px;
    background: #eee;
    border: 2px solid #000;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.4rem;
    flex-shrink: 0;
}

.ranking-search-result-info {
    flex: 1;
    min-width: 0;
}

.ranking-search-result-info strong {
    display: block;
    font-size: 0.95rem;
    font-weight: 700;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.ranking-search-result-info span {
    display: block;
    font-size: 0.82rem;
    color: #666;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.ranking-search-result-add {
    font-size: 0.75rem;
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: 1px;
    color: #000;
    opacity: 0;
    transition: opacity 0.15s;
    flex-shrink: 0;
}

.ranking-search-result-item:hover .ranking-search-result-add {
    opacity: 1;
}

.ranking-search-loading,
.ranking-search-no-results {
    padding: 24px;
    text-align: center;
    color: #999;
    font-size: 0.9rem;
}


/* ---- Ranking Filter Bar ---- */
.ranking-filter-bar {
    margin-bottom: 40px;
}

.ranking-filter-wrapper {
    display: flex;
    align-items: center;
    gap: 0;
    border: 3px solid #000;
    background: #fff;
    transition: border-color 0.2s;
}

.ranking-filter-wrapper:focus-within {
    border-color: #FFD700;
}

.ranking-filter-icon {
    flex-shrink: 0;
    margin: 0 14px;
    color: #888;
    pointer-events: none;
}

.ranking-filter-input {
    flex: 1;
    padding: 14px 12px 14px 0;
    font-size: 1rem;
    font-family: 'Inter', sans-serif;
    border: none;
    outline: none;
    background: transparent;
    color: #000;
}

.ranking-filter-input::placeholder {
    color: #aaa;
}

.ranking-filter-clear {
    background: #000;
    color: #fff;
    border: none;
    width: 44px;
    height: 44px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1rem;
    cursor: pointer;
    transition: background 0.2s;
    flex-shrink: 0;
    font-family: 'Inter', sans-serif;
}

.ranking-filter-clear:hover {
    background: #333;
}

/* Filter no-results */
.ranking-filter-no-results {
    grid-column: 1 / -1;
    text-align: center;
    padding: 60px 20px;
    color: #888;
}

.ranking-filter-no-results span {
    font-size: 3rem;
    display: block;
    margin-bottom: 12px;
}

.ranking-filter-no-results p {
    font-size: 1rem;
    max-width: 340px;
    margin: 0 auto;
}

.ranking-filter-no-results strong {
    color: #000;
}

/* Already-in-ranking badge on search results */
.ranking-search-result-item.already-added {
    cursor: pointer;
}

.ranking-search-result-item.already-added:hover {
    background: #f0f9e8;
}

.ranking-search-result-badge.in-ranking {
    font-size: 0.72rem;
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    background: #000;
    color: #FFD700;
    padding: 4px 8px;
    flex-shrink: 0;
    white-space: nowrap;
}

/* Highlight flash for scroll-to */
@keyframes highlightPulse {
    0%   { box-shadow: 0 0 0 0 rgba(255, 215, 0, 0.8); outline: 3px solid #FFD700; }
    50%  { box-shadow: 0 0 0 12px rgba(255, 215, 0, 0); outline: 3px solid #FFD700; }
    100% { box-shadow: 0 0 0 0 rgba(255, 215, 0, 0); outline: 3px solid transparent; }
}

.highlight-flash {
    animation: highlightPulse 0.6s ease 0s 3 forwards;
}

/* ---- Load More ---- */
.ranking-load-more-wrap {
    display: flex;
    justify-content: center;
    margin: 32px 0 20px;
}

.ranking-load-more-btn {
    background: #fff;
    color: #000;
    border: 3px solid #000;
    padding: 14px 36px;
    font-family: 'Inter', sans-serif;
    font-size: 0.85rem;
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: 1.5px;
    cursor: pointer;
    transition: background 0.2s, color 0.2s, transform 0.15s;
}

.ranking-load-more-btn:hover {
    background: #FFD700;
    color: #000;
    transform: translateY(-2px);
}

.ranking-load-more-btn:active {
    transform: translateY(0);
}

/* ---- Top 5 Podium ---- */
.ranking-podium {
    display: grid;
    grid-template-columns: repeat(5, 1fr);
    gap: 16px;
    margin-bottom: 60px;
    justify-content: center;
}

.podium-card {
    position: relative;
    background: #fff;
    border: 3px solid #000;
    overflow: hidden;
    transition: transform 0.2s ease;
}

.podium-card:hover {
    transform: translateY(-4px);
}

/* First place — bigger */
.podium-card[data-rank="1"] {
    grid-column: span 1;
}

.podium-rank {
    position: absolute;
    top: 8px;
    left: 12px;
    font-size: clamp(2rem, 4vw, 3.5rem);
    font-weight: 900;
    color: #000;
    line-height: 1;
    z-index: 2;
    text-shadow: 
        -1px -1px 0 #fff,
        1px -1px 0 #fff,
        -1px 1px 0 #fff,
        1px 1px 0 #fff,
        -2px 0 0 #fff,
        2px 0 0 #fff,
        0 -2px 0 #fff,
        0 2px 0 #fff;
}

.podium-cover-wrapper {
    aspect-ratio: 1;
    overflow: hidden;
    position: relative;
}

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

.podium-no-cover {
    width: 100%;
    height: 100%;
    background: linear-gradient(135deg, #eee, #ddd);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 3rem;
}

.podium-info {
    padding: 10px 12px 6px;
}

.podium-album-name {
    font-size: 0.8rem;
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    color: #000;
}

.podium-artist-name {
    font-size: 0.72rem;
    color: #666;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    margin-top: 2px;
}

.podium-vote-row {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 8px 12px 12px;
    border-top: 2px solid #000;
}

.vote-btn {
    background: #f0f0f0;
    border: 2px solid #ddd;
    border-radius: 6px;
    width: 36px;
    height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.2s ease;
    color: #666;
    line-height: 1;
    padding: 7px;
}

.vote-btn svg {
    width: 100%;
    height: 100%;
    display: block;
}

.vote-btn.vote-up:hover:not(.voted):not(:disabled) {
    background: #27ae60;
    border-color: #27ae60;
    color: #fff;
    transform: scale(1.15);
}

.vote-btn.vote-down:hover:not(.voted):not(:disabled) {
    background: #c0392b;
    border-color: #c0392b;
    color: #fff;
    transform: scale(1.15);
}

.vote-btn.voted {
    background: #000;
    border-color: #000;
    color: #FFD700;
    cursor: default;
}

.vote-btn:disabled:not(.voted) {
    opacity: 0.25;
    cursor: not-allowed;
}

.vote-count {
    font-size: 1.1rem;
    font-weight: 900;
    min-width: 32px;
    text-align: center;
    color: #000;
}

.vote-count.positive { color: #27ae60; }
.vote-count.negative { color: #c0392b; }


/* ---- Trend Badges ---- */
.trend-badge {
    position: absolute;
    top: 8px;
    right: 10px;
    font-size: 0.75rem;
    font-weight: 900;
    z-index: 2;
    padding: 2px 6px;
    line-height: 1.3;
    letter-spacing: 0.5px;
}

.trend-up {
    color: #27ae60;
}

.trend-down {
    color: #c0392b;
}

.trend-same {
    color: #999;
}

.trend-new {
    color: #FFD700;
    text-shadow:
        -1px -1px 0 #000,
        1px -1px 0 #000,
        -1px 1px 0 #000,
        1px 1px 0 #000;
    font-size: 0.9rem;
}

.grid-card-trend {
    position: absolute;
    top: 4px;
    right: 6px;
    background: rgba(0, 0, 0, 0.7);
    color: #fff;
    font-size: 0.6rem;
    font-weight: 900;
    padding: 2px 5px;
    line-height: 1.3;
}

.grid-card-trend.trend-up { background: #27ae60; color: #fff; }
.grid-card-trend.trend-down { background: #c0392b; color: #fff; }
.grid-card-trend.trend-same { background: rgba(0,0,0,0.5); color: #ccc; }
.grid-card-trend.trend-new { background: #FFD700; color: #000; }


/* ---- Full Ranking Grid ---- */
.ranking-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(140px, 180px));
    gap: 16px;
    margin-bottom: 40px;
    justify-content: center;
}

.ranking-grid-card {
    background: #fff;
    border: 3px solid #000;
    overflow: hidden;
    transition: transform 0.2s ease;
}

.ranking-grid-card:hover {
    transform: translateY(-3px);
}

.grid-card-cover {
    aspect-ratio: 1;
    overflow: hidden;
    position: relative;
}

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

.grid-card-no-cover {
    width: 100%;
    height: 100%;
    background: #eee;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 2rem;
}

.grid-card-rank {
    position: absolute;
    top: 4px;
    left: 6px;
    background: #000;
    color: #FFD700;
    font-size: 0.7rem;
    font-weight: 900;
    padding: 2px 6px;
    line-height: 1.3;
}

.grid-card-info {
    padding: 8px 10px 4px;
}

.grid-card-info strong {
    display: block;
    font-size: 0.72rem;
    font-weight: 800;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    text-transform: uppercase;
}

.grid-card-info span {
    display: block;
    font-size: 0.65rem;
    color: #888;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.grid-card-vote-row {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 4px;
    padding: 6px 8px 8px;
    border-top: 2px solid #000;
}

.grid-card-vote-row .vote-btn {
    width: 28px;
    height: 28px;
    font-size: 0.9rem;
}

.grid-card-vote-row .vote-count {
    font-size: 0.85rem;
    min-width: 24px;
}


/* ---- Empty & Loading ---- */
.ranking-empty {
    text-align: center;
    padding: 80px 20px;
}

.ranking-empty-icon {
    font-size: 4rem;
    margin-bottom: 16px;
}

.ranking-empty h3 {
    font-size: 1.6rem;
    font-weight: 900;
    text-transform: uppercase;
    margin-bottom: 8px;
}

.ranking-empty p {
    color: #666;
    max-width: 400px;
    margin: 0 auto;
}

.ranking-loading {
    text-align: center;
    padding: 80px 20px;
}

.ranking-spinner {
    width: 40px;
    height: 40px;
    border: 4px solid #eee;
    border-top-color: #000;
    border-radius: 50%;
    margin: 0 auto 16px;
    animation: spin 0.8s linear infinite;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

.ranking-loading p {
    color: #999;
    font-size: 0.9rem;
}

/* Toast notification */
.ranking-toast {
    position: fixed;
    bottom: 32px;
    left: 50%;
    transform: translateX(-50%) translateY(100px);
    background: #000;
    color: #FFD700;
    padding: 14px 28px;
    font-weight: 700;
    font-size: 0.9rem;
    letter-spacing: 0.5px;
    z-index: 9999;
    border: 3px solid #FFD700;
    opacity: 0;
    transition: all 0.3s ease;
    pointer-events: none;
}

.ranking-toast.show {
    opacity: 1;
    transform: translateX(-50%) translateY(0);
}

.ranking-toast.error {
    background: #c0392b;
    color: #fff;
    border-color: #922b21;
}


/* ---- Responsive ---- */

@media (max-width: 1024px) {
    .ranking-podium {
        grid-template-columns: repeat(5, 1fr);
        gap: 10px;
    }
}

@media (max-width: 768px) {
    .album-ranking-page {
        padding: 90px 0 60px;
    }

    /* Collapse to single column */
    .ranking-header {
        flex-direction: column;
        align-items: center;
        text-align: center;
        gap: 24px;
        margin-bottom: 28px;
    }

    .ranking-header-text {
        text-align: center;
    }

    .ranking-description {
        margin: 8px auto 0;
        font-size: 0.82rem;
    }

    .ranking-header-side {
        width: 100%;
        align-items: center;
    }

    .ranking-header-text h1 {
        font-size: 2.2rem;
        letter-spacing: -1px;
    }

    .ranking-subtitle {
        font-size: 0.95rem;
    }

    /* Compact status bar on tablet */
    .ranking-status-bar {
        flex-wrap: wrap;
        justify-content: center;
    }

    .ranking-stat-pill {
        padding: 8px 16px;
    }

    .ranking-stat-value {
        font-size: 1.15rem;
    }

    .ranking-stat-label {
        font-size: 0.58rem;
    }

    .ranking-search-toggle {
        padding: 10px 22px;
        font-size: 0.8rem;
    }

    .ranking-search-toggle svg {
        width: 18px;
        height: 18px;
    }

    .ranking-podium {
        grid-template-columns: repeat(3, 1fr);
        gap: 10px;
        margin-bottom: 40px;
    }

    .podium-rank {
        font-size: 1.6rem;
    }

    .podium-album-name {
        font-size: 0.7rem;
    }

    .podium-artist-name {
        font-size: 0.62rem;
    }

    .podium-vote-row {
        gap: 4px;
        padding: 6px 8px 8px;
    }

    .ranking-grid {
        grid-template-columns: repeat(3, 1fr);
        gap: 10px;
    }

    .vote-btn {
        width: 28px;
        height: 28px;
        font-size: 0.9rem;
    }

    .vote-count {
        font-size: 0.9rem;
        min-width: 24px;
    }

    .trend-badge {
        font-size: 0.6rem;
        padding: 1px 4px;
    }
}

@media (max-width: 480px) {
    .album-ranking-page {
        padding: 80px 0 50px;
    }

    .ranking-header-text h1 {
        font-size: 1.8rem;
    }

    .ranking-header-side {
        width: 100%;
    }

    .ranking-stats {
        max-width: 100%;
    }

    .ranking-stat {
        padding: 10px 12px;
    }

    .ranking-stat-value {
        font-size: 1.25rem;
        letter-spacing: -0.5px;
    }

    .ranking-stat-label {
        font-size: 0.55rem;
    }

    .ranking-status-bar {
        flex-direction: column;
        align-items: stretch;
        width: 100%;
    }

    .ranking-status-sep {
        width: auto;
        height: 2px;
    }

    .ranking-stat-pill {
        padding: 9px 16px;
        justify-content: center;
    }

    .ranking-podium {
        grid-template-columns: repeat(2, 1fr);
        gap: 8px;
    }

    .ranking-podium .podium-card:first-child {
        grid-column: span 2;
    }

    .ranking-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 8px;
    }

    .ranking-search-input {
        font-size: 0.95rem;
        padding: 12px 14px;
    }

    .ranking-search-toggle {
        width: 100%;
        justify-content: center;
    }

    .podium-info {
        padding: 8px 8px 4px;
    }

    .podium-vote-row {
        gap: 3px;
        padding: 5px 6px 6px;
    }

    .vote-btn {
        width: 26px;
        height: 26px;
        font-size: 0.85rem;
        border-width: 1.5px;
    }

    .vote-count {
        font-size: 0.8rem;
    }
}
