/* Reset and base styles */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
    line-height: 1.6;
    color: #333;
    background-color: #f5f5f5;
}

.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 20px;
}

/* Header styles */
header {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    padding: 2rem;
    border-radius: 10px;
    margin-bottom: 2rem;
    text-align: center;
}

header h1 {
    font-size: 2.5rem;
    margin-bottom: 0.5rem;
}

.user-info {
    margin-top: 1rem;
    font-size: 0.9rem;
}

/* Navigation */
.main-nav {
    display: flex;
    gap: 1rem;
    margin-bottom: 2rem;
    background: white;
    padding: 1rem;
    border-radius: 10px;
    box-shadow: 0 2px 10px rgba(0,0,0,0.1);
}

.main-nav a {
    text-decoration: none;
    color: #666;
    padding: 0.5rem 1rem;
    border-radius: 5px;
    transition: all 0.3s ease;
}

.main-nav a:hover,
.main-nav a.active {
    background: #667eea;
    color: white;
}

/* Album grid */
.albums-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 2rem;
    margin-bottom: 3rem;
}

.album-card {
    background: white;
    padding: 1.5rem;
    border-radius: 10px;
    box-shadow: 0 4px 15px rgba(0,0,0,0.1);
    transition: transform 0.3s ease;
}

.album-card:hover {
    transform: translateY(-5px);
}

.album-card h3 {
    color: #667eea;
    margin-bottom: 0.5rem;
}

.song-count {
    color: #666;
    font-size: 0.9rem;
    margin-bottom: 1rem;
}

.song-list {
    list-style: none;
}

.song-list li {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.5rem 0;
    border-bottom: 1px solid #eee;
}

.song-list li:last-child {
    border-bottom: none;
}

.play-link {
    color: #667eea;
    text-decoration: none;
    font-weight: bold;
}

.play-link:hover {
    color: #764ba2;
}

/* Player styles */
.player-container {
    background: white;
    padding: 2rem;
    border-radius: 10px;
    box-shadow: 0 4px 15px rgba(0,0,0,0.1);
    margin-bottom: 2rem;
}

.now-playing {
    position: relative;
    background: white;
    padding: 2rem;
    border-radius: 15px;
    box-shadow: 0 8px 25px rgba(0,0,0,0.1);
    margin-bottom: 2rem;
}

.song-info h3 {
    color: #667eea;
    font-size: 1.5rem;
    margin-bottom: 0.5rem;
}

.album {
    color: #666;
    font-style: italic;
}

.audio-player {
    width: 100%;
    margin-top: 1rem;
    border-radius: 8px;
    box-shadow: 0 2px 10px rgba(0,0,0,0.1);
}

.audio-controls-info {
    margin-top: 0.5rem;
    color: #666;
    font-size: 0.85rem;
    text-align: center;
}

.song-format {
    color: #888;
    font-size: 0.8rem;
    margin-left: 0.5rem;
}

.no-song-selected {
    text-align: center;
    padding: 3rem 2rem;
}

.no-song-selected h2 {
    color: #667eea;
    margin-bottom: 1rem;
}

.no-song-selected p {
    margin-bottom: 1.5rem;
    color: #666;
}

/* Playlist */
.playlist-section {
    background: white;
    padding: 1.5rem;
    border-radius: 10px;
    box-shadow: 0 4px 15px rgba(0,0,0,0.1);
}

.playlist-item {
    padding: 0.5rem;
    border-radius: 5px;
    margin-bottom: 0.5rem;
    transition: background-color 0.3s ease;
}

.playlist-item.active {
    background: #e3f2fd;
}

.playlist-item a {
    text-decoration: none;
    color: #333;
    display: block;
}

.playlist-item a:hover {
    color: #667eea;
}

.playing-indicator {
    color: #667eea;
    font-weight: bold;
    float: right;
}

/* Forms */
.form-group {
    margin-bottom: 1rem;
}

.form-group label {
    display: block;
    margin-bottom: 0.5rem;
    font-weight: bold;
}

.form-group input,
.form-group select {
    width: 100%;
    padding: 0.75rem;
    border: 1px solid #ddd;
    border-radius: 5px;
    font-size: 1rem;
}

.form-group input:focus,
.form-group select:focus {
    outline: none;
    border-color: #667eea;
    box-shadow: 0 0 0 2px rgba(102, 126, 234, 0.2);
}

