@font-face { font-family: 'Morabba'; src: url('../../fonts/Morabba.woff2') format('woff2'); font-weight: normal; }
@font-face { font-family: 'IRANSansX'; src: url('../../fonts/IRANSansX.woff2') format('woff2'); font-weight: normal; }

:root {
    --primary: #6c5ce7;
    --primary-soft: #a29bfe;
    --bg-main: #f8f9fa;
    --card-bg: #ffffff;
    --text-main: #2d3436;
    --text-mute: #b2bec3;
    --border: #dfe6e9;
    --folder-color: #6c5ce7;
    --shadow: 0 10px 30px rgba(108, 92, 231, 0.1);
    --drawer-bg: #ffffff;
    --ctrl-btn-color: #2d3436;
}

body[data-theme="dark"] {
    --bg-main: #18191a;
    --card-bg: #242526;
    --text-main: #e4e6eb;
    --text-mute: #b0b3b8;
    --border: #3a3b3c;
    --shadow: 0 10px 30px rgba(0,0,0,0.5);
    --drawer-bg: #242526;
    --ctrl-btn-color: #e4e6eb;
}

* { box-sizing: border-box; margin: 0; padding: 0; outline: none; -webkit-tap-highlight-color: transparent; }
body { background-color: var(--bg-main); color: var(--text-main); font-family: 'Morabba', sans-serif; height: 100vh; overflow: hidden; transition: background 0.3s, color 0.3s; }

.app-container { display: flex; flex-direction: column; height: 100%; max-width: 800px; margin: 0 auto; position: relative; }

