/* Аудиоплеер */
.audio-player {
    position: fixed;
    bottom: 0;
    left: 0;
    width: 100%;
    background: rgba(18, 18, 18, 0.98);
    backdrop-filter: blur(10px);
    z-index: 1000;
    border-top: 1px solid rgba(255, 255, 255, 0.1);
    transition: transform 0.3s ease, height 0.3s ease;
    box-shadow: 0px -2px 10px rgba(0, 0, 0, 0.2);
}

[data-theme="light"] .audio-player {
    background: linear-gradient(120deg, #f6f5ee 80%, #b7b08a 100%) !important;
    border-top: 1px solid rgba(35, 60, 43, 0.08) !important;
    box-shadow: 0 -2px 24px 0 var(--sunlight-glow);
}

[data-theme="dark"] .audio-player {
    background: linear-gradient(120deg, #24190f 80%, #4b2e1e 100%) !important;
    border-top: 1px solid rgba(75, 46, 30, 0.18) !important;
    box-shadow: 0 -2px 32px 0 rgba(255,179,71,0.10), 0 -1px 8px 0 #24190f;
}

.audio-player.expanded {
    height: auto;
}

.audio-player.collapsed {
    height: 64px;
    background: rgba(18, 18, 18, 0.95);
}

[data-theme="light"] .audio-player.collapsed {
    background: rgba(255, 255, 255, 0.95);
}

.audio-player.collapsed .player-content {
    max-height: 64px;
}

.audio-player.collapsed .toggle-player {
    transform: rotate(180deg);
}

.player-content {
    padding: 1rem;
    display: flex;
    flex-direction: column;
    gap: 1rem;
    overflow: hidden;
    transition: max-height 0.3s ease;
}

.player-main {
    display: flex;
    align-items: center;
    gap: 1rem;
    width: 100%;
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 1rem;
}

/* Информация о треке */
.track-info {
    display: flex;
    align-items: center;
    gap: 1rem;
    flex: 1;
}

.track-cover-container {
    width: 50px;
    height: 50px;
    border-radius: 6px;
    overflow: hidden;
    position: relative;
    flex-shrink: 0;
    background-color: var(--card-background);
    transition: var(--transition);
}

.track-cover-container:hover {
    transform: scale(1.05);
}

.track-cover-container:hover .cover-overlay {
    opacity: 1;
}

#track-cover {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.3s ease;
}

.cover-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.6);
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    transition: opacity 0.3s ease;
    cursor: pointer;
}

.play-pause-btn {
    background: transparent;
    border: none;
    color: white;
    font-size: 1.2rem;
    cursor: pointer;
    width: 30px;
    height: 30px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: var(--transition);
}

.play-pause-btn:hover {
    transform: scale(1.1);
}

.track-details {
    flex: 1;
}

.track-title, 
.track-artist {
    overflow: hidden;
    white-space: nowrap;
    text-overflow: ellipsis;
}

.track-title {
    font-weight: 600;
    font-size: 0.95rem;
}

.track-artist {
    font-size: 0.8rem;
    opacity: 0.7;
}

/* Контроль плеера */
.player-controls {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    flex: 2;
}

.progress-section {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    width: 100%;
}

.progress-container {
    height: 5px;
    background-color: rgba(255, 255, 255, 0.1);
    border-radius: 5px;
    position: relative;
    cursor: pointer;
    flex: 1;
    display: flex;
    align-items: center;
    padding: 0;
}

[data-theme="light"] .progress-container {
    background-color: rgba(0, 0, 0, 0.1);
}

.progress-bar {
    height: 100%;
    width: 0;
    background: linear-gradient(to right, var(--accent-color), #ff6b6b);
    border-radius: 5px;
    transition: width 0.1s ease-in-out;
    position: relative;
}

.progress-bar:after {
    content: '';
    position: absolute;
    right: 0;
    top: 50%;
    transform: translateY(-50%);
    width: 0px;
    height: 0px;
    border-radius: 50%;
    background-color: white;
    transition: width 0.2s, height 0.2s;
}

.progress-container:hover .progress-bar:after {
    width: 10px;
    height: 10px;
}

.progress-handle {
    position: absolute;
    right: -6px;
    top: 50%;
    transform: translateY(-50%);
    width: 12px;
    height: 12px;
    background-color: white;
    border-radius: 50%;
    box-shadow: 0 0 5px rgba(0, 0, 0, 0.3);
    opacity: 0;
    transition: opacity 0.3s ease;
    pointer-events: none;
    z-index: 2;
}

@media (pointer: coarse) {
    .progress-container {
        height: 10px;
    }
    .progress-handle {
        width: 16px;
        height: 16px;
        right: -8px;
    }
}

.progress-container:hover .progress-handle,
.progress-container:focus .progress-handle {
    opacity: 1;
}

.progress-container:active .progress-handle {
    transform: translateY(-50%) scale(1.2);
}

.time-info {
    font-size: 0.75rem;
    opacity: 0.7;
    min-width: 35px;
    text-align: center;
    position: relative;
}

#current-time, 
#total-time {
    transition: color 0.3s ease;
}

