/* DAGSTUDIO PLAYER - Style v28 */

:root {
    --bg-color: #111111;       
    --text-color: #e0e0e0;     
    --accent-color: #C06C42;   
    --font-main: 'Inter', sans-serif;
    --font-head: 'Oswald', sans-serif;
}

* { box-sizing: border-box; margin: 0; padding: 0; }
html, body { height: 100%; overflow-x: hidden; }

body {
    background-color: var(--bg-color);
    color: var(--text-color);
    font-family: var(--font-main);
    line-height: 1.6;
    font-size: 16px;
    display: flex; flex-direction: column;
    -webkit-tap-highlight-color: transparent;
}

body {
    -webkit-touch-callout: none;
    -webkit-user-select: none;
    user-select: none;
}

h1, h2, h3, h4 { font-family: var(--font-head); text-transform: uppercase; font-weight: 700; line-height: 1.2; }
a { text-decoration: none; color: inherit; transition: 0.3s; }
img { max-width: 100%; display: block; }
button { font-family: inherit; }
.accent { color: var(--accent-color); }
.container { max-width: 1200px; margin: 0 auto; padding: 0 20px; width: 100%; }

.page-header { display: none; }

/* --- MAIN LAYOUT --- */
.audio-dashboard-section { padding-bottom: 60px; flex-grow: 1; display: flex; align-items: center; justify-content: center; min-height: 100vh; }

.centered-player {
    max-width: 480px; 
    margin: 0 auto;   
    width: 100%;
    transition: max-width 0.3s ease; 
}

/* --- PLAYER CARD --- */
.sticky-player { 
    background: transparent !important; 
    border: none !important;            
    box-shadow: none !important;        
    padding: 10px 0;         
    border-radius: 0;
    text-align: center; 
    position: relative;
    transition: padding-bottom 0.3s ease;
}

/* --- BRANDING --- */
.player-branding { margin-bottom: 20px; position: relative; display: flex; flex-direction: column; align-items: center; justify-content: center; }
.brand-subtitle { font-size: 0.65rem; color: var(--accent-color); letter-spacing: 4px; text-transform: uppercase; opacity: 0.8; margin-bottom: 5px; font-weight: 600; }
.brand-title { font-family: var(--font-head); font-size: 1.8rem; color: #fff; font-weight: 700; letter-spacing: 1px; line-height: 1; text-transform: uppercase; text-shadow: 0 0 20px rgba(192, 108, 66, 0.2); }
.brand-line { width: 40px; height: 3px; background: var(--accent-color); margin-top: 15px; border-radius: 2px; box-shadow: 0 0 10px var(--accent-color); }

/* --- NEW TOP CONTROLS --- */
.top-controls-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    width: 100%;
    margin-bottom: 10px;
    padding: 0 10px;
}

.top-btn {
    width: 40px; 
    height: 40px; 
    background: transparent; 
    border: none; 
    color: #555; 
    font-size: 1rem; 
    cursor: pointer;
    border-radius: 50%;
    display: flex; align-items: center; justify-content: center;
    transition: 0.3s;
}
.top-btn:hover { color: var(--accent-color); background: rgba(255,255,255,0.05); }

