:root {
    --primary-color: #bfb8f5;
    --primary-dark: #43379e;
    --secondary-color: #a29bfe;
    --dark-color: #454c96;
    --darker-color: #16213e;

    --light-color: #f5f6fa;
    --accent-color: #fd79a8;
    --success-color: #42ffe9;
    --warning-color: #fcdc9f;
    --error-color: #f50029;
    --text-primary: #ffffff;
    --text-secondary: rgba(255, 255, 255, 0.7);
    --card-bg: rgba(30, 30, 60, 0.7);
    --card-shadow: 0 10px 30px rgba(0, 0, 0, 0.5);
    --border-radius: 15px;
    --transition: all 0.5s cubic-bezier(0.25, 0.8, 0.25, 1);
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html {
    scroll-behavior: smooth;
    height: 100%;
}

body {
    font-family: 'Montserrat', sans-serif;
    min-height: 100vh;
    line-height: 1.1;
    padding: 2px;
    overflow-x: hidden;
    display: flex;
    flex-direction: column;
}

.audio-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0,0,0,0.7);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 1000;
}

.player-container {
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    padding: 1rem !important;
    gap: 1rem;
}

.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 0px;
    flex: 1;
    display: flex;
    flex-direction: column;
}

/* Шапка */
header {
    text-align: center;
    margin-bottom: 2rem;
    animation: fadeIn 0.8s ease;
}

.logo {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.5rem;
}

.logo-text {
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
}

.logo:hover img {
    transform: rotate(15deg) scale(1.05);
}

.logo h1 {
    font-size: clamp(1.8rem, 5vw, 2.5rem);
    background: linear-gradient(to right, var(--primary-color), var(--accent-color));
    -webkit-background-clip: text;
    background-clip: text;
    color: transparent;
    letter-spacing: 1px;
    text-shadow: 0 2px 10px rgba(0,0,0,0.2);
}

.logo img {
    width: 250px;
    height: 250px;
    object-fit: contain;
    filter: drop-shadow(0 0 15px rgba(108, 92, 231, 0.6));
    transition: var(--transition);
}

.logo p {
    font-size: clamp(0.8rem, 1vw, 2rem);
    color: var(--text-secondary);
}

/* Основное содержимое */
main {
    display: flex;
    flex-wrap: wrap;
    gap: 2rem;
    justify-content: center;
    margin-bottom: 2rem;
    flex: 1;
}

/* Кновка ПУСК */
#start-playback {
    position: relative;
    padding: 15px 30px;
    font-size: 1rem;
    background: var(--primary-color);
    color: white;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    min-width: 200px;
}

#start-playback[disabled] {
    opacity: 0.8;
    cursor: not-allowed;
    background: var(--dark-color);
}

.loading-spinner {
    display: none;
    width: 16px;
    height: 16px;
    border: 2px solid rgba(255,255,255,0.3);
    border-radius: 50%;
    border-top-color: #fff;
    animation: spin 1s linear infinite;
    margin-right: 10px;
}

.button-text {
    transition: all 0.3s ease;
}

/* Плеер */
.player-container {
    flex: 1;
    min-width: min(100%, 350px);
    max-width: 500px;
    background: var(--card-bg);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border-radius: var(--border-radius);
    padding: 1.5rem;
    box-shadow: var(--card-shadow);
    transition: var(--transition);
    border: 1px solid rgba(255, 255, 255, 0.1);
    display: flex;
    flex-direction: column;
}

.player-container:hover {
    transform: translateY(-5px);
    box-shadow: 0 15px 35px rgba(0, 0, 0, 0.6);
}

.album-art {
    position: relative;
    width: 400px;
    height: 400px;
    margin: 0 auto;
    border-radius: 50%;
    overflow: hidden;
}

.album-art img {
    position: relative;
    z-index: 1;
    width: 100%;
    height: 100%;
    object-fit: cover;
    animation: spin 20s linear infinite;
}

.album-art.playing img {
    animation-play-state: running;
}

.track-info {
    text-align: center;
    margin-bottom: 1.5rem;
}

.track-info h2 {
    font-size: 1.3rem;
    margin-bottom: 0.5rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    color: var(--text-primary);
    font-weight: 600;
}

.track-info p {
    font-size: 0.95rem;
    color: var(--text-secondary);
    margin-bottom: 0.5rem;
}

.track-progress {
    display: flex;
    align-items: center;
    gap: 5px;
    margin-top: 5px;
}

