/**
 * GETBGM Custom Player - Stylesheet
 * デザインコンセプト: ダークモード × ゴールドアクセント × 透過ブラック
 */

/* ==========================================================================
   Variables
   ========================================================================== */
.gbgm-player,
.gbgm-playlist-container {
    --gbgm-bg:           rgba(0, 0, 0, 0.7);
    --gbgm-bg-solid:     #0a0a0a;
    --gbgm-bg-hover:     rgba(212, 175, 55, 0.06);
    --gbgm-gold:         #D4AF37;
    --gbgm-gold-light:   #F4D87C;
    --gbgm-gold-dark:    #9A7B1F;
    --gbgm-wave:         #333333;
    --gbgm-progress:     #D4AF37;
    --gbgm-cursor:       #F4D87C;
    --gbgm-text:         #ffffff;
    --gbgm-text-muted:   #a8a8a8;
    --gbgm-border:       rgba(212, 175, 55, 0.4);
    --gbgm-border-soft:  rgba(212, 175, 55, 0.15);
    --gbgm-radius:       6px;
    --gbgm-transition:   0.25s cubic-bezier(0.4, 0, 0.2, 1);

    font-family: 'Montserrat', -apple-system, BlinkMacSystemFont, 'Helvetica Neue', sans-serif;
    box-sizing: border-box;
}

.gbgm-player *,
.gbgm-playlist-container * {
    box-sizing: border-box;
}

/* ==========================================================================
   Single Player Container
   ========================================================================== */
.gbgm-player {
    background: var(--gbgm-bg);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    border: 1px solid var(--gbgm-border);
    border-radius: var(--gbgm-radius);
    margin: 16px 0;
    position: relative;
    overflow: hidden;
    box-shadow:
        0 4px 24px rgba(0, 0, 0, 0.4),
        inset 0 1px 0 rgba(212, 175, 55, 0.08);
    transition: border-color var(--gbgm-transition), box-shadow var(--gbgm-transition);
}

.gbgm-player:hover {
    border-color: rgba(212, 175, 55, 0.6);
    box-shadow:
        0 6px 32px rgba(0, 0, 0, 0.5),
        0 0 24px rgba(212, 175, 55, 0.08),
        inset 0 1px 0 rgba(212, 175, 55, 0.12);
}

.gbgm-player.is-playing {
    border-color: var(--gbgm-gold);
    box-shadow:
        0 6px 32px rgba(0, 0, 0, 0.5),
        0 0 32px rgba(212, 175, 55, 0.18),
        inset 0 1px 0 rgba(212, 175, 55, 0.18);
}

/* Layout: Jacket | Body */
.gbgm-player-layout {
    display: flex;
    align-items: stretch;
    gap: 0;
    min-height: 140px;
}

/* ==========================================================================
   Jacket Image
   ========================================================================== */
.gbgm-jacket {
    flex-shrink: 0;
    width: 140px;
    height: 140px;
    background: var(--gbgm-bg-solid);
    background-size: cover;
    background-position: center;
    background-repeat: no-repeat;
    position: relative;
    border-right: 1px solid var(--gbgm-border-soft);
}

.gbgm-jacket-placeholder {
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--gbgm-gold-dark);
    background: linear-gradient(135deg, #1a1a1a 0%, #0a0a0a 100%);
    position: relative;
    overflow: hidden;
}

.gbgm-jacket-placeholder::before {
    content: '';
    position: absolute;
    inset: 0;
    background:
        radial-gradient(circle at 30% 30%, rgba(212, 175, 55, 0.12) 0%, transparent 50%),
        radial-gradient(circle at 70% 70%, rgba(212, 175, 55, 0.06) 0%, transparent 50%);
}

.gbgm-jacket-placeholder svg {
    width: 48px;
    height: 48px;
    opacity: 0.6;
    position: relative;
    z-index: 1;
}

/* Equalizer overlay when playing */
.gbgm-jacket-equalizer {
    position: absolute;
    bottom: 8px;
    right: 8px;
    display: flex;
    align-items: flex-end;
    gap: 2px;
    height: 20px;
    opacity: 0;
    transition: opacity var(--gbgm-transition);
    pointer-events: none;
}

.gbgm-player.is-playing .gbgm-jacket-equalizer {
    opacity: 1;
}

