/* 🎵 CloudTunes - Mega Cool Styles */

/* CSS Variables for theming */
:root {
    --primary-color: #6366f1;
    --primary-hover: #4f46e5;
    --secondary-color: #f59e0b;
    --accent-color: #10b981;
    --danger-color: #ef4444;

    --bg-primary: #0f0f23;
    --bg-secondary: #1a1a3e;
    --bg-tertiary: #252552;
    --bg-hover: #2d2d5a;

    --text-primary: #f1f5f9;
    --text-secondary: #cbd5e1;
    --text-muted: #94a3b8;

    --border-color: #334155;
    --shadow-color: rgba(99, 102, 241, 0.2);
    --glow-color: rgba(99, 102, 241, 0.4);

    --gradient-primary: linear-gradient(135deg, #6366f1 0%, #8b5cf6 100%);
    --gradient-secondary: linear-gradient(135deg, #f59e0b 0%, #f97316 100%);
    --gradient-success: linear-gradient(135deg, #10b981 0%, #059669 100%);
}

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

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    background: var(--bg-primary);
    color: var(--text-primary);
    line-height: 1.6;
    overflow-x: hidden;
}

/* Scrollbar styling */
::-webkit-scrollbar {
    width: 8px;
}

::-webkit-scrollbar-track {
    background: var(--bg-secondary);
}

::-webkit-scrollbar-thumb {
    background: var(--primary-color);
    border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
    background: var(--primary-hover);
}

/* App Container */
.app-container {
    display: grid;
    grid-template-areas:
        "header header header"
        "browser player playlist";
    grid-template-columns: 1fr 2fr 300px;
    grid-template-rows: 80px 1fr;
    height: 100vh;
    gap: 1rem;
    padding: 1rem;
    background: radial-gradient(ellipse at top, var(--bg-secondary) 0%, var(--bg-primary) 70%);
}

/* Header */
.header {
    grid-area: header;
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: 16px;
    padding: 1rem 2rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
    box-shadow: 0 4px 20px var(--shadow-color);
    backdrop-filter: blur(10px);
    position: relative;
    overflow: hidden;
}

.header::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255,255,255,0.05), transparent);
    animation: shimmer 3s infinite;
}

.logo {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.logo i {
    font-size: 2rem;
    color: var(--primary-color);
}

.logo h1 {
    font-size: 1.8rem;
    font-weight: 700;
    background: var(--gradient-primary);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

/* Main Content */
.main-content {
    display: contents;
}

/* File Browser */
.file-browser {
    grid-area: browser;
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: 16px;
    padding: 1.5rem;
    overflow-y: auto;
    box-shadow: 0 4px 20px var(--shadow-color);
}

.file-browser h2 {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin-bottom: 1rem;
    color: var(--text-primary);
    font-size: 1.4rem;
    font-weight: 600;
}

.breadcrumb {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin-bottom: 1.5rem;
    padding: 0.75rem;
    background: var(--bg-tertiary);
    border-radius: 8px;
    border: 1px solid var(--border-color);
}

.breadcrumb-item {
    display: flex;
    align-items: center;
    gap: 0.25rem;
    padding: 0.25rem 0.5rem;
    border-radius: 4px;
    cursor: pointer;
    transition: all 0.3s ease;
    color: var(--text-secondary);
}

.breadcrumb-item:hover,
.breadcrumb-item.active {
    background: var(--primary-color);
    color: white;
}

/* File List */
.file-list {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.file-item, .folder-item {
    display: flex;
    align-items: center;
    gap: 1rem;
    padding: 1rem;
    background: var(--bg-tertiary);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    cursor: pointer;
    transition: all 0.3s ease;
    position: relative;
    overflow: hidden;
}

.file-item:hover, .folder-item:hover {
    background: var(--bg-hover);
    border-color: var(--primary-color);
    transform: translateY(-2px);
    box-shadow: 0 8px 25px var(--shadow-color);
}

.file-item.playing {
    background: var(--gradient-primary);
    color: white;
    border-color: var(--primary-color);
    box-shadow: 0 0 20px var(--glow-color);
}

.file-item::before, .folder-item::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255,255,255,0.1), transparent);
    transition: left 0.5s ease;
}

.file-item:hover::before, .folder-item:hover::before {
    left: 100%;
}

.file-icon, .folder-icon {
    font-size: 1.5rem;
    width: 2rem;
    text-align: center;
}

.folder-icon {
    color: var(--secondary-color);
}

.file-icon {
    color: var(--accent-color);
}

.file-info h4 {
    font-weight: 500;
    margin-bottom: 0.25rem;
}

.file-meta {
    color: var(--text-muted);
    font-size: 0.875rem;
}

/* Music Player */
.music-player {
    grid-area: player;
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: 16px;
    padding: 2rem;
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
    box-shadow: 0 4px 20px var(--shadow-color);
    position: relative;
    overflow: hidden;
}

