/* ===================================== */
/*              HISTORY PAGE             */
/* ===================================== */

.history-page {
    padding: 20px 40px 100px 40px !important;
    max-width: 1200px !important;
    margin: 0 auto !important;
    animation: fadeIn 0.4s ease;
    width: 100% !important;
    box-sizing: border-box !important;
    position: relative !important;
    z-index: 1 !important;
}

/* Шапка */
.history-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 40px;
    padding: 0 20px;
    flex-wrap: wrap;
    gap: 20px;
}

.history-title {
    font-size: 32px;
    font-weight: 900;
    margin: 0;
    background: linear-gradient(135deg, #fff, var(--accent));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.history-stats {
    display: flex;
    gap: 30px;
}

.history-stat {
    display: flex;
    flex-direction: column;
    align-items: center;
}

.stat-number {
    font-size: 24px;
    font-weight: 700;
    color: var(--accent);
    line-height: 1.2;
}

.stat-label {
    font-size: 12px;
    color: var(--text-dim);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.history-clear-btn {
    background: rgba(255, 75, 75, 0.1);
    border: 1px solid rgba(255, 75, 75, 0.3);
    color: #ff6b6b;
    padding: 8px 16px;
    border-radius: 30px;
    cursor: pointer;
    font-size: 13px;
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 8px;
    transition: all 0.2s ease;
}

.history-clear-btn:hover {
    background: rgba(255, 75, 75, 0.2);
    border-color: #ff6b6b;
    transform: translateY(-2px);
}

/* Пустое состояние */
.history-empty-state {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 80px 20px;
    text-align: center;
    animation: fadeInUp 0.5s ease;
}

.history-empty-icon {
    font-size: 80px;
    margin-bottom: 20px;
    opacity: 0.5;
}

.history-empty-state h2 {
    font-size: 24px;
    margin: 0 0 10px 0;
    color: #fff;
}

.history-empty-state p {
    color: var(--text-dim);
    margin: 0 0 30px 0;
    font-size: 14px;
}

.history-empty-state .play-all-btn {
    background: var(--accent);
    color: #000;
    border: none;
    padding: 12px 30px;
    border-radius: 30px;
    font-weight: 700;
    cursor: pointer;
    transition: all 0.2s ease;
    display: inline-flex;
    align-items: center;
    gap: 10px;
}

.history-empty-state .play-all-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(255,204,0,0.3);
}

/* Временная шкала */
.history-timeline {
    display: flex;
    flex-direction: column;
    gap: 40px;
    width: 100%;
}

/* Группа по дате */
.history-date-group {
    /* Своё имя, а не slideUp: под этим именем в проекте пять разных
       @keyframes (в player-volume.css и expanded.css он с translateX(-50%)),
       а имена в CSS глобальны — побеждает последнее определение. Из-за этого
       группы истории уезжали влево на половину ширины, и строки выглядели
       пустыми: обложка, название и исполнитель оказывались за краем экрана. */
    animation: historySlideUp 0.4s ease;
    animation-fill-mode: both;
    width: 100%;
}

.history-date-group:nth-child(1) { animation-delay: 0.1s; }
.history-date-group:nth-child(2) { animation-delay: 0.15s; }
.history-date-group:nth-child(3) { animation-delay: 0.2s; }
.history-date-group:nth-child(4) { animation-delay: 0.25s; }
.history-date-group:nth-child(5) { animation-delay: 0.3s; }
.history-date-group:nth-child(6) { animation-delay: 0.35s; }
.history-date-group:nth-child(7) { animation-delay: 0.4s; }
.history-date-group:nth-child(8) { animation-delay: 0.45s; }
.history-date-group:nth-child(9) { animation-delay: 0.5s; }
.history-date-group:nth-child(10) { animation-delay: 0.55s; }

.history-date-header {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    margin-bottom: 20px;
    padding: 0 20px;
}

.history-date-title {
    font-size: 18px;
    font-weight: 600;
    color: var(--accent);
    text-transform: uppercase;
    letter-spacing: 1px;
    margin: 0;
}

.history-date-count {
    font-size: 13px;
    color: var(--text-dim);
    background: rgba(255,255,255,0.05);
    padding: 4px 12px;
    border-radius: 30px;
}

/* Список треков */
.history-tracks-list {
    display: flex;
    flex-direction: column;
    gap: 2px;
    background: rgba(255,255,255,0.02);
    border-radius: 20px;
    overflow: hidden;
    border: 1px solid rgba(255,255,255,0.03);
    width: 100%;
}

/* Карточка трека */
.history-track-card {
    display: flex;
    align-items: center;
    gap: 16px;
    padding: 12px 20px;
    background: rgba(255,255,255,0.02);
    cursor: pointer;
    transition: all 0.2s ease;
    border-bottom: 1px solid rgba(255,255,255,0.03);
    width: 100%;
    box-sizing: border-box;
}

.history-track-card:hover {
    background: rgba(255,204,0,0.05);
    transform: translateX(5px);
}

.history-track-card.active {
    background: rgba(255,204,0,0.1);
    border-left: 4px solid var(--accent);
}

/* Скругления для первой/последней карточки */
.history-track-card.first {
    border-top-left-radius: 20px;
    border-top-right-radius: 20px;
}

.history-track-card.last {
    border-bottom-left-radius: 20px;
    border-bottom-right-radius: 20px;
    border-bottom: none;
}

.history-track-card.single {
    border-radius: 20px;
}

/* Обложка */
.history-track-cover {
    width: 60px;
    height: 60px;
    border-radius: 12px;
    overflow: hidden;
    position: relative;
    flex-shrink: 0;
    box-shadow: 0 4px 10px rgba(0,0,0,0.3);
}

.history-track-cover img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.3s ease;
}