.gbgm-jacket-equalizer span {
    width: 3px;
    background: var(--gbgm-gold);
    border-radius: 1px;
    box-shadow: 0 0 6px var(--gbgm-gold);
    animation: gbgm-eq 0.9s ease-in-out infinite;
}

.gbgm-jacket-equalizer span:nth-child(1) { height: 8px;  animation-delay: 0s; }
.gbgm-jacket-equalizer span:nth-child(2) { height: 14px; animation-delay: 0.15s; }
.gbgm-jacket-equalizer span:nth-child(3) { height: 6px;  animation-delay: 0.3s; }
.gbgm-jacket-equalizer span:nth-child(4) { height: 12px; animation-delay: 0.45s; }

@keyframes gbgm-eq {
    0%, 100% { transform: scaleY(0.4); }
    50%      { transform: scaleY(1); }
}

/* ==========================================================================
   Player Body
   ========================================================================== */
.gbgm-player-body {
    flex: 1;
    min-width: 0;
    padding: 14px 18px;
    display: flex;
    flex-direction: column;
    justify-content: center;
    gap: 10px;
}

/* Track Info */
.gbgm-track-info {
    display: flex;
    flex-direction: column;
    gap: 2px;
    min-width: 0;
}

.gbgm-title {
    font-size: 15px;
    font-weight: 600;
    color: var(--gbgm-text);
    letter-spacing: 0.02em;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.gbgm-artist {
    font-size: 11px;
    font-weight: 500;
    color: var(--gbgm-gold);
    letter-spacing: 0.12em;
    text-transform: uppercase;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* ==========================================================================
   Waveform
   ========================================================================== */
.gbgm-waveform-container {
    position: relative;
    min-height: 60px;
    border-radius: 4px;
    overflow: hidden;
    background: rgba(0, 0, 0, 0.4);
    border: 1px solid var(--gbgm-border-soft);
}

.gbgm-waveform {
    width: 100%;
    height: 60px;
    cursor: pointer;
}

/* Loading state */
.gbgm-loading {
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    background: rgba(0, 0, 0, 0.6);
    color: var(--gbgm-text-muted);
    font-size: 12px;
    letter-spacing: 0.08em;
    transition: opacity var(--gbgm-transition);
    z-index: 5;
}

.gbgm-loading.hidden {
    opacity: 0;
    pointer-events: none;
}

.gbgm-spinner {
    width: 18px;
    height: 18px;
    border: 2px solid rgba(212, 175, 55, 0.2);
    border-top-color: var(--gbgm-gold);
    border-radius: 50%;
    animation: gbgm-spin 0.7s linear infinite;
}

@keyframes gbgm-spin {
    to { transform: rotate(360deg); }
}

/* Error state */
.gbgm-error-message {
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #e07070;
    font-size: 12px;
    text-align: center;
    padding: 0 12px;
}

/* ==========================================================================
   Controls
   ========================================================================== */
.gbgm-controls {
    display: flex;
    align-items: center;
    gap: 14px;
    flex-wrap: wrap;
}

/* Play Button */
.gbgm-play-btn {
    flex-shrink: 0;
    width: 38px;
    height: 38px;
    border-radius: 50%;
    border: 1px solid var(--gbgm-gold);
    background: transparent;
    color: var(--gbgm-gold);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all var(--gbgm-transition);
    position: relative;
}

.gbgm-play-btn::before {
    content: '';
    position: absolute;
    inset: -4px;
    border-radius: 50%;
    background: radial-gradient(circle, var(--gbgm-gold) 0%, transparent 70%);
    opacity: 0;
    transition: opacity var(--gbgm-transition);
    z-index: -1;
    filter: blur(8px);
}

.gbgm-play-btn:hover {
    background: var(--gbgm-gold);
    color: #000;
    transform: scale(1.05);
}

.gbgm-play-btn:hover::before {
    opacity: 0.6;
}

.gbgm-play-btn:active {
    transform: scale(0.95);
}

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

.gbgm-play-btn .gbgm-icon-pause { display: none; }
.gbgm-player.is-playing .gbgm-play-btn .gbgm-icon-play  { display: none; }
.gbgm-player.is-playing .gbgm-play-btn .gbgm-icon-pause { display: block; }

.gbgm-player.is-playing .gbgm-play-btn {
    background: var(--gbgm-gold);
    color: #000;
    box-shadow: 0 0 16px rgba(212, 175, 55, 0.5);
}

/* Prev/Next */
.gbgm-prev-btn,
.gbgm-next-btn {
    width: 30px;
    height: 30px;
    border-radius: 50%;
    border: none;
    background: transparent;
    color: var(--gbgm-text-muted);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all var(--gbgm-transition);
}

.gbgm-prev-btn:hover,
.gbgm-next-btn:hover {
    color: var(--gbgm-gold);
    background: rgba(212, 175, 55, 0.1);
}

.gbgm-prev-btn svg,
.gbgm-next-btn svg {
    width: 14px;
    height: 14px;
}

.gbgm-playlist-controls {
    display: flex;
    align-items: center;
    gap: 4px;
}

/* Time */
.gbgm-time {
    font-size: 12px;
    font-weight: 500;
    font-variant-numeric: tabular-nums;
    color: var(--gbgm-text-muted);
    letter-spacing: 0.05em;
    flex-shrink: 0;
}

.gbgm-time .gbgm-current-time {
    color: var(--gbgm-gold);
}

.gbgm-time .gbgm-separator {
    margin: 0 4px;
    opacity: 0.5;
}

/* Volume */
.gbgm-volume-control {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-left: auto;
    flex-shrink: 0;
}

.gbgm-volume-btn {
    width: 28px;
    height: 28px;
    border-radius: 50%;
    border: none;
    background: transparent;
    color: var(--gbgm-text-muted);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all var(--gbgm-transition);
}

.gbgm-volume-btn:hover {
    color: var(--gbgm-gold);
}

.gbgm-volume-btn svg {
    width: 16px;
    height: 16px;
}

.gbgm-volume-btn .gbgm-icon-volume-mute { display: none; }
.gbgm-volume-control.muted .gbgm-icon-volume-on   { display: none; }
.gbgm-volume-control.muted .gbgm-icon-volume-mute { display: block; }

.gbgm-volume-slider {
    -webkit-appearance: none;
    appearance: none;
    width: 80px;
    height: 3px;
    background: var(--gbgm-wave);
    border-radius: 2px;
    outline: none;
    cursor: pointer;
}

.gbgm-volume-slider::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 12px;
    height: 12px;
    background: var(--gbgm-gold);
    border-radius: 50%;
    cursor: pointer;
    box-shadow: 0 0 8px rgba(212, 175, 55, 0.5);
    transition: transform var(--gbgm-transition);
}

.gbgm-volume-slider::-webkit-slider-thumb:hover {
    transform: scale(1.2);
}

.gbgm-volume-slider::-moz-range-thumb {
    width: 12px;
    height: 12px;
    background: var(--gbgm-gold);
    border: none;
    border-radius: 50%;
    cursor: pointer;
    box-shadow: 0 0 8px rgba(212, 175, 55, 0.5);
}

/* ==========================================================================
   Playlist Container
   ========================================================================== */
.gbgm-playlist-container {
    background: var(--gbgm-bg);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    border: 1px solid var(--gbgm-border);
    border-radius: var(--gbgm-radius);
    margin: 16px 0;
    overflow: hidden;
    box-shadow: 0 4px 24px rgba(0, 0, 0, 0.4);
}

.gbgm-playlist-container .gbgm-player {
    margin: 0;
    border: none;
    border-radius: 0;
    border-bottom: 1px solid var(--gbgm-border-soft);
    box-shadow: none;
}

.gbgm-playlist-container .gbgm-player:hover {
    border-color: transparent;
    border-bottom-color: var(--gbgm-border-soft);
    box-shadow: none;
}

/* Playlist Header */
.gbgm-playlist-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 14px 20px;
    border-bottom: 1px solid var(--gbgm-border-soft);
    background: linear-gradient(180deg, rgba(212, 175, 55, 0.04), transparent);
}

