/* ===================================
   Music Player - スタイル
   =================================== */

:root {
    --music-primary: #ec4899;
    /* Pink */
    --music-secondary: #8b5cf6;
    /* Violet */
    --music-accent: #22d3ee;
    /* Cyan */
}

.music-body {
    background: #050505;
    color: var(--text-primary);
    min-height: 100vh;
    overflow: hidden;
}

.music-bg-gradient {
    background:
        radial-gradient(circle at 0% 0%, rgba(236, 72, 153, 0.15), transparent 40%),
        radial-gradient(circle at 100% 0%, rgba(139, 92, 246, 0.15), transparent 40%),
        radial-gradient(circle at 50% 100%, rgba(34, 211, 238, 0.15), transparent 50%);
}

.music-content {
    position: relative;
    z-index: 10;
    max-width: 1400px;
    margin: 0 auto;
    padding: 30px 40px;
    height: calc(100vh - 100px);
    /* プレイヤーバーの高さ分引く */
    display: flex;
    flex-direction: column;
}

/* ヘッダー */
.music-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 40px;
    flex-shrink: 0;
}

.back-btn {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 16px;
    background: rgba(255, 255, 255, 0.05);
    border-radius: 50px;
    font-size: 0.9rem;
    color: var(--text-secondary);
    transition: all 0.3s ease;
}

.back-btn:hover {
    background: rgba(255, 255, 255, 0.1);
    color: var(--text-primary);
    transform: translateX(-5px);
}

.back-btn svg {
    width: 20px;
    height: 20px;
    fill: currentColor;
}

.music-title {
    font-family: 'Outfit', sans-serif;
    font-size: 2.5rem;
    font-weight: 800;
    background: linear-gradient(135deg, #fff, var(--music-primary), var(--music-secondary));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    letter-spacing: -0.02em;
}

.header-actions {
    display: flex;
    gap: 12px;
}

.glass-btn {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 10px 20px;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 12px;
    color: var(--text-primary);
    font-weight: 600;
    backdrop-filter: blur(10px);
    transition: all 0.3s ease;
}

.glass-btn:hover {
    background: rgba(255, 255, 255, 0.1);
    border-color: rgba(255, 255, 255, 0.3);
    transform: translateY(-2px);
}

.glass-btn.primary {
    background: linear-gradient(135deg, var(--music-primary), var(--music-secondary));
    border: none;
    box-shadow: 0 4px 15px rgba(236, 72, 153, 0.3);
}

.glass-btn.primary:hover {
    box-shadow: 0 6px 20px rgba(236, 72, 153, 0.5);
}

.glass-btn svg {
    width: 20px;
    height: 20px;
    fill: currentColor;
}

/* レイアウト */
.music-layout {
    display: grid;
    grid-template-columns: 280px 1fr;
    gap: 40px;
    flex-grow: 1;
    min-height: 0;
    /* Important for inner scroll */
}

/* サイドバー */
.music-sidebar {
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.sidebar-title {
    font-family: 'Outfit', sans-serif;
    font-size: 1.2rem;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 1px;
}

.folder-grid {
    display: flex;
    flex-direction: column;
    gap: 10px;
    overflow-y: auto;
    padding-right: 8px;
}

.folder-item-music {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 14px 20px;
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid transparent;
    border-radius: 16px;
    cursor: pointer;
    transition: all 0.3s ease;
}

.folder-item-music:hover {
    background: rgba(255, 255, 255, 0.08);
}

.folder-item-music.active {
    background: rgba(139, 92, 246, 0.15);
    border-color: rgba(139, 92, 246, 0.3);
    box-shadow: inset 0 0 10px rgba(139, 92, 246, 0.1);
}

.folder-item-music svg {
    width: 20px;
    height: 20px;
    fill: var(--music-secondary);
}

.folder-item-music.active svg {
    fill: var(--primary-light);
}

.folder-item-name {
    font-weight: 600;
    font-size: 1.05rem;
}

/* メインコンテンツ */
.music-main {
    display: flex;
    flex-direction: column;
    background: rgba(255, 255, 255, 0.03);
    border-radius: 24px;
    border: 1px solid rgba(255, 255, 255, 0.05);
    padding: 30px;
    overflow: hidden;
}

.main-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 30px;
}

.current-folder-title {
    font-family: 'Outfit', sans-serif;
    font-size: 1.8rem;
    font-weight: 700;
}

.folder-controls {
    display: flex;
    gap: 8px;
}

.icon-btn {
    width: 36px;
    height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(255, 255, 255, 0.05);
    border-radius: 10px;
    color: var(--text-secondary);
    transition: all 0.2s ease;
}

.icon-btn:hover {
    background: rgba(255, 255, 255, 0.1);
    color: var(--text-primary);
}

.icon-btn.danger:hover {
    background: rgba(239, 68, 68, 0.2);
    color: #f87171;
}

.icon-btn svg {
    width: 18px;
    height: 18px;
    fill: currentColor;
}

/* トラックリスト */
.track-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
    overflow-y: auto;
    padding-right: 10px;
}