.track-progress span {
    font-size: 0.85rem;
    color: var(--text-secondary);
    min-width: 40px;
}

#progress-bar {
flex: 1;
height: 5px;
-webkit-appearance: none;
background: rgba(255, 255, 255, 0.2);
border-radius: 5px;
outline: none;
overflow: hidden;
}

#progress-bar::-webkit-slider-thumb {
-webkit-appearance: none;
width: 15px;
height: 15px;
border-radius: 50%;
background: var(--primary-color);
cursor: pointer;
box-shadow: -407px 0 0 400px var(--primary-color);
transition: var(--transition);
}

#progress-bar::-webkit-slider-thumb:hover {
transform: scale(1.2);
background: var(--accent-color);
}

.player-buttons {
    display: flex !important;
    gap: 1rem;
    margin-top: 1rem;
    justify-content: center;
}

.player-buttons button {
    background: none;
    border: none;
    color: var(--text-primary);
    cursor: pointer;
    transition: var(--transition);
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
}

.volume-control {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    flex: 1;
    max-width: 150px;
}

#volume-btn {
width: 40px;
height: 40px;
font-size: 1.1rem;
}

#volume-btn:hover {
color: var(--accent-color);
background: rgba(255, 255, 255, 0.1);
}

#volume-slider {
flex: 1;
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: 15px;
height: 15px;
border-radius: 50%;
background: var(--primary-color);
cursor: pointer;
transition: var(--transition);
}

#volume-slider::-webkit-slider-thumb:hover {
background: var(--accent-color);
transform: scale(1.2);
}

/* Блок информации о треках */
.track-details {
    margin-top: 0.5rem;
    background: rgba(0, 0, 0, 0.2);
    border-radius: var(--border-radius);
    padding: 0.8rem !important;
    border: 1px solid rgba(255, 255, 255, 0.05);
}

.now-playing, .up-next, .recent-tracks {
    margin-bottom: 1.2rem;
}

.now-playing h3, .up-next h3, .recent-tracks h3 {
    color: var(--primary-color);
    margin-bottom: 0.5rem;
    font-size: 1rem;
    display: flex;
    align-items: center;
    gap: 8px;
}

.now-playing h3::before, .up-next h3::before, .recent-tracks h3::before {
    content: '';
    width: 8px;
    height: 8px;
    background: var(--primary-color);
    border-radius: 50%;
    display: inline-block;
}

.track-info-box {
    background: rgba(255, 255, 255, 0.05);
    padding: 0.5rem !important;
    border-radius: 10px;
    margin-bottom: 0.5rem;
    border-left: 3px solid var(--primary-color);
}

.track-title {
    font-weight: 500;
    color: var(--text-primary);
    grid-column: 1;
}

.track-artist {
    color: var(--text-secondary);
    font-size: 0.85em;
    grid-column: 1;
}

.track-time {
    grid-column: 2;
    grid-row: 1 / span 2;
    color: var(--text-secondary);
    font-size: 0.8em;
    text-align: right;
}

.track-name {
    font-weight: 600;
    color: var(--text-primary);
    display: block;
    margin-bottom: 0.3rem;
    font-size: 1rem;
}

.track-progress, .track-time {
    font-size: 0.85rem;
    color: var(--text-secondary);
}

#history-list {
    list-style: none;
    padding: 0;
    will-change: transform; /* Подсказка браузеру для оптимизации */
    contain: content; /* Ограничивает область перерисовки */
}

#history-list li {
    display: grid;
    grid-template-columns: 1fr auto;
    gap: 8px;
    padding: 0.4rem;
    font-size: 0.8rem;
    align-items: center;
    transform: translateZ(0); /* Аппаратное ускорение */
}

#history-list li:hover {
    background: rgba(108, 92, 231, 0.1);
    border-left-color: var(--primary-color);
}

#history-list li::before {
    content: '♫';
    margin-right: 10px;
    color: var(--primary-color);
    font-size: 0.8rem;
}

.new-track {
    animation: fadeInTrack 0.5s ease;
    background: rgba(108, 92, 231, 0.1) !important;
}

/* Подвал */
footer {
    text-align: center;
    margin-top: auto;
    padding-top: 1.5rem;
    border-top: 1px solid rgba(255, 255, 255, 0.1);
    color: var(--text-secondary);
    font-size: 0.9rem;
}

