/* =================================================================
   SBM ZEN PLAYER 3.0 - APP-LIKE INTERNAL VIEWS
   ================================================================= */

:root {
    --bg-desktop: none;
    --bg-mobile: none;
    --sbm-primary: #10b981;
    --sbm-primary-hover: #059669;
}

/* --- 1. BASE WIDGET & MINI BUBBLE --- */
.sbm-zen-player-widget {
    position: fixed; bottom: 25px; left: 25px; z-index: 99998; 
    font-family: 'Roboto', sans-serif;
    transition: all 0.4s cubic-bezier(0.25, 0.8, 0.25, 1);
}

.sbm-zp-mini-btn {
    width: 56px; height: 56px; border-radius: 50%;
    background: rgba(255, 255, 255, 0.85); backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 255, 255, 0.5); box-shadow: 0 8px 25px rgba(0, 0, 0, 0.15);
    display: flex; align-items: center; justify-content: center;
    cursor: pointer; position: relative; padding: 0;
    transition: transform 0.3s ease, box-shadow 0.3s ease;
}
.sbm-zp-mini-btn:hover { transform: scale(1.05); box-shadow: 0 10px 30px rgba(0, 0, 0, 0.2); }

.sbm-zp-mini-disc {
    position: absolute; width: 44px; height: 44px; border-radius: 50%;
    background: conic-gradient(#111, #333, #111, #333, #111);
    animation: sbmSpin 4s linear infinite; animation-play-state: paused; 
}
.sbm-zp-music-icon { position: relative; z-index: 2; color: #fff; filter: drop-shadow(0 2px 4px rgba(0,0,0,0.5)); }

.sbm-zen-player-widget.is-playing .sbm-zp-mini-disc { animation-play-state: running; }
.sbm-zen-player-widget.is-playing .sbm-zp-mini-btn { box-shadow: 0 0 20px rgba(16, 185, 129, 0.4); border-color: rgba(16, 185, 129, 0.3); }

/* --- 2. EXPANDED PANEL --- */
.sbm-zp-expanded-panel {
    position: absolute; bottom: 0; left: 0; width: 320px;
    background: rgba(255, 255, 255, 0.6); backdrop-filter: blur(20px) saturate(150%); -webkit-backdrop-filter: blur(20px) saturate(150%);
    border: 1px solid rgba(255, 255, 255, 0.8); border-radius: 20px;
    box-shadow: 0 15px 40px rgba(0, 0, 0, 0.12); padding: 20px;
    display: flex; flex-direction: column; gap: 15px;
    
    opacity: 0; visibility: hidden; transform: translateY(20px) scale(0.95); transform-origin: bottom left;
    transition: all 0.4s cubic-bezier(0.25, 0.8, 0.25, 1);
}

.sbm-zen-player-widget.is-expanded .sbm-zp-mini-btn { opacity: 0; visibility: hidden; transform: scale(0.5); }
.sbm-zen-player-widget.is-expanded .sbm-zp-expanded-panel { opacity: 1; visibility: visible; transform: translateY(0) scale(1); }

/* --- 3. INTERNAL VIEWS SYSTEM --- */
.sbm-zp-view-container {
    position: relative;
    min-height: 240px; /* Giữ UI không bị giật khi chuyển trang */
    display: flex; flex-direction: column; overflow: hidden;
}

.zp-view {
    display: none; flex-direction: column; width: 100%;
}
.zp-view.is-active {
    display: flex;
    animation: zpFadeIn 0.3s cubic-bezier(0.25, 0.8, 0.25, 1);
}
@keyframes zpFadeIn {
    from { opacity: 0; transform: translateX(15px); }
    to { opacity: 1; transform: translateX(0); }
}

/* --- VIEW 1: HOME NAV (3 Nút Chính) --- */
.sbm-zp-main-nav {
    display: flex; justify-content: space-around; align-items: center; 
    border-bottom: 1px solid rgba(0,0,0,0.05); padding-bottom: 15px; margin-bottom: 15px;
}

.sbm-nav-trigger {
    background: transparent; border: none; cursor: pointer;
    display: flex; flex-direction: column; align-items: center; gap: 5px;
    transition: 0.2s; padding: 5px; border-radius: 8px;
}
.sbm-nav-trigger .nav-icon {
    width: 44px; height: 44px; border-radius: 50%;
    background: rgba(255,255,255,0.8); border: 1px solid rgba(0,0,0,0.05); box-shadow: 0 2px 5px rgba(0,0,0,0.05);
    display: flex; align-items: center; justify-content: center; font-size: 1.2rem;
    transition: 0.2s;
}
.sbm-nav-trigger .nav-label { font-size: 0.75rem; font-weight: 600; color: #4b5563; transition: 0.2s; }

.sbm-nav-trigger:hover .nav-icon { background: var(--sbm-primary); color: white; transform: translateY(-3px); box-shadow: 0 4px 10px rgba(16, 185, 129, 0.3); }
.sbm-nav-trigger:hover .nav-label { color: var(--sbm-primary); }

/* --- HEADER CHO TRANG CON (Nút Back) --- */
.zp-view-header {
    display: flex; align-items: center; justify-content: center; /* Đổi thành center */
    border-bottom: 1px solid rgba(0,0,0,0.05); padding-bottom: 10px; margin-bottom: 12px;
}
.zp-back-btn {
    background: none; border: none; color: var(--sbm-primary); 
    font-weight: bold; font-size: 0.85rem; cursor: pointer;
    padding: 5px 15px; transition: 0.2s; display: flex; align-items: center; gap: 5px;
}
.zp-back-btn:hover { color: var(--sbm-primary-hover); transform: translateX(-3px); }

/* --- NỘI DUNG CUỘN (Scroll Content) --- */
.zp-scroll-content {
    flex: 1; overflow-y: auto; max-height: 220px; padding-right: 5px;
}
.zp-scroll-content::-webkit-scrollbar { width: 5px; }
.zp-scroll-content::-webkit-scrollbar-track { background: transparent; }
.zp-scroll-content::-webkit-scrollbar-thumb { background: rgba(16, 185, 129, 0.5); border-radius: 10px; }

/* Lưới chọn (Dùng chung cho Nhạc & Không gian) */
.sbm-zp-grid-list { 
    display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; 
}
.sbm-grid-item {
    background: rgba(0,0,0,0.03); border: none; border-radius: 10px; 
    padding: 12px 5px; cursor: pointer; transition: 0.2s;
    display: flex; flex-direction: column; align-items: center; gap: 8px;
}
.sbm-grid-item .grid-icon { font-size: 1.5rem; transition: 0.2s; }
.sbm-grid-item .grid-label { font-size: 0.75rem; font-weight: 600; color: #4b5563; text-align: center; line-height: 1.2; }

.sbm-grid-item:hover, .sbm-grid-item.is-active { 
    background: var(--sbm-primary); transform: translateY(-2px); box-shadow: 0 4px 10px rgba(16, 185, 129, 0.2); 
}
.sbm-grid-item:hover .grid-label, .sbm-grid-item.is-active .grid-label { color: #fff; }
.sbm-grid-item:hover .grid-icon, .sbm-grid-item.is-active .grid-icon { transform: scale(1.1); }

/* Lưới Thumbnail Ảnh */
.sbm-zp-thumb-grid .grid-container { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.grid-container img { width: 100%; height: 60px; object-fit: cover; border-radius: 6px; cursor: pointer; transition: 0.2s; border: 2px solid transparent; }
.grid-container img:hover { transform: scale(1.05); border-color: var(--sbm-primary); box-shadow: 0 4px 10px rgba(0,0,0,0.2); }

/* Bảng thời tiết */
.weather-panel { font-size: 0.85rem; color: #374151; width: 100%; padding-top: 5px; }
.weather-row, .slider-row { display: flex; justify-content: space-between; align-items: center; margin-bottom: 12px; font-weight: 600; }
.weather-panel select { width: 100%; padding: 8px; border-radius: 6px; border: 1px solid #d1d5db; margin-bottom: 15px; outline: none; background: rgba(255,255,255,0.8); font-family: inherit; }
.weather-panel input[type="range"] { width: 65%; accent-color: var(--sbm-primary); }

/* --- 4. PLAYER BASE (Đĩa xoay & Thông tin) --- */
.sbm-zp-body { display: flex; align-items: center; gap: 15px; margin-bottom: 5px; }
.sbm-zp-vinyl-wrapper { position: relative; width: 64px; height: 64px; border-radius: 50%; overflow: hidden; box-shadow: 0 4px 12px rgba(0,0,0,0.3) !important; animation: sbmSpin 5s linear infinite; animation-play-state: paused; background: conic-gradient(#111, #333, #111, #333, #111) !important; border: 2px solid #1f2937 !important; flex-shrink: 0; }
.sbm-zp-vinyl-wrapper img { display: none !important; }
.sbm-zp-vinyl-hole { position: absolute; top: 50%; left: 50%; transform: translate(-50%, -50%); width: 20px !important; height: 20px !important; background: #f3f4f6 !important; border-radius: 50%; border: 3px solid #111 !important; box-shadow: inset 0 1px 4px rgba(0,0,0,0.4) !important; }
.sbm-zen-player-widget.is-playing .sbm-zp-vinyl-wrapper { 
    animation-play-state: running !important; 
}

.sbm-zp-info { flex: 1; overflow: hidden; }
.sbm-zp-track-name { font-size: 0.95rem; font-weight: 700; color: #111827; white-space: nowrap; text-overflow: ellipsis; overflow: hidden; margin-bottom: 4px; }
.sbm-zp-artist-name { font-size: 0.8rem; color: #6b7280; white-space: nowrap; text-overflow: ellipsis; overflow: hidden; }

/* Player Controls */
.sbm-zp-controls { display: flex; align-items: center; justify-content: center; gap: 20px; margin-top: 10px; }
.sbm-zp-ctrl-btn { background: none; border: none; color: #4b5563; cursor: pointer; padding: 5px; transition: 0.2s; display: flex; align-items: center; justify-content: center; font-size: 1.2rem; }
.sbm-zp-ctrl-btn:hover { color: var(--sbm-primary); transform: scale(1.1); }
.sbm-zp-play-btn { width: 44px; height: 44px; border-radius: 50%; background: #111827; color: #fff; box-shadow: 0 4px 12px rgba(0,0,0,0.2); }
.sbm-zp-play-btn:hover { background: var(--sbm-primary); color: #fff; box-shadow: 0 6px 15px rgba(16, 185, 129, 0.4); }

/* YouTube Input */
.sbm-zp-youtube-box { display: flex; gap: 8px; margin-top: 20px; border-top: 1px dashed rgba(0,0,0,0.1); padding-top: 15px; }
.sbm-zp-youtube-box input { flex: 1; background: rgba(255,255,255,0.7); border: 1px solid rgba(0,0,0,0.1); border-radius: 20px; padding: 8px 12px; font-size: 0.8rem; color: #374151; outline: none; transition: 0.2s; }
.sbm-zp-youtube-box input:focus { border-color: #ef4444; box-shadow: 0 0 0 2px rgba(239,68,68,0.2); }
.sbm-zp-youtube-box button { background: #ef4444; color: #fff; border: none; border-radius: 20px; padding: 8px 15px; font-size: 0.8rem; font-weight: bold; cursor: pointer; transition: 0.2s; }
.sbm-zp-youtube-box button:hover { background: #dc2626; transform: scale(1.05); }

/* --- 5. NỀN & THỜI TIẾT (FULLSCREEN) --- */
.sbm-zp-bg-system { position: fixed; top: 0; left: 0; width: 100vw; height: 100vh; z-index: -1; background-size: cover; background-position: center; transition: background-image 1s ease-in-out; }
#sbm-zp-weather-overlay { position: fixed; top: 0; left: 0; width: 100vw; height: 100vh; pointer-events: none !important; z-index: 99997; overflow: hidden; display: none; }
#sbm-zp-weather-overlay.is-active { display: block; }

.sbm-weather-item { position: absolute; top: -20px; pointer-events: none; will-change: transform, opacity; }
.sbm-weather-item.is-rain { background: linear-gradient(to bottom, rgba(255,255,255,0), rgba(255,255,255,0.7)); width: 2px; height: 25px; animation: sbmFallRain linear infinite; }
.sbm-weather-item.is-snow { background: #fff; width: 5px; height: 5px; border-radius: 50%; box-shadow: 0 0 6px rgba(255,255,255,0.9); animation: sbmFallSnow linear infinite; }
.sbm-weather-item.is-stardust { background: #fef08a; width: 3px; height: 3px; border-radius: 50%; box-shadow: 0 0 10px #f59e0b, 0 0 3px #fff; animation: sbmFloatStar linear infinite; }
.sbm-weather-item.is-petals { background: #fbcfe8; width: 10px; height: 10px; border-radius: 50% 0 50% 50%; box-shadow: 0 0 4px rgba(251, 207, 232, 0.5); animation: sbmFallSnow linear infinite; }
.sbm-weather-item.is-fireflies { background: #bef264; width: 4px; height: 4px; border-radius: 50%; box-shadow: 0 0 10px #bef264; animation: sbmFloatStar linear infinite; }

.sbm-weather-sun { position: fixed; top: 0; left: 0; width: 100%; height: 100%; background: radial-gradient(circle at 10% 10%, rgba(253, 224, 71, 0.2) 0%, transparent 50%); pointer-events: none; }
.sbm-weather-fog { position: fixed; top: 0; left: 0; width: 100%; height: 100%; backdrop-filter: blur(4px); background: rgba(255,255,255,0.1); pointer-events: none; }
#sbm-zp-lightning-flash { position: fixed; top: 0; left: 0; width: 100%; height: 100%; background: #fff; opacity: 0; z-index: 99999; pointer-events: none; transition: opacity 0.1s ease; }

@keyframes sbmSpin { 
    0% { transform: rotate(0deg); } 
    100% { transform: rotate(360deg); } 
}
@keyframes sbmFallRain { to { transform: translateY(110vh) translateX(-10vw); } }
@keyframes sbmFallSnow { 0% { transform: translateY(-10px) translateX(0) rotate(0deg); } 50% { transform: translateY(50vh) translateX(30px) rotate(180deg); } 100% { transform: translateY(110vh) translateX(-20px) rotate(360deg); } }
@keyframes sbmFloatStar { 0% { transform: translateY(110vh) scale(0.5); opacity: 0; } 50% { opacity: 1; transform: translateY(50vh) scale(1.5); } 100% { transform: translateY(-10vh) scale(0.5); opacity: 0; } }

/* --- 6. MOBILE RESPONSIVE --- */
@media (max-width: 768px) {
    .sbm-zen-player-widget { bottom: 15px; left: 15px; }
    .sbm-zp-expanded-panel { width: calc(100vw - 30px); left: 0; bottom: 70px; padding: 15px; }
    .sbm-zp-grid-list { grid-template-columns: repeat(3, 1fr); gap: 8px; }
}