/*
 * MadDog Music Audio Player - Visual Update (v6 - Integrated Share Styles)
 * Large album art display in header with title above controls
 * 700px width layout
 */

/* ========================================
   PAGE LAYOUT - Full height with sticky footer
   ======================================== */
html {
    height: 100%;
}

body {
    min-height: 100%;
    display: flex;
    flex-direction: column;
}

/* Center wrapper needs to grow */
body > div[align="center"] {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
}

/* Main table fills available space */
#table1 {
    flex: 1;
    display: flex;
    flex-direction: column;
}

#table1 > tbody {
    display: flex;
    flex-direction: column;
    flex: 1;
}

/* Content row grows, footer row stays at bottom */
#table1 > tbody > tr:first-child {
    flex: 1;
}

/* Main Player Container */
#hamster-audio-player {
    width: 800px;
    margin: 0 auto;
    font-family: 'Ubuntu', Arial, sans-serif;
    background: transparent;
}

#media-audio-player {
    width: 750px;
    margin: 0 auto;
    font-family: 'Ubuntu', Arial, sans-serif;
    background: transparent;
}

/* Fixed Header with Large Album Art */
.player-header-embedded {
    position: sticky;
    top: 0;
    background: rgba(0, 0, 0, 0.95);
    padding: 10px 20px;
    z-index: 100;
    border-bottom: 0px solid #333;
    display: flex;
    align-items: flex-start;
    gap: 20px;
}

/* Large Album Art Container (Left Side) */
.header-album-art-container {
    flex-shrink: 0;
    width: 200px;
    height: 200px;
    border-radius: 0px;
    overflow: hidden;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.6);
}

.header-album-art {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: opacity 0.3s ease;
}

/* Controls Section (Right Side) */
.header-controls-section {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 8px;
    min-width: 0;
    overflow: visible;
}

/* Playlist Title (Top of Controls Section) */
.header-playlist-title {
    font-family: 'Ubuntu', Arial, sans-serif;
    font-size: 18px;
	color: rgba(204, 204, 204, 0.6);
    /*color: #cccccc;*/
    text-align: left;
    padding-left: 30px;
    padding-bottom: 12px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    /*opacity: 0.6;*/
	padding-bottom: 38px;
}

.header-playlist-title .playlist-label {
    font-weight: 500;
}

.header-playlist-title .playlist-name {
    font-weight: 400;
}

/* Song Title (Above Controls) */
.header-song-title {
    font-size: 20px;
    font-weight: 600;
    color: #cccaca;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    text-align: left;
    padding-left: 30px;
    padding-bottom: 0px;
    min-height: 28px;
    line-height: 28px;
}

/* Artist Row (with Download/Share buttons) */
.header-artist-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 15px;
    padding-right: 10px;
    overflow: visible;
    margin-top: 0; /* Reduce gap from song title */
}

/* Song Artist */
.header-song-artist {
    font-size: 18px;
    font-weight: 400;
    color: #999;
    min-height: 24px;
    line-height: 24px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    text-align: left;
    padding-left: 30px;
    padding-bottom: 8px;
    flex: 1;
    min-width: 0;
	margin-top: -22px;
}

/* Header Action Buttons (Download & Share) */
.header-action-buttons {
    visibility: hidden; /* Hidden until song is active, but keeps space */
    display: flex;
    flex-direction: row;
    flex-wrap: nowrap;
    align-items: center;
    gap: 8px;
    flex-shrink: 0;
}

.header-action-buttons.visible {
    visibility: visible;
}

.btn-header-action {
    width: 44px;
    height: 44px;
    background: none;
    border: none;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    transition: transform 0.1s;
    padding: 0;
}

.btn-header-action:hover {
    transform: scale(1.1);
}

.btn-header-action:active {
    transform: scale(1.0);
}

.btn-header-action img {
    width: 32px;
    height: 32px;
}

/* Global Controls Layout */
.global-controls {
    display: flex;
    align-items: center;
    gap: 12px;
}

/* Global Play/Pause Button */
.btn-control-global {
    width: 40px;
    height: 40px;
    background: #333;
    border: none;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.2s;
    flex-shrink: 0;
    padding: 0;
}

.btn-control-global:hover {
    background: #444;
}

.btn-control-global img {
    width: 32px;
    height: 32px;
}

