/**
 * Bandcamp Footer Player Styles
 * Version: 1.0.0
 */

/* ============================================
   FOOTER PLAYER - Main Container
   ============================================ */

.bandcamp-footer-player {
    position: relative;
    width: 100%;
    padding: 15px 20px;
    box-sizing: border-box;
    z-index: 9998;
}

.bandcamp-footer-player .bcp-container {
    display: flex;
    align-items: center;
    gap: 20px;
    max-width: 1400px;
    margin: 0 auto;
    flex-wrap: wrap;
}

/* ============================================
   ALBUM ART
   ============================================ */

.bcp-album-art-container {
    flex-shrink: 0;
}

.bcp-album-art {
    width: 60px;
    height: 60px;
    object-fit: cover;
    border-radius: 4px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
}

/* ============================================
   TRACK INFO
   ============================================ */

.bcp-track-info {
    flex: 1;
    min-width: 200px;
    overflow: hidden;
}

.bcp-track-title {
    font-weight: 600;
    font-size: 1.1em;
    margin-bottom: 4px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.bcp-track-meta {
    font-size: 0.9em;
    opacity: 0.8;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.bcp-artist,
.bcp-album {
    display: inline;
}

.bcp-separator {
    margin: 0 6px;
}

/* ============================================
   CONTROLS
   ============================================ */

.bcp-controls {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-shrink: 0;
}

.bcp-control-btn {
    background: transparent;
    border: none;
    cursor: pointer;
    padding: 8px;
    border-radius: 50%;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    justify-content: center;
}

.bcp-control-btn:hover {
    background: rgba(255, 255, 255, 0.1);
    transform: scale(1.1);
}

.bcp-control-btn:active {
    transform: scale(0.95);
}

.bcp-control-btn svg {
    display: block;
}

.bcp-play-pause {
    width: 48px;
    height: 48px;
}

.bcp-shuffle.bcp-active {
    background: rgba(255, 255, 255, 0.2);
}

/* ============================================
   PROGRESS BAR
   ============================================ */

.bcp-progress-container {
    display: flex;
    align-items: center;
    gap: 12px;
    flex: 1;
    min-width: 250px;
}

.bcp-progress-bar {
    flex: 1;
    height: 6px;
    background: rgba(255, 255, 255, 0.2);
    border-radius: 3px;
    cursor: pointer;
    position: relative;
    overflow: hidden;
}

.bcp-progress-fill {
    height: 100%;
    width: 0;
    border-radius: 3px;
    transition: width 0.1s linear;
}

.bcp-time {
    font-size: 0.85em;
    font-variant-numeric: tabular-nums;
    min-width: 40px;
    text-align: center;
}

/* ============================================
   ACTION BUTTONS
   ============================================ */

.bcp-actions {
    display: flex;
    gap: 10px;
    align-items: center;
    flex-shrink: 0;
}

.bcp-button {
    padding: 10px 20px;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    font-weight: 600;
    text-decoration: none;
    display: inline-block;
    transition: all 0.2s ease;
    font-size: 0.95em;
    white-space: nowrap;
}

.bcp-button:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
}

.bcp-button:active {
    transform: translateY(0);
}

/* ============================================
   NAVIGATION DRAWER - Slide Up Panel
   ============================================ */

.bandcamp-drawer {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    z-index: 9999;
    pointer-events: none;
}

.bandcamp-drawer-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.7);
    opacity: 0;
    transition: opacity 0.3s ease;
    pointer-events: none;
}

.bandcamp-drawer.open .bandcamp-drawer-overlay {
    opacity: 1;
    pointer-events: auto;
}

.bandcamp-drawer-content {
    position: relative;
    max-width: 1200px;
    margin: 0 auto;
    background: inherit;
    box-shadow: 0 -4px 20px rgba(0, 0, 0, 0.5);
    transform: translateY(100%);
    transition: transform 0.4s cubic-bezier(0.4, 0, 0.2, 1);
    max-height: 70vh;
    display: flex;
    flex-direction: column;
    pointer-events: auto;
}