.music-player::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 2px;
    background: var(--gradient-primary);
    opacity: 0;
    animation: pulse-line 2s ease-in-out infinite;
}

.player-header h2 {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 1.4rem;
    font-weight: 600;
    margin-bottom: 0;
}

.track-info {
    display: flex;
    align-items: center;
    gap: 2rem;
    padding: 1.5rem;
    background: var(--bg-tertiary);
    border-radius: 16px;
    border: 1px solid var(--border-color);
}

.track-artwork {
    position: relative;
    width: 120px;
    height: 120px;
    border-radius: 16px;
    background: var(--gradient-primary);
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    box-shadow: 0 8px 25px var(--shadow-color);
}

.artwork-placeholder {
    font-size: 3rem;
    color: white;
    opacity: 0.8;
}

.equalizer {
    position: absolute;
    bottom: 10px;
    right: 10px;
    display: flex;
    align-items: flex-end;
    gap: 3px;
    height: 20px;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.equalizer.active {
    opacity: 1;
}

.equalizer .bar {
    width: 3px;
    background: white;
    border-radius: 2px;
    animation: equalizer 1s ease-in-out infinite;
}

.equalizer .bar:nth-child(1) { animation-delay: 0s; }
.equalizer .bar:nth-child(2) { animation-delay: 0.2s; }
.equalizer .bar:nth-child(3) { animation-delay: 0.4s; }
.equalizer .bar:nth-child(4) { animation-delay: 0.6s; }
.equalizer .bar:nth-child(5) { animation-delay: 0.8s; }

.track-details h3 {
    font-size: 1.5rem;
    font-weight: 600;
    margin-bottom: 0.5rem;
    color: var(--text-primary);
}

.track-details p {
    color: var(--text-secondary);
    margin-bottom: 0.5rem;
}

.track-meta {
    color: var(--text-muted);
    font-size: 0.875rem;
}

/* Progress Bar */
.progress-container {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.progress-bar {
    position: relative;
    height: 6px;
    background: var(--bg-tertiary);
    border-radius: 3px;
    cursor: pointer;
    border: 1px solid var(--border-color);
}

.progress-fill {
    height: 100%;
    background: var(--gradient-primary);
    border-radius: 3px;
    width: 0%;
    transition: width 0.1s ease;
    position: relative;
}

.progress-fill::after {
    content: '';
    position: absolute;
    right: -2px;
    top: 50%;
    transform: translateY(-50%);
    width: 4px;
    height: 4px;
    background: white;
    border-radius: 50%;
    box-shadow: 0 0 10px var(--glow-color);
}

.progress-thumb {
    position: absolute;
    top: 50%;
    width: 16px;
    height: 16px;
    background: white;
    border-radius: 50%;
    transform: translate(-50%, -50%);
    cursor: pointer;
    opacity: 0;
    transition: opacity 0.3s ease;
    box-shadow: 0 2px 10px rgba(0,0,0,0.3);
    border: 2px solid var(--primary-color);
}

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

.time-display {
    display: flex;
    justify-content: space-between;
    color: var(--text-muted);
    font-size: 0.875rem;
    font-variant-numeric: tabular-nums;
}

/* Player Controls */
.player-controls {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 1rem;
}

.control-btn {
    width: 56px;
    height: 56px;
    border: none;
    border-radius: 50%;
    background: var(--bg-tertiary);
    color: var(--text-primary);
    font-size: 1.2rem;
    cursor: pointer;
    transition: all 0.3s ease;
    border: 1px solid var(--border-color);
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
    overflow: hidden;
}

.control-btn:hover:not(:disabled) {
    background: var(--bg-hover);
    border-color: var(--primary-color);
    transform: scale(1.05);
    box-shadow: 0 4px 15px var(--shadow-color);
}

.control-btn.primary {
    width: 80px;
    height: 80px;
    background: var(--gradient-primary);
    color: white;
    font-size: 1.8rem;
    border: none;
    box-shadow: 0 8px 25px var(--shadow-color);
}

.control-btn.primary:hover:not(:disabled) {
    transform: scale(1.1);
    box-shadow: 0 12px 35px var(--glow-color);
}

.control-btn:disabled {
    opacity: 0.4;
    cursor: not-allowed;
}

/* Volume Controls */
.volume-container {
    display: flex;
    align-items: center;
    gap: 1rem;
    padding: 1rem;
    background: var(--bg-tertiary);
    border-radius: 12px;
    border: 1px solid var(--border-color);
}

.volume-slider {
    flex: 1;
    height: 6px;
    background: var(--bg-primary);
    border-radius: 3px;
    outline: none;
    border: none;
    cursor: pointer;
}

.volume-slider::-webkit-slider-thumb {
    appearance: none;
    width: 18px;
    height: 18px;
    background: var(--primary-color);
    border-radius: 50%;
    cursor: pointer;
    box-shadow: 0 2px 10px var(--shadow-color);
    transition: all 0.3s ease;
}

.volume-slider::-webkit-slider-thumb:hover {
    transform: scale(1.2);
    box-shadow: 0 4px 15px var(--glow-color);
}

/* Playlist */
.playlist {
    grid-area: playlist;
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: 16px;
    padding: 1.5rem;
    display: flex;
    flex-direction: column;
    gap: 1rem;
    box-shadow: 0 4px 20px var(--shadow-color);
    overflow-y: auto;
}

.playlist h3 {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.5rem;
    margin-bottom: 1rem;
    font-size: 1.2rem;
    font-weight: 600;
}

.playlist-count {
    background: var(--primary-color);
    color: white;
    padding: 0.25rem 0.5rem;
    border-radius: 12px;
    font-size: 0.75rem;
    font-weight: 500;
}

.playlist-items {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.playlist-empty {
    text-align: center;
    padding: 2rem 1rem;
    color: var(--text-muted);
}

.playlist-empty i {
    font-size: 3rem;
    margin-bottom: 1rem;
    opacity: 0.5;
}

.playlist-empty .subtitle {
    font-size: 0.875rem;
    margin-top: 0.5rem;
}

.playlist-item {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.75rem;
    background: var(--bg-tertiary);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.3s ease;
}

.playlist-item:hover {
    background: var(--bg-hover);
    border-color: var(--primary-color);
}

.playlist-item.current {
    background: var(--gradient-primary);
    color: white;
    border-color: var(--primary-color);
}

.playlist-item-info {
    flex: 1;
    min-width: 0;
}

.playlist-item-info h5 {
    font-weight: 500;
    font-size: 0.875rem;
    margin-bottom: 0.25rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.playlist-item-info p {
    color: var(--text-muted);
    font-size: 0.75rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.playlist-item.current .playlist-item-info p {
    color: rgba(255, 255, 255, 0.8);
}

/* Modern Buttons */
.btn-modern {
    padding: 0.75rem 1.5rem;
    border: none;
    border-radius: 12px;
    background: var(--gradient-primary);
    color: white;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    box-shadow: 0 4px 15px var(--shadow-color);
}

.btn-modern:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 25px var(--glow-color);
}

/* Loading Animation */
.loading {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 3rem;
    color: var(--text-muted);
}

.spinner {
    width: 40px;
    height: 40px;
    border: 3px solid var(--bg-tertiary);
    border-top: 3px solid var(--primary-color);
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin-bottom: 1rem;
}

/* Toast Notifications */
.toast-container {
    position: fixed;
    top: 2rem;
    right: 2rem;
    z-index: 1000;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.toast {
    padding: 1rem 1.5rem;
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    color: var(--text-primary);
    box-shadow: 0 8px 25px var(--shadow-color);
    backdrop-filter: blur(10px);
    transform: translateX(100%);
    animation: slideIn 0.3s ease forwards;
    min-width: 300px;
}

.toast.success {
    border-left: 4px solid var(--accent-color);
}

.toast.error {
    border-left: 4px solid var(--danger-color);
}

.toast.info {
    border-left: 4px solid var(--primary-color);
}

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

@keyframes pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.5; }
}

@keyframes shimmer {
    0% { left: -100%; }
    100% { left: 100%; }
}

@keyframes slideIn {
    from { transform: translateX(100%); }
    to { transform: translateX(0); }
}

@keyframes slideOut {
    from { transform: translateX(0); }
    to { transform: translateX(100%); }
}

@keyframes equalizer {
    0%, 100% { height: 5px; }
    50% { height: 20px; }
}

@keyframes pulse-line {
    0%, 100% { opacity: 0; }
    50% { opacity: 1; }
}

/* Utility Classes */
.pulse {
    animation: pulse 2s ease-in-out infinite;
}

/* Responsive Design */
@media (max-width: 1200px) {
    .app-container {
        grid-template-columns: 1fr 1.5fr 250px;
    }
}

@media (max-width: 768px) {
    .app-container {
        grid-template-areas:
            "header"
            "player"
            "browser"
            "playlist";
        grid-template-columns: 1fr;
        grid-template-rows: 80px auto auto auto;
    }

    .track-info {
        flex-direction: column;
        text-align: center;
        gap: 1rem;
    }

    .track-artwork {
        width: 100px;
        height: 100px;
    }

    .control-btn {
        width: 48px;
        height: 48px;
    }

    .control-btn.primary {
        width: 64px;
        height: 64px;
    }
}

@media (max-width: 480px) {
    .app-container {
        padding: 0.5rem;
        gap: 0.5rem;
    }

    .header {
        padding: 0.75rem 1rem;
    }

    .logo h1 {
        font-size: 1.4rem;
    }

    .music-player,
    .file-browser,
    .playlist {
        padding: 1rem;
    }
}