/* Variables CSS */
:root {
    --bg-main: #121212;
    --bg-card: #181818;
    --bg-elevated: #282828;
    --text-primary: #ffffff;
    --text-muted: #b3b3b3;
    --text-subtle: #6a6a6a;
    --accent: #1db954;
    --accent-hover: #1ed760;
    --border-subtle: #292929;
    --radius-sm: 4px;
    --radius-md: 8px;
    --radius-lg: 12px;
    --transition-fast: 0.1s ease;
    --transition-normal: 0.2s ease;
    --shadow-soft: 0 4px 12px rgba(0, 0, 0, 0.3);
}

/* Reset et base */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
    background: var(--bg-main);
    color: var(--text-primary);
    overflow: hidden;
}

/* Layout principal */
.app {
    display: grid;
    grid-template-columns: 240px minmax(0, 1fr);
    height: 100vh;
    overflow: hidden;
}

/* Sidebar */
.sidebar {
    background: #000;
    padding: 24px 16px;
    display: flex;
    flex-direction: column;
    overflow-y: auto;
}

.logo {
    font-size: 24px;
    font-weight: bold;
    color: var(--accent);
    margin-bottom: 32px;
    padding: 0 12px;
}

.nav-main {
    margin-bottom: 32px;
}

.nav-item {
    display: flex;
    align-items: center;
    gap: 16px;
    padding: 12px 16px;
    color: var(--text-muted);
    text-decoration: none;
    border-radius: var(--radius-md);
    margin-bottom: 4px;
    transition: all var(--transition-fast);
    font-size: 14px;
    font-weight: 600;
}

.nav-item:hover {
    color: var(--text-primary);
    background: var(--bg-elevated);
}

.nav-item.active {
    color: var(--text-primary);
    background: var(--bg-elevated);
}

.nav-secondary {
    margin-top: auto;
}

.nav-secondary h3 {
    font-size: 12px;
    font-weight: 700;
    text-transform: uppercase;
    color: var(--text-subtle);
    margin-bottom: 16px;
    padding: 0 12px;
}

.nav-secondary ul {
    list-style: none;
}

.nav-secondary li {
    padding: 8px 16px;
    color: var(--text-muted);
    cursor: pointer;
    border-radius: var(--radius-md);
    margin-bottom: 2px;
    transition: all var(--transition-fast);
    font-size: 14px;
}

.nav-secondary li:hover {
    color: var(--text-primary);
    background: var(--bg-elevated);
}

/* Main content */
.main {
    background: linear-gradient(to bottom, #1a1a1a 0%, var(--bg-main) 100%);
    overflow-y: auto;
    padding-bottom: 90px;
}

/* Topbar */
.topbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px 32px;
    background: rgba(0, 0, 0, 0.8);
    backdrop-filter: blur(10px);
    position: sticky;
    top: 0;
    z-index: 100;
}

/* Tab headers */
.tab-header {
    padding: 24px 32px 16px;
    border-bottom: 1px solid var(--border-subtle);
}

.tab-header h1 {
    font-size: 28px;
    font-weight: 700;
    color: var(--text-primary);
    margin: 0;
}

.search-wrapper {
    flex: 1;
    max-width: 420px;
}

#search {
    width: 100%;
    padding: 9px 12px;
    border-radius: 999px;
    border: 1px solid transparent;
    background: rgba(0, 0, 0, 0.6);
    color: var(--text-primary);
    outline: none;
    font-size: 14px;
    transition: border var(--transition-fast), background var(--transition-fast), box-shadow var(--transition-fast);
}

#search::placeholder {
    color: var(--text-muted);
}

#search:focus {
    border-color: var(--accent);
    background: rgba(0, 0, 0, 0.9);
    box-shadow: 0 0 0 1px rgba(29, 185, 84, 0.35);
}

.profile {
    display: flex;
    align-items: center;
    gap: 8px;
}

.avatar {
    width: 28px;
    height: 28px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--accent), var(--accent-hover));
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 14px;
    color: #000;
}

.username {
    font-size: 14px;
    font-weight: 600;
}

/* Sections */
.section {
    padding: 32px;
}

.section h2 {
    font-size: 24px;
    font-weight: 700;
    margin-bottom: 20px;
}

/* Cards */
.cards-row {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: 24px;
    margin-bottom: 32px;
}

.card {
    background: var(--bg-card);
    border-radius: var(--radius-md);
    padding: 16px;
    cursor: pointer;
    transition: all var(--transition-normal);
    position: relative;
}

.card:hover {
    background: var(--bg-elevated);
}