/* Global Progress Container */
.global-progress-container {
    display: flex;
    align-items: center;
    gap: 10px;
    flex: 1;
    min-width: 180px;
}

.global-time-current,
.global-time-duration {
    font-size: 12px;
    color: #ffffff;
    min-width: 35px;
    flex-shrink: 0;
}

.global-time-duration {
    text-align: right;
}

/* Global Progress Bar */
.global-progress-bar {
    flex: 1;
    height: 6px;
    background: #333;
    border-radius: 3px;
    overflow: hidden;
    position: relative;
    cursor: pointer;
}

.global-progress-fill {
    height: 100%;
    background: #7c1749;
    width: 0%;
    transition: width 0.2s linear;
    border-radius: 3px;
}

/* Volume Slider Container */
.volume-slider-container {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-shrink: 0;
}

.volume-slider {
    width: 80px;
    height: 6px;
    -webkit-appearance: none;
    appearance: none;
    background: #333;
    border-radius: 3px;
    outline: none;
    cursor: pointer;
}

.volume-slider::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 14px;
    height: 14px;
    background: #7c1749;
    border-radius: 50%;
    cursor: pointer;
    transition: background 0.2s;
}

.volume-slider::-webkit-slider-thumb:hover {
    background: #8c1a52;
}

.volume-slider::-moz-range-thumb {
    width: 14px;
    height: 14px;
    background: #7c1749;
    border-radius: 50%;
    border: none;
    cursor: pointer;
    transition: background 0.2s;
}

.volume-slider::-moz-range-thumb:hover {
    background: #8c1a52;
}

.volume-value {
    font-size: 11px;
    color: #999;
    min-width: 30px;
    text-align: right;
}

/* Mute Button */
.btn-mute {
    width: 40px;
    height: 40px;
    background: #333;
    border: none;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.2s;
    flex-shrink: 0;
    padding: 0;
}

.btn-mute:hover {
    background: #444;
}

.btn-mute img {
    width: 32px;
    height: 32px;
}

/* Loading State */
.loading-container {
    text-align: center;
    padding: 60px 20px;
    color: #999;
}

.loading-spinner {
    border: 4px solid #333;
    border-top: 4px solid #7c1749;
    border-radius: 50%;
    width: 50px;
    height: 50px;
    animation: spin 1s linear infinite;
    margin: 0 auto 20px;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* Error State */
.error-container {
    text-align: center;
    padding: 60px 20px;
    color: #d32f2f;
}

.error-message {
    font-size: 16px;
}

/* Songs Container - Full height, page scrolls */
.songs-container-embedded {
    padding: 10px;
}

/* Custom Scrollbar */
.songs-container-embedded::-webkit-scrollbar {
    width: 8px;
}

.songs-container-embedded::-webkit-scrollbar-track {
    background: rgba(255, 255, 255, 0.05);
    border-radius: 4px;
}

.songs-container-embedded::-webkit-scrollbar-thumb {
    background: #333;
    border-radius: 4px;
}

.songs-container-embedded::-webkit-scrollbar-thumb:hover {
    background: #444;
}

/* Song Row - Transparent Background */
.song-row {
    display: flex;
    align-items: center;
    gap: 15px;
    padding: 7px 15px;
    background: rgba(0, 0, 0, 0.2);
    border-radius: 0px;
    margin-bottom: 2px;
    cursor: pointer;
    transition: background 0.2s ease;
    border: 1px solid transparent;
}

/* Hover State - Light Grey Overlay */
.song-row:hover {
    background: rgba(80, 80, 80, 0.3);
}

/* Active (Playing) State */
.song-row.active {
    background: rgba(80, 80, 80, 0.25);
    
}

/* Album Art Container (Small Thumbnails) */
.album-art-container {
    position: relative;
    flex-shrink: 0;
    width: 100px;
    height: 100px;
    border-radius: 0px;
    overflow: hidden;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.5);
    cursor: pointer;
}

.album-art {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

/* Play Overlay on Album Art */
.play-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(0, 0, 0, 0.3);
    transition: background 0.2s;
}

.song-row:hover .play-overlay {
    background: rgba(0, 0, 0, 0.5);
}

.song-row.active .play-overlay {
    background: rgba(0, 0, 0, 0.4);
}

