/* Windows Vista Aero Taskbar - Authentic Glass Design */
.music-bar {
    position: fixed;
    left: 0;
    bottom: 0;
    width: 100vw;
    height: 40px; /* Vista taskbar height */
    z-index: 99999;
    
    /* Vista Aero Glass Background */
    background: linear-gradient(180deg, 
        rgba(20, 20, 20, 0.95) 0%,
        rgba(10, 10, 10, 0.98) 50%,
        rgba(0, 0, 0, 0.99) 100%
    );
    
    /* Glass blur effect */
    backdrop-filter: blur(20px) saturate(180%);
    -webkit-backdrop-filter: blur(20px) saturate(180%);
    
    color: #fff;
    display: flex;
    visibility: visible !important;
    align-items: center;
    gap: 6px;
    padding: 0 12px;
    
    /* Performance optimizations */
    contain: layout style paint;
    will-change: auto;
    
    /* Vista-style border and shadow */
    border-top: 1px solid rgba(255, 255, 255, 0.1);
    box-shadow: 
        0 -2px 8px rgba(0, 0, 0, 0.4),
        inset 0 1px 0 rgba(255, 255, 255, 0.05),
        0 -1px 0 rgba(255, 255, 255, 0.05);
    
    font-family: 'Segoe UI', 'Tahoma', 'Verdana', sans-serif;
    font-size: 12px;
    font-weight: 400;
    
    /* Vista glass texture overlay */
}

/* Vista glass texture overlay */
.music-bar::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: 
        /* Custom Vista texture overlay */
        url('https://i.imgur.com/gQPNALP.png') repeat-x,
        /* Glass texture overlay */
        radial-gradient(ellipse at center, rgba(255,255,255,0.03) 0%, transparent 70%),
        /* Main black glass gradient */
        linear-gradient(180deg, 
            rgba(0, 0, 0, 0.9) 0%,
            rgba(0, 0, 0, 0.85) 25%,
            rgba(0, 0, 0, 0.8) 50%,
            rgba(0, 0, 0, 0.85) 75%,
            rgba(0, 0, 0, 0.9) 100%
        ),
        /* Deep black base */
        #000;
    pointer-events: none;
    z-index: -1;
}

/* Vista Aero Taskbar Buttons */
.music-bar .bar-btn {
    background: linear-gradient(180deg, 
        rgba(255, 255, 255, 0.12) 0%,
        rgba(255, 255, 255, 0.08) 50%,
        rgba(255, 255, 255, 0.04) 100%
    );
    border: 1px solid rgba(255, 255, 255, 0.15);
    border-radius: 3px;
    color: #fff;
    font-size: 12px;
    font-weight: 400;
    cursor: pointer;
    min-width: 28px;
    height: 28px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    margin: 0 2px;
    padding: 4px 8px;
    contain: layout style;
    
    /* Vista glass effect */
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    
    box-shadow: 
        0 1px 3px rgba(0, 0, 0, 0.2),
        inset 0 1px 0 rgba(255, 255, 255, 0.1);
    
    transition: all 0.15s cubic-bezier(0.4, 0, 0.2, 1);
    position: relative;
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.7);
}

.music-bar .bar-btn:hover {
    background: linear-gradient(180deg, 
        rgba(255, 255, 255, 0.2) 0%,
        rgba(255, 255, 255, 0.15) 50%,
        rgba(255, 255, 255, 0.1) 100%
    );
    border-color: rgba(255, 255, 255, 0.25);
    box-shadow: 
        0 2px 6px rgba(0, 0, 0, 0.3),
        inset 0 1px 0 rgba(255, 255, 255, 0.15),
        0 0 8px rgba(255, 255, 255, 0.1);
}

.music-bar .bar-btn:active {
    background: linear-gradient(180deg, 
        rgba(255, 255, 255, 0.08) 0%,
        rgba(255, 255, 255, 0.12) 50%,
        rgba(255, 255, 255, 0.16) 100%
    );
    box-shadow: 
        inset 0 1px 3px rgba(0, 0, 0, 0.3),
        inset 0 0 2px rgba(0, 0, 0, 0.2);
    transform: translateY(1px);
}