.track-item {
    display: flex;
    align-items: center;
    gap: 20px;
    padding: 12px 20px;
    background: transparent;
    border-radius: 12px;
    transition: all 0.2s ease;
    cursor: pointer;
    border: 1px solid transparent;
}

.track-item:hover {
    background: rgba(255, 255, 255, 0.05);
}

.track-item.playing {
    background: rgba(139, 92, 246, 0.1);
    border-color: rgba(139, 92, 246, 0.2);
}

.track-icon {
    width: 44px;
    height: 44px;
    background: rgba(255, 255, 255, 0.05);
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    overflow: hidden;
}

.track-icon img {
    width: 100%;
    height: 100%;
    object-fit: contain;
}

.track-details {
    flex-grow: 1;
    min-width: 0;
}

.track-title {
    font-weight: 600;
    font-size: 1rem;
    margin-bottom: 2px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.track-type {
    font-size: 0.8rem;
    color: var(--text-muted);
    display: flex;
    align-items: center;
    gap: 6px;
}

.youtube-badge {
    background: rgba(255, 0, 0, 0.1);
    color: #ff6b6b;
    padding: 2px 6px;
    border-radius: 4px;
    font-size: 0.7rem;
    text-transform: uppercase;
    font-weight: 700;
}

.track-actions {
    display: flex;
    gap: 10px;
    opacity: 0;
    transition: opacity 0.2s ease;
}

.track-item:hover .track-actions {
    opacity: 1;
}

/* プレイヤーバー */
.player-bar {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    height: 100px;
    background: rgba(15, 15, 20, 0.8);
    backdrop-filter: blur(20px);
    border-top: 1px solid rgba(255, 255, 255, 0.08);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 40px;
    z-index: 1000;
}

.player-info {
    display: flex;
    align-items: center;
    gap: 16px;
    width: 300px;
}

.current-track-icon {
    width: 60px;
    height: 60px;
    background: rgba(255, 255, 255, 0.05);
    border-radius: 12px;
    overflow: hidden;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.3);
}

.current-track-icon img {
    width: 100%;
    height: 100%;
    object-fit: contain;
}

.current-track-details h3 {
    font-family: 'Outfit', sans-serif;
    font-size: 1rem;
    font-weight: 700;
    margin-bottom: 4px;
}

.current-track-details p {
    font-size: 0.85rem;
    color: var(--text-muted);
}

/* プレイヤーコントロール */
.player-controls {
    flex-grow: 1;
    max-width: 600px;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 10px;
}

.main-controls {
    display: flex;
    align-items: center;
    gap: 24px;
}

.control-btn {
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--text-secondary);
    transition: all 0.2s ease;
}

.control-btn:hover {
    color: var(--text-primary);
    transform: scale(1.1);
}

.control-btn.active {
    color: var(--music-primary);
}

.control-btn svg {
    width: 24px;
    height: 24px;
    fill: currentColor;
}

.play-btn {
    width: 54px;
    height: 54px;
    background: var(--text-primary);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #000;
    transition: all 0.2s ease;
    box-shadow: 0 4px 15px rgba(255, 255, 255, 0.2);
}

.play-btn:hover {
    transform: scale(1.08);
    background: #fff;
    box-shadow: 0 4px 20px rgba(255, 255, 255, 0.4);
}

.play-btn svg {
    width: 32px;
    height: 32px;
    fill: currentColor;
}

/* プログレスバー */
.progress-container {
    width: 100%;
    display: flex;
    align-items: center;
    gap: 12px;
}