.control-buttons {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 1rem;
}

.control-btn {
    background: transparent;
    border: none;
    color: white;
    font-size: 1.2rem;
    cursor: pointer;
    width: 36px;
    height: 36px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: var(--transition);
}

[data-theme="light"] .control-btn {
    color: var(--text-color);
}

.control-btn:hover {
    background-color: rgba(255, 255, 255, 0.1);
}

.control-btn.play-pause {
    font-size: 1.8rem;
    background-color: var(--accent-color);
}

[data-theme="light"] .control-btn.play-pause {
    color: white;
}

/* Опции плеера */
.player-options {
    display: flex;
    align-items: center;
    flex: 1;
    justify-content: flex-end;
}

.volume-control {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin-right: 1rem;
}

.volume-btn {
    background: transparent;
    border: none;
    color: white;
    font-size: 1.2rem;
    cursor: pointer;
    width: 36px;
    height: 36px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: var(--transition);
}

.volume-btn:hover {
    background-color: rgba(255, 255, 255, 0.1);
}

.volume-slider-container {
    width: 80px;
}

.volume-slider {
    width: 100%;
    height: 5px;
    -webkit-appearance: none;
    background: rgba(255, 255, 255, 0.2);
    border-radius: 5px;
    outline: none;
}

.volume-slider::-webkit-slider-thumb {
    -webkit-appearance: none;
    width: 12px;
    height: 12px;
    border-radius: 50%;
    background: white;
    cursor: pointer;
    transition: var(--transition);
}

.volume-slider::-webkit-slider-thumb:hover {
    transform: scale(1.2);
}

.toggle-player {
    background: transparent;
    border: none;
    color: white;
    font-size: 1.2rem;
    cursor: pointer;
    width: 36px;
    height: 36px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: transform 0.3s ease;
}

.toggle-player:hover {
    background-color: rgba(255, 255, 255, 0.1);
}

.toggle-player i {
    transition: transform 0.3s ease;
}

.audio-player.expanded .toggle-player i {
    transform: rotate(180deg);
}

/* Кнопка плеера и ее поведение */
.player-collapse {
    position: fixed;
    bottom: 64px;
    right: 20px;
    width: auto;
    z-index: 999;
    display: flex;
    justify-content: flex-end;
    transition: bottom 0.5s ease;
}

/* Добавляем класс для управления плавностью анимации */
.player-collapse.transition-active {
    transition: bottom 0.5s ease;
}

.collapse-btn {
    background: var(--accent-color);
    color: white;
    border: none;
    border-radius: 20px 20px 0 0;
    padding: 8px 20px;
    font-size: 0.8rem;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 5px;
    box-shadow: 0 -2px 10px rgba(0, 0, 0, 0.2);
    transition: var(--transition), transform 0.5s ease;
}

[data-theme="light"] .collapse-btn {
    background: var(--accent-color);
    color: white;
    box-shadow: 0 -2px 10px rgba(0, 0, 0, 0.1);
}

.collapse-btn:hover {
    transform: translateY(-3px);
}

[data-theme="light"] .collapse-btn:hover {
    transform: translateY(-3px);
}

.collapse-text {
    margin-right: 5px;
}

/* Явно поднимаем кнопку вместе с плеером */
.audio-player.expanded + .player-collapse {
    bottom: 180px !important;
}

/* Управление иконками для состояний */
.audio-player.expanded + .player-collapse .collapse-btn i {
    transform: rotate(180deg);
}

.audio-player.collapsed + .player-collapse .collapse-btn i {
    transform: rotate(0deg);
}

/* Добавляем визуальную подсказку для свайпа на мобильных */
.swipe-hint {
    display: none;
    position: absolute;
    top: -24px;
    left: 50%;
    transform: translateX(-50%);
    color: white;
    font-size: 0.75rem;
    background-color: rgba(0, 0, 0, 0.6);
    padding: 3px 8px;
    border-radius: 12px;
    white-space: nowrap;
    animation: fadeInOut 2s ease-in-out infinite;
}

@keyframes fadeInOut {
    0%, 100% { opacity: 0.7; }
    50% { opacity: 1; }
}