.bandcamp-drawer.open .bandcamp-drawer-content {
    transform: translateY(0);
}

/* ============================================
   DRAWER HEADER
   ============================================ */

.bandcamp-drawer-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 20px 30px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    flex-shrink: 0;
}

.bandcamp-drawer-title {
    font-size: 1.5em;
    font-weight: 700;
    margin: 0;
}

.bandcamp-drawer-back {
    background: transparent;
    border: none;
    cursor: pointer;
    padding: 8px 16px;
    border-radius: 4px;
    transition: background 0.2s ease;
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 1em;
    margin-right: auto;
    margin-left: 10px;
}

.bandcamp-drawer-back:hover {
    background: rgba(255, 255, 255, 0.1);
}

.bandcamp-drawer-close {
    background: transparent;
    border: none;
    cursor: pointer;
    padding: 8px;
    border-radius: 4px;
    transition: background 0.2s ease;
    display: flex;
    align-items: center;
    justify-content: center;
}

.bandcamp-drawer-close:hover {
    background: rgba(255, 255, 255, 0.1);
}

/* ============================================
   DRAWER BODY
   ============================================ */

.bandcamp-drawer-body {
    padding: 20px 30px;
    overflow-y: auto;
    flex: 1;
}

/* Custom scrollbar */
.bandcamp-drawer-body::-webkit-scrollbar {
    width: 10px;
}

.bandcamp-drawer-body::-webkit-scrollbar-track {
    background: rgba(0, 0, 0, 0.2);
}

.bandcamp-drawer-body::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.3);
    border-radius: 5px;
}

.bandcamp-drawer-body::-webkit-scrollbar-thumb:hover {
    background: rgba(255, 255, 255, 0.5);
}

/* ============================================
   ARTIST LIST VIEW
   ============================================ */

.bcp-artist-list {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
    gap: 15px;
    list-style: none;
    padding: 0;
    margin: 0;
}

.bcp-artist-item {
    background: rgba(255, 255, 255, 0.05);
    border-radius: 8px;
    padding: 20px;
    cursor: pointer;
    transition: all 0.2s ease;
    border: 2px solid transparent;
}

.bcp-artist-item:hover {
    background: rgba(255, 255, 255, 0.1);
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
}

.bcp-artist-name {
    font-weight: 600;
    font-size: 1.1em;
    margin-bottom: 6px;
}

.bcp-artist-count {
    font-size: 0.9em;
    opacity: 0.7;
}

/* ============================================
   ALBUM LIST VIEW
   ============================================ */

.bcp-album-list {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
    gap: 20px;
    list-style: none;
    padding: 0;
    margin: 0;
}

.bcp-album-item {
    cursor: pointer;
    transition: all 0.2s ease;
}

.bcp-album-item:hover {
    transform: translateY(-4px);
}

.bcp-album-cover {
    width: 100%;
    aspect-ratio: 1;
    object-fit: cover;
    border-radius: 8px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.4);
    margin-bottom: 12px;
    transition: box-shadow 0.2s ease;
}

.bcp-album-item:hover .bcp-album-cover {
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.6);
}

.bcp-album-info {
    text-align: center;
}

