/*
Theme Name: VinylPlayer
Author: Bendigital
Description: A high-fidelity audio platform for Music, Sermons, and Devotions.
Version: 1.0
*/

/* --- (Keep CSS Variables & Base Styles from V11) --- */
:root { --bg-color: #121212; --bg-secondary: #181818; --bg-panel: #1e1e1e; --bg-input: #282828; --text-main: #ffffff; --text-sub: #aaaaaa; --accent: #ff5722; --border: #333333; --shadow: rgba(0,0,0,0.5); --wave-color: #ff5722; --safe-area-bottom: env(safe-area-inset-bottom, 0px); --vinyl-black: #111; --vinyl-groove: #1a1a1a; --tonearm-metal: #888; --tonearm-plastic: #444; }
body.light-mode { --bg-color: #f4f4f4; --bg-secondary: #ffffff; --bg-panel: #e0e0e0; --bg-input: #dcdcdc; --text-main: #121212; --text-sub: #555555; --accent: #d84315; --border: #cccccc; --shadow: rgba(0,0,0,0.1); --wave-color: #d84315; --vinyl-black: #333; --vinyl-groove: #444; --tonearm-metal: #ccc; --tonearm-plastic: #999; }
* { box-sizing: border-box; } body, html { margin: 0; padding: 0; width: 100%; height: 100%; overflow: hidden; background-color: var(--bg-color); color: var(--text-main); font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif; transition: background 0.3s; }
.app-container { display: flex; flex-direction: column; height: 100vh; height: 100dvh; width: 100%; background: var(--bg-secondary); }

/* Header & Filter */
.app-header { flex: 0 0 60px; display: flex; align-items: center; justify-content: space-between; padding: 0 10px; border-bottom: 1px solid var(--border); background: var(--bg-secondary); z-index: 20; gap: 8px; }
.sidebar-logo-area { display: none; }
.mobile-logo { font-weight: 800; font-size: 1.1rem; color: var(--accent); display: block; text-decoration: none; white-space: nowrap; }
.filter-bar { display: flex; gap: 5px; overflow-x: auto; scrollbar-width: none; align-items: center; max-width: 40%; }
.filter-bar::-webkit-scrollbar { display: none; }
.filter-pill { padding: 5px 12px; border-radius: 15px; border: 1px solid var(--border); background: var(--bg-input); color: var(--text-sub); font-size: 0.75rem; cursor: pointer; white-space: nowrap; transition: 0.2s; }
.filter-pill.active { background: var(--accent); color: #fff; border-color: var(--accent); }
.search-box { flex: 1; background: var(--bg-input); border-radius: 20px; padding: 5px 10px; display: flex; align-items: center; max-width: 150px; }
.search-input { background: none; border: none; color: var(--text-main); width: 100%; font-size: 0.8rem; outline: none; margin-left: 5px; }
.header-controls { display: flex; gap: 8px; align-items: center; }
.theme-toggle, .auth-btn, .user-avatar-btn { background: none; border: 1px solid var(--border); color: var(--text-main); padding: 4px 8px; border-radius: 12px; cursor: pointer; font-size: 0.8rem; }
.auth-btn.primary { background: var(--accent); border-color: var(--accent); color: white; }
.user-avatar-btn { width: 30px; height: 30px; padding: 0; border-radius: 50%; overflow: hidden; }
.user-avatar-img { width: 100%; height: 100%; object-fit: cover; }

/* Views */
.view-section { display: none; flex: 1; flex-direction: column; overflow: hidden; position: relative; }
.view-section.active-view { display: flex; }
.player-stage { flex: 1; padding: 20px; display: flex; flex-direction: column; align-items: center; justify-content: center; background: var(--bg-secondary); position: relative; overflow-y: auto; }

/* Turntable */
.turntable-system { position: relative; width: 260px; height: 260px; margin-bottom: 20px; background: var(--bg-panel); border-radius: 10px; border: 1px solid var(--border); box-shadow: inset 0 0 20px rgba(0,0,0,0.2), 0 5px 15px var(--shadow); display: flex; align-items: center; justify-content: center; }
.record-platter { width: 220px; height: 220px; position: relative; border-radius: 50%; box-shadow: 0 4px 10px rgba(0,0,0,0.4); }
.vinyl-grooves { position: absolute; top: 0; left: 0; width: 100%; height: 100%; border-radius: 50%; background: repeating-radial-gradient(circle at center, var(--vinyl-black), var(--vinyl-black) 2px, var(--vinyl-groove) 3px, var(--vinyl-groove) 4px); background-image: linear-gradient(135deg, rgba(255,255,255,0.1) 0%, transparent 50%, rgba(255,255,255,0.05) 100%), repeating-radial-gradient(circle at center, var(--vinyl-black), var(--vinyl-black) 2px, var(--vinyl-groove) 3px, var(--vinyl-groove) 4px); }
.vinyl-label { position: absolute; top: 50%; left: 50%; width: 35%; height: 35%; transform: translate(-50%, -50%); border-radius: 50%; object-fit: cover; border: 4px solid var(--bg-secondary); z-index: 2; }
.tonearm-assembly { position: absolute; top: 10px; right: 10px; width: 100px; height: 200px; pointer-events: none; z-index: 10; transform-origin: 85px 25px; transform: rotate(-35deg); transition: transform 0.8s cubic-bezier(0.4, 0.0, 0.2, 1); }
.tonearm-pivot { position: absolute; top: 10px; right: 10px; width: 30px; height: 30px; background: var(--tonearm-metal); border-radius: 50%; border: 2px solid var(--border); box-shadow: 0 2px 5px rgba(0,0,0,0.3); }
.tonearm-arm { position: absolute; top: 25px; right: 25px; width: 8px; height: 140px; background: linear-gradient(90deg, var(--tonearm-metal), #aaa, var(--tonearm-metal)); transform-origin: top center; border-radius: 4px; }
.tonearm-headshell { position: absolute; bottom: 35px; left: 55px; width: 25px; height: 40px; background: var(--tonearm-plastic); border-radius: 4px 4px 10px 10px; transform: rotate(20deg); box-shadow: 1px 1px 3px rgba(0,0,0,0.3); }
.tonearm-headshell::after { content: ''; position: absolute; bottom: -5px; left: 50%; width: 4px; height: 6px; background: #eee; transform: translateX(-50%); border-radius: 2px; }
.turntable-system.is-playing .record-platter { animation: spin-record 1.8s linear infinite; }
.turntable-system.is-playing .tonearm-assembly { transform: rotate(15deg); }
@keyframes spin-record { from { transform: rotate(0deg); } to { transform: rotate(360deg); } }

.track-info { text-align: center; margin-bottom: 10px; width: 100%; }
.track-title { font-size: 1.1rem; margin: 0 0 5px; color: var(--text-main); }
.track-artist { font-size: 0.9rem; color: var(--text-sub); }
.meta-label { font-size: 0.65rem; color: var(--accent); text-transform: uppercase; letter-spacing: 1px; margin-right: 5px; opacity: 0.8; }
.action-row { display: flex; gap: 20px; margin-bottom: 15px; }
.icon-btn { background: none; border: none; color: var(--text-sub); font-size: 1.5rem; cursor: pointer; text-decoration: none; display: flex; align-items: center; justify-content: center; }
.icon-btn.active { color: var(--accent); }
.visualizer-container { width: 100%; height: 50px; background: var(--bg-input); border-radius: 5px; cursor: pointer; margin-bottom: 15px; position: relative; overflow: hidden; }
#wave-canvas { width: 100%; height: 100%; display: block; }
.controls { display: flex; align-items: center; gap: 20px; margin-bottom: 20px; }
.btn-ctrl { background: none; border: none; color: var(--text-main); cursor: pointer; font-size: 2rem; }
.btn-play { width: 60px; height: 60px; border-radius: 50%; background: var(--text-main); color: var(--bg-color); display: flex; align-items: center; justify-content: center; font-size: 1.5rem; }

/* Lists & Pop-up */
.playlist-area { display: none; flex-direction: column; background: var(--bg-color); }
.playlist-area.mobile-active { display: flex; position: fixed; top: 60px; left: 0; right: 0; bottom: 60px; z-index: 30; overflow-y: auto; border-top: 1px solid var(--border); animation: slideUp 0.3s ease-out; }
@keyframes slideUp { from { transform: translateY(100%); } to { transform: translateY(0); } }
#mobile-close-list { display: block; color: var(--accent); background: none; border: none; font-weight: bold; cursor: pointer; font-size: 0.8rem; }
.playlist-header { padding: 15px; font-size: 0.8rem; text-transform: uppercase; color: var(--text-sub); border-bottom: 1px solid var(--border); display: flex; justify-content: space-between; align-items: center; background: var(--bg-secondary); position: sticky; top: 0; }
.playlist-item { display: flex; align-items: center; padding: 10px 15px; border-bottom: 1px solid var(--border); cursor: pointer; }
.playlist-item:hover { background: var(--bg-panel); }
.playlist-item.active .list-title { color: var(--accent); }
.list-thumb { width: 40px; height: 40px; border-radius: 4px; margin-right: 15px; object-fit: cover; }
.list-info { flex: 1; display: flex; flex-direction: column; }
.list-title { color: var(--text-main); font-size: 0.9rem; }
.list-artist { font-size: 0.8rem; color: var(--text-sub); }

/* V12 Extras: Bible & Live */
.live-banner { background: #d32f2f; color: white; padding: 10px; text-align: center; font-weight: bold; cursor: pointer; display: none; animation: pulse 2s infinite; }
@keyframes pulse { 0% { opacity: 1; } 50% { opacity: 0.8; } 100% { opacity: 1; } }
.video-wrapper { position: relative; padding-bottom: 56.25%; height: 0; width: 100%; display: none; margin-bottom: 20px; border-radius: 10px; overflow: hidden; border: 1px solid var(--border); }
.video-wrapper iframe { position: absolute; top: 0; left: 0; width: 100%; height: 100%; }
.bible-controls { display: flex; gap: 10px; margin-bottom: 20px; padding: 20px; border-bottom: 1px solid var(--border); background: var(--bg-secondary); }
.bible-input { flex: 1; background: var(--bg-input); border: 1px solid var(--border); padding: 10px; color: var(--text-main); border-radius: 5px; }
.bible-content { padding: 20px; line-height: 1.8; font-size: 1.1rem; overflow-y: auto; height: 100%; }
.verse-num { font-weight: bold; color: var(--accent); margin-right: 5px; font-size: 0.8rem; vertical-align: super; }

/* Grids & Modals */
.grid-container { padding: 20px; display: grid; grid-template-columns: repeat(2, 1fr); gap: 15px; overflow-y: auto; padding-bottom: 80px; }
.grid-card { background: var(--bg-panel); border-radius: 10px; padding: 15px; text-align: center; cursor: pointer; border: 1px solid var(--border); position: relative; }
.grid-img { width: 80px; height: 80px; border-radius: 50%; object-fit: cover; margin-bottom: 10px; }
.grid-name { color: var(--text-main); font-size: 0.9rem; font-weight: bold; }
.delete-pl-btn { position: absolute; top: 5px; right: 5px; color: #ff5722; background: none; border: none; font-size: 1.2rem; cursor: pointer; }
.modal-overlay { position: fixed; top: 0; left: 0; width: 100%; height: 100%; background: rgba(0,0,0,0.8); z-index: 100; display: none; align-items: center; justify-content: center; }
.modal-overlay.show { display: flex; }
.modal-box { background: var(--bg-secondary); padding: 30px; border-radius: 12px; width: 90%; max-width: 400px; text-align: center; position: relative; border: 1px solid var(--border); display: flex; flex-direction: column; max-height: 80vh; }
.modal-title { margin-top: 0; color: var(--text-main); margin-bottom: 20px; }
.modal-input { width: 100%; padding: 10px; margin: 10px 0; border-radius: 5px; border: 1px solid var(--border); background: var(--bg-input); color: var(--text-main); }
.modal-btn { width: 100%; padding: 10px; background: var(--accent); color: white; border: none; border-radius: 5px; cursor: pointer; font-weight: bold; }
.close-modal { position: absolute; top: 10px; right: 15px; background: none; border: none; font-size: 1.5rem; color: var(--text-sub); cursor: pointer; }
.scroll-list { overflow-y: auto; text-align: left; }
.mini-list-item { padding: 10px; border-bottom: 1px solid var(--border); cursor: pointer; }
.switch-auth { margin-top: 15px; font-size: 0.85rem; color: var(--text-sub); cursor: pointer; text-decoration: underline; }

/* Nav */
.nav-tabs { position: fixed; bottom: 0; left: 0; width: 100%; height: calc(60px + var(--safe-area-bottom)); background: var(--bg-secondary); border-top: 1px solid var(--border); display: flex; justify-content: space-around; align-items: center; z-index: 50; padding-bottom: var(--safe-area-bottom); }
.nav-item { background: none; border: none; color: var(--text-sub); font-size: 0.7rem; display: flex; flex-direction: column; align-items: center; cursor: pointer; }
.nav-item.active { color: var(--accent); }
.nav-icon { font-size: 1.4rem; margin-bottom: 3px; }

/* Desktop */
@media (min-width: 900px) {
    .app-container { display: grid; grid-template-columns: 220px 1fr; grid-template-rows: 60px 1fr; max-width: 100%; }
    .app-header { grid-column: 2 / 3; grid-row: 1 / 2; padding: 0 30px; justify-content: flex-end; }
    .mobile-logo { display: none; }
    .filter-bar { margin-right: auto; border-bottom: none; padding: 0; max-width: none; }
    .search-box { max-width: 250px; margin-right: 20px; }
    .nav-tabs { position: static; height: 100%; width: 100%; grid-column: 1 / 2; grid-row: 1 / 3; flex-direction: column; justify-content: flex-start; padding-top: 0; padding-bottom: 0; border-right: 1px solid var(--border); border-top: none; }
    .nav-item { flex-direction: row; width: 100%; padding: 15px 25px; margin-bottom: 5px; gap: 15px; font-size: 0.9rem; }
    .sidebar-logo-area { display: flex; align-items: center; justify-content: center; padding: 20px 10px; margin-bottom: 10px; border-bottom: 1px solid var(--border); width: 100%; height: 60px; }
    .view-section { grid-column: 2 / 3; grid-row: 2 / 3; background: var(--bg-color); }
    #view-player.active-view { flex-direction: row; }
    .player-stage { flex: 0 0 400px; border-right: 1px solid var(--border); border-bottom: none; justify-content: center; padding: 40px; }
    .playlist-area { display: flex; position: static; padding-bottom: 20px; border-top: none; top: auto; bottom: auto; left: auto; right: auto; }
    #mobile-close-list { display: none !important; }
    .grid-container { grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); padding-bottom: 20px; }
}