/* Медиа-запросы для плеера */
@media (max-width: 768px) {
    /* Устанавливаем фиксированную высоту для развернутого плеера - 2/3 экрана */
    .audio-player.expanded {
        height: 66vh !important;
        overflow-y: hidden;
        display: flex;
        flex-direction: column;
        /* Увеличиваем отступ снизу для навигационных кнопок Android */
        padding-bottom: 80px;
        /* Убираем отступ сверху полностью */
        padding-top: 0;
        /* Сдвигаем весь контент вверх */
        margin-top: -30px;
    }
    
    .audio-player.expanded .container,
    .audio-player.expanded .player-content {
        flex: 1;
        display: flex;
        flex-direction: column;
        height: 100%;
        /* Сдвигаем контент выше */
        padding-top: 0;
        /* Перераспределяем элементы равномерно по вертикали */
        justify-content: space-between;
    }
    
    /* Оптимизируем размер обложки под 2/3 экрана */
    .audio-player.expanded .track-cover-container {
        width: 70%;
        height: auto;
        aspect-ratio: 1/1;
        margin: 10px auto 8px;
        border-radius: 8px;
        max-width: 240px;
    }
    
    /* Упорядочиваем элементы в колонку с правильным расположением */
    .player-main {
        flex-direction: column;
        gap: 5px;
        height: 100%;
        padding-bottom: 0;
        padding-top: 0;
        justify-content: flex-start;
    }
    
    /* Центрируем информацию о треке */
    .track-info {
        flex-direction: column;
        justify-content: flex-start;
        align-items: center;
        width: 100%;
        order: 1;
        margin-bottom: 0;
    }
    
    /* Стилизуем текстовые блоки с уменьшенными отступами */
    .track-details {
        margin-top: 3px;
        margin-bottom: 5px;
        width: 100%;
        text-align: center;
    }
    
    .track-title {
        font-size: 0.95rem;
        font-weight: 700;
        margin-bottom: 2px;
    }
    
    .track-artist {
        font-size: 0.85rem;
        margin-bottom: 0;
        opacity: 0.85;
    }
    
    .track-remix {
        display: block !important;
        font-size: 0.75rem;
        opacity: 0.75;
        margin-top: 1px;
    }
    
    /* Настраиваем элементы управления, поднимая их выше */
    .player-controls {
        width: 100%;
        margin-top: 0;
        padding: 0 0.5rem 0;
        order: 2;
    }
    
    /* Уменьшаем отступы прогресс-бара */
    .progress-section {
        margin-bottom: 10px;
        margin-top: 5px;
    }
    
    .progress-container {
        height: 5px;
    }
    
    /* Настраиваем время */
    .time-info {
        font-size: 0.7rem;
        opacity: 0.8;
    }
    
    /* Увеличиваем отступ снизу для кнопок */
    .control-buttons {
        justify-content: center;
        gap: 2.5rem;
        margin-top: 5px;
        /* Поднимаем кнопки управления выше от края экрана */
        margin-bottom: 40px;
    }
    
    .control-btn {
        width: 42px;
        height: 42px;
    }

    .control-btn.play-pause {
        width: 52px;
        height: 52px;
        font-size: 1.5rem;
    }
    
    /* Скрываем опции громкости на мобильном */
    .player-options {
        display: none;
    }
    
    .audio-player.collapsed {
        height: 60px;
    }
    
    /* Строго скрываем кнопку на мобильных устройствах */
    .player-collapse {
        display: none !important;
        visibility: hidden !important;
        opacity: 0 !important;
        pointer-events: none !important;
    }
    
    /* Убираем полоску-индикатор для мобильных устройств */
    .audio-player:after {
        display: none !important;
    }
    
    [data-theme="light"] .audio-player:after {
        display: none !important;
    }
}

@media (max-height: 500px) {
    .audio-player .player-main {
        flex-direction: row;
        padding: 5px 10px;
        gap: 10px;
        align-items: center;
        justify-content: space-between;
    }

    .track-info {
        display: flex;
        flex-direction: row;
        align-items: center;
        gap: 10px;
        flex: 0 0 auto;
        width: auto;
        max-width: 50%;
    }

    .track-cover-container {
        width: 50px;
        height: 50px;
        border-radius: 4px;
        flex-shrink: 0;
    }

    .track-details {
        flex: 1;
        min-width: 50px;
    }

    .track-title {
        font-size: 0.8rem;
        white-space: nowrap;
        overflow: hidden;
        text-overflow: ellipsis;
    }

    .track-artist {
        font-size: 0.7rem;
        white-space: nowrap;
        overflow: hidden;
        text-overflow: ellipsis;
    }
    
    .track-remix {
        display: inline-block !important;
        font-size: 0.7rem;
        font-style: italic;
        opacity: 0.75;
    }

    .player-controls {
        flex-direction: row;
        align-items: center;
        gap: 10px;
        flex: 1;
        display: flex !important;
    }

    .progress-section {
        margin: 0;
        flex: 1;
        display: flex !important;
    }

    .control-buttons {
        display: flex !important;
        gap: 10px;
        margin: 0;
    }

    .control-btn {
        width: 32px;
        height: 32px;
        font-size: 0.9rem;
        display: flex !important;
        visibility: visible !important;
        opacity: 1 !important;
    }

    .control-btn.play-pause {
        width: 38px;
        height: 38px;
    }

    .time-info {
        display: block !important;
        visibility: visible !important;
        opacity: 1 !important;
        min-width: 50px;
    }

    .audio-player.collapsed {
        height: 60px;
    }
}

[data-theme="light"] .player-content,
[data-theme="light"] .player-main,
[data-theme="light"] .track-title,
[data-theme="light"] .track-artist,
[data-theme="light"] .time-info,
[data-theme="light"] .player-options {
    color: var(--text-color) !important;
} 