.card-cover {
    width: 100%;
    aspect-ratio: 1;
    border-radius: var(--radius-md);
    margin-bottom: 16px;
    position: relative;
    overflow: hidden;
}

.gradient-1 {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
}

.gradient-2 {
    background: linear-gradient(135deg, #f093fb 0%, #f5576c 100%);
}

.gradient-3 {
    background: linear-gradient(135deg, #4facfe 0%, #00f2fe 100%);
}

.card h3 {
    font-size: 15px;
    margin-bottom: 4px;
    font-weight: 600;
}

.card p {
    font-size: 13px;
    color: var(--text-muted);
}

/* Tracks table */
.tracks {
    width: 100%;
    border-collapse: collapse;
    font-size: 14px;
}

.tracks thead {
    font-size: 12px;
    text-transform: uppercase;
    color: var(--text-muted);
}

.tracks th,
.tracks td {
    padding: 8px 8px;
    text-align: left;
}

.tracks tbody tr {
    cursor: pointer;
    border-radius: var(--radius-md);
    transition: background var(--transition-fast);
}

.tracks tbody tr:nth-child(even) {
    background: rgba(255, 255, 255, 0.01);
}

.tracks tbody tr:hover {
    background: rgba(255, 255, 255, 0.08);
}

.tracks tbody tr.active {
    background: rgba(29, 185, 84, 0.2);
}

.tracks tbody tr td:first-child,
.tracks thead th:first-child {
    width: 36px;
    text-align: right;
    color: var(--text-muted);
}

/* Player */
.player {
    position: fixed;
    left: 0;
    right: 0;
    bottom: 0;
    height: 90px;
    background: linear-gradient(90deg, #181818 0%, #101010 50%, #181818 100%);
    border-top: 1px solid var(--border-subtle);
    display: grid;
    grid-template-columns: minmax(0, 1.2fr) minmax(0, 2fr) minmax(0, 0.8fr);
    align-items: center;
    padding: 8px 18px;
    gap: 12px;
    color: var(--text-primary);
    z-index: 1000;
}

.player-info {
    display: flex;
    align-items: center;
    gap: 10px;
}

.player-cover {
    width: 56px;
    height: 56px;
    border-radius: var(--radius-md);
    background: linear-gradient(135deg, var(--accent), var(--accent-hover));
}

.player-title {
    font-size: 14px;
    font-weight: 600;
}

.player-artist {
    font-size: 12px;
    color: var(--text-muted);
}

.player-controls {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    margin-bottom: 4px;
}

.icon-btn {
    width: 34px;
    height: 34px;
    border-radius: 50%;
    border: none;
    display: flex;
    align-items: center;
    justify-content: center;
    background: transparent;
    color: var(--text-primary);
    cursor: pointer;
    transition: background var(--transition-fast), transform var(--transition-fast);
    font-size: 16px;
}

.icon-btn:hover {
    background: rgba(255, 255, 255, 0.12);
    transform: translateY(-1px);
}

.icon-btn.play-btn {
    width: 40px;
    height: 40px;
    background: var(--accent);
    color: #000;
}

.icon-btn.play-btn:hover {
    background: var(--accent-hover);
}

.player-timeline {
    display: grid;
    grid-template-columns: auto minmax(0, 1fr) auto;
    align-items: center;
    gap: 8px;
    font-size: 11px;
    color: var(--text-muted);
}

#seek,
#volume {
    -webkit-appearance: none;
    appearance: none;
    background: transparent;
}

#seek {
    width: 100%;
}

#seek::-webkit-slider-runnable-track,
#volume::-webkit-slider-runnable-track {
    height: 3px;
    background: #404040;
    border-radius: 999px;
}

#seek::-webkit-slider-thumb,
#volume::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 11px;
    height: 11px;
    border-radius: 50%;
    background: var(--accent);
    margin-top: -4px;
}

#volume {
    width: 100%;
    max-width: 130px;
}

.player-right {
    display: flex;
    justify-content: flex-end;
    align-items: center;
    gap: 8px;
}

/* Auth styles */
.btn-login-topbar {
    padding: 8px 16px;
    background: var(--accent);
    color: #000;
    border: none;
    border-radius: 20px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: all var(--transition-fast);
    text-decoration: none;
    margin-right: 8px;
}

.btn-login-topbar:hover {
    background: var(--accent-hover);
    transform: translateY(-1px);
}

.btn-register-topbar {
    padding: 8px 16px;
    background: transparent;
    color: var(--text-primary);
    border: 1px solid var(--border-subtle);
    border-radius: 20px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: all var(--transition-fast);
    text-decoration: none;
}

.btn-register-topbar:hover {
    background: var(--bg-elevated);
    border-color: var(--text-primary);
    transform: translateY(-1px);
}