.footer-content {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.social-links {
    display: flex;
    justify-content: center;
    gap: 1rem;
}

.social-links a {
    color: var(--text-secondary);
    font-size: 1.25rem;
    transition: var(--transition);
    width: 35px;
    height: 35px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
}

.social-links a:hover {
    color: var(--primary-color);
    background: rgba(255, 255, 255, 0.1);
    transform: translateY(-2px);
}

.status-card

#stream-status {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    transition: opacity 0.3s ease;
    opacity: 0;
}

#stream-status.show {
    opacity: 1;
}

.connection-status {
    margin-top: 8px;
    font-size: 0.9rem;
    display: block; /* Добавляем это свойство */
    min-height: 24px; /* Гарантируем место для статуса */
}

.status-success, .status-error {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    transition: all 0.3s ease;
}

.status-success {
    color: var(--success-color);
}

.status-error {
    color: var(--error-color);
}

.wave-animation {
    display: inline-flex;
    align-items: flex-end;
    height: 18px;
    gap: 3px;
}

.wave-dot {
    width: 3px;
    height: 8px;
    background: currentColor;
    border-radius: 2px;
    animation: wave 1.2s ease-in-out infinite;
    transform-origin: bottom;
}

.wave-dot:nth-child(1) { animation-delay: 0s; }
.wave-dot:nth-child(2) { animation-delay: 0.3s; }
.wave-dot:nth-child(3) { animation-delay: 0.6s; }

.status-card {
    background: var(--card-bg);
    backdrop-filter: blur(12px);
    border-radius: var(--border-radius);
    padding: 1rem;
    box-shadow: var(--card-shadow);
    border: 1px solid rgba(255, 255, 255, 0.1);
    margin-top: 1rem;
    transition: var(--transition);
}

.status-header {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    margin-bottom: 0.75rem;
    font-size: 0.95rem;
}

.status-icon {
    width: 24px;
    height: 24px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.status-title {
    font-weight: 600;
    flex-grow: 1;
}

.status-time {
    font-size: 0.85rem;
    color: var(--text-secondary);
}

.status-message {
    margin-bottom: 0.75rem;
    line-height: 1.4;
}

.progress-bar {
    height: 4px;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 2px;
    overflow: hidden;
    margin-bottom: 0.75rem;
}

.progress-fill {
    height: 100%;
    background: var(--primary-color);
    width: 0%;
    transition: width 0.5s ease;
}

.status-stats {
    display: flex;
    gap: 1rem;
    flex-wrap: wrap;
    font-size: 0.85rem;
}

.stat-item {
    display: flex;
    align-items: center;
    gap: 0.3rem;
    color: var(--text-secondary);
}

/* Состояния статуса */
.status-success .progress-fill {
    background: var(--success-color);
}

.status-error .progress-fill {
    background: var(--error-color);
}

.status-warning .progress-fill {
    background: var(--warning-color);
}

.status-success .status-icon {
    color: var(--success-color);
}

.status-error .status-icon {
    color: var(--error-color);
}

.status-warning .status-icon {
    color: var(--warning-color);
}

/* Бейдж слушателей */
.now-playing-badge {
    position: fixed;
    bottom: 20px;
    right: 20px;
    background: var(--card-bg);
    backdrop-filter: blur(10px);
    padding: 8px 12px;
    border-radius: 20px;
    font-size: 0.85rem;
    display: flex;
    align-items: center;
    gap: 8px;
    box-shadow: 0 4px 15px rgba(0,0,0,0.2);
    z-index: 10;
    border: 1px solid rgba(255,255,255,0.1);
}

.online-status {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    background: var(--success-color);
    animation: pulse 2s infinite;
}

.album-art {
    position: relative;
    margin: 0 auto;
}

.loader {
    position: center;
    border: 4px solid rgba(255,255,255,0.3);
    border-radius: 50%;
    border-top: 4px solid var(--primary-color);
    width: 40px;
    height: 40px;
    animation: spin 1s linear infinite;
    margin-bottom: 15px;
    display: none;
}

.loading-status {
    color: var(--text-secondary);
    font-size: 0.9rem;
    margin-top: 10px;
    display: none;
}


/* Анимации */
@keyframes spin {
    from { transform: rotate(0deg); }
    to { transform: rotate(360deg); }
}

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

@keyframes fadeInTrack {
    from { opacity: 0; transform: translateX(-10px); }
    to { opacity: 1; transform: translateX(0); }
}

@keyframes pulse {
    0% { transform: scale(1); opacity: 1; }
    50% { transform: scale(1.1); opacity: 0.8; }
    100% { transform: scale(1); opacity: 1; }
}

@keyframes wave {
    0%, 100% { height: 5px; }
    50% { height: 12px; }
}

.playing .album-art img {
    animation: spin 20s linear infinite;
}

.connection-pulse {
    animation: pulse 2s infinite;
}

@media (max-width: 768px) {
    .player-container {
        padding: 1rem;
        max-width: 100%;
    }

    .album-art {
        width: 180px !important;
        height: 180px !important;

    }

    .track-info h2 {
        font-size: 1.1rem;
    }

    .track-info p {
        font-size: 0.8rem;
    }

    .track-details {
        padding: 0.8rem;
        margin-top: 1rem;
    }

    .track-info-box {
        padding: 0.6rem;
    }

    .now-playing, .up-next, .recent-tracks {
        margin-bottom: 1rem;
    }

    #history-list li {
    padding: 0.6rem;
    font-size: 0.85rem;
    grid-template-columns: 1fr;
    }

    .container {
        padding: 0 10px;
    }

    .now-playing-badge {
        bottom: 10px;
        right: 10px;
        padding: 5px 8px;
        font-size: 0.75rem;
    }
}