/* Title and info section - MySpace 2009 style */
.bar-info-section {
    flex: 1;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    min-width: 0; /* Required for text-overflow to work in flex items */
    margin: 0 8px;
    padding: 2px 0;
    max-width: calc(100% - 170px);
    width: 100%;
}

.bar-label-row {
    display: flex;
    align-items: center;
    margin-bottom: 2px;
}

.bar-now-playing {
    color: #c4d7f5;
    font-size: 9px;
    font-weight: bold;
    text-shadow: 0 1px 1px rgba(0, 0, 0, 0.4);
    margin-right: 3px;
    text-transform: uppercase;
}

.music-bar .bar-title {
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    font-weight: bold;
    font-size: 10px;
    color: #ffffff;
    text-shadow: 0 1px 1px rgba(0, 0, 0, 0.4);
    letter-spacing: 0.2px;
}

/* Progress bar section - MySpace 2009 style */
.bar-progress-container {
    display: flex;
    align-items: center;
    gap: 4px;
    height: 12px;
    flex: 1;
    min-width: 150px;
}

.bar-time-display, .bar-time-total {
    font-size: 9px;
    color: #c4d7f5;
    flex-shrink: 0;
    text-shadow: 0 1px 1px rgba(0, 0, 0, 0.4);
}

.bar-progress {
    flex: 1;
    display: flex;
    align-items: center;
    height: 8px;
    flex-grow: 1;
    background: rgba(0, 0, 0, 0.25);
    position: relative;
    border-radius: 3px;
    cursor: pointer;
    box-shadow: inset 0 1px 2px rgba(0, 0, 0, 0.3);
    overflow: hidden;
    min-width: 100px;
}