.user-profile-info {
    display: flex;
    align-items: center;
    gap: 12px;
}

.profile-actions {
    display: flex;
    align-items: center;
    gap: 8px;
}

.btn-profile-settings {
    padding: 6px 12px;
    background: transparent;
    color: var(--text-muted);
    border: 1px solid var(--border-subtle);
    border-radius: 16px;
    font-size: 12px;
    cursor: pointer;
    transition: all var(--transition-fast);
    display: flex;
    align-items: center;
    gap: 6px;
}

.btn-profile-settings:hover {
    background: var(--bg-elevated);
    color: var(--text-primary);
    border-color: var(--text-primary);
}

.btn-logout-topbar {
    padding: 6px 12px;
    background: transparent;
    color: var(--text-muted);
    border: 1px solid var(--border-subtle);
    border-radius: 16px;
    font-size: 12px;
    cursor: pointer;
    transition: all var(--transition-fast);
}

.btn-logout-topbar:hover {
    background: rgba(231, 76, 60, 0.2);
    color: #e74c3c;
    border-color: #e74c3c;
}

/* Modal */
.modal {
    display: none;
    position: fixed;
    z-index: 2000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background: rgba(0,0,0,0.8);
}

.modal-content {
    background: var(--bg-card);
    margin: 15% auto;
    padding: 32px;
    border: none;
    border-radius: var(--radius-lg);
    width: 400px;
    max-width: 90%;
    box-shadow: var(--shadow-soft);
}

.close {
    color: var(--text-muted);
    float: right;
    font-size: 28px;
    font-weight: bold;
    cursor: pointer;
}

.close:hover {
    color: var(--text-primary);
}

.modal h2 {
    margin-bottom: 24px;
    text-align: center;
}

.modal form {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.modal input {
    padding: 12px 16px;
    border: 1px solid var(--border-subtle);
    background: var(--bg-elevated);
    color: var(--text-primary);
    border-radius: var(--radius-md);
    font-size: 16px;
}

.modal input::placeholder {
    color: var(--text-muted);
}

.modal input:focus {
    outline: none;
    border-color: var(--accent);
}

.modal button {
    background: var(--accent);
    color: #000;
    border: none;
    padding: 12px 24px;
    border-radius: 20px;
    cursor: pointer;
    font-weight: 600;
    transition: all var(--transition-fast);
}

.modal button:hover {
    background: var(--accent-hover);
}

/* Scrollbar */
.main::-webkit-scrollbar {
    width: 10px;
}

.main::-webkit-scrollbar-track {
    background: transparent;
}

.main::-webkit-scrollbar-thumb {
    background: #333;
    border-radius: 999px;
}

.main::-webkit-scrollbar-thumb:hover {
    background: #444;
}

/* Profile fullscreen interface */
.profile-fullscreen {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: var(--bg-main);
    z-index: 1000;
    display: none;
}

.profile-container {
    height: 100vh;
    display: flex;
    flex-direction: column;
}

.profile-topbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px 32px;
    background: rgba(0, 0, 0, 0.8);
    backdrop-filter: blur(10px);
    border-bottom: 1px solid var(--border-subtle);
}

.btn-back {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 16px;
    background: transparent;
    color: var(--text-muted);
    border: 1px solid var(--border-subtle);
    border-radius: 20px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: all var(--transition-fast);
    text-decoration: none;
}

.btn-back:hover {
    background: var(--bg-elevated);
    color: var(--text-primary);
    border-color: var(--text-primary);
}

.profile-topbar h1 {
    font-size: 24px;
    font-weight: 700;
    color: var(--text-primary);
    margin: 0;
}

.profile-content {
    flex: 1;
    overflow-y: auto;
    padding: 32px;
    display: grid;
    grid-template-columns: 1fr 300px;
    gap: 32px;
    max-width: 1200px;
    margin: 0 auto;
    width: 100%;
}

/* Profile sections */
.profile-section {
    padding: 32px;
}

.profile-card {
    background: var(--bg-card);
    border-radius: var(--radius-lg);
    padding: 32px;
    margin-bottom: 32px;
}

.profile-header {
    display: flex;
    align-items: center;
    gap: 24px;
    margin-bottom: 32px;
    padding-bottom: 24px;
    border-bottom: 1px solid var(--border-subtle);
}

.profile-avatar-section {
    position: relative;
}

.profile-avatar {
    width: 120px;
    height: 120px;
    border-radius: 50%;
    object-fit: cover;
    border: 4px solid var(--bg-elevated);
}

.avatar-upload {
    position: absolute;
    bottom: 0;
    right: 0;
}