.vinyl-record-wrapper { width: 240px; height: 240px; margin: 0 auto 25px auto; border-radius: 50%; background: repeating-radial-gradient(circle, #222, #222 10px, #111 10px, #111 20px); border: 4px solid #0a0a0a; box-shadow: 0 10px 30px rgba(0,0,0,0.5); display: flex; align-items: center; justify-content: center; }
.vinyl-label { width: 120px; height: 120px; border-radius: 50%; overflow: hidden; border: 3px solid #1a1a1a; animation: spinVinyl 8s linear infinite; animation-play-state: paused; }
.vinyl-label.spinning { animation-play-state: running; }
.vinyl-label img { width: 100%; height: 100%; object-fit: cover; }
@keyframes spinVinyl { 100% { transform: rotate(360deg); } }

.now-playing-info { margin: 20px 0 20px 0; }
.now-playing-info h4 { font-size: 0.7rem; color: var(--accent-color); letter-spacing: 2px; margin-bottom: 8px; opacity: 0.8; }
.now-playing-info h2 { 
    font-size: 1.3rem; 
    color: #fff; 
    margin-bottom: 5px; 
    padding: 0 15px;
    min-height: 3.2rem; 
    display: block;      
    white-space: normal; 
    overflow: visible;   
    cursor: pointer; 
    transition: 0.3s;
    line-height: 1.3;
}
.now-playing-info h2:hover { opacity: 0.8; color: var(--accent-color) !important; }
.now-playing-info p { color: #666; font-size: 0.85rem; letter-spacing: 1px; margin-bottom: 5px; }

.music-warning { display: none; color: #ff4444; font-size: 0.7rem; font-weight: bold; text-transform: uppercase; letter-spacing: 1px; margin-top: 8px; border: 1px solid #ff4444; padding: 4px 10px; border-radius: 4px; animation: pulseWarn 2s infinite; }
@keyframes pulseWarn { 0% { opacity: 1; box-shadow: 0 0 0 rgba(255, 68, 68, 0); } 50% { opacity: 0.7; box-shadow: 0 0 10px rgba(255, 68, 68, 0.3); } 100% { opacity: 1; box-shadow: 0 0 0 rgba(255, 68, 68, 0); } }

.eq-display-info { font-size: 0.75rem; color: var(--accent-color); font-weight: bold; opacity: 0.8; text-transform: uppercase; letter-spacing: 1px; }

.equalizer { display: flex; justify-content: center; gap: 4px; height: 20px; margin-bottom: 25px; opacity: 0.3; }
.equalizer.active { opacity: 1; }
.equalizer span { width: 4px; background: var(--accent-color); animation: bounce 1s infinite ease-in-out; animation-play-state: paused; }
.equalizer.active span { animation-play-state: running; }
.equalizer span:nth-child(1) { animation-delay: 0.1s; height: 40%; }
.equalizer span:nth-child(2) { animation-delay: 0.3s; height: 80%; }
.equalizer span:nth-child(3) { animation-delay: 0.5s; height: 50%; }
.equalizer span:nth-child(4) { animation-delay: 0.2s; height: 90%; }
.equalizer span:nth-child(5) { animation-delay: 0.4s; height: 60%; }
@keyframes bounce { 0%, 100% { height: 20%; } 50% { height: 100%; } }

/* --- BOTTOM CONTROLS ROW --- */
.player-controls { 
    display: flex; 
    justify-content: center; 
    align-items: center; 
    gap: 15px; 
    padding-top: 20px; 
    border-top: none;
}
.ctrl-btn { 
    background: transparent; border: 1px solid #333; color: #666; 
    width: 45px; height: 45px; 
    border-radius: 50%; font-size: 1rem; cursor: pointer; 
    display: flex; align-items: center; justify-content: center; 
    transition: 0.2s; font-weight: bold; 
}
.ctrl-btn:hover { border-color: #fff; color: #fff; background: #222; }
.ctrl-btn.active { color: var(--accent-color); border-color: var(--accent-color); background: rgba(192, 108, 66, 0.1); }
.play-btn { 
    width: 65px; height: 65px; 
    font-size: 1.8rem; 
    border: 2px solid var(--accent-color); color: var(--accent-color); 
    box-shadow: 0 0 20px rgba(192, 108, 66, 0.1); padding-left: 4px; 
}
.play-btn:hover { background: var(--accent-color); color: #fff; transform: scale(1.05); }

#btn-playlist.active, #btn-shuffle.active, #btn-repeat.active {
    color: var(--accent-color);
    border-color: var(--accent-color);
    background: rgba(192, 108, 66, 0.1);
    box-shadow: 0 0 10px rgba(192, 108, 66, 0.2);
}

/* По умолчанию (мобилка) кнопка повтора скрыта */
#btn-repeat { display: none; }

.btn-install-app { display: none; align-items: center; justify-content: center; gap: 10px; width: 100%; margin-bottom: 25px; padding: 12px; background: #111; border: 1px solid var(--accent-color); border-radius: 30px; color: var(--accent-color); font-weight: 700; font-size: 0.8rem; letter-spacing: 1px; cursor: pointer; transition: 0.3s; }
.btn-install-app:hover { background: var(--accent-color); color: #fff; }

/* --- PLAYLIST DRAWER --- */
.playlist-drawer {
    width: 100%;
    max-height: 0;
    overflow: hidden;
    opacity: 0;
    transition: max-height 0.5s cubic-bezier(0.4, 0, 0.2, 1), opacity 0.4s ease;
    background: transparent !important; 
    border-radius: 0;
    margin-top: 0;
}

.playlist-drawer.open {
    max-height: 500px;
    opacity: 1;
    margin-top: 20px; 
    border: none !important; 
}

.playlist-inner-content { padding: 0 5px; } 

.tracks-container { display: flex; flex-direction: column; gap: 0; width: 100%; max-height: 300px; overflow-y: auto; padding-right: 5px; }
.tracks-container::-webkit-scrollbar { width: 4px; }
.tracks-container::-webkit-scrollbar-track { background: transparent; }
.tracks-container::-webkit-scrollbar-thumb { background: #333; border-radius: 2px; }
.tracks-container::-webkit-scrollbar-thumb:hover { background: var(--accent-color); }

.track-item { 
    display: flex; 
    align-items: center; 
    justify-content: space-between; 
    background: transparent; 
    border: none;            
    border-bottom: 1px solid #222; 
    padding: 12px 5px; 
    border-radius: 0; 
    cursor: pointer; 
    transition: 0.2s; 
    width: 100%; 
}
.track-item:hover { background: rgba(255,255,255, 0.03); }
.track-item.active-track { background: transparent; }
.track-item.active-track .row-text .track-title { color: var(--accent-color); }

.row-icon { width: 38px; height: 38px; flex-shrink: 0; background: transparent; color: #555; border-radius: 50%; border: 1px solid #333; display: flex; align-items: center; justify-content: center; margin-right: 12px; transition: 0.3s; font-size: 0.9rem; }
.track-item.active-track .row-icon { background: var(--accent-color); color: #fff; border-color: var(--accent-color); }
.row-info { display: flex; align-items: center; flex: 1; min-width: 0; margin-right: 10px; overflow: hidden; }
.row-text { flex: 1; min-width: 0; text-align: left; }
.track-title { font-size: 0.95rem; color: #ccc; margin-bottom: 2px; font-weight: 500; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; line-height: 1.2; }
.track-artist { font-size: 0.75rem; color: #666; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; display: block; line-height: 1.2; }
.btn-delete-local { width: 32px; height: 32px; flex-shrink: 0; border: 1px solid #333; border-radius: 50%; color: #666; background: transparent; display: flex; align-items: center; justify-content: center; transition: 0.3s; cursor: pointer; font-size: 0.8rem; }
.btn-delete-local:hover { color: #ff4444; border-color: #ff4444; }

/* MODALS */
.modal-overlay { display: none; position: fixed; top: 0; left: 0; width: 100%; height: 100%; background: rgba(0,0,0,0.85); backdrop-filter: blur(5px); z-index: 9999; align-items: center; justify-content: center; opacity: 0; transition: opacity 0.3s; }
.modal-overlay.show { opacity: 1; }
.modal-window { background: #111; border: 1px solid var(--accent-color); width: 90%; max-width: 350px; padding: 30px; text-align: center; position: relative; border-radius: 8px; box-shadow: 0 0 30px rgba(192, 108, 66, 0.2); }
.close-modal { position: absolute; top: 10px; right: 15px; font-size: 24px; cursor: pointer; color: #666; }
.eq-list { display: flex; flex-direction: column; gap: 10px; margin-top: 20px; }
.btn-eq-preset { background: #1a1a1a; border: 1px solid #333; color: #fff; padding: 12px; font-family: var(--font-head); font-size: 0.9rem; cursor: pointer; transition: 0.3s; text-transform: uppercase; letter-spacing: 1px; }
.btn-eq-preset:hover { border-color: var(--accent-color); background: #222; }
.btn-eq-preset.active { background: var(--accent-color); color: #000; border-color: var(--accent-color); font-weight: bold; }
.ios-instructions p { margin: 15px 0; color: #ccc; font-size: 1rem; }
.ios-instructions b { color: #fff; }
.ios-instructions i { color: #007aff; font-size: 1.2rem; margin-left: 5px; }

@media (max-width: 500px) {
    .sticky-player { padding: 10px 0; max-width: 100%; }
    .vinyl-record-wrapper { width: 200px; height: 200px; }
    .vinyl-label { width: 100px; height: 100px; }
    .brand-title { font-size: 2rem; }
    .ctrl-btn { width: 40px; height: 40px; }
    .play-btn { width: 60px; height: 60px; }
}

@media all and (display-mode: standalone), (display-mode: fullscreen) {
    .page-header { padding-top: calc(env(safe-area-inset-top) + 20px); }
    body { padding-bottom: env(safe-area-inset-bottom); }
    .btn-install-app { display: none !important; }
}

/* ==========================================================================
   DESKTOP & LANDSCAPE LAYOUT (2 Columns)
   ========================================================================== */
@media (min-width: 800px), (orientation: landscape) and (min-width: 600px) {
    
    .centered-player {
        max-width: 1100px;
        display: flex;
        flex-direction: row; 
        align-items: flex-start; 
        justify-content: center;
        gap: 40px;
        padding-top: 20px;
    }

    /* Левая колонка - Плеер */
    .sticky-player {
        flex: 1;
        min-width: 350px; 
        max-width: 450px;
    }

    /* Правая колонка - Плейлист */
    .playlist-drawer {
        flex: 1;
        min-width: 300px;
        max-height: 80vh !important; 
        height: auto !important;
        opacity: 1 !important; 
        display: block !important;
        margin-top: 0 !important;
        padding-top: 20px; 
    }

    /* Принудительно показываем контент плейлиста */
    .playlist-drawer.open, .playlist-drawer {
        max-height: none;
    }

    .tracks-container {
        max-height: 70vh !important; 
        padding-right: 10px;
    }

    /* На ПК скрываем кнопку ПЛЕЙЛИСТА и показываем кнопку ПОВТОРА */
    #btn-playlist { display: none !important; }
    #btn-repeat   { display: flex !important; }
    
    @media (orientation: landscape) and (max-height: 500px) {
        .vinyl-record-wrapper { width: 160px; height: 160px; margin-bottom: 10px; }
        .vinyl-label { width: 80px; height: 80px; }
        .brand-title { font-size: 1.5rem; }
        .sticky-player { padding-top: 0; }
        .centered-player { gap: 20px; }
    }
}