.gbgm-playlist-name {
    margin: 0;
    font-size: 14px;
    font-weight: 600;
    color: var(--gbgm-gold);
    letter-spacing: 0.1em;
    text-transform: uppercase;
}

.gbgm-track-count {
    font-size: 11px;
    font-weight: 500;
    color: var(--gbgm-text-muted);
    letter-spacing: 0.1em;
}

/* Track List */
.gbgm-tracklist {
    list-style: none;
    margin: 0;
    padding: 0;
    max-height: 360px;
    overflow-y: auto;
}

.gbgm-tracklist::-webkit-scrollbar {
    width: 6px;
}

.gbgm-tracklist::-webkit-scrollbar-track {
    background: transparent;
}

.gbgm-tracklist::-webkit-scrollbar-thumb {
    background: var(--gbgm-wave);
    border-radius: 3px;
}

.gbgm-tracklist::-webkit-scrollbar-thumb:hover {
    background: var(--gbgm-gold-dark);
}

.gbgm-track-item {
    display: flex;
    align-items: center;
    padding: 10px 20px;
    gap: 12px;
    cursor: pointer;
    transition: background var(--gbgm-transition);
    border-bottom: 1px solid rgba(212, 175, 55, 0.05);
    position: relative;
}

.gbgm-track-item:last-child {
    border-bottom: none;
}