.play-overlay img {
    width: 32px;
    height: 32px;
    opacity: 0.5;
    filter: drop-shadow(0 2px 4px rgba(0, 0, 0, 0.5));
}

/* Song Info - White Text */
.song-info {
    flex: 1;
    min-width: 175px;
    overflow: hidden;
}

.song-title {
    font-size: 15px;
    font-weight: 500;
    text-align: left;
    color: #ffffff;
    margin-bottom: 4px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.song-artist {
    font-size: 13px;
    text-align: left;
    color: #cccccc;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* Song Controls (Progress + Download + Share) */
.song-controls {
    display: flex;
    align-items: center;
    gap: 12px;
}

/* Progress Container */
.progress-container {
    display: flex;
    align-items: center;
    gap: 8px;
    min-width: 175px;
}

.time-current,
.time-duration {
    font-size: 12px;
    color: #ffffff;
    min-width: 35px;
}

.time-duration {
    text-align: right;
}

/* Progress Bar - Inactive by Default */
.progress-bar {
    flex: 1;
    height: 6px;
    background: #333;
    border-radius: 3px;
    overflow: hidden;
    position: relative;
    cursor: default;
    opacity: 0.6;
}

/* Active Song Progress Bar - Interactive */
.progress-bar.interactive {
    cursor: pointer;
    opacity: 1;
}

.progress-fill {
    height: 100%;
    background: #7c1749;
    width: 0%;
    transition: width 0.2s linear;
    border-radius: 3px;
}

/* Inactive progress bars get grey fill */
.progress-bar:not(.interactive) .progress-fill {
    background: #666;
}

/* Download Button */
.btn-download {
    padding: 6px 10px;
    background: none;
    color: #ffffff;
    border: none;
    border-radius: 6px;
    font-size: 16px;
    cursor: pointer;
    transition: background 0.2s, transform 0.1s;
    line-height: 1;
    display: flex;
    align-items: center;
    justify-content: center;
}

.btn-download:hover {
    background: none;
    transform: translateY(-1px) scale(1.1);
}

.btn-download:active {
    transform: translateY(0);
}

.btn-download img {
    width: 40px;
    height: 40px;
}

/* Icon Placeholders */
.icon-placeholder {
    display: inline-block;
    width: 32px;
    height: 32px;
    background: #333;
    border-radius: 4px;
    line-height: 24px;
    text-align: center;
    color: #fff;
    font-size: 14px;
    font-weight: bold;
}

.icon-play::before { content: "▶"; }
.icon-pause::before { content: "⏸"; }
.icon-volume::before { content: "🔊"; }
.icon-mute::before { content: "🔇"; }
.icon-download::before { content: "⬇"; }

/* Responsive Adjustments */
@media (max-width: 750px) {
    #hamster-audio-player,
    #media-audio-player {
        width: 100%;
    }

    .player-header-embedded {
        flex-direction: column;
        gap: 15px;
    }

    .header-album-art-container {
        width: 150px;
        height: 150px;
    }

    .header-controls-section {
        width: 100%;
    }

    .header-song-title {
        text-align: right;
    }

    .song-row {
        flex-wrap: wrap;
    }

    .song-controls {
        flex-basis: 100%;
        justify-content: space-between;
    }

    .progress-container {
        flex: 1;
        min-width: 0;
    }
}

@media (max-width: 480px) {
    .header-album-art-container {
        width: 120px;
        height: 120px;
    }

    .album-art-container {
        width: 50px;
        height: 50px;
    }

    .song-title {
        font-size: 13px;
    }

    .song-artist {
        font-size: 11px;
    }

    .time-current,
    .time-duration {
        font-size: 11px;
        min-width: 30px;
    }

    .btn-download {
        font-size: 14px;
        padding: 5px 8px;
    }

    .volume-slider {
        width: 60px;
    }

    .volume-value {
        display: none;
    }
}

/* ========================================
   STATIC SCROLL INDICATOR (PAGE SCROLL VERSION)
   Fixed position on right side, fades when near bottom
   ======================================== */

.scroll-indicator-static {
    position: fixed;
    right: calc(50% - 390px); /* Align with right edge of 800px player */
    bottom: 30px;
    z-index: 100;
    transition: opacity 1.0s ease;
    pointer-events: none;
}

.scroll-down-image {
    width: 20px;
    height: auto;
    opacity: 0.6;
    filter: drop-shadow(0 2px 4px rgba(0, 0, 0, 0.5));
    transition: opacity 0.3s ease;
}

.scroll-indicator-static:not(.hidden):hover .scroll-down-image {
    opacity: 1;
}

.scroll-indicator-static.hidden {
    opacity: 0;
}

/* Responsive - adjust position for narrower screens */
@media (max-width: 850px) {
    .scroll-indicator-static {
        right: 20px;
    }
}

/* ========================================
   LOADING SPINNER (Header Album Art)
   ======================================== */
.header-album-art-container {
    position: relative;
}

.hero-loading-spinner {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.7);
    display: none;
    align-items: center;
    justify-content: center;
    z-index: 200;
}

