/* Playlist page styles */
.playlist-header {
    display: flex !important;
    align-items: flex-start !important;
    gap: 15px;
    margin-bottom: 20px;
    padding: 15px;
    background: var(--card-bg, #fff);
    border-radius: 8px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}
.playlist-station-info {
    display: flex;
    flex-direction: column;
    align-items: flex-start !important;
    justify-content: flex-start;
}
.playlist-logo {
    width: 80px;
    height: 80px;
    border-radius: 8px;
    object-fit: cover;
}
.playlist-station-info h1 {
    font-size: 1.4rem;
    margin: 0 0 10px 0;
}
.playlist-station-link {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 8px 16px;
    background: #28a745;
    color: #fff !important;
    text-decoration: none;
    border-radius: 20px;
    font-size: 0.9rem;
    font-weight: 500;
    transition: all 0.2s;
}
.playlist-station-link:hover {
    background: #218838;
    color: #fff;
    text-decoration: none;
    transform: translateY(-1px);
}
.playlist-header-links {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
}
.playlist-all-link {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 8px 16px;
    background: #5c9edd;
    color: #fff !important;
    text-decoration: none;
    border-radius: 20px;
    font-size: 0.9rem;
    font-weight: 500;
    transition: all 0.2s;
}
.playlist-all-link:hover {
    background: #4a8dd0;
    color: #fff;
    text-decoration: none;
    transform: translateY(-1px);
}

/* Date navigation */
.playlist-dates {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
    margin-bottom: 20px;
    padding: 10px;
    background: var(--card-bg, #fff);
    border-radius: 8px;
}
.date-link {
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 8px 12px;
    border-radius: 6px;
    text-decoration: none;
    color: var(--text-color, #333);
    background: var(--bg-secondary, #f5f5f5);
    transition: all 0.2s;
    min-width: 60px;
}
.date-link:hover {
    background: #e9e9e9;
    text-decoration: none;
}
.date-link.active {
    background: #4a90d9;
    color: #fff;
}
.date-link.no-data {
    opacity: 0.5;
    pointer-events: none;
}
.date-link .day-name {
    font-size: 0.75rem;
    opacity: 0.8;
}
.date-link .day-num {
    font-weight: bold;
    font-size: 0.9rem;
}

/* Track list */
.playlist-info {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 15px;
    padding: 10px 15px;
    background: var(--card-bg, #fff);
    border-radius: 8px;
}
.playlist-date {
    font-size: 1.1rem;
    font-weight: 600;
}
.track-count {
    color: var(--text-muted, #666);
    font-size: 0.9rem;
}

.playlist-tracks {
    list-style: none;
    padding: 0;
    margin: 0;
}
.track-item {
    display: flex;
    align-items: center;
    gap: 15px;
    padding: 12px 15px;
    background: var(--card-bg, #fff);
    border-bottom: 1px solid var(--border-color, #eee);
    transition: background 0.2s;
}
.track-item:first-child {
    border-radius: 8px 8px 0 0;
}
.track-item:last-child {
    border-radius: 0 0 8px 8px;
    border-bottom: none;
}
.track-item:only-child {
    border-radius: 8px;
}
.track-item:hover {
    background: var(--bg-hover, #f9f9f9);
}

.track-time {
    flex-shrink: 0;
    width: 50px;
    font-family: monospace;
    font-size: 0.9rem;
    color: var(--text-muted, #666);
}
.track-cover {
    width: 40px;
    height: 40px;
    border-radius: 4px;
    object-fit: cover;
    flex-shrink: 0;
}
.track-cover-placeholder {
    width: 40px;
    height: 40px;
    border-radius: 4px;
    background: var(--bg-secondary, #f0f0f0);
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--text-muted, #999);
    flex-shrink: 0;
}
.track-name {
    flex: 1;
    font-size: 0.95rem;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.track-links {
    display: flex;
    gap: 6px;
    flex-shrink: 0;
}
.track-link {
    width: 28px;
    height: 28px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #fff;
    border-radius: 50%;
    text-decoration: none;
    font-size: 0.75rem;
    transition: transform 0.2s, opacity 0.2s;
    opacity: 0.8;
}
.track-link:hover {
    transform: scale(1.1);
    opacity: 1;
    color: #fff;
    text-decoration: none;
}
.track-link.yt { background: #ff0000; }
.track-link.vk { background: #0077ff; }
.track-link.ya { background: #ffcc00; color: #000; }
.track-link.ya:hover { color: #000; }

/* Mobile: More button with popup */
.track-more-btn {
    display: none; /* Hidden on desktop */
    position: relative;
    width: 32px;
    height: 32px;
    border: none;
    border-radius: 50%;
    background: var(--bg-secondary, #f0f0f0);
    color: var(--text-muted, #666);
    cursor: pointer;
    flex-shrink: 0;
    transition: background 0.2s;
}
.track-more-btn:hover {
    background: #e0e0e0;
}
.track-more-btn:focus {
    outline: none;
}
.track-popup {
    display: none;
    position: absolute;
    right: 0;
    top: 50%;
    transform: translateY(-50%) translateX(-40px);
    background: var(--card-bg, #fff);
    border-radius: 20px;
    padding: 6px 10px;
    box-shadow: 0 3px 12px rgba(0,0,0,0.2);
    gap: 6px;
    z-index: 50;
    white-space: nowrap;
}
.track-more-btn.active .track-popup {
    display: flex;
}
.track-popup .track-link {
    width: 32px;
    height: 32px;
    font-size: 0.85rem;
}
.dark-theme .track-more-btn {
    background: #444;
    color: #aaa;
}
.dark-theme .track-more-btn:hover {
    background: #555;
}
.dark-theme .track-popup {
    background: #333;
    box-shadow: 0 3px 12px rgba(0,0,0,0.4);
}

.playlist-empty {
    text-align: center;
    padding: 40px 20px;
    background: var(--card-bg, #fff);
    border-radius: 8px;
    color: var(--text-muted, #666);
}
.playlist-empty i {
    font-size: 3rem;
    margin-bottom: 15px;
    opacity: 0.5;
}

/* SEO Description */
.playlist-description {
    padding: 15px 20px;
    margin-bottom: 20px;
    background: var(--card-bg, #fff);
    border-radius: 8px;
    font-size: 0.95rem;
    line-height: 1.6;
    color: var(--text-color, #555);
}
.playlist-description p {
    margin: 0;
}

/* Time Filter Buttons */
.playlist-time-filter {
    display: flex;
    gap: 8px;
    margin-bottom: 15px;
}
.time-filter-btn {
    padding: 8px 16px;
    border: none;
    border-radius: 20px;
    background: var(--bg-secondary, #f0f0f0);
    color: var(--text-color, #333);
    cursor: pointer;
    font-size: 0.9rem;
    transition: all 0.2s;
    display: flex;
    align-items: center;
    gap: 6px;
    outline: none;
}
.time-filter-btn:hover {
    background: #e0e0e0;
}
.time-filter-btn:focus {
    outline: none;
}
.time-filter-btn.active {
    background: #4a90d9;
    color: #fff;
}
.time-filter-btn .count {
    background: rgba(255,255,255,0.2);
    padding: 2px 8px;
    border-radius: 10px;
    font-size: 0.8rem;
}
.time-filter-btn.active .count {
    background: rgba(255,255,255,0.3);
}
.time-filter-btn.refresh-btn {
    margin-left: auto;
    background: #28a745;
    color: #fff;
}
.time-filter-btn.refresh-btn:hover {
    background: #218838;
}
.time-filter-btn.refresh-btn.loading i {
    animation: spin 1s linear infinite;
}
@keyframes spin {
    from { transform: rotate(0deg); }
    to { transform: rotate(360deg); }
}

/* Hour Navigation & Search Panel */
.playlist-nav-panel {
    position: -webkit-sticky; /* Safari */
    position: sticky;
    top: 56px; /* Below site header */
    z-index: 100;
    background: var(--card-bg, #fff);
    padding: 12px 15px;
    margin-bottom: 15px;
    border-radius: 8px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
    display: flex;
    flex-direction: column;
    gap: 10px;
}
.playlist-search-box {
    display: flex;
    align-items: center;
    gap: 10px;
    background: var(--bg-secondary, #f5f5f5);
    border-radius: 20px;
    padding: 8px 15px;
}
.playlist-search-box i.fa-search {
    color: var(--text-muted, #888);
    font-size: 0.9rem;
}
.playlist-search-box input {
    flex: 1;
    border: none;
    background: transparent;
    font-size: 0.95rem;
    color: var(--text-color, #333);
    outline: none;
    min-width: 0;
}
.playlist-search-box input:focus {
    outline: none;
}
.playlist-search-box input::placeholder {
    color: var(--text-muted, #999);
}
.search-clear {
    background: none;
    border: none;
    color: var(--text-muted, #888);
    cursor: pointer;
    padding: 4px;
    font-size: 0.85rem;
    opacity: 0.7;
    transition: opacity 0.2s;
    outline: none;
}
.search-clear:hover {
    opacity: 1;
}
.search-clear:focus {
    outline: none;
}
.search-results {
    font-size: 0.8rem;
    color: var(--text-muted, #888);
    white-space: nowrap;
}
.playlist-hours-nav {
    display: flex;
    flex-wrap: wrap;
    gap: 4px;
    justify-content: center;
    align-items: center;
}
.hours-label {
    color: var(--text-muted, #888);
    font-size: 0.9rem;
    margin-right: 6px;
    display: flex;
    align-items: center;
    gap: 4px;
}
.hour-btn {
    min-width: 32px;
    height: 28px;
    padding: 0 6px;
    border: none;
    border-radius: 4px;
    background: var(--bg-secondary, #f0f0f0);
    color: var(--text-color, #333);
    font-size: 0.8rem;
    font-family: monospace;
    cursor: pointer;
    transition: all 0.15s;
    outline: none;
}
.hour-btn:focus {
    outline: none;
}
.hour-btn:hover:not(.no-data):not(.active) {
    background: #d0d0d0;
}
.hour-btn.active {
    background: #4a90d9;
    color: #fff;
}
.hour-btn.no-data {
    opacity: 0.35;
    cursor: default;
}

/* Hour Anchors (invisible markers) */
.hour-anchor {
    height: 0;
    margin: 0;
    padding: 0;
    border: none;
    list-style: none;
}

/* Time Period Headers */
.time-period-header {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 12px 15px;
    margin-top: 15px;
    background: linear-gradient(90deg, var(--card-bg, #fff), transparent);
    border-radius: 8px 8px 0 0;
    font-weight: 600;
    font-size: 0.95rem;
    color: var(--text-color, #555);
}
.time-period-header:first-child {
    margin-top: 0;
}
.time-period-header.night {
    background: linear-gradient(90deg, rgba(63, 81, 181, 0.15), transparent);
    color: #5c6bc0;
}
.time-period-header.day {
    background: linear-gradient(90deg, rgba(255, 193, 7, 0.15), transparent);
    color: #f9a825;
}
.time-period-header i {
    font-size: 1.1rem;
}

/* Hidden tracks for filtering */
.track-item.hidden,
.time-period-header.hidden {
    display: none;
}

/* Adjust borders after headers */
.time-period-header + .track-item {
    border-radius: 0;
}
.time-period-header + .track-item:last-child {
    border-radius: 0 0 8px 8px;
}

/* Dark theme adjustments */
.dark-theme .playlist-header,
.dark-theme .playlist-dates,
.dark-theme .playlist-info,
.dark-theme .track-item,
.dark-theme .playlist-empty {
    background: #2a2a2a;
}
.dark-theme .date-link {
    background: #333;
    color: #e0e0e0;
}
.dark-theme .date-link:hover {
    background: #444;
}
.dark-theme .date-link.active {
    background: #555;
    color: #fff;
}
.dark-theme .track-item {
    border-color: #444;
}
.dark-theme .track-item:hover {
    background: #333;
}
.dark-theme .track-cover-placeholder {
    background: #444;
    color: #888;
}
.dark-theme .breadcrumb {
    background: #2a2a2a;
}
.dark-theme .breadcrumb-item a {
    color: #e0e0e0;
}
.dark-theme .breadcrumb-item.active {
    color: #a0a0a0;
}
.dark-theme .breadcrumb-item + .breadcrumb-item::before {
    color: #666;
}
.dark-theme .playlist-description {
    background: #2a2a2a;
    border-left-color: #28a745;
    color: #b0b0b0;
}
.dark-theme .time-filter-btn {
    background: #333;
    color: #e0e0e0;
}
.dark-theme .time-filter-btn:hover {
    background: #444;
}
.dark-theme .time-filter-btn.active {
    background: #555;
    color: #fff;
}
.dark-theme .time-period-header {
    background: linear-gradient(90deg, #2a2a2a, transparent);
    color: #e0e0e0;
}
.dark-theme .time-period-header.night {
    background: linear-gradient(90deg, rgba(92, 107, 192, 0.2), transparent);
    color: #7986cb;
}
.dark-theme .time-period-header.day {
    background: linear-gradient(90deg, rgba(255, 193, 7, 0.15), transparent);
    color: #ffc107;
}
.dark-theme .time-filter-btn.refresh-btn {
    background: #28a745;
    color: #fff;
}
.dark-theme .time-filter-btn.refresh-btn:hover {
    background: #218838;
}
.dark-theme .playlist-all-link {
    background: #6c757d;
}
.dark-theme .playlist-all-link:hover {
    background: #5a6268;
}
.dark-theme .playlist-nav-panel {
    background: #2a2a2a;
    box-shadow: 0 2px 8px rgba(0,0,0,0.3);
}
.dark-theme .playlist-search-box {
    background: #333;
}
.dark-theme .playlist-search-box input {
    color: #e0e0e0;
}
.dark-theme .playlist-search-box input::placeholder {
    color: #888;
}
.dark-theme .hour-btn {
    background: #333;
    color: #e0e0e0;
}
.dark-theme .hour-btn:hover:not(.no-data):not(.active) {
    background: #444;
}
.dark-theme .hour-btn.active {
    background: #4a90d9;
    color: #fff;
}
.dark-theme .hours-label {
    color: #888;
}

/* Tablet: Horizontal swipe for long track names */
@media (max-width: 768px) {
    .track-name {
        overflow-x: auto;
        overflow-y: hidden;
        text-overflow: clip;
        white-space: nowrap;
        -webkit-overflow-scrolling: touch;
        scrollbar-width: none;
        -ms-overflow-style: none;
        mask-image: linear-gradient(to right, black 85%, transparent 100%);
        -webkit-mask-image: linear-gradient(to right, black 85%, transparent 100%);
        padding-right: 10px;
    }
    .track-name::-webkit-scrollbar {
        display: none;
    }
    .track-name.scrolled,
    .track-name.no-overflow {
        mask-image: none;
        -webkit-mask-image: none;
    }
}

@media (max-width: 576px) {
    /* Compact header - keep horizontal layout */
    .playlist-header {
        flex-direction: row;
        align-items: center !important;
        padding: 12px;
        gap: 12px;
    }
    .playlist-logo {
        width: 50px;
        height: 50px;
    }
    .playlist-station-info h1 {
        font-size: 1rem;
        margin-bottom: 6px;
    }
    .playlist-station-info h1 i {
        display: none;
    }
    .playlist-header-links {
        gap: 6px;
    }
    .playlist-station-link,
    .playlist-all-link {
        padding: 5px 10px;
        font-size: 0.75rem;
    }

    /* Compact time filter buttons */
    .playlist-time-filter {
        flex-wrap: wrap;
        gap: 6px;
    }
    .time-filter-btn {
        padding: 6px 10px;
        font-size: 0.8rem;
        gap: 4px;
    }
    .time-filter-btn .count {
        padding: 1px 5px;
        font-size: 0.7rem;
    }
    .time-filter-btn.refresh-btn {
        margin-left: 0;
    }
    /* Hide text on very small screens, show only icons */
    .time-filter-btn span:not(.count) {
        display: none;
    }

    /* Compact playlist info */
    .playlist-info {
        flex-direction: column;
        gap: 5px;
        align-items: flex-start;
        padding: 8px 12px;
    }
    .playlist-date {
        font-size: 0.95rem;
    }

    /* Date navigation */
    .playlist-dates {
        justify-content: flex-start;
        overflow-x: auto;
        flex-wrap: nowrap;
        padding: 8px;
        -webkit-overflow-scrolling: touch;
    }
    .date-link {
        min-width: 50px;
        padding: 6px 8px;
        flex-shrink: 0;
    }
    .date-link .day-name {
        font-size: 0.65rem;
    }
    .date-link .day-num {
        font-size: 0.8rem;
    }

    /* Track items */
    .track-item {
        gap: 8px;
        padding: 8px 10px;
    }
    .track-time {
        width: 40px;
        font-size: 0.8rem;
    }
    .track-cover, .track-cover-placeholder {
        width: 32px;
        height: 32px;
    }
    .track-name {
        font-size: 0.85rem;
    }
    /* Hide inline links, show more button on mobile */
    .track-links {
        display: none;
    }
    .track-more-btn {
        display: flex;
        align-items: center;
        justify-content: center;
    }

    /* Mobile nav panel */
    .playlist-nav-panel {
        position: sticky;
        position: -webkit-sticky; /* Safari */
        top: 50px; /* Mobile header height */
        padding: 10px;
        margin-left: -15px;
        margin-right: -15px;
        width: calc(100% + 30px);
        border-radius: 0;
        z-index: 100;
    }
    .playlist-search-box {
        padding: 6px 12px;
    }
    .playlist-hours-nav {
        gap: 3px;
    }
    .hours-label {
        font-size: 0.8rem;
        margin-right: 4px;
    }
    .hour-btn {
        min-width: 26px;
        height: 24px;
        font-size: 0.7rem;
        padding: 0 4px;
    }

    /* Description */
    .playlist-description {
        padding: 10px 12px;
        font-size: 0.85rem;
    }
}

/* Scroll to Top Button */
.scroll-top-btn {
    position: fixed;
    bottom: 100px;
    right: 20px;
    width: 44px;
    height: 44px;
    border: none;
    border-radius: 50%;
    background: #4a90d9;
    color: #fff;
    font-size: 1.1rem;
    cursor: pointer;
    box-shadow: 0 2px 8px rgba(0,0,0,0.2);
    opacity: 0;
    visibility: hidden;
    transform: translateY(20px);
    transition: all 0.3s ease;
    z-index: 99;
}
.scroll-top-btn.visible {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}
.scroll-top-btn:hover {
    background: #3a7bc8;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0,0,0,0.25);
}
.scroll-top-btn:active {
    transform: translateY(0);
}
.scroll-top-btn:focus {
    outline: none;
}
.dark-theme .scroll-top-btn {
    background: #5a9ae0;
}
.dark-theme .scroll-top-btn:hover {
    background: #4a8ad0;
}

/* Extra small screens */
@media (max-width: 380px) {
    .playlist-header {
        padding: 10px;
        gap: 10px;
    }
    .playlist-logo {
        width: 40px;
        height: 40px;
    }
    .playlist-station-info h1 {
        font-size: 0.9rem;
    }
    .playlist-station-link,
    .playlist-all-link {
        padding: 4px 8px;
        font-size: 0.7rem;
    }
    .hour-btn {
        min-width: 24px;
        height: 22px;
        font-size: 0.65rem;
    }
}