.gbgm-track-item::before {
    content: '';
    position: absolute;
    left: 0;
    top: 0;
    bottom: 0;
    width: 2px;
    background: var(--gbgm-gold);
    opacity: 0;
    transition: opacity var(--gbgm-transition);
}

.gbgm-track-item:hover {
    background: var(--gbgm-bg-hover);
}

.gbgm-track-item.active {
    background: rgba(212, 175, 55, 0.08);
}

.gbgm-track-item.active::before {
    opacity: 1;
}

.gbgm-track-jacket-mini {
    width: 36px;
    height: 36px;
    background: var(--gbgm-bg-solid);
    background-size: cover;
    background-position: center;
    border-radius: 3px;
    flex-shrink: 0;
    border: 1px solid var(--gbgm-border-soft);
}

.gbgm-track-number {
    font-size: 12px;
    font-weight: 500;
    color: var(--gbgm-text-muted);
    width: 22px;
    text-align: center;
    flex-shrink: 0;
    font-variant-numeric: tabular-nums;
}

.gbgm-track-item.active .gbgm-track-number {
    color: var(--gbgm-gold);
}

.gbgm-track-details {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.gbgm-track-title {
    font-size: 13px;
    font-weight: 500;
    color: var(--gbgm-text);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.gbgm-track-item.active .gbgm-track-title {
    color: var(--gbgm-gold);
}

.gbgm-track-artist {
    font-size: 11px;
    color: var(--gbgm-text-muted);
    letter-spacing: 0.05em;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* Playing indicator */
.gbgm-track-playing-indicator {
    display: none;
    align-items: flex-end;
    gap: 2px;
    height: 14px;
}

.gbgm-track-item.active.playing .gbgm-track-playing-indicator {
    display: flex;
}

.gbgm-track-playing-indicator span {
    width: 3px;
    background: var(--gbgm-gold);
    border-radius: 1px;
    box-shadow: 0 0 6px var(--gbgm-gold);
    animation: gbgm-eq 0.9s ease-in-out infinite;
}

.gbgm-track-playing-indicator span:nth-child(1) { height: 6px;  animation-delay: 0s; }
.gbgm-track-playing-indicator span:nth-child(2) { height: 12px; animation-delay: 0.15s; }
.gbgm-track-playing-indicator span:nth-child(3) { height: 8px;  animation-delay: 0.3s; }

/* ==========================================================================
   Error
   ========================================================================== */
.gbgm-error {
    background: rgba(224, 112, 112, 0.05);
    border: 1px solid rgba(224, 112, 112, 0.3);
    color: #e07070;
    padding: 14px 18px;
    border-radius: var(--gbgm-radius);
    margin: 16px 0;
    font-size: 13px;
    font-family: 'Montserrat', sans-serif;
}

/* ==========================================================================
   Responsive
   ========================================================================== */
@media (max-width: 600px) {
    .gbgm-player-layout {
        flex-direction: column;
        min-height: 0;
    }

    .gbgm-jacket {
        width: 100%;
        height: 140px;
        border-right: none;
        border-bottom: 1px solid var(--gbgm-border-soft);
    }

    .gbgm-player-body {
        padding: 12px 14px;
    }

    .gbgm-controls {
        gap: 10px;
    }

    .gbgm-volume-slider {
        width: 60px;
    }

    .gbgm-playlist-header {
        padding: 12px 16px;
    }

    .gbgm-track-item {
        padding: 10px 16px;
    }
}