.upload-btn {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 8px 12px;
    background: var(--accent);
    color: #000;
    border: none;
    border-radius: 20px;
    font-size: 12px;
    font-weight: 600;
    cursor: pointer;
    transition: all var(--transition-fast);
}

.upload-btn:hover {
    background: var(--accent-hover);
}

.profile-info h2 {
    font-size: 28px;
    font-weight: 700;
    margin-bottom: 8px;
}

.profile-info p {
    font-size: 16px;
    color: var(--text-muted);
    margin-bottom: 8px;
}

.member-since {
    font-size: 14px;
    color: var(--text-subtle);
}

/* Profile form */
.profile-form h3 {
    font-size: 20px;
    font-weight: 700;
    margin-bottom: 24px;
}

.form-group {
    margin-bottom: 24px;
}

.form-group label {
    display: block;
    font-size: 14px;
    font-weight: 600;
    margin-bottom: 8px;
    color: var(--text-primary);
}

.form-group input {
    width: 100%;
    padding: 12px 16px;
    border: 1px solid var(--border-subtle);
    background: var(--bg-elevated);
    color: var(--text-primary);
    border-radius: var(--radius-md);
    font-size: 16px;
    transition: all var(--transition-fast);
}

.form-group input:focus {
    outline: none;
    border-color: var(--accent);
    box-shadow: 0 0 0 1px rgba(29, 185, 84, 0.35);
}

.form-group small {
    display: block;
    margin-top: 6px;
    font-size: 12px;
    color: var(--text-subtle);
}

.form-actions {
    display: flex;
    gap: 12px;
    margin-top: 32px;
}

.btn-primary {
    padding: 12px 24px;
    background: var(--accent);
    color: #000;
    border: none;
    border-radius: 20px;
    font-weight: 600;
    cursor: pointer;
    transition: all var(--transition-fast);
    display: flex;
    align-items: center;
    gap: 8px;
}

.btn-primary:hover {
    background: var(--accent-hover);
}

.btn-secondary {
    padding: 12px 24px;
    background: transparent;
    color: var(--text-muted);
    border: 1px solid var(--border-subtle);
    border-radius: 20px;
    font-weight: 600;
    cursor: pointer;
    transition: all var(--transition-fast);
    display: flex;
    align-items: center;
    gap: 8px;
}

.btn-secondary:hover {
    background: var(--bg-elevated);
    color: var(--text-primary);
    border-color: var(--text-primary);
}

/* Profile stats */
.profile-stats {
    background: var(--bg-card);
    border-radius: var(--radius-lg);
    padding: 24px;
}

.profile-stats h3 {
    font-size: 18px;
    font-weight: 700;
    margin-bottom: 20px;
}

.stats-grid {
    display: grid;
    gap: 16px;
}

.stat-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 16px;
    background: var(--bg-elevated);
    border-radius: var(--radius-md);
    transition: all var(--transition-fast);
}

.stat-item:hover {
    background: rgba(255, 255, 255, 0.05);
}

.stat-item i {
    font-size: 20px;
    color: var(--accent);
    width: 24px;
}

.stat-number {
    font-size: 24px;
    font-weight: 700;
    color: var(--text-primary);
    display: block;
}

.stat-label {
    font-size: 12px;
    color: var(--text-muted);
}

/* Responsive */
@media (max-width: 830px) {
    .app {
        grid-template-columns: 72px minmax(0, 1fr);
    }

    .logo {
        font-size: 16px;
    }

    .nav-item span {
        font-size: 0;
    }

    .nav-secondary {
        display: none;
    }
}

@media (max-width: 640px) {
    .app {
        grid-template-columns: minmax(0, 1fr);
        height: auto;
        padding-bottom: 90px;
    }

    .sidebar {
        display: none;
    }

    .player {
        grid-template-columns: minmax(0, 1fr);
        height: auto;
        row-gap: 6px;
    }

    .player-right {
        justify-content: center;
    }

    .topbar {
        padding: 12px 16px;
    }

    .section {
        padding: 16px;
    }

    .cards-row {
        grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
        gap: 16px;
    }

    /* Profile responsive */
    .profile-content {
        grid-template-columns: 1fr;
        padding: 16px;
        gap: 16px;
    }

    .profile-card {
        padding: 20px;
    }

    .profile-header {
        flex-direction: column;
        text-align: center;
        gap: 16px;
    }

    .profile-avatar {
        width: 100px;
        height: 100px;
    }

    .profile-topbar {
        padding: 12px 16px;
    }

    .profile-topbar h1 {
        font-size: 20px;
    }

    .form-actions {
        flex-direction: column;
    }

    .stats-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 12px;
    }
}