.bar-progress-fill {
    position: absolute;
    left: 0;
    top: 0;
    height: 100%;
    background: linear-gradient(180deg, #7390c3 0%, #5273bc 100%);
    width: 0%;
    border-radius: 3px;
    transition: width 0.1s ease;
    will-change: width;
    transform: translateZ(0); /* Force GPU acceleration */
}

/* MySpace 2009 chat windows styling */
.ms-chat-window {
    position: fixed;
    bottom: 36px; /* Position above music bar */
    right: 20px;
    width: 245px;
    height: 300px;
    background: #fff;
    border: 1px solid #3b5998;
    border-radius: 6px 6px 0 0;
    overflow: hidden;
    box-shadow: 0 0 8px rgba(0, 0, 0, 0.2);
    z-index: 99998;
    font-family: "Lucida Grande", "Lucida Sans Unicode", Arial, sans-serif;
    font-size: 11px;
}

.ms-chat-header {
    background: linear-gradient(180deg, #5273bc 0%, #3b5998 50%, #2d4373 100%);
    color: white;
    padding: 5px 8px;
    font-weight: bold;
    display: flex;
    justify-content: space-between;
    align-items: center;
    height: 24px;
    border-radius: 5px 5px 0 0;
    cursor: pointer;
}

.ms-chat-header .chat-actions {
    display: flex;
    gap: 3px;
}

.ms-chat-header .chat-actions button {
    background: transparent;
    border: none;
    color: white;
    font-size: 11px;
    cursor: pointer;
    width: 16px;
    height: 16px;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0;
}

.ms-chat-body {
    height: calc(100% - 24px);
    display: flex;
    flex-direction: column;
}

.ms-chat-messages {
    flex: 1;
    overflow-y: auto;
    padding: 8px;
    background: #fff;
}

.ms-chat-input {
    border-top: 1px solid #ddd;
    padding: 5px;
    display: flex;
}

.ms-chat-input input {
    flex: 1;
    border: 1px solid #ccc;
    border-radius: 2px;
    padding: 4px;
    font-size: 11px;
    outline: none;
}

/* Minimized chat window */
.ms-chat-window.minimized {
    height: 24px !important;
    overflow: hidden;
    transition: height 0.2s ease-out;
}

/* New message indicator */
.ms-chat-window.new-message .ms-chat-header {
    background: linear-gradient(180deg, #5fad56 0%, #3b9950 50%, #2d7340 100%);
    animation: pulse-header 2s infinite;
}

@keyframes pulse-header {
    0% { background: linear-gradient(180deg, #5273bc 0%, #3b5998 50%, #2d4373 100%); }
    50% { background: linear-gradient(180deg, #5fad56 0%, #3b9950 50%, #2d7340 100%); }
    100% { background: linear-gradient(180deg, #5273bc 0%, #3b5998 50%, #2d4373 100%); }
}

/* Add proper spacing between chat windows */
.ms-chat-window:nth-of-type(1) {
    right: 20px;
}

.ms-chat-window:nth-of-type(2) {
    right: 275px;
}

.ms-chat-window:nth-of-type(3) {
    right: 530px;
}

/* Hover and focus styles for inputs */
.ms-chat-input input:focus {
    border-color: #3b5998;
    box-shadow: 0 0 3px rgba(59, 89, 152, 0.5);
}

/* Chat window container to ensure proper positioning */
#ms-chat-container {
    position: fixed;
    bottom: 36px;
    left: 0;
    right: 0;
    z-index: 99990;
    pointer-events: none; /* Allow clicks to pass through container but not children */
}

#ms-chat-container > * {
    pointer-events: auto; /* Make chat windows and chat bar clickable */
}

/* Friendship status indicators */
.online-indicator {
    display: inline-block;
    width: 10px;
    height: 10px;
    border-radius: 50%;
    background-color: #34D399;
    margin-right: 4px;
    border: 1px solid white;
}

/* Chat bar at bottom of page */
.ms-chat-bar {
    position: fixed;
    right: 20px;
    bottom: 36px;
    background: linear-gradient(180deg, #3b5998 0%, #2b4170 50%, #203766 100%);
    border: 1px solid #4a69a8;
    border-bottom: none;
    border-radius: 6px 6px 0 0;
    color: white;
    font-size: 11px;
    width: 200px;
    font-family: "Lucida Grande", "Lucida Sans Unicode", Arial, sans-serif;
    z-index: 99997;
    box-shadow: 0 -1px 3px rgba(0, 0, 0, 0.3);
}

.ms-chat-friends {
    display: flex;
    flex-direction: column;
}

.ms-chat-status {
    padding: 4px 10px;
    font-weight: bold;
    font-size: 11px;
    cursor: pointer;
    text-align: left;
}

.friend-icons {
    display: none;
    max-height: 300px;
    overflow-y: auto;
    background: white;
    color: #333;
    border-top: 1px solid #ccc;
}

.ms-chat-bar:hover .friend-icons {
    display: block;
}

.friend-icon {
    padding: 5px 10px;
    border-bottom: 1px solid #eee;
    display: flex;
    align-items: center;
    cursor: pointer;
}

.friend-icon:hover {
    background-color: #f0f0f0;
}

/* Message styling */
.ms-chat-messages .message {
    margin-bottom: 6px;
    line-height: 1.3;
}

.ms-chat-messages .message.friend strong {
    color: #3b5998;
}

.ms-chat-messages .message.user strong {
    color: #cc0000;
}

/* Volume controls */
.bar-volume {
    display: flex;
    align-items: center;
    gap: 4px;
    min-width: 70px;
    margin-left: 0;
}

.volume-slider-container {
    width: 70px;
    height: 18px;
    position: relative;
    display: flex;
    align-items: center;
}

.volume-slider {
    -webkit-appearance: none;
    appearance: none;
    width: 100%;
    height: 6px;
    border-radius: 3px;
    background: linear-gradient(180deg, #12326e 0%, #1a3f84 100%);
    outline: none;
    border: 1px solid #2c5294;
    box-shadow: inset 0 1px 3px rgba(0, 0, 0, 0.5);
}

.volume-slider:focus {
    outline: none;
}

.volume-slider::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 14px;
    height: 14px;
    border-radius: 50%;
    background: linear-gradient(180deg, #eef4ff 0%, #94c5ff 100%);
    cursor: pointer;
    border: 1px solid #4b7fd8;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.3);
}

.volume-slider::-moz-range-thumb {
    width: 14px;
    height: 14px;
    border-radius: 50%;
    background: linear-gradient(180deg, #eef4ff 0%, #94c5ff 100%);
    cursor: pointer;
    border: 1px solid #4b7fd8;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.3);
}

/* Volume button hover effect */
.volume-btn:hover {
    background: linear-gradient(180deg, #4777d6 0%, #2a56ab 100%);
}

/* Ensure main content isn't hidden underneath the bar and ALWAYS include space for it */
body {
    padding-bottom: 56px !important; /* Force padding to ensure content is visible */
    margin-bottom: 56px !important; /* Additional margin to be safe */
}

/* Force show the music bar on all pages */
#footer-music-bar {
    display: flex !important;
    opacity: 1 !important;
    visibility: visible !important;
}

/* Hide the non-IM chat bar as per user request */
.ms-chat-bar {
    display: none !important;
}

/* Mobile Optimizations */
/* Playlist button sprite (normal / hover / active) */
#bar-playlist-btn {
    width: 36px;
    height: 36px;
    background: transparent url('/music/Uty99nO.png') no-repeat 0 0 / 36px 108px; /* sprite scaled */
    border: none;
    padding: 0;
    min-width: 36px;
    box-shadow: none;
    backdrop-filter: none !important;
    -webkit-backdrop-filter: none !important;
    transition: none !important;
}
#bar-playlist-btn:hover {
    backdrop-filter: none !important;
    -webkit-backdrop-filter: none !important;
    background: transparent url('/music/Uty99nO.png') no-repeat 0 -36px / 36px 108px !important;
}
#bar-playlist-btn:active,
#bar-playlist-btn:focus,
#bar-playlist-btn:focus:active {
    backdrop-filter: none !important;
    -webkit-backdrop-filter: none !important;
    background: transparent url('/music/Uty99nO.png') no-repeat 0 -72px / 36px 108px !important;
}

#bar-playlist-btn svg {
    display: none;
}

/* Force override if .bar-btn class still present */
.music-bar .bar-btn.playlist-btn,
.music-bar .bar-btn.playlist-btn:hover,
.music-bar .bar-btn.playlist-btn:active,
.music-bar .bar-btn.playlist-btn:focus {
    background: transparent url('/music/Uty99nO.png') no-repeat 0 0 / 36px 108px !important;
    backdrop-filter: none !important;
    -webkit-backdrop-filter: none !important;
    border: none !important;
    box-shadow: none !important;
    transition: none !important;
}
.music-bar .bar-btn.playlist-btn:hover  { background-position: 0 -36px !important; }
.music-bar .bar-btn.playlist-btn:active,
.music-bar .bar-btn.playlist-btn:focus { background-position: 0 -72px !important; }

@media (max-width: 768px) {
    
    .music-bar {
        height: 48px; /* Increase height for better touch interaction */
        gap: 2px;
        padding: 0 4px;
    }

    .music-bar .bar-btn {
        min-width: 30px; /* Larger touch targets */
        height: 30px;
        font-size: 14px; /* Slightly larger icons if using font icons, or ensure SVG scales */
    }
    
    .music-bar .bar-btn svg {
        width: 18px; /* Adjust SVG icon size */
        height: 18px;
    }

    .bar-info-section {
        margin: 0 4px;
        /* Allow info section to shrink more, buttons take precedence */
        max-width: calc(100% - 160px);
    }

    .bar-now-playing {
        font-size: 8px; /* Slightly smaller */
    }

    .music-bar .bar-title {
        font-size: 9px; /* Slightly smaller */
    }
    
    .bar-progress-container {
        min-width: 100px; /* Allow it to shrink more */
        gap: 3px;
    }

    .bar-progress {
        min-width: 60px; /* Allow progress bar to be smaller */
        height: 6px;
    }
    
    .bar-time-display, .bar-time-total {
        font-size: 8px; /* Smaller time display */
    }

    .bar-volume {
        display: none; /* Hide volume controls entirely */
    }

    /* Adjust body padding for new bar height */
    body {
        padding-bottom: 68px !important; /* New height + some buffer */
        margin-bottom: 68px !important;
    }
}

@media (max-width: 480px) {
    .music-bar {
        height: 40px; /* Slightly reduce height for very small screens */
        gap: 1px;
    }

    .music-bar .bar-btn {
        min-width: 28px;
        height: 28px;
    }
    
    .music-bar .bar-btn svg {
        width: 16px;
        height: 16px;
    }
    
    .bar-info-section {
        /* Hide "Now Playing:" text and rely on title only */
        max-width: calc(100% - 92px); /* Adjusted: 120px original - 28px for volume button */
    }

    .bar-now-playing {
        display: none; /* Hide "Now Playing:" text */
    }

    .music-bar .bar-title {
        font-size: 10px; /* Keep title readable */
    }

    .bar-progress-container {
        /* Optionally hide time display if too cluttered */
        /* For now, keep it but allow it to be small */
        min-width: 80px;
    }
    
    .bar-time-display, .bar-time-total {
        font-size: 8px;
    }
    
    .bar-time-total {
        display: none; /* Hide total time to save space */
    }

    .bar-progress {
        min-width: 50px;
    }

    .bar-volume {
        display: none; /* Hide volume controls entirely */
    }
    
    /* Adjust body padding for new bar height */
    body {
        padding-bottom: 60px !important; 
        margin-bottom: 60px !important;
    }
}

/* Messages button styling */
.bar-messages {
    display: flex;
    align-items: center;
    position: relative;
    margin-left: 8px;
}

.messages-btn {
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
}

/* Message notification badge */
.messages-badge {
    position: absolute;
    top: -8px;
    right: -8px;
    background: #ff4757;
    color: white;
    border-radius: 50%;
    width: 18px;
    height: 18px;
    font-size: 11px;
    font-weight: bold;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.3);
    border: 2px solid rgba(0, 0, 0, 0.8);
    z-index: 10;
    animation: pulse 1.5s infinite;
}

/* Pulse animation for the notification badge */
@keyframes pulse {
    0% {
        transform: scale(1);
        box-shadow: 0 2px 4px rgba(0, 0, 0, 0.3), 0 0 0 0 rgba(255, 71, 87, 0.7);
    }
    50% {
        transform: scale(1.1);
        box-shadow: 0 2px 6px rgba(0, 0, 0, 0.4), 0 0 0 6px rgba(255, 71, 87, 0.3);
    }
    100% {
        transform: scale(1);
        box-shadow: 0 2px 4px rgba(0, 0, 0, 0.3), 0 0 0 0 rgba(255, 71, 87, 0);
    }
}

/* Hover effects for messages button */
.messages-btn:hover {
    background: rgba(255, 255, 255, 0.15);
}

.messages-btn:active {
    background: rgba(255, 255, 255, 0.25);
}

/* Mobile responsive adjustments for messages button */
@media (max-width: 768px) {
    .bar-messages {
        margin-left: 4px;
    }
    
    .messages-badge {
        width: 16px;
        height: 16px;
        font-size: 10px;
        top: -6px;
        right: -6px;
    }
}

/* ============================================
   RADIO MODE - Live Stream Animation
   ============================================ */

/* Radio mode: hide time displays, show animation */
.bar-progress-container.radio-mode .bar-time-display,
.bar-progress-container.radio-mode .bar-time-total {
    display: none;
}

.bar-progress-container.radio-mode .bar-progress {
    position: relative;
    overflow: hidden;
    background: linear-gradient(90deg, 
        rgba(30, 60, 120, 0.6) 0%,
        rgba(40, 80, 150, 0.5) 50%,
        rgba(30, 60, 120, 0.6) 100%
    );
    border: 1px solid rgba(100, 150, 255, 0.3);
    box-shadow: 
        inset 0 0 10px rgba(100, 150, 255, 0.2),
        0 0 8px rgba(100, 150, 255, 0.15);
}

/* Hide the normal progress fill in radio mode */
.bar-progress-container.radio-mode .bar-progress-fill {
    display: none;
}

/* Radio wave animation container */
.radio-wave-animation {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 2px;
    padding: 0 8px;
}

/* Individual wave bars */
.radio-wave-bar {
    width: 3px;
    background: linear-gradient(180deg, 
        rgba(100, 180, 255, 0.9) 0%,
        rgba(80, 140, 220, 0.8) 50%,
        rgba(60, 100, 180, 0.7) 100%
    );
    border-radius: 2px;
    animation: radioWave 1.2s ease-in-out infinite;
    box-shadow: 
        0 0 4px rgba(100, 180, 255, 0.5),
        0 0 8px rgba(100, 180, 255, 0.3);
}

/* Stagger the wave animations */
.radio-wave-bar:nth-child(1) { animation-delay: 0s; height: 60%; }
.radio-wave-bar:nth-child(2) { animation-delay: 0.1s; height: 80%; }
.radio-wave-bar:nth-child(3) { animation-delay: 0.2s; height: 100%; }
.radio-wave-bar:nth-child(4) { animation-delay: 0.3s; height: 70%; }
.radio-wave-bar:nth-child(5) { animation-delay: 0.4s; height: 90%; }
.radio-wave-bar:nth-child(6) { animation-delay: 0.5s; height: 50%; }
.radio-wave-bar:nth-child(7) { animation-delay: 0.6s; height: 85%; }
.radio-wave-bar:nth-child(8) { animation-delay: 0.7s; height: 65%; }
.radio-wave-bar:nth-child(9) { animation-delay: 0.8s; height: 95%; }
.radio-wave-bar:nth-child(10) { animation-delay: 0.9s; height: 75%; }
.radio-wave-bar:nth-child(11) { animation-delay: 1.0s; height: 55%; }
.radio-wave-bar:nth-child(12) { animation-delay: 1.1s; height: 85%; }

@keyframes radioWave {
    0%, 100% {
        transform: scaleY(0.3);
        opacity: 0.6;
    }
    50% {
        transform: scaleY(1);
        opacity: 1;
    }
}

/* LIVE indicator */
.radio-live-indicator {
    position: absolute;
    right: 8px;
    top: 50%;
    transform: translateY(-50%);
    display: flex;
    align-items: center;
    gap: 4px;
    font-size: 9px;
    font-weight: 600;
    color: #ff4444;
    text-transform: uppercase;
    letter-spacing: 1px;
    text-shadow: 0 0 4px rgba(255, 68, 68, 0.5);
}

.radio-live-dot {
    width: 6px;
    height: 6px;
    background: #ff4444;
    border-radius: 50%;
    animation: livePulse 1.5s ease-in-out infinite;
    box-shadow: 0 0 6px rgba(255, 68, 68, 0.8);
}

@keyframes livePulse {
    0%, 100% {
        opacity: 1;
        transform: scale(1);
    }
    50% {
        opacity: 0.5;
        transform: scale(0.8);
    }
}

/* Flowing gradient behind waves */
.bar-progress-container.radio-mode .bar-progress::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 200%;
    height: 100%;
    background: linear-gradient(90deg,
        transparent 0%,
        rgba(100, 180, 255, 0.15) 25%,
        rgba(150, 200, 255, 0.25) 50%,
        rgba(100, 180, 255, 0.15) 75%,
        transparent 100%
    );
    animation: radioFlow 3s linear infinite;
}

@keyframes radioFlow {
    0% { transform: translateX(0); }
    100% { transform: translateX(50%); }
}