@media (max-width: 480px) {
    .album-art {
        max-width: 250px;
    }

    .track-info h2 {
        font-size: 1rem;
    }
}

/* Светлая */
body.light-theme {
    background: linear-gradient(to right, #7fc7ff, #0082e6);
    color: var(--dark-color);

}

body.light-theme {
    --primary-light-bg-start: #66b5ff;
    --light-bg-end: #00bfff;
}

body.light-theme #progress-bar {
    background: rgba(0, 0, 0, 0.2);
}

body.light-theme .logo h1 {
    background: linear-gradient(to right, #e60548, #ccffff);
    -webkit-background-clip: text;
    background-clip: text;
    color: transparent;
    text-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    filter: brightness(1.1);
}
body.light-theme .now-playing-badge {
    background: rgba(175, 218, 251, 0.8);
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.2);
    border: 1px solid rgba(255, 255, 255, 0.1);
    color: 98acd6;
}

/* Темная */
body.dark-theme {
    background: linear-gradient(to left, var(--darker-color), var(--dark-color));
    color: var(--text-primary);
}

body.dark-theme .logo h1 {
    background: linear-gradient(to right, #007fff, #e60548);
    -webkit-background-clip: text;
    background-clip: text;
    color: transparent;
    text-shadow: 0 2px 8px rgba(255, 255, 255, 0.2);
    filter: brightness(1.1);
}

body.dark-theme .track-info h2 {
    color: var(--text-primary);
}

body.dark-theme .track-info p {
    color: var(--text-secondary);
}

body.dark-theme .player-container {
    background: var(--card-bg);
    border: 1px solid rgba(255, 255, 255, 0.1);
    box-shadow: var(--card-shadow);
}

body.dark-theme .track-details {
    background: rgba(0, 0, 0, 0.2);
    border: 1px solid rgba(255, 255, 255, 0.05);
}

body.dark-theme .track-title {
    color: var(--text-primary);
}

body.dark-theme .track-artist {
    color: var(--text-secondary);
}

body.dark-theme footer {
    border-top: 1px solid rgba(255, 255, 255, 0.1);
    color: var(--text-secondary);
}

body.dark-theme .now-playing-badge {
    background: var(--card-bg);
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.2);
    border: 1px solid rgba(255, 255, 255, 0.1);
    color: var(--text-primary);
}

body.dark-theme .now-playing h3,
body.dark-theme .up-next h3,
body.dark-theme .recent-tracks h3 {
    color: var(--primary-color);
}

body.dark-theme .now-playing h3::before,
body.dark-theme .up-next h3::before,
body.dark-theme .recent-tracks h3::before {
    background: var(--primary-color);
}

/* Theme Toggle Button */
.theme-toggle {
    position: absolute;
    top: 20px;
    right: 20px;
    background: none;
    border: none;
    color: var(--text-primary);
    cursor: pointer;
    font-size: 1.5rem;
    transition: color 0.3s;
    z-index: 100;
}

.theme-toggle:hover {
    color: var(--accent-color);
}