.hero-loading-spinner.active {
    display: flex;
}

.spinner {
    width: 50px;
    height: 50px;
    border: 4px solid rgba(255, 255, 255, 0.3);
    border-top: 4px solid #ffffff;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

/* ========================================
   SHARE POPOVER (Integrated)
   ======================================== */

.share-popover {
    position: fixed;
    width: min(340px, calc(100vw - 24px));
    background: #1a1a1a;
    border: 1px solid #444;
    border-radius: 14px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.6);
    padding: 16px;
    z-index: 99999;
    font-family: 'Ubuntu', Arial, sans-serif;
    opacity: 0;
    transform: translateY(-8px);
    pointer-events: none;
    transition: opacity 0.15s ease, transform 0.15s ease;
}

.share-popover[aria-hidden="false"] {
    opacity: 1;
    transform: translateY(0);
    pointer-events: auto;
}

.share-popover__header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 8px;
    padding-bottom: 10px;
    border-bottom: 1px solid #333;
}

.share-popover__title {
    font-weight: 700;
    font-size: 16px;
    color: #f9cd00;
}

.share-popover__close {
    border: 0;
    background: transparent;
    cursor: pointer;
    font-size: 20px;
    line-height: 1;
    color: #888;
    padding: 4px 8px;
    border-radius: 4px;
    transition: background 0.15s, color 0.15s;
}

.share-popover__close:hover {
    background: #333;
    color: #fff;
}

.share-popover__song {
    font-size: 13px;
    color: #aaa;
    margin-bottom: 12px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.share-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 8px;
    margin-bottom: 12px;
}

.share-option {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 12px;
    border: 1px solid #333;
    border-radius: 10px;
    text-decoration: none;
    color: #fff;
    font-size: 13px;
    transition: background 0.15s, border-color 0.15s;
}

.share-option:hover {
    background: #2a2a2a;
    border-color: #f9cd00;
}

.share-icon {
    width: 28px;
    height: 28px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 8px;
    font-size: 14px;
    font-weight: bold;
    overflow: hidden;
    flex-shrink: 0;
}

.share-icon img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    border-radius: 8px;
}

/* No colored backgrounds when using PNG icons */
.share-icon--email,
.share-icon--whatsapp,
.share-icon--telegram,
.share-icon--messenger,
.share-icon--twitter,
.share-icon--facebook {
    background: transparent;
}

.share-copy {
    width: 100%;
    padding: 12px;
    border-radius: 10px;
    border: 1px solid #f9cd00;
    background: transparent;
    color: #f9cd00;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.15s, color 0.15s;
}

.share-copy:hover {
    background: #f9cd00;
    color: #000;
}

.share-toast {
    margin-top: 10px;
    min-height: 20px;
    font-size: 13px;
    color: #4ade80;
    text-align: center;
}

/* ========================================
   SHARE BUTTON IN SONG ROW
   ======================================== */

.share-button-container {
    position: relative;
    display: inline-block;
}

.btn-share-row {
    padding: 6px 10px;
    background: none;
    color: #ffffff;
    border: none;
    border-radius: 6px;
    font-size: 16px;
    cursor: pointer;
    transition: background 0.2s, transform 0.1s;
    line-height: 1;
    display: flex;
    align-items: center;
    justify-content: center;
}

.btn-share-row:hover {
    background: none;
    transform: translateY(-1px) scale(1.1);
}

.btn-share-row:active {
    transform: translateY(0);
}

.btn-share-row img {
    width: 40px;
    height: 40px;
}

.share-icon-fallback {
    width: 40px;
    height: 40px;
    font-size: 24px;
    color: #f9cd00;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}
