/**
 * Song History Styles
 * AnowXRadio v1.2.0
 * Uses site's CSS variables for dynamic color theming
 */

/* ========== Section Container ========== */
.song-history-section {
    margin: 25px 0;
    background: var(--bg-card, #1a1a2e);
    border-radius: 16px;
    overflow: hidden;
    border: 1px solid var(--border-color, rgba(255,255,255,0.06));
    transition: all 0.3s ease;
}

/* ========== Header ========== */
.sh-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 20px 24px;
    border-bottom: 1px solid var(--border-color, rgba(255,255,255,0.06));
    background: var(--bg-card-hover, rgba(255,255,255,0.02));
}

.sh-header-left {
    display: flex;
    align-items: center;
    gap: 12px;
}

.sh-header-left i {
    font-size: 20px;
    color: var(--accent-red, #dc143c);
}

.sh-header-left h3 {
    margin: 0;
    font-size: 18px;
    font-weight: 700;
    color: var(--text-primary, #ffffff);
}

.sh-count {
    font-size: 12px;
    color: var(--text-secondary, rgba(255,255,255,0.5));
    background: var(--bg-secondary, rgba(255,255,255,0.05));
    padding: 4px 10px;
    border-radius: 20px;
    font-weight: 500;
}

.sh-header-right {
    display: flex;
    align-items: center;
    gap: 10px;
}

/* ========== Live Indicator ========== */
.sh-live-indicator {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 12px;
    font-weight: 600;
    color: #27ae60;
    background: rgba(39, 174, 96, 0.1);
    padding: 5px 12px;
    border-radius: 20px;
    border: 1px solid rgba(39, 174, 96, 0.2);
}

.sh-live-dot {
    width: 8px;
    height: 8px;
    background: #27ae60;
    border-radius: 50%;
    display: inline-block;
    animation: shLivePulse 1.5s ease-in-out infinite;
}

@keyframes shLivePulse {
    0%, 100% { opacity: 1; transform: scale(1); }
    50% { opacity: 0.5; transform: scale(0.8); }
}

/* ========== Now Playing ========== */
.sh-now-playing {
    display: flex;
    align-items: center;
    gap: 16px;
    padding: 18px 24px;
    background: linear-gradient(135deg, 
        rgba(220, 20, 60, 0.08) 0%, 
        rgba(220, 20, 60, 0.02) 100%
    );
    border-bottom: 1px solid var(--border-color, rgba(255,255,255,0.06));
    position: relative;
    overflow: hidden;
}

.sh-now-playing::before {
    content: '';
    position: absolute;
    left: 0;
    top: 0;
    bottom: 0;
    width: 3px;
    background: var(--accent-red, #dc143c);
}

.sh-np-badge {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: var(--accent-red, #dc143c);
    background: rgba(220, 20, 60, 0.1);
    padding: 6px 12px;
    border-radius: 20px;
    white-space: nowrap;
    flex-shrink: 0;
}

/* Mini Equalizer in Now Playing Badge */
.sh-np-eq {
    display: flex;
    align-items: flex-end;
    gap: 2px;
    height: 14px;
}

.sh-np-eq span {
    width: 3px;
    background: var(--accent-red, #dc143c);
    border-radius: 2px;
    animation: shEqBounce 0.8s ease-in-out infinite;
}

.sh-np-eq span:nth-child(1) { height: 6px; animation-delay: 0s; }
.sh-np-eq span:nth-child(2) { height: 10px; animation-delay: 0.15s; }
.sh-np-eq span:nth-child(3) { height: 4px; animation-delay: 0.3s; }

@keyframes shEqBounce {
    0%, 100% { transform: scaleY(0.5); }
    50% { transform: scaleY(1); }
}

.sh-np-info {
    flex: 1;
    min-width: 0;
}

.sh-np-song {
    font-size: 15px;
    font-weight: 600;
    color: var(--text-primary, #ffffff);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.sh-np-artist {
    color: var(--accent-red, #dc143c);
    font-weight: 700;
}

.sh-np-separator {
    color: var(--text-secondary, rgba(255,255,255,0.3));
    margin: 0 6px;
    font-size: 13px;
}

.sh-np-title {
    color: var(--text-primary, #ffffff);
}

.sh-np-time {
    font-size: 12px;
    color: var(--text-secondary, rgba(255,255,255,0.4));
    margin-top: 3px;
}

/* YouTube Button (Now Playing) */
.sh-youtube-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
    background: rgba(255, 0, 0, 0.1);
    color: #ff0000;
    border-radius: 50%;
    text-decoration: none;
    font-size: 18px;
    flex-shrink: 0;
    transition: all 0.3s ease;
    border: 1px solid rgba(255, 0, 0, 0.2);
}

.sh-youtube-btn:hover {
    background: #ff0000;
    color: #ffffff;
    transform: scale(1.1);
    box-shadow: 0 4px 15px rgba(255, 0, 0, 0.3);
}

/* ========== Song List ========== */
.sh-list {
    max-height: 600px;
    overflow-y: auto;
    scrollbar-width: thin;
    scrollbar-color: var(--accent-red, #dc143c) transparent;
}

.sh-list::-webkit-scrollbar {
    width: 6px;
}

.sh-list::-webkit-scrollbar-track {
    background: transparent;
}

.sh-list::-webkit-scrollbar-thumb {
    background: var(--accent-red, #dc143c);
    border-radius: 3px;
}

/* ========== Song Item ========== */
.sh-item {
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 14px 24px;
    border-bottom: 1px solid var(--border-color, rgba(255,255,255,0.04));
    transition: all 0.2s ease;
    cursor: default;
}

.sh-item:hover {
    background: var(--bg-card-hover, rgba(255,255,255,0.03));
}

.sh-item:last-child {
    border-bottom: none;
}

.sh-item-latest {
    background: rgba(220, 20, 60, 0.03);
}

/* Item Number */
.sh-item-number {
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 12px;
    font-weight: 700;
    color: var(--text-secondary, rgba(255,255,255,0.3));
    background: var(--bg-secondary, rgba(255,255,255,0.05));
    border-radius: 8px;
    flex-shrink: 0;
}

.sh-item-latest .sh-item-number {
    background: rgba(220, 20, 60, 0.15);
    color: var(--accent-red, #dc143c);
}

/* Item Info */
.sh-item-info {
    flex: 1;
    min-width: 0;
}

.sh-item-song {
    font-size: 14px;
    font-weight: 500;
    color: var(--text-primary, #ffffff);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    line-height: 1.4;
}

.sh-item-artist {
    color: var(--accent-red, #dc143c);
    font-weight: 600;
}

.sh-item-separator {
    color: var(--text-secondary, rgba(255,255,255,0.3));
    margin: 0 5px;
    font-size: 12px;
}

.sh-item-title {
    color: var(--text-primary, #ffffff);
    font-weight: 400;
}

.sh-item-time {
    font-size: 11px;
    color: var(--text-secondary, rgba(255,255,255,0.35));
    margin-top: 3px;
    display: flex;
    align-items: center;
    gap: 4px;
}

.sh-item-time i {
    font-size: 10px;
}

/* YouTube Button (List Items) */
.sh-yt-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 34px;
    height: 34px;
    background: rgba(255, 0, 0, 0.08);
    color: rgba(255, 0, 0, 0.6);
    border-radius: 8px;
    text-decoration: none;
    font-size: 15px;
    flex-shrink: 0;
    transition: all 0.3s ease;
    border: 1px solid rgba(255, 0, 0, 0.1);
    opacity: 0;
}

.sh-item:hover .sh-yt-btn {
    opacity: 1;
}

.sh-yt-btn:hover {
    background: #ff0000;
    color: #ffffff;
    transform: scale(1.1);
    border-color: #ff0000;
}

/* ========== Empty State ========== */
.sh-empty {
    padding: 40px 24px;
    text-align: center;
    color: var(--text-secondary, rgba(255,255,255,0.4));
}

.sh-empty i {
    font-size: 48px;
    margin-bottom: 16px;
    opacity: 0.3;
    animation: shDiscSpin 4s linear infinite;
}

@keyframes shDiscSpin {
    from { transform: rotate(0deg); }
    to { transform: rotate(360deg); }
}

.sh-empty p {
    font-size: 14px;
    margin: 0;
    line-height: 1.6;
}

/* ========== Load More ========== */
.sh-load-more {
    padding: 16px 24px;
    text-align: center;
    border-top: 1px solid var(--border-color, rgba(255,255,255,0.06));
}

.sh-load-more-btn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 10px 24px;
    background: var(--bg-secondary, rgba(255,255,255,0.05));
    color: var(--text-primary, #ffffff);
    border: 1px solid var(--border-color, rgba(255,255,255,0.1));
    border-radius: 25px;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    font-family: inherit;
}

.sh-load-more-btn:hover {
    background: var(--accent-red, #dc143c);
    border-color: var(--accent-red, #dc143c);
    color: #ffffff;
    transform: translateY(-2px);
    box-shadow: 0 4px 15px rgba(220, 20, 60, 0.3);
}

.sh-load-more-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    transform: none;
}

.sh-load-more-btn .sh-remaining {
    font-weight: 400;
    opacity: 0.7;
    font-size: 12px;
}

.sh-load-more-btn .fa-spinner {
    animation: spin 1s linear infinite;
}

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

/* ========== Skeleton Loading ========== */
.sh-item-skeleton {
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 14px 24px;
    border-bottom: 1px solid var(--border-color, rgba(255,255,255,0.04));
}

.sh-skeleton-number {
    width: 32px;
    height: 32px;
    background: var(--bg-secondary, rgba(255,255,255,0.05));
    border-radius: 8px;
    animation: shSkeletonPulse 1.5s ease-in-out infinite;
}

.sh-skeleton-info {
    flex: 1;
}

.sh-skeleton-line {
    height: 12px;
    background: var(--bg-secondary, rgba(255,255,255,0.05));
    border-radius: 6px;
    animation: shSkeletonPulse 1.5s ease-in-out infinite;
}

.sh-skeleton-line-short {
    height: 10px;
    width: 100px;
    background: var(--bg-secondary, rgba(255,255,255,0.03));
    border-radius: 6px;
    margin-top: 6px;
    animation: shSkeletonPulse 1.5s ease-in-out infinite;
    animation-delay: 0.2s;
}

.sh-skeleton-btn {
    width: 34px;
    height: 34px;
    background: var(--bg-secondary, rgba(255,255,255,0.05));
    border-radius: 8px;
    animation: shSkeletonPulse 1.5s ease-in-out infinite;
    animation-delay: 0.4s;
}

@keyframes shSkeletonPulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.4; }
}

/* ========== New Song Animation ========== */
.sh-item-new {
    animation: shSlideIn 0.5s ease-out;
}

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

/* ========== Responsive ========== */
@media (max-width: 768px) {
    .sh-header {
        padding: 16px 18px;
    }

    .sh-header-left h3 {
        font-size: 16px;
    }

    .sh-now-playing {
        padding: 14px 18px;
        flex-wrap: wrap;
        gap: 10px;
    }

    .sh-np-badge {
        font-size: 10px;
        padding: 4px 10px;
    }

    .sh-np-song {
        font-size: 14px;
    }

    .sh-item {
        padding: 12px 18px;
        gap: 10px;
    }

    .sh-item-number {
        width: 28px;
        height: 28px;
        font-size: 11px;
    }

    .sh-item-song {
        font-size: 13px;
    }

    .sh-yt-btn {
        opacity: 1;
        width: 30px;
        height: 30px;
        font-size: 13px;
    }

    .sh-youtube-btn {
        width: 36px;
        height: 36px;
        font-size: 16px;
    }

    .sh-load-more-btn {
        font-size: 12px;
        padding: 8px 20px;
    }

    .sh-list {
        max-height: 400px;
    }
}

@media (max-width: 480px) {
    .sh-header {
        padding: 14px 14px;
        flex-direction: column;
        gap: 10px;
        align-items: flex-start;
    }

    .sh-header-right {
        align-self: flex-end;
    }

    .sh-now-playing {
        padding: 12px 14px;
        flex-direction: column;
        align-items: flex-start;
    }

    .sh-youtube-btn {
        align-self: flex-end;
        margin-top: -30px;
    }

    .sh-item {
        padding: 10px 14px;
    }

    .sh-count {
        display: none;
    }

    .sh-list {
        max-height: 350px;
    }
}

/* ========== Light Mode / Dark Mode Adaptations ========== */
body.light-mode .song-history-section,
.light-mode .song-history-section {
    background: #ffffff;
    border-color: rgba(0,0,0,0.08);
}

body.light-mode .sh-header,
.light-mode .sh-header {
    background: rgba(0,0,0,0.02);
    border-bottom-color: rgba(0,0,0,0.06);
}

body.light-mode .sh-header-left h3,
.light-mode .sh-header-left h3 {
    color: #1a1a2e;
}

body.light-mode .sh-count,
.light-mode .sh-count {
    color: #666;
    background: rgba(0,0,0,0.05);
}

body.light-mode .sh-np-song,
.light-mode .sh-np-song {
    color: #1a1a2e;
}

body.light-mode .sh-np-title,
.light-mode .sh-np-title {
    color: #333;
}

body.light-mode .sh-np-separator,
.light-mode .sh-np-separator {
    color: #999;
}

body.light-mode .sh-np-time,
.light-mode .sh-np-time {
    color: #888;
}

body.light-mode .sh-now-playing,
.light-mode .sh-now-playing {
    background: linear-gradient(135deg, rgba(220,20,60,0.04) 0%, rgba(220,20,60,0.01) 100%);
    border-bottom-color: rgba(0,0,0,0.06);
}

body.light-mode .sh-item,
.light-mode .sh-item {
    border-bottom-color: rgba(0,0,0,0.04);
}

body.light-mode .sh-item:hover,
.light-mode .sh-item:hover {
    background: rgba(0,0,0,0.02);
}

body.light-mode .sh-item-number,
.light-mode .sh-item-number {
    color: #999;
    background: rgba(0,0,0,0.04);
}

body.light-mode .sh-item-latest .sh-item-number,
.light-mode .sh-item-latest .sh-item-number {
    background: rgba(220,20,60,0.1);
}

body.light-mode .sh-item-song,
.light-mode .sh-item-song {
    color: #1a1a2e;
}

body.light-mode .sh-item-title,
.light-mode .sh-item-title {
    color: #333;
}

body.light-mode .sh-item-separator,
.light-mode .sh-item-separator {
    color: #ccc;
}

body.light-mode .sh-item-time,
.light-mode .sh-item-time {
    color: #999;
}

body.light-mode .sh-load-more,
.light-mode .sh-load-more {
    border-top-color: rgba(0,0,0,0.06);
}

body.light-mode .sh-load-more-btn,
.light-mode .sh-load-more-btn {
    color: #333;
    background: rgba(0,0,0,0.04);
    border-color: rgba(0,0,0,0.1);
}

body.light-mode .sh-load-more-btn:hover,
.light-mode .sh-load-more-btn:hover {
    background: var(--accent-red, #dc143c);
    color: #fff;
    border-color: var(--accent-red, #dc143c);
}

body.light-mode .sh-empty,
.light-mode .sh-empty {
    color: #999;
}

body.light-mode .sh-yt-btn,
.light-mode .sh-yt-btn {
    background: rgba(255,0,0,0.05);
    border-color: rgba(255,0,0,0.08);
}

body.light-mode .sh-youtube-btn,
.light-mode .sh-youtube-btn {
    background: rgba(255,0,0,0.06);
    border-color: rgba(255,0,0,0.15);
}

body.light-mode .sh-list::-webkit-scrollbar-thumb,
.light-mode .sh-list::-webkit-scrollbar-thumb {
    background: rgba(220,20,60,0.4);
}