.bcp-album-title {
    font-weight: 600;
    font-size: 1em;
    margin-bottom: 4px;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.bcp-album-artist {
    font-size: 0.9em;
    opacity: 0.7;
}

/* ============================================
   TRACK LIST VIEW
   ============================================ */

.bcp-track-list {
    list-style: none;
    padding: 0;
    margin: 0;
}

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

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

.bcp-track-item.bcp-active {
    background: rgba(255, 255, 255, 0.12);
    border-color: currentColor;
}

.bcp-track-number {
    font-size: 0.9em;
    opacity: 0.6;
    min-width: 30px;
    text-align: center;
}

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

.bcp-track-name {
    font-weight: 500;
    margin-bottom: 2px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.bcp-track-duration {
    font-size: 0.85em;
    opacity: 0.6;
    font-variant-numeric: tabular-nums;
}

/* ============================================
   ALBUM HEADER IN TRACK VIEW
   ============================================ */

.bcp-album-header {
    display: flex;
    align-items: center;
    gap: 20px;
    margin-bottom: 30px;
    padding: 20px;
    background: rgba(255, 255, 255, 0.05);
    border-radius: 8px;
}

.bcp-album-header-art {
    width: 120px;
    height: 120px;
    object-fit: cover;
    border-radius: 8px;
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.4);
}

.bcp-album-header-info h3 {
    font-size: 1.8em;
    margin: 0 0 8px 0;
    font-weight: 700;
}

.bcp-album-header-info p {
    margin: 4px 0;
    opacity: 0.8;
}

/* ============================================
   RESPONSIVE DESIGN
   ============================================ */

@media (max-width: 1024px) {
    .bandcamp-footer-player .bcp-container {
        gap: 15px;
    }
    
    .bcp-progress-container {
        order: 10;
        width: 100%;
        flex-basis: 100%;
    }
}

@media (max-width: 768px) {
    .bandcamp-footer-player .bcp-container {
        flex-direction: column;
        align-items: stretch;
        gap: 12px;
    }
    
    .bcp-track-info {
        text-align: center;
    }
    
    .bcp-controls {
        justify-content: center;
    }
    
    .bcp-actions {
        justify-content: center;
        flex-wrap: wrap;
    }
    
    .bcp-album-art {
        width: 50px;
        height: 50px;
    }
    
    .bandcamp-drawer-content {
        max-height: 80vh;
    }
    
    .bcp-artist-list,
    .bcp-album-list {
        grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
        gap: 12px;
    }
    
    .bcp-album-header {
        flex-direction: column;
        text-align: center;
    }
}

@media (max-width: 480px) {
    .bandcamp-footer-player {
        padding: 12px 15px;
    }
    
    .bandcamp-drawer-header,
    .bandcamp-drawer-body {
        padding: 15px 20px;
    }
    
    .bcp-artist-list,
    .bcp-album-list {
        grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
    }
    
    .bcp-button {
        padding: 8px 16px;
        font-size: 0.9em;
    }
}

/* ============================================
   LOADING STATE
   ============================================ */

.bcp-loading {
    text-align: center;
    padding: 40px;
    opacity: 0.6;
}

.bcp-loading::after {
    content: '...';
    animation: bcp-dots 1.5s infinite;
}

@keyframes bcp-dots {
    0%, 20% { content: '.'; }
    40% { content: '..'; }
    60%, 100% { content: '...'; }
}

/* ============================================
   EMPTY STATE
   ============================================ */

.bcp-empty {
    text-align: center;
    padding: 60px 20px;
    opacity: 0.6;
}

.bcp-empty svg {
    width: 64px;
    height: 64px;
    margin-bottom: 20px;
    opacity: 0.3;
}

/* ============================================
   ACCESSIBILITY
   ============================================ */

.bcp-control-btn:focus,
.bcp-button:focus,
.bandcamp-drawer-close:focus,
.bandcamp-drawer-back:focus {
    outline: 2px solid currentColor;
    outline-offset: 2px;
}

.bcp-artist-item:focus,
.bcp-album-item:focus,
.bcp-track-item:focus {
    outline: 2px solid currentColor;
    outline-offset: 2px;
}

/* Hide focus outline for mouse users */
.bcp-control-btn:focus:not(:focus-visible),
.bcp-button:focus:not(:focus-visible),
.bandcamp-drawer-close:focus:not(:focus-visible),
.bandcamp-drawer-back:focus:not(:focus-visible),
.bcp-artist-item:focus:not(:focus-visible),
.bcp-album-item:focus:not(:focus-visible),
.bcp-track-item:focus:not(:focus-visible) {
    outline: none;
}

/* ============================================
   ANIMATIONS
   ============================================ */

@keyframes slideUp {
    from {
        transform: translateY(100%);
    }
    to {
        transform: translateY(0);
    }
}

@keyframes fadeIn {
    from {
        opacity: 0;
    }
    to {
        opacity: 1;
    }
}

/* Smooth transitions for view changes */
.bcp-view-transition {
    animation: fadeIn 0.3s ease;
}

/* --- Drawer container fixes --- */
.bandcamp-drawer {
    position: fixed !important;
    bottom: 0 !important;
    left: 0 !important;
    right: 0 !important;
    height: 100vh !important; /* full viewport height */
    z-index: 9999 !important;
    pointer-events: none; /* disable clicks when closed */
    display: flex !important;
    flex-direction: column !important;
    justify-content: flex-end !important;
    background: transparent !important;
    transition: background-color 0.3s ease !important;
    overflow: visible !important;
}

/* Enable pointer events and overlay background when open */
.bandcamp-drawer.open {
    pointer-events: auto !important;
    background-color: rgba(0, 0, 0, 0.6) !important; /* optional overlay */
}

/* Overlay styling */
.bandcamp-drawer-overlay {
    position: absolute !important;
    top: 0 !important;
    left: 0 !important;
    right: 0 !important;
    bottom: 0 !important;
    cursor: pointer !important;
    z-index: 1 !important;
}

/* --- Drawer content fixes --- */
.bandcamp-drawer-content {
    position: relative !important;
    max-height: 85vh !important; /* allow tall drawer */
    overflow-y: auto !important; /* scroll if needed */
    transform: translateY(100%) !important; /* start hidden below */
    transition: transform 0.4s cubic-bezier(0.4, 0, 0.2, 1) !important;
    z-index: 10 !important;
    /* Preserve your existing background, border-radius, padding */
}

/* Slide drawer content up when open */
.bandcamp-drawer.open .bandcamp-drawer-content {
    transform: translateY(0) !important;
}

.bandcamp-drawer {
    position: fixed !important;
    bottom: 0 !important;
    left: 0 !important;
    right: 0 !important;
    height: 100vh !important;
    width: 100vw !important;
    max-width: 100% !important;
    z-index: 9999 !important;
    pointer-events: none;
    display: flex !important;
    flex-direction: column !important;
    justify-content: flex-end !important;
    background: transparent !important;
    transition: background-color 0.3s ease !important;
    overflow: visible !important;
    box-sizing: border-box !important;
}

.bandcamp-drawer.open {
    pointer-events: auto !important;
    background-color: rgba(0, 0, 0, 0.6) !important;
}

.bandcamp-drawer-content {
    position: relative !important;
    max-height: 85vh !important;
    width: 100% !important;
    max-width: 100% !important;
    box-sizing: border-box !important;
    overflow-y: auto !important;
    transform: translateY(100%) !important;
    transition: transform 0.4s cubic-bezier(0.4, 0, 0.2, 1) !important;
    z-index: 10 !important;
    padding-left: 20px !important;
    padding-right: 20px !important;
}

.bandcamp-drawer.open .bandcamp-drawer-content {
    transform: translateY(0) !important;
}

.bandcamp-drawer-close {
    position: absolute;
    top: 12px;
    right: 12px;
    background: transparent;
    border: none;
    color: #fff; /* White color for visibility */
    cursor: pointer;
    z-index: 20; /* Higher than drawer content */
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.bandcamp-drawer-close svg {
    width: 20px;
    height: 20px;
    stroke: currentColor;
    stroke-width: 2;
}

.bandcamp-drawer-close:hover {
    color: #4a9eff; /* Highlight on hover */
}