.history-track-card:hover .history-track-cover img {
    transform: scale(1.05);
}

.history-play-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0,0,0,0.4);
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    transition: opacity 0.2s ease;
}

.history-track-card:hover .history-play-overlay {
    opacity: 1;
}

.play-icon {
    font-size: 20px;
    color: white;
    text-shadow: 0 2px 5px rgba(0,0,0,0.5);
}

/* Информация о треке */
.history-track-info {
    flex: 1;
    min-width: 0;
}

.history-track-title-row {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 4px;
    flex-wrap: wrap;
}

.history-track-title {
    font-size: 16px;
    font-weight: 600;
    color: #fff;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 300px;
}

.history-track-badge {
    background: var(--accent);
    color: #000;
    font-size: 10px;
    font-weight: 700;
    padding: 2px 8px;
    border-radius: 20px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.history-track-artist {
    font-size: 13px;
    color: var(--text-dim);
    margin-bottom: 4px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.history-track-meta {
    display: flex;
    gap: 16px;
    font-size: 11px;
    color: var(--text-dim);
}

.history-track-time,
.history-track-plays {
    display: flex;
    align-items: center;
    gap: 4px;
}

.meta-icon {
    font-size: 10px;
    opacity: 0.7;
}

/* Правая часть */
.history-track-right {
    display: flex;
    align-items: center;
    gap: 20px;
    flex-shrink: 0;
}

.history-track-listen-time {
    display: flex;
    align-items: center;
    gap: 6px;
    background: rgba(255,255,255,0.05);
    padding: 6px 12px;
    border-radius: 30px;
    font-size: 12px;
    color: var(--text-dim);
    border: 1px solid rgba(255,255,255,0.05);
}

.time-icon {
    font-size: 11px;
}

.time-value {
    font-family: monospace;
    font-weight: 600;
    color: var(--accent);
}

.history-track-actions {
    display: flex;
    justify-content: flex-end;
    flex-shrink: 0;
    width: auto;
    min-width: 0;
}

.history-track-actions .track-menu-container {
    width: auto !important;
    min-width: 0 !important;
    max-width: none !important;
}

.history-track-actions .track-menu-btn {
    width: 28px !important;
    min-width: 28px !important;
    margin: 0 auto;
}

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