/* FilfelTV - Mobile CSS v1.0.2 */
:root {
    --bg: #0f1117;
    --card: #161a22;
    --card-2: #1b2130;
    --text: #eef2ff;
    --muted: #9aa3b2;
    --accent: #5eead4;
    --accent-2: #22d3ee;
    --danger: #ff5d5d;
    --shadow: 0 8px 30px rgba(0, 0, 0, .25);
    --radius: 14px;
    --pad: clamp(14px, 2.8vw, 20px);
    --hit: 52px;
    /* cible tactile */

    /* Couleur spécifique titres + flèches */
    --ios-blue: #007AFF;

    /* Taille globale du gros titre (accueil + events) */
    --title-size: clamp(18px, 4.5vw, 22px);
}

* {
    box-sizing: border-box
}

html,
body {
    height: 100%;
    overflow-x: hidden;
}

body {
    margin: 0;
    font-family: system-ui, -apple-system, Segoe UI, Roboto, Inter, Arial, sans-serif;
    background: var(--bg);
    color: var(--text);
    -webkit-tap-highlight-color: transparent;
}

/* Header + recherche */
.appbar {
    position: sticky;
    top: 0;
    z-index: 30;
    padding: calc(env(safe-area-inset-top) + 12px) var(--pad) 12px;
    background: linear-gradient(180deg, rgba(15, 17, 23, .95) 0%, rgba(15, 17, 23, .85) 70%, rgba(15, 17, 23, 0) 100%);
    backdrop-filter: blur(8px);
}

/* Titre (accueil + events) */
.appbar .title {
    margin: 0 0 10px 0;
    font-weight: 600;
    letter-spacing: .2px;
    font-size: var(--title-size);
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    text-align: center;
}

.title .dot {
    width: 10px;
    height: 10px;
    border-radius: 999px;
    background: linear-gradient(135deg, var(--accent), var(--accent-2));
    box-shadow: 0 0 0 6px rgba(34, 211, 238, .15);
}

/* Ligne du haut (events) */
.toprow {
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    margin-bottom: 10px;
    min-height: var(--hit);
}

.toprow .title {
    margin: 0;
    justify-content: center;
}

/* Bouton retour (events) */
.backbtn {
    position: absolute;
    left: 0;
    top: 50%;
    transform: translateY(-50%);
    width: 40px;
    height: 40px;
    display: grid;
    place-items: center;
    border-radius: 10px;
    border: 1px solid rgba(255, 255, 255, .08);
    background: rgba(255, 255, 255, .04);
    color: var(--ios-blue);
    text-decoration: none;
}

.backbtn svg path {
    stroke: currentColor;
}

.backbtn:active {
    transform: translateY(-50%) scale(.98);
}

.searchbar {
    display: flex;
    align-items: center;
    gap: 10px;
    background: var(--card);
    border: 1px solid rgba(255, 255, 255, .06);
    border-radius: 12px;
    padding: 10px 12px;
    box-shadow: var(--shadow);
}

.searchbar input {
    appearance: none;
    border: 0;
    outline: 0;
    flex: 1;
    background: transparent;
    color: var(--text);
    font-size: 16px;
    line-height: 24px;
}

.searchbar .icon {
    width: 22px;
    height: 22px;
    opacity: .8
}

.pill {
    margin-top: 10px;
    background: rgba(94, 234, 212, .1);
    color: #bffcf4;
    border: 1px solid rgba(94, 234, 212, .25);
    padding: 6px 10px;
    border-radius: 999px;
    font-size: 12px;
    display: inline-flex;
    align-items: center;
    gap: 6px;
}

/* Boutons mini */
.btn-mini {
    height: 36px;
    padding: 0 12px;
    border-radius: 10px;
    border: 1px solid rgba(255, 255, 255, .12);
    background: rgba(255, 255, 255, .08);
    color: #fff;
    font-weight: 700;
    text-decoration: none;
    display: inline-flex;
    align-items: center;
    cursor: pointer;
}

.btn-mini.ghost {
    background: transparent;
}

