:root {
    --bg-dark: #0f111a;
    --bg-panel: #161b28;
    --bg-card: #1f2535;
    --primary: #6c5ce7;
    --primary-gradient: linear-gradient(135deg, #6c5ce7 0%, #a29bfe 100%);
    --secondary: #00cec9;
    --text-main: #dfe6e9;
    --text-muted: #b2bec3;
    --border: rgba(255, 255, 255, 0.08);
    --glass: rgba(31, 37, 53, 0.7);
    --radius: 16px;
    --success: #00b894;
    --danger: #ff7675;
    --font: 'Outfit', sans-serif;
}

body {
    margin: 0;
    font-family: var(--font);
    background-color: var(--bg-dark);
    color: var(--text-main);
    height: 100vh;
    overflow: hidden;
}

/* Layout Grid */
.app-layout {
    display: grid;
    grid-template-columns: 260px 1fr;
    height: 100vh;
}

/* Sidebar */
.sidebar {
    background: var(--bg-panel);
    border-right: 1px solid var(--border);
    padding: 2rem;
    display: flex;
    flex-direction: column;
}

.brand {
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 1.5rem;
    font-weight: 700;
    margin-bottom: 3rem;
    color: #fff;
}

.brand i {
    color: var(--primary);
    font-size: 1.8rem;
}

.highlight {
    color: var(--primary);
}

.nav-menu {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.nav-item {
    background: none;
    border: none;
    text-align: left;
    padding: 1rem;
    color: var(--text-muted);
    font-family: var(--font);
    font-size: 1rem;
    font-weight: 500;
    cursor: pointer;
    border-radius: 12px;
    display: flex;
    align-items: center;
    gap: 12px;
    transition: all 0.3s ease;
}

.nav-item:hover {
    background: rgba(255, 255, 255, 0.03);
    color: #fff;
}

.nav-item.is-active {
    background: var(--primary-gradient);
    color: white;
    box-shadow: 0 4px 15px rgba(108, 92, 231, 0.4);
}

.logout-btn {
    width: 100%;
    background: rgba(255, 118, 117, 0.1);
    border: 1px solid rgba(255, 118, 117, 0.2);
    color: var(--danger);
    padding: 0.8rem;
    border-radius: 10px;
    cursor: pointer;
    font-weight: 600;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    transition: 0.2s;
}

.logout-btn:hover {
    background: rgba(255, 118, 117, 0.2);
}

/* Main Content */
.main-content {
    overflow-y: auto;
    padding: 2rem 3rem;
    background: radial-gradient(circle at top right, #1f2535 0%, #0f111a 40%);
}

.top-bar {
    display: flex;
    justify-content: space-between;
    margin-bottom: 2rem;
    color: var(--text-muted);
    font-size: 0.9rem;
}

.info-badge {
    background: var(--bg-card);
    padding: 5px 12px;
    border-radius: 20px;
    border: 1px solid var(--border);
    margin-right: 10px;
}

/* Sections */
.tab-panel {
    display: none;
    animation: fadeIn 0.4s ease;
}

.tab-panel.is-active {
    display: block;
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.section-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-end;
    margin-bottom: 2rem;
}

.section-header h2 {
    font-size: 2rem;
    margin: 0;
    color: #fff;
}

.section-header p {
    color: var(--text-muted);
    margin: 5px 0 0 0;
}

/* Grid & Cards */
.grid-layout {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(350px, 1fr));
    gap: 1.5rem;
}

.list-layout {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

/* Stream Card (Modern) */
.stream-card {
    background: var(--glass);
    backdrop-filter: blur(10px);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 1.5rem;
    position: relative;
    overflow: hidden;
}

.stream-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 4px;
    background: var(--primary-gradient);
}

.card-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1.5rem;
}

.card-header h3 {
    margin: 0;
    font-size: 1.2rem;
}

.status-badge {
    padding: 6px 12px;
    border-radius: 20px;
    font-size: 0.75rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.status-ok {
    background: rgba(0, 184, 148, 0.2);
    color: var(--success);
}

.status-warn {
    background: rgba(253, 203, 110, 0.2);
    color: #fdcb6e;
}

.status-error {
    background: rgba(255, 118, 117, 0.2);
    color: var(--danger);
}

.status-info {
    background: rgba(116, 185, 255, 0.2);
    color: #74b9ff;
}

.card-stats {
    display: grid;
    gap: 0.8rem;
    font-size: 0.9rem;
    margin-bottom: 1.5rem;
}

.stat-row {
    display: flex;
    justify-content: space-between;
}

.stat-label {
    color: var(--text-muted);
}

.stat-value {
    font-weight: 600;
    color: #fff;
    font-family: monospace;
}

/* Recording Card (Horizontal) */
.recording-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 0;
    display: flex;
    flex-direction: column;
}

.recording-main {
    padding: 1.2rem;
    display: flex;
    align-items: center;
    gap: 1.5rem;
    border-bottom: 1px solid var(--border);
}

.icon-box {
    width: 50px;
    height: 50px;
    background: linear-gradient(135deg, #2d3436 0%, #000000 100%);
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--text-muted);
    font-size: 1.5rem;
}

.rec-info {
    flex: 1;
}

.rec-info h3 {
    margin: 0 0 5px 0;
    font-size: 1.1rem;
}

.rec-meta {
    font-size: 0.85rem;
    color: var(--text-muted);
    display: flex;
    gap: 15px;
}

.rec-actions {
    display: flex;
    gap: 10px;
}

.btn-dl {
    text-decoration: none;
    color: var(--text-main);
    font-size: 0.9rem;
    font-weight: 500;
    padding: 8px 16px;
    border-radius: 8px;
    background: rgba(255, 255, 255, 0.05);
    transition: 0.2s;
}

.btn-dl:hover {
    background: rgba(255, 255, 255, 0.1);
}

/* Playlist */
.playlist-container {
    background: rgba(0, 0, 0, 0.2);
    max-height: 250px;
    overflow-y: auto;
}

.track-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 10px 20px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.03);
    transition: 0.2s;
    cursor: pointer;
}

.track-row:hover {
    background: rgba(108, 92, 231, 0.1);
}

.track-left {
    display: flex;
    gap: 15px;
    align-items: center;
    overflow: hidden;
}

.track-time {
    font-family: monospace;
    font-size: 0.8rem;
    color: var(--primary);
    background: rgba(108, 92, 231, 0.1);
    padding: 2px 6px;
    border-radius: 4px;
}

.track-title {
    font-weight: 500;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.btn-cut {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid var(--border);
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--text-muted);
    transition: 0.2s;
}

.btn-cut:hover {
    background: var(--success);
    color: white;
    border-color: var(--success);
    transform: scale(1.1);
}

/* Filters & Tabs */
.select-wrapper {
    position: relative;
    display: flex;
    align-items: center;
    background: var(--bg-card);
    padding: 0 1rem;
    border-radius: 10px;
    border: 1px solid var(--border);
}

.select-wrapper i {
    margin-right: 10px;
    color: var(--primary);
}

.select-wrapper select {
    background: none;
    border: none;
    color: #fff;
    padding: 12px 0;
    font-family: var(--font);
    cursor: pointer;
    outline: none;
}

.tabs-pills {
    display: flex;
    gap: 10px;
    margin-bottom: 2rem;
    flex-wrap: wrap;
}

.pill-btn {
    background: var(--bg-card);
    border: 1px solid var(--border);
    color: var(--text-muted);
    padding: 8px 20px;
    border-radius: 20px;
    cursor: pointer;
    font-family: var(--font);
    transition: 0.3s;
}

.pill-btn:hover {
    border-color: var(--primary);
    color: #fff;
}

.pill-btn.is-active {
    background: var(--primary);
    color: white;
    border-color: var(--primary);
}

/* Audio Player Custom */
audio {
    width: 100%;
    height: 36px;
    margin-top: 10px;
    filter: invert(0.9) hue-rotate(180deg);
    opacity: 0.8;
}

@media (max-width: 768px) {
    .app-layout {
        grid-template-columns: 1fr;
    }

    .sidebar {
        display: none;
        /* Ou faire un menu burger */
    }

    .main-content {
        padding: 1rem;
    }
}

/* --- VERSION MOBILE (Responsive) --- */
@media (max-width: 768px) {

    /* 1. On change la grille principale */
    .app-layout {
        display: block;
        /* Plus de grille, tout s'empile */
        height: auto;
        min-height: 100vh;
        padding-bottom: 80px;
        /* Espace pour le menu du bas */
    }

    /* 2. On transforme la Sidebar en barre de menu du bas (Bottom Bar) */
    .sidebar {
        display: flex;
        /* On la réaffiche ! */
        flex-direction: row;
        position: fixed;
        bottom: 0;
        left: 0;
        width: 100%;
        height: 70px;
        padding: 0;
        background: rgba(22, 27, 40, 0.95);
        /* Fond sombre semi-transparent */
        backdrop-filter: blur(15px);
        -webkit-backdrop-filter: blur(15px);
        border-right: none;
        border-top: 1px solid var(--border);
        z-index: 1000;
        /* Toujours au dessus */
        justify-content: space-around;
        align-items: center;
    }

    /* 3. On cache le Logo (Brand) pour gagner de la place */
    .brand {
        display: none;
    }

    /* 4. On adapte le menu de navigation */
    .nav-menu {
        flex-direction: row;
        width: 100%;
        justify-content: space-around;
        padding: 0;
        margin: 0;
    }

    /* 5. Style des boutons "App Mobile" (Icône au dessus, texte en dessous) */
    .nav-item {
        flex-direction: column;
        justify-content: center;
        background: transparent !important;
        /* Enlève le fond dégradé */
        box-shadow: none !important;
        padding: 5px;
        font-size: 0.7rem;
        /* Texte plus petit */
        gap: 4px;
        color: var(--text-muted);
        border-radius: 0;
    }

    .nav-item i {
        font-size: 1.4rem;
        /* Icône plus grande */
        margin: 0;
    }

    .nav-item.is-active {
        color: var(--primary);
        /* Juste la couleur change quand actif */
    }

    .nav-item.is-active i {
        color: var(--primary);
    }

    /* 6. On garde le bouton déconnexion mais en petit */
    .user-profile {
        margin: 0;
        padding-right: 15px;
    }

    .logout-btn {
        background: none;
        border: none;
        padding: 5px;
        display: flex;
        flex-direction: column;
        align-items: center;
        gap: 4px;
        color: var(--danger);
        font-size: 0.7rem;
    }

    .logout-btn i {
        font-size: 1.4rem;
    }

    /* 7. Ajustement du contenu principal */
    .main-content {
        padding: 1rem 1rem 6rem 1rem;
        /* Marge en bas pour ne pas cacher le dernier élément */
        overflow: visible;
        /* Laisser scroller la page entière */
        background: var(--bg-dark);
        /* Fond uni sur mobile pour perf */
    }

    .section-header h2 {
        font-size: 1.5rem;
    }

    /* Cacher les infos serveur (Dossier/Timezone) sur mobile pour épuré */
    .server-info {
        display: none;
    }

    .top-bar {
        justify-content: center;
        margin-bottom: 1rem;
    }
}