/* Buttons */
.btn {
    display: inline-block;
    padding: 0.75rem 1.5rem;
    background: #667eea;
    color: white;
    text-decoration: none;
    border: none;
    border-radius: 5px;
    cursor: pointer;
    transition: background 0.3s ease;
}

.btn:hover {
    background: #5a6fd8;
}

.btn-primary {
    background: #667eea;
}

.btn-primary:hover {
    background: #5a6fd8;
}

.btn-small {
    padding: 0.5rem 1rem;
    font-size: 0.9rem;
}

.btn-block {
    width: 100%;
}

.btn-download {
    background: #28a745;
}

.btn-download:hover {
    background: #218838;
}

/* Alerts */
.alert {
    padding: 1rem;
    border-radius: 5px;
    margin-bottom: 1rem;
}

.alert-success {
    background: #d4edda;
    color: #155724;
    border: 1px solid #c3e6cb;
}

.alert-error {
    background: #f8d7da;
    color: #721c24;
    border: 1px solid #f5c6cb;
}

/* Player Menu - Three Dots Dropdown */
.player-controls {
    position: absolute;
    top: 1rem;
    right: 1rem;
    z-index: 100;
}

.three-dots-menu {
    position: relative;
    display: inline-block;
}

.dots-button {
    background: rgba(255, 255, 255, 0.9);
    border: 1px solid #ddd;
    border-radius: 6px;
    cursor: pointer;
    padding: 8px 6px;
    display: flex;
    flex-direction: column;
    gap: 3px;
    align-items: center;
    transition: all 0.3s ease;
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
}

.dots-button:hover {
    background: rgba(102, 126, 234, 0.1);
    border-color: #667eea;
    transform: translateY(-1px);
}

.dots-button .dot {
    width: 4px;
    height: 4px;
    background-color: #667eea;
    border-radius: 50%;
    transition: background-color 0.3s ease;
}

.dots-button:hover .dot {
    background-color: #5a6fd8;
}

.dropdown-menu {
    display: none;
    position: absolute;
    top: 100%;
    right: 0;
    background-color: white;
    min-width: 140px;
    box-shadow: 0 8px 25px rgba(0,0,0,0.15);
    border-radius: 8px;
    margin-top: 8px;
    overflow: hidden;
    border: 1px solid #e9ecef;
    z-index: 1000;
}

.dropdown-menu.show {
    display: block;
    animation: menuFadeIn 0.3s ease;
}

@keyframes menuFadeIn {
    from { 
        opacity: 0; 
        transform: translateY(-10px); 
    }
    to { 
        opacity: 1; 
        transform: translateY(0); 
    }
}

.dropdown-menu a {
    color: #333;
    padding: 12px 16px;
    text-decoration: none;
    display: flex;
    align-items: center;
    gap: 8px;
    transition: background-color 0.2s ease;
    font-size: 0.9rem;
    font-weight: 500;
}

.dropdown-menu a:hover {
    background-color: #f8f9fa;
}

.dropdown-menu a:first-child {
    border-bottom: 1px solid #e9ecef;
}

/* Enhanced Audio Controls with Seek Bar */
.audio-controls {
    margin-top: 1.5rem;
    padding: 1rem;
    background: #f8f9fa;
    border-radius: 10px;
    border: 1px solid #e9ecef;
}

.seek-container {
    display: flex;
    align-items: center;
    gap: 1rem;
    margin-top: 1rem;
}

.time-display {
    font-family: 'Courier New', monospace;
    font-size: 0.9rem;
    color: #667eea;
    font-weight: 600;
    min-width: 45px;
    text-align: center;
}

.seek-bar {
    flex: 1;
    height: 8px;
    background: #e9ecef;
    border-radius: 4px;
    position: relative;
    cursor: pointer;
    transition: height 0.2s ease;
}

.seek-bar:hover {
    height: 10px;
}