.progress-container span {
    font-size: 0.8rem;
    color: var(--text-muted);
    width: 40px;
}

.progress-bar-wrapper {
    flex-grow: 1;
    height: 4px;
    position: relative;
    display: flex;
    align-items: center;
}

#progress-bar {
    width: 100%;
    -webkit-appearance: none;
    background: rgba(255, 255, 255, 0.1);
    height: 4px;
    border-radius: 2px;
    outline: none;
    cursor: pointer;
}

#progress-bar::-webkit-slider-runnable-track {
    height: 4px;
}

#progress-bar::-webkit-slider-thumb {
    -webkit-appearance: none;
    height: 12px;
    width: 12px;
    background: var(--text-primary);
    border-radius: 50%;
    margin-top: -4px;
    box-shadow: 0 0 10px rgba(0, 0, 0, 0.3);
}

/* 音量 */
.player-volume {
    display: flex;
    align-items: center;
    gap: 12px;
    width: 200px;
    justify-content: flex-end;
}

.player-volume svg {
    width: 20px;
    height: 20px;
    fill: var(--text-secondary);
}

#volume-slider {
    width: 100px;
    -webkit-appearance: none;
    background: rgba(255, 255, 255, 0.1);
    height: 4px;
    border-radius: 2px;
    outline: none;
}

#volume-slider::-webkit-slider-thumb {
    -webkit-appearance: none;
    height: 12px;
    width: 12px;
    background: var(--text-primary);
    border-radius: 50%;
}

/* ===================================
   レスポンシブ (極小モバイル最適化)
   =================================== */
@media (max-width: 768px) {
    html {
        font-size: 14px;
    }

    .music-content {
        padding: 15px;
        height: calc(100vh - 80px);
    }

    .music-header {
        margin-bottom: 20px;
    }

    .music-title {
        font-size: 1.8rem;
    }

    .music-layout {
        grid-template-columns: 1fr;
        gap: 20px;
        overflow-y: auto;
    }

    .folder-grid {
        flex-direction: row;
        overflow-x: auto;
        padding-bottom: 10px;
        flex-shrink: 0;
    }

    .folder-item-music {
        padding: 10px 16px;
        white-space: nowrap;
        border-radius: 12px;
    }

    .music-main {
        padding: 15px;
        border-radius: 16px;
    }

    .current-folder-title {
        font-size: 1.4rem;
    }

    .player-bar {
        height: 80px;
        padding: 0 15px;
    }

    .player-info {
        width: 150px;
    }

    .current-track-icon {
        width: 40px;
        height: 40px;
    }

    .current-track-details h3 {
        font-size: 0.9rem;
    }

    .main-controls {
        gap: 12px;
    }

    .play-btn {
        width: 44px;
        height: 44px;
    }

    .play-btn svg {
        width: 24px;
        height: 24px;
    }

    .player-volume {
        display: none;
        /* スマホでは音量バーを非表示にしてスペース確保 */
    }
}

@media (max-width: 480px) {
    html {
        font-size: 12px;
    }

    .music-title {
        font-size: 1.5rem;
    }

    .back-btn {
        padding: 6px 12px;
    }

    .glass-btn {
        padding: 8px 14px;
        font-size: 0.85rem;
    }

    .music-content {
        height: calc(100vh - 70px);
    }

    .player-bar {
        height: 70px;
    }

    .player-info {
        width: 120px;
    }

    .current-track-icon {
        display: none;
        /* 極小画面ではジャケットも隠してコントロールを優先 */
    }

    .track-item {
        padding: 8px 12px;
        gap: 12px;
    }

    .track-icon {
        width: 32px;
        height: 32px;
    }

    .track-title {
        font-size: 0.9rem;
    }
}

/* ドラッグ&ドロップのゴースト */
.sortable-ghost {
    opacity: 0.3;
    background: var(--bg-hover) !important;
}

/* スクロールバー */
::-webkit-scrollbar {
    width: 6px;
}

::-webkit-scrollbar-track {
    background: transparent;
}

::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.1);
    border-radius: 10px;
}

::-webkit-scrollbar-thumb:hover {
    background: rgba(255, 255, 255, 0.2);
}

.empty-state {
    display: flex;
    align-items: center;
    justify-content: center;
    height: 100%;
    color: var(--text-muted);
    font-size: 0.95rem;
}