.app-header { display: flex; align-items: center; justify-content: space-between; padding: 15px 20px; gap: 15px; }
.header-right { display: flex; gap: 10px; }
.header-btn { background: var(--card-bg); border: none; width: 40px; height: 40px; border-radius: 12px; cursor: pointer; color: var(--text-main); box-shadow: 0 2px 5px rgba(0,0,0,0.05); display: flex; align-items: center; justify-content: center; transition: 0.2s; }
.header-btn:hover { background: var(--border); }
.exit-btn { color: #ff7675; }

.app-tabs { display: flex; background: var(--card-bg); padding: 5px; border-radius: 12px; box-shadow: 0 2px 10px rgba(0,0,0,0.05); gap: 5px; flex: 1; justify-content: center; max-width: 300px; }
.tab-btn { flex: 1; border: none; background: transparent; padding: 8px; border-radius: 8px; font-family: inherit; font-size: 14px; color: var(--text-mute); cursor: pointer; transition: 0.2s; font-weight: bold; }
.tab-btn.active { background: var(--primary); color: #fff; box-shadow: 0 2px 8px rgba(108, 92, 231, 0.3); }

.app-content { flex: 1; position: relative; overflow: hidden; }
.view-section { position: absolute; inset: 0; padding: 10px 20px 80px; overflow-y: auto; opacity: 0; transform: scale(0.95); pointer-events: none; transition: 0.3s ease; }
.view-section.active { opacity: 1; transform: scale(1); pointer-events: auto; }

.toolbar { background: var(--card-bg); padding: 12px 15px; border-radius: 14px; margin-bottom: 15px; display: flex; justify-content: space-between; align-items: center; box-shadow: var(--shadow); }
.breadcrumb { font-size: 13px; color: var(--text-mute); font-weight: 500; font-family: 'IRANSansX', sans-serif; direction: ltr; }
.tools { display: flex; gap: 8px; }
.tool-btn { background: var(--bg-main); border: none; width: 36px; height: 36px; border-radius: 10px; color: var(--text-main); cursor: pointer; display: flex; align-items: center; justify-content: center; transition: 0.2s; }
.tool-btn:hover { background: var(--primary); color: white; }

.file-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(110px, 1fr)); gap: 15px; }
.file-card { background: var(--card-bg); border-radius: 14px; padding: 15px; display: flex; flex-direction: column; align-items: center; text-align: center; cursor: pointer; transition: 0.2s; border: 2px solid transparent; position: relative; overflow: hidden; }
.file-card:hover { transform: translateY(-3px); box-shadow: var(--shadow); }
.file-card.active-track { border-color: var(--primary); background: rgba(108, 92, 231, 0.05); }
.file-card.active-track .file-name { color: var(--primary); font-weight: bold; }
.file-icon { width: 45px; height: 45px; margin-bottom: 10px; color: var(--text-mute); }
.file-card[data-type="folder"] .file-icon { color: var(--folder-color); }
.file-name { font-size: 12px; color: var(--text-main); width: 100%; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

.file-actions { position: absolute; top: 0; left: 0; right: 0; padding: 5px; display: flex; justify-content: space-between; opacity: 0; transition: 0.2s; background: linear-gradient(to bottom, rgba(0,0,0,0.05), transparent); }
.file-card:hover .file-actions { opacity: 1; }
.action-btn { width: 24px; height: 24px; border-radius: 6px; border: none; cursor: pointer; display: flex; align-items: center; justify-content: center; font-size: 14px; transition: 0.2s; box-shadow: 0 2px 5px rgba(0,0,0,0.1); }
.btn-del { background: #ff7675; color: white; }
.btn-ren { background: #74b9ff; color: white; }
.btn-del:hover { background: #d63031; }
.btn-ren:hover { background: #0984e3; }

.focus-player { height: 100%; display: flex; flex-direction: column; align-items: center; justify-content: center; text-align: center; padding-top: 20px; }
.animation-container { position: relative; width: 180px; height: 180px; display: flex; align-items: center; justify-content: center; margin-bottom: 70px; }
.center-icon { width: 80px; height: 80px; background: var(--primary); border-radius: 50%; display: flex; align-items: center; justify-content: center; z-index: 2; box-shadow: 0 15px 35px rgba(108, 92, 231, 0.4); color: white; }
.pulse-circle { position: absolute; width: 100%; height: 100%; border-radius: 50%; background: var(--primary); opacity: 0; animation: pulse 4s infinite cubic-bezier(0.4, 0, 0.6, 1); }
.delay-1 { animation-delay: 1s; } .delay-2 { animation-delay: 2s; }
@keyframes pulse { 0% { transform: scale(0.5); opacity: 0.4; } 100% { transform: scale(1.6); opacity: 0; } }

.player-controls-large { display: flex; align-items: center; justify-content: center; gap: 40px; margin-bottom: 40px; }
.ctrl-btn { border: none; background: transparent; color: var(--ctrl-btn-color); cursor: pointer; transition: 0.2s; display: flex; align-items: center; justify-content: center; }
.sub-btn { opacity: 0.7; } .sub-btn:hover { opacity: 1; transform: scale(1.1); color: var(--primary); }
.main-btn { width: 65px; height: 65px; background: var(--card-bg); border-radius: 50%; color: var(--primary); box-shadow: var(--shadow); }
.main-btn:hover { transform: scale(1.05); }

.progress-wrapper { width: 100%; max-width: 320px; display: flex; align-items: center; gap: 15px; font-size: 12px; color: var(--text-mute); font-family: sans-serif; font-weight: bold; margin-bottom: 30px; direction: ltr; }
input[type=range] { -webkit-appearance: none; flex: 1; background: transparent; cursor: pointer; border-radius: 5px; height: 6px; }
input[type=range]::-webkit-slider-thumb { -webkit-appearance: none; height: 16px; width: 16px; border-radius: 50%; background: var(--primary); cursor: pointer; margin-top: -5px; box-shadow: 0 0 10px rgba(108, 92, 231, 0.5); border: 2px solid #fff; transition: transform 0.1s; }
input[type=range]::-webkit-slider-thumb:hover { transform: scale(1.2); }
input[type=range]::-webkit-slider-runnable-track { width: 100%; height: 6px; cursor: pointer; background: transparent; border-radius: 5px; }

.effects-row { display: flex; justify-content: center; gap: 20px; margin-bottom: 30px; }
.effect-btn { width: 45px; height: 45px; border-radius: 12px; border: none; background: var(--card-bg); color: var(--text-mute); cursor: pointer; display: flex; align-items: center; justify-content: center; transition: all 0.3s ease; box-shadow: 0 4px 10px rgba(0,0,0,0.05); }
.effect-btn:hover { background: var(--border); transform: translateY(-2px); }
.effect-btn.active { background: var(--primary); color: white; box-shadow: 0 5px 15px rgba(108, 92, 231, 0.4); }

.playlist-toggle-btn { background: var(--card-bg); border: 1px solid var(--border); padding: 10px 20px; border-radius: 50px; display: flex; align-items: center; gap: 8px; font-family: inherit; font-size: 14px; color: var(--text-main); cursor: pointer; transition: 0.2s; box-shadow: 0 4px 10px rgba(0,0,0,0.05); }
.playlist-toggle-btn:hover { background: var(--primary); color: white; border-color: var(--primary); }

.overlay { position: fixed; inset: 0; background: rgba(0,0,0,0.5); z-index: 90; backdrop-filter: blur(2px); transition: 0.3s; }
.playlist-drawer { position: fixed; top: 0; right: 0; bottom: 0; width: 320px; background: var(--drawer-bg); z-index: 100; transform: translateX(100%); transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1); box-shadow: -5px 0 25px rgba(0,0,0,0.1); display: flex; flex-direction: column; }
.playlist-drawer.open { transform: translateX(0); }
.drawer-header { padding: 20px; display: flex; justify-content: space-between; align-items: center; border-bottom: 1px solid var(--border); }
.drawer-header h3 { font-size: 18px; color: var(--text-main); }
.close-btn { background: transparent; border: none; color: var(--text-mute); cursor: pointer; }
.close-btn:hover { color: #ff7675; }
.drawer-content { flex: 1; overflow-y: auto; padding: 10px; }
.plist-item { display: flex; align-items: center; padding: 10px; border-radius: 10px; margin-bottom: 5px; cursor: pointer; transition: 0.2s; justify-content: space-between; }
.plist-item:hover { background: var(--bg-main); }
.plist-item.active { background: rgba(108, 92, 231, 0.1); border: 1px solid var(--primary); }
.plist-info { display: flex; align-items: center; gap: 10px; flex: 1; overflow: hidden; }
.plist-icon { color: var(--primary); width: 24px; height: 24px; }
.plist-name { font-size: 13px; color: var(--text-main); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.plist-actions { display: flex; gap: 5px; }
.mini-btn { width: 28px; height: 28px; border: none; background: transparent; color: var(--text-mute); border-radius: 6px; cursor: pointer; display: flex; align-items: center; justify-content: center; }
.mini-btn:hover { background: var(--border); color: var(--text-main); }

@media (max-width: 600px) {
    .playlist-drawer { top: auto; bottom: 0; right: 0; left: 0; width: 100%; height: 70vh; transform: translateY(100%); border-radius: 20px 20px 0 0; }
    .playlist-drawer.open { transform: translateY(0); }
    .header-btn { width: 35px; height: 35px; }
    .app-tabs { max-width: 100%; }
    .animation-container { width: 160px; height: 160px; margin-bottom: 50px; }
    .center-icon { width: 70px; height: 70px; }
    .player-controls-large { gap: 30px; margin-bottom: 40px; }
    .main-btn { width: 60px; height: 60px; }
}

.loader { width: 30px; height: 30px; border: 3px solid var(--border); border-top-color: var(--primary); border-radius: 50%; animation: spin 0.8s linear infinite; margin: 30px auto; }
@keyframes spin { to { transform: rotate(360deg); } }
.hidden { display: none !important; }