.seek-bar-progress {
    position: absolute;
    left: 0;
    top: 0;
    height: 100%;
    background: linear-gradient(90deg, #667eea 0%, #764ba2 100%);
    border-radius: 4px;
    transition: width 0.1s ease;
    box-shadow: 0 2px 4px rgba(102, 126, 234, 0.3);
}

.seek-bar-thumb {
    position: absolute;
    top: 50%;
    transform: translate(-50%, -50%);
    width: 16px;
    height: 16px;
    background: white;
    border: 3px solid #667eea;
    border-radius: 50%;
    cursor: grab;
    transition: all 0.2s ease;
    box-shadow: 0 2px 8px rgba(102, 126, 234, 0.4);
}

.seek-bar-thumb:hover {
    width: 18px;
    height: 18px;
    border-width: 4px;
}

.seek-bar-thumb.dragging {
    cursor: grabbing;
    width: 20px;
    height: 20px;
    border-width: 4px;
    box-shadow: 0 4px 12px rgba(102, 126, 234, 0.6);
}

.seek-bar:hover .seek-bar-thumb {
    opacity: 1;
}

.seek-bar-thumb {
    opacity: 0.8;
}

/* Enhanced player layout */
.now-playing {
    position: relative;
    background: white;
    padding: 2rem;
    border-radius: 15px;
    box-shadow: 0 8px 25px rgba(0,0,0,0.1);
    margin-bottom: 2rem;
}

.song-info {
    margin-bottom: 1.5rem;
    padding-right: 40px; /* Make room for menu button */
}

/* Enhanced playlist */
.playlist-item {
    position: relative;
    padding: 0.75rem;
    border-radius: 8px;
    margin-bottom: 0.5rem;
    transition: all 0.3s ease;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.playlist-item:hover {
    background: #f0f0f0;
    transform: translateX(5px);
}

.playlist-item.active {
    background: #e3f2fd;
    border-left: 4px solid #667eea;
    box-shadow: 0 2px 8px rgba(102, 126, 234, 0.2);
}

.playlist-item a {
    text-decoration: none;
    color: #333;
    font-weight: 500;
    flex: 1;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.song-format {
    color: #888;
    font-size: 0.8rem;
    margin-left: 0.5rem;
}

.playing-indicator {
    color: #667eea;
    font-weight: bold;
    margin-left: 0.5rem;
    animation: pulse 1.5s infinite;
}

@keyframes pulse {
    0% { opacity: 1; transform: scale(1); }
    50% { opacity: 0.6; transform: scale(1.1); }
    100% { opacity: 1; transform: scale(1); }
}

/* Responsive seek bar */
@media (max-width: 768px) {
    .seek-container {
        gap: 0.5rem;
    }
    
    .time-display {
        font-size: 0.8rem;
        min-width: 35px;
    }
    
    .seek-bar {
        height: 6px;
    }
    
    .seek-bar:hover {
        height: 8px;
    }
    
    .seek-bar-thumb {
        width: 14px;
        height: 14px;
    }
    
    .player-controls {
        top: 0.5rem;
        right: 0.5rem;
    }
    
    .dots-button {
        width: 28px;
        height: 28px;
        padding: 6px 4px;
    }
    
    .dots-button .dot {
        width: 4px;
        height: 4px;
    }
    
    .dropdown-menu {
        right: -5px;
        min-width: 120px;
    }
}

/* Admin panel */
.admin-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(400px, 1fr));
    gap: 2rem;
}

.admin-section {
    background: white;
    padding: 1.5rem;
    border-radius: 10px;
    box-shadow: 0 4px 15px rgba(0,0,0,0.1);
}

.admin-section h2 {
    color: #667eea;
    margin-bottom: 1rem;
    font-size: 1.3rem;
}

.admin-form {
    margin-bottom: 1rem;
}

.library-stats {
    background: #f8f9fa;
    padding: 1rem;
    border-radius: 5px;
    margin-bottom: 1rem;
}

.library-stats p {
    margin-bottom: 0.5rem;
    font-weight: bold;
}

.album-contents {
    max-height: 300px;
    overflow-y: auto;
    border: 1px solid #eee;
    border-radius: 5px;
    padding: 1rem;
}

.album-item {
    margin-bottom: 1rem;
    padding-bottom: 1rem;
    border-bottom: 1px solid #eee;
}

.album-item:last-child {
    border-bottom: none;
    margin-bottom: 0;
    padding-bottom: 0;
}

.album-item h4 {
    color: #667eea;
    margin-bottom: 0.5rem;
    font-size: 1.1rem;
}

.album-item ul {
    list-style: none;
    padding-left: 1rem;
}

.album-item li {
    padding: 0.25rem 0;
    color: #555;
}

.file-type {
    color: #888;
    font-size: 0.8rem;
    font-weight: normal;
}

.system-info {
    background: #f8f9fa;
    padding: 1rem;
    border-radius: 5px;
}

.system-info p {
    margin-bottom: 0.5rem;
    font-family: monospace;
    font-size: 0.9rem;
}

/* Login */
.login-container {
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 100vh;
}

.login-box {
    background: white;
    padding: 2rem;
    border-radius: 10px;
    box-shadow: 0 4px 15px rgba(0,0,0,0.1);
    width: 100%;
    max-width: 400px;
}

.login-box h1 {
    text-align: center;
    color: #667eea;
    margin-bottom: 1.5rem;
}

.login-info {
    margin-top: 1.5rem;
    padding: 1rem;
    background: #f8f9fa;
    border-radius: 5px;
    font-size: 0.9rem;
}

.login-info p {
    margin-bottom: 0.5rem;
}

/* Utility classes */
.text-center { text-align: center; }
.mt-1 { margin-top: 0.5rem; }
.mt-2 { margin-top: 1rem; }
.mb-1 { margin-bottom: 0.5rem; }
.mb-2 { margin-bottom: 1rem; }

/* Loading states */
.loading {
    opacity: 0.6;
    pointer-events: none;
}

/* Error states */
.error-message {
    background: #f8d7da;
    color: #721c24;
    padding: 0.75rem;
    border-radius: 5px;
    margin: 0.5rem 0;
    border: 1px solid #f5c6cb;
}

/* Success states */
.success-message {
    background: #d4edda;
    color: #155724;
    padding: 0.75rem;
    border-radius: 5px;
    margin: 0.5rem 0;
    border: 1px solid #c3e6cb;
}

/* Empty folder styling */
.album-item p {
    color: #666;
    font-style: italic;
    margin-top: 0.5rem;
}

/* Visual feedback for dragging */
.seek-bar.dragging .seek-bar-progress {
    background: linear-gradient(90deg, #5a6fd8 0%, #6a4bc2 100%);
}

/* High contrast mode support */
@media (prefers-contrast: high) {
    .seek-bar {
        border: 2px solid #000;
    }
    
    .seek-bar-progress {
        background: #000;
    }
}
/* Fix for menu positioning and seek bar layout */
.now-playing {
    position: relative;
    background: white;
    padding: 2rem;
    border-radius: 15px;
    box-shadow: 0 8px 25px rgba(0,0,0,0.1);
    margin-bottom: 2rem;
}

.song-info {
    margin-bottom: 1.5rem;
    padding-right: 40px; /* Make room for menu button */
}

/* Fix menu positioning */
.player-controls {
    position: absolute;
    top: 1rem;
    right: 1rem;
    z-index: 100;
}

.three-dots-menu {
    position: relative;
    display: inline-block;
}

.dots-button {
    background: rgba(255, 255, 255, 0.9);
    border: 1px solid #ddd;
    border-radius: 6px;
    cursor: pointer;
    padding: 8px 6px;
    display: flex;
    flex-direction: column;
    gap: 3px;
    align-items: center;
    transition: all 0.3s ease;
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
}

.dots-button:hover {
    background: rgba(102, 126, 234, 0.1);
    border-color: #667eea;
    transform: translateY(-1px);
}

.dots-button .dot {
    width: 4px;
    height: 4px;
    background-color: #667eea;
    border-radius: 50%;
    transition: background-color 0.3s ease;
}

.dots-button:hover .dot {
    background-color: #5a6fd8;
}

.dropdown-menu {
    display: none;
    position: absolute;
    top: 100%;
    right: 0;
    background-color: white;
    min-width: 140px;
    box-shadow: 0 8px 25px rgba(0,0,0,0.15);
    border-radius: 8px;
    margin-top: 8px;
    overflow: hidden;
    border: 1px solid #e9ecef;
    z-index: 1000;
}

.dropdown-menu.show {
    display: block;
    animation: menuFadeIn 0.3s ease;
}

@keyframes menuFadeIn {
    from { 
        opacity: 0; 
        transform: translateY(-10px); 
    }
    to { 
        opacity: 1; 
        transform: translateY(0); 
    }
}

.dropdown-menu a {
    color: #333;
    padding: 12px 16px;
    text-decoration: none;
    display: flex;
    align-items: center;
    gap: 8px;
    transition: background-color 0.2s ease;
    font-size: 0.9rem;
    font-weight: 500;
}

.dropdown-menu a:hover {
    background-color: #f8f9fa;
}

.dropdown-menu a:first-child {
    border-bottom: 1px solid #e9ecef;
}

/* Enhanced Audio Controls with Seek Bar */
.audio-controls {
    margin-top: 1.5rem;
    padding: 1rem;
    background: #f8f9fa;
    border-radius: 10px;
    border: 1px solid #e9ecef;
}

.seek-container {
    display: flex;
    align-items: center;
    gap: 1rem;
    margin-top: 1rem;
}

.time-display {
    font-family: 'Courier New', monospace;
    font-size: 0.9rem;
    color: #667eea;
    font-weight: 600;
    min-width: 45px;
    text-align: center;
}

.seek-bar {
    flex: 1;
    height: 8px;
    background: #e9ecef;
    border-radius: 4px;
    position: relative;
    cursor: pointer;
    transition: height 0.2s ease;
}

.seek-bar:hover {
    height: 10px;
}

.seek-bar-progress {
    position: absolute;
    left: 0;
    top: 0;
    height: 100%;
    background: linear-gradient(90deg, #667eea 0%, #764ba2 100%);
    border-radius: 4px;
    transition: width 0.1s ease;
    box-shadow: 0 2px 4px rgba(102, 126, 234, 0.3);
}

.seek-bar-thumb {
    position: absolute;
    top: 50%;
    transform: translate(-50%, -50%);
    width: 16px;
    height: 16px;
    background: white;
    border: 3px solid #667eea;
    border-radius: 50%;
    cursor: grab;
    transition: all 0.2s ease;
    box-shadow: 0 2px 8px rgba(102, 126, 234, 0.4);
}

.seek-bar-thumb:hover {
    width: 18px;
    height: 18px;
    border-width: 4px;
}

.seek-bar-thumb.dragging {
    cursor: grabbing;
    width: 20px;
    height: 20px;
    border-width: 4px;
    box-shadow: 0 4px 12px rgba(102, 126, 234, 0.6);
}

.seek-bar:hover .seek-bar-thumb {
    opacity: 1;
}

.seek-bar-thumb {
    opacity: 0.8;
}

/* Hide seek bar for unseekable content */
.seek-bar.hidden {
    display: none;
}

.time-display.error {
    color: #dc3545;
    font-size: 0.8rem;
}

/* Fix for Infinity:NaN display */
.time-display:contains('Infinity:NaN') {
    color: #dc3545;
    font-size: 0.8rem;
}

/* Enhanced player layout */
.now-playing {
    position: relative;
    background: white;
    padding: 2rem;
    border-radius: 15px;
    box-shadow: 0 8px 25px rgba(0,0,0,0.1);
    margin-bottom: 2rem;
}

.song-info {
    margin-bottom: 1.5rem;
    padding-right: 40px; /* Make room for menu button */
}

/* Responsive seek bar */
@media (max-width: 768px) {
    .seek-container {
        gap: 0.5rem;
    }
    
    .time-display {
        font-size: 0.8rem;
        min-width: 35px;
    }
    
    .seek-bar {
        height: 6px;
    }
    
    .seek-bar:hover {
        height: 8px;
    }
    
    .seek-bar-thumb {
        width: 14px;
        height: 14px;
    }
    
    .player-controls {
        top: 0.5rem;
        right: 0.5rem;
    }
    
    .dots-button {
        width: 28px;
        height: 28px;
        padding: 6px 4px;
    }
    
    .dots-button .dot {
        width: 4px;
        height: 4px;
    }
    
    .dropdown-menu {
        right: -5px;
        min-width: 120px;
    }
}

/* Fix menu button positioning */
#replayIcon, #shuffleIcon {
    font-size: 1.1rem;
    margin-right: 6px;
}

#replayText, #shuffleText {
    font-size: 0.85rem;
}

/* Visual feedback for dragging */
.seek-bar.dragging .seek-bar-progress {
    background: linear-gradient(90deg, #5a6fd8 0%, #6a4bc2 100%);
}

/* High contrast mode support */
@media (prefers-contrast: high) {
    .seek-bar {
        border: 2px solid #000;
    }
    
    .seek-bar-progress {
        background: #000;
    }
}