/* Bandeau NiPlayer */
.infobar {
    display: flex;
    align-items: center;
    gap: 10px;
    margin: 10px var(--pad) 0;
    padding: 10px 12px;
    border-radius: 12px;
    background: linear-gradient(135deg, #2a1f00, #3a2b00);
    color: #ffd98a;
    border: 1px solid rgba(255, 220, 130, .35);
}

.infobar a {
    color: #fff;
    text-decoration: underline
}

/* Promo */
.promo {
    margin: 12px var(--pad) 0;
    display: block;
    background: linear-gradient(135deg, #132030, #0e1622);
    border: 1px solid rgba(255, 255, 255, .06);
    border-radius: 14px;
    overflow: hidden;
    text-decoration: none;
    color: var(--text);
    box-shadow: var(--shadow);
}

.promo .row {
    display: flex;
    gap: 12px;
    align-items: center;
    padding: 12px;
}

.promo img {
    width: 56px;
    height: 56px;
    border-radius: 12px;
    object-fit: cover;
    flex: 0 0 auto;
}

.promo .t1 {
    font-weight: 800
}

.promo .t2 {
    color: var(--muted);
    font-size: 13px;
    margin-top: 2px
}

/* Liste */
.grid {
    padding: 10px var(--pad) calc(env(safe-area-inset-bottom) + 90px);
    display: grid;
    grid-template-columns: 1fr;
    gap: 12px;
    max-width: 100%;
}

@media(min-width:520px) {
    .grid {
        grid-template-columns: 1fr 1fr;
    }
}

.card {
    display: flex;
    gap: 12px;
    align-items: center;
    width: 100%;
    overflow: hidden;
    background: linear-gradient(180deg, var(--card) 0%, var(--card-2) 100%);
    border: 1px solid rgba(255, 255, 255, .06);
    border-radius: var(--radius);
    padding: 10px;
    min-height: 86px;
    box-shadow: var(--shadow);
    transition: transform .12s ease, border-color .12s ease, background .12s ease;
    touch-action: manipulation;
}

.card:active {
    transform: scale(.99)
}

.thumb {
    width: 72px;
    height: 72px;
    border-radius: 12px;
    overflow: hidden;
    flex: 0 0 auto;
    background: #0b0e13;
    display: grid;
    place-items: center;
    border: 1px solid rgba(255, 255, 255, .07);
}

.thumb img {
    width: 100%;
    height: 100%;
    object-fit: fill;
    /* remplit sans crop */
    display: block;
}

.meta {
    min-width: 0;
    flex: 1
}

.name {
    font-weight: 800;
    font-size: 16px;
    line-height: 22px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    color: var(--ios-blue);
}

.hint {
    color: var(--muted);
    font-size: 12px;
    margin-top: 4px
}

.fav-btn {
    flex: 0 0 auto;
    height: var(--hit);
    min-width: 40px;
    display: grid;
    place-items: center;
    border: 0;
    background: transparent;
    color: rgba(255, 255, 255, .4);
    cursor: pointer;
    padding: 0;
    transition: color .15s ease, transform .1s ease;
}

.fav-btn:active {
    transform: scale(.9);
}

.fav-btn svg[fill="currentColor"] {
    color: #ffd700;
}

.fav-btn:hover {
    color: rgba(255, 215, 0, .7);
}

.open {
    flex: 0 0 auto;
    height: var(--hit);
    min-width: 44px;
    display: grid;
    place-items: center;
    border-radius: 12px;
    border: 1px solid rgba(255, 255, 255, .08);
    background: rgba(255, 255, 255, .04);
    color: var(--ios-blue);
}

/* Skeleton */
.skeleton {
    animation: pulse 1.2s ease-in-out infinite;
    background: #151922;
    border-radius: 12px;
    height: 86px
}

@keyframes pulse {
    0% {
        opacity: .6
    }

    50% {
        opacity: .9
    }

    100% {
        opacity: .6
    }
}

/* Bottom Sheet */
.sheet-backdrop {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, .45);
    opacity: 0;
    pointer-events: none;
    transition: opacity .2s;
    z-index: 50;
}

.sheet-backdrop.active {
    opacity: 1;
    pointer-events: auto
}

.sheet {
    position: fixed;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 60;
    transform: translateY(100%);
    transition: transform .28s cubic-bezier(.2, .8, .2, 1);
    background: var(--card);
    border-top-left-radius: 18px;
    border-top-right-radius: 18px;
    box-shadow: 0 -8px 30px rgba(0, 0, 0, .45);
    padding-bottom: calc(env(safe-area-inset-bottom) + 16px);
}

.sheet.active {
    transform: translateY(0)
}

.sheet .handle {
    width: 42px;
    height: 5px;
    border-radius: 999px;
    background: rgba(255, 255, 255, .2);
    margin: 10px auto;
}

.sheet .head {
    padding: 6px var(--pad) 12px
}

.sheet h2 {
    margin: 6px 0 0;
    font-size: 18px
}

.servers {
    display: grid;
    gap: 10px;
    padding: 0 var(--pad) 16px;
    max-height: 60vh;
    overflow-y: auto;
    overscroll-behavior: contain;
    /* Personnalisation de la barre de défilement */
    scrollbar-width: thin;
    scrollbar-color: rgba(255, 255, 255, .2) transparent;
}

.servers::-webkit-scrollbar {
    width: 6px;
}

.servers::-webkit-scrollbar-track {
    background: transparent;
}

.servers::-webkit-scrollbar-thumb {
    background-color: rgba(255, 255, 255, .2);
    border-radius: 999px;
}

.server {
    height: 56px;
    min-height: 56px;
    /* S'assurer qu'il ne rapetisse pas dans la grille */
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(180deg, rgba(34, 211, 238, .12), rgba(94, 234, 212, .12));
    border: 1px solid rgba(94, 234, 212, .35);
    color: #bffcf4;
    font-weight: 800;
    text-decoration: none;
}

.server:active {
    transform: scale(.99)
}

.close-row {
    padding: 0 var(--pad) 14px
}

.close {
    width: 100%;
    height: 52px;
    border-radius: 12px;
    border: 0;
    background: rgba(255, 255, 255, .06);
    color: #fff;
    font-weight: 700;
}

/* Bouton haut */
.topbtn {
    position: fixed;
    right: 14px;
    bottom: calc(env(safe-area-inset-bottom) + 14px);
    width: 50px;
    height: 50px;
    border-radius: 999px;
    border: 0;
    background: radial-gradient(120% 120% at 0% 0%, var(--accent-2), var(--accent));
    color: #001015;
    font-weight: 900;
    box-shadow: var(--shadow);
    display: none;
    z-index: 40;
}

.topbtn.show {
    display: block
}

/* Bottom navigation */
.bottom-nav {
    position: fixed;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 45;
    padding: 6px var(--pad);
    padding-bottom: calc(env(safe-area-inset-bottom) + 4px);
    background: linear-gradient(180deg, rgba(15, 17, 23, .0) 0%, rgba(15, 17, 23, .96) 28%, #0f1117 100%);
    border-top: 1px solid rgba(255, 255, 255, .06);
    display: flex;
    justify-content: space-between;
    gap: 6px;
    backdrop-filter: blur(10px);
}

.bottom-nav .nav-item {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 2px;
    padding: 6px 4px 4px;
    border-radius: 999px;
    text-decoration: none;
    font-size: 11px;
    color: var(--muted);
    -webkit-tap-highlight-color: transparent;
}

.bottom-nav .nav-item span {
    max-width: 100%;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.bottom-nav .nav-item i {
    font-size: 20px;
    margin-bottom: 2px;
    transition: color 0.2s ease;
}

.bottom-nav .nav-item.is-active {
    color: var(--ios-blue);
    background: rgba(255, 255, 255, .06);
}

.bottom-nav .nav-item.is-active i {
    color: var(--ios-blue);
}

.bottom-nav .nav-item:active {
    transform: scale(.96);
}

/* Pop-up notifications */
.notif-popup[hidden] {
    display: none !important;
}

.notif-popup {
    position: fixed;
    bottom: 20px;
    left: 50%;
    transform: translateX(-50%);
    z-index: 70;
    background: var(--card);
    border: 1px solid rgba(255, 255, 255, .08);
    box-shadow: var(--shadow);
    border-radius: 14px;
    padding: 12px;
    max-width: 360px;
    width: calc(100% - 28px);
}

.notif-content {
    text-align: center
}

.notif-content p {
    margin: 0;
    font-size: 14px;
    line-height: 1.35
}

.notif-hint {
    display: block;
    margin-top: 6px;
    color: var(--muted)
}

.notif-actions {
    display: flex;
    gap: 8px;
    justify-content: center;
    margin-top: 10px;
}

.notif-actions .btn-mini {
    height: 38px;
}

/* Accessibilité / Motion */
@media (prefers-reduced-motion: reduce) {

    .sheet,
    .card {
        transition: none
    }

    .skeleton {
        animation: none
    }
}