/* UTF Modal */
.utf-modal.hidden {
    display: none !important;
}

.utf-modal:not(.hidden) {
    display: flex !important;
}

/* ==================== VARIABLES ==================== */
:root {
    --navbar-height: 70px;
    --comments-visible-height: 50vh;
    --primary-green: #00e676;
    --like-color: #FF3366;
}


/* ==================== TRANSITIONS SPA - FIX FLASH ==================== */

/* Classes utilisées par router.js */
#app.fade-out {
    opacity: 0 !important;
    pointer-events: none !important;
    transition: opacity 0.15s ease-out !important;
}

#app.fade-in {
    opacity: 1 !important;
    animation: fadeInApp 0.25s ease-in !important;
}

@keyframes fadeInApp {
    from {
        opacity: 0;
        transform: translateY(5px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Animation d'entrée pour toutes les pages */
.live-page,
.watch-page,
.replay-page,
.replays-page,
.list-page,
.event-detail-page,
.events-page,
.hub-page,
.profile-page,
.admin-page,
.dashboard-page,
.admin-events-page,
.admin-teams-page,
.event-dashboard-page,
.team-create-page,
.events-create-page,
.match-create-page {
    animation: smoothPageEntry 0.2s ease-out;
}

@keyframes smoothPageEntry {
    from {
        opacity: 0;
        transform: translateY(8px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Empêcher le flash de texte non stylé */
body {
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

/* Pendant le chargement, fond noir */
#app:empty,
#app.fade-out {
    background: #000 !important;
    min-height: 100vh !important;
}

/* ==================== RESET ==================== */
* { 
    margin: 0; 
    padding: 0; 
    box-sizing: border-box; 
}

html, body {
    background: #000;
    color: #fff;
    font-family: Poppins, Roboto, sans-serif;
    height: auto;
    overflow: auto;
}

/* ==================== FEED IMMERSIF ==================== */
.main-content-scrollable {
    position: relative;
    height: calc(100dvh - var(--navbar-height));
    overflow-y: scroll;
    scroll-snap-type: y mandatory;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
}

.main-content-scrollable::-webkit-scrollbar {
    display: none;
}

/* ==================== VIDEO ==================== */
#video-container {
    width: 100%;
    height: auto;  
    display: block;
}

.video-card {
    width: 100%;
    height: calc(100dvh - var(--navbar-height)) !important;
    position: relative;
    scroll-snap-align: start;
    overflow: hidden;
    background: #000 !important;
    margin: 0 !important;
    padding: 0 !important;
    scroll-snap-stop: always;

}

.video-card video {
    width: 100%;
    height: 100% !important;
    object-fit: cover;
}

.video-card.comments-open .overlay {
    opacity: 0;
    pointer-events: none;
}

.video-card.comments-open video {
    height: calc(100dvh - var(--comments-visible-height));
}


/* ==================== OVERLAY ==================== */
.overlay {
    position: absolute;
    inset: 0;
    display: flex;
    justify-content: space-between;
    align-items: flex-end;
    padding: 12px !important;
    padding-bottom: calc(var(--navbar-height) + 10px) !important;
    background: none !important;
    z-index: 50;
    pointer-events: none;
}

.video-info,
.video-info *,
.video-actions,
.video-actions * {
    pointer-events: auto !important;
}

.video-info {
    display: flex;
    flex-direction: column;
    gap: 8px;
    max-width: 65%;
}

.video-title {
    font-size: 1rem;
    font-weight: 600;
    color: white;
    text-shadow: 0 2px 4px rgba(0,0,0,0.8);
    line-height: 1.4;
    overflow: hidden;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    margin-bottom: 10px;
}

.video-author-link {
    font-size: 0.9rem;
    color: rgba(255,255,255,0.95);
    text-decoration: none;
    font-weight: 500;
    text-shadow: 0 2px 4px rgba(0,0,0,0.8);
}

.video-author-link:hover {
    text-decoration: underline;
}

/* ==================== ACTIONS VIDEO ==================== */
.video-actions {
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
    align-items: center;
    padding-right: 4px;
    padding-bottom: 120px !important;
}

.video-actions button {
    background: none;
    border: none;
    color: white;
    font-size: 2rem;
    cursor: pointer;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.25rem;
    transition: transform 0.2s;
    filter: drop-shadow(0 2px 4px rgba(0,0,0,0.8));
}

.video-actions button:active {
    transform: scale(0.85);
}

.like-count,
.comment-count {
    font-size: 0.75rem;
    font-weight: 700;
    color: white;
    text-shadow: 0 2px 4px rgba(0,0,0,0.8);
    opacity: 1 !important;
    display: block !important;
}

.like-btn.active i {
    color: var(--like-color);
}

.like-btn.active {
    animation: heartBeat 0.4s ease;
}

@keyframes heartBeat {
    0%, 100% { transform: scale(1); }
    30% { transform: scale(1.25); }
    50% { transform: scale(1.1); }
}

.share-btn {
    font-size: 1.8rem;
}

.mute-btn {
    font-size: 1.6rem;
}

/* ==================== LOADER ==================== */
#loader.loader{
  position: static !important;
  width: 100%;
  margin: 18px 0;
  display: none;          /* caché par défaut */
  text-align: center;
  padding: 12px;
  color: #aaa;
}


/* ==================== MODAL COMMENTAIRES ==================== */



#comments-modal.open {
    display: flex;
    justify-content: flex-end;
    align-items: flex-end;
}

.comments-backdrop {
    position: absolute;
    inset: 0;
    background: rgba(0,0,0,0.55);
    backdrop-filter: blur(8px);
    z-index: 1;
}

.comments-panel {
    position: relative;
    width: 100%;
    height: 60vh;
    max-height: 600px;
    background: linear-gradient(180deg, rgba(0,0,0,0.95) 0%, rgba(0,0,0,0.98) 100%);
    backdrop-filter: blur(20px);
    border-radius: 20px 20px 0 0;
    z-index: 2;
    display: flex;
    flex-direction: column;
    animation: slideUp 0.3s ease-out;
}

@keyframes slideUp {
    from { transform: translateY(100%); opacity: 0; }
    to { transform: translateY(0); opacity: 1; }
}

.comments-panel.close-animation {
    animation: slideDown 0.25s ease-out forwards;
}

@keyframes slideDown {
    from { transform: translateY(0); opacity: 1; }
    to { transform: translateY(100%); opacity: 0; }
}

.comments-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 18px 20px;
    border-bottom: 1px solid rgba(255,255,255,0.1);
    color: white;
}

#comments-close-btn {
    background: none;
    border: none;
    font-size: 1.6rem;
    color: white;
    cursor: pointer;
}

.comments-list {
    flex: 1;
    overflow-y: auto;
    padding: 15px 20px;
    scrollbar-width: thin;
    scrollbar-color: rgba(255,255,255,0.3) transparent;
}

.comments-list::-webkit-scrollbar {
    width: 6px;
}

.comments-list::-webkit-scrollbar-thumb {
    background: rgba(255,255,255,0.3);
    border-radius: 10px;
}

.comment {
    display: flex;
    gap: 12px;
    margin-bottom: 18px;
    animation: fadeIn 0.3s ease;
}

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

.comment-header {
    display: flex;
    align-items: center;
    gap: 10px;
}

.comment-username {
    font-weight: 700;
    font-size: 14px;
    color: white;
}

.comment-date {
    font-size: 12px;
    color: rgba(255,255,255,0.5);
}

.comment-content {
    font-size: 14px;
    color: rgba(255,255,255,0.9);
    margin-top: 4px;
    line-height: 1.4;
}

.comments-input {
    display: flex;
    gap: 10px;
    padding: 12px 20px;
    border-top: 1px solid rgba(255,255,255,0.1);
    background: rgba(0,0,0,0.6);
}

#comments-input-field {
    flex: 1;
    background: rgba(255,255,255,0.12);
    border: 1px solid rgba(255,255,255,0.25);
    border-radius: 25px;
    padding: 12px 18px;
    color: white;
    font-size: 14px;
    outline: none;
}

#comments-input-field::placeholder {
    color: rgba(255,255,255,0.5);
}

#comments-send-btn {
    width: 45px;
    height: 45px;
    border-radius: 50%;
    background: linear-gradient(135deg, #10B981, #059669);
    color: white;
    border: none;
    font-size: 18px;
    cursor: pointer;
    display: flex;
    justify-content: center;
    align-items: center;
}

/* ==================== LOGIN PAGE ==================== */
.login-page {
    height: 100vh;
    display: flex;
    justify-content: center;
    align-items: center;
    background: #000;
    padding: 20px;
}

.login-container {
    width: 100%;
    max-width: 380px;
    background: rgba(255, 255, 255, 0.06);
    padding: 35px 28px;
    border-radius: 20px;
    backdrop-filter: blur(14px);
    border: 1px solid rgba(255, 255, 255, 0.12);
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.4);
    animation: fadeInLogin 0.5s ease;
}

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

.login-title {
    text-align: center;
    font-size: 2rem;
    margin-bottom: 25px;
    color: #fff;
    font-weight: 700;
    letter-spacing: -1px;
}

.login-input {
    width: 100%;
    padding: 14px 15px;
    margin-bottom: 15px;
    border-radius: 12px;
    border: none;
    background: rgba(255, 255, 255, 0.12);
    color: #fff;
    font-size: 1rem;
}

.login-input::placeholder {
    color: #bbb;
}

.login-input:focus {
    outline: 2px solid var(--primary-green);
}

.login-btn {
    width: 100%;
    padding: 14px;
    border-radius: 12px;
    background: var(--primary-green);
    border: none;
    color: #000;
    font-weight: 700;
    font-size: 1rem;
    cursor: pointer;
    transition: 0.25s;
}

.login-btn:hover {
    background: #00c868;
    transform: translateY(-2px);
}

.login-register {
    margin-top: 18px;
    text-align: center;
}

.login-register a {
    color: var(--primary-green);
    text-decoration: none;
    font-size: 0.95rem;
}

.login-register a:hover {
    text-decoration: underline;
}

#errorMsg {
    background: rgba(255, 0, 0, 0.18);
    color: #ff6b6b;
    padding: 10px 14px;
    text-align: center;
    border-radius: 10px;
    margin-bottom: 15px;
    display: none;
}

/* ==================== NAVBAR ==================== */
.mobile-navbar {
    z-index: 9999 !important;
}

/* ==================== DESKTOP ==================== */
@media (min-width: 1024px) {
    html, body {
        overflow-y: auto;
        height: auto;
    }

    .mobile-navbar {
        display: none !important;
    }

    .main-content-scrollable {
        height: auto;
        overflow: visible;
        scroll-snap-type: none;
    }

    #video-container {
        display: grid;
        grid-template-columns: repeat(auto-fill, minmax(340px, 1fr));
        gap: 20px;
        padding: 80px 20px;
    }

    .video-card {
        height: auto;
        aspect-ratio: 16/9;
        border-radius: 10px;
    }

    .overlay { 
        display: none; 
    }
}

/* ✅ BASE STABLE MODAL COMMENTAIRES */
#comments-modal{
  position: fixed !important;
  inset: 0 !important;
  display: none !important;
  z-index: 20000 !important; /* au-dessus de la bottom-nav */
}
#comments-modal.open{
  display: flex !important;
  justify-content: flex-end !important;
  align-items: flex-end !important;
}

/* ✅ Backdrop en dessous du panel */
#comments-modal .comments-backdrop{
  z-index: 0 !important;
}

/* ✅ Panel au-dessus + cliquable */
#comments-modal .comments-panel{
  z-index: 1 !important;
  pointer-events: auto !important;
}

/* ✅ Boutons toujours cliquables */
#comments-close-btn,
#comments-send-btn{
  position: relative !important;
  z-index: 2 !important;
  pointer-events: auto !important;
}

/* =====================================================
   🎯 TIKTOK UI - AJOUTS CSS
   À AJOUTER à la fin de style.css
   ===================================================== */

/* ==================== TOP BAR FLOTTANTE ==================== */
.feed-topbar {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    height: 54px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 16px;
    z-index: 9998;
    background: linear-gradient(180deg, rgba(0,0,0,0.5) 0%, transparent 100%);
    /* Cachée par défaut, visible uniquement sur le feed */
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.25s ease;
}

.feed-topbar.visible {
    opacity: 1;
    pointer-events: auto;
}

.topbar-left,
.topbar-right {
    flex: 0 0 40px;
    display: flex;
    align-items: center;
}

.topbar-right {
    justify-content: flex-end;
}

.topbar-icon-btn {
    background: none;
    border: none;
    color: white;
    font-size: 1.2rem;
    cursor: pointer;
    padding: 8px;
    filter: drop-shadow(0 1px 3px rgba(0,0,0,0.6));
    transition: transform 0.2s;
}

.topbar-icon-btn:active {
    transform: scale(0.9);
}

/* Onglets centraux */
.topbar-tabs {
    display: flex;
    gap: 20px;
    align-items: center;
}

.topbar-tab {
    background: none;
    border: none;
    color: rgba(255,255,255,0.6);
    font-size: 1.05rem;
    font-weight: 600;
    cursor: pointer;
    padding: 6px 2px;
    position: relative;
    transition: color 0.2s;
    font-family: inherit;
    letter-spacing: -0.01em;
    text-shadow: 0 1px 4px rgba(0,0,0,0.5);
}

.topbar-tab.active {
    color: #fff;
}

/* Barre sous l'onglet actif */
.topbar-tab.active::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 50%;
    transform: translateX(-50%);
    width: 24px;
    height: 3px;
    background: #fff;
    border-radius: 2px;
}


/* ==================== AVATAR + FOLLOW DANS SIDEBAR ==================== */

.action-avatar-wrapper {
    position: relative;
    display: flex;
    flex-direction: column;
    align-items: center;
    margin-bottom: 6px;
}

.action-avatar {
    width: 48px;
    height: 48px;
    border-radius: 50%;
    border: 2px solid #fff;
    overflow: hidden;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    background: #333;
    transition: transform 0.2s;
    filter: drop-shadow(0 2px 4px rgba(0,0,0,0.6));
}

.action-avatar:active {
    transform: scale(0.92);
}

.action-avatar-img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.action-avatar-initial {
    font-size: 1.2rem;
    font-weight: 700;
    color: #fff;
    text-transform: uppercase;
}

/* Bouton follow mini (le petit + rouge sous l'avatar) */
.follow-mini-btn {
    position: absolute;
    bottom: -8px;
    left: 50%;
    transform: translateX(-50%);
    width: 22px;
    height: 22px;
    border-radius: 50%;
    background: #FE2C55;
    border: none;
    color: white;
    font-size: 10px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
    box-shadow: 0 2px 6px rgba(0,0,0,0.4);
    z-index: 2;
}

.follow-mini-btn:active {
    transform: translateX(-50%) scale(0.85);
}

/* État "following" — coche verte, plus discret */
.follow-mini-btn.following {
    background: #10B981;
}

.follow-mini-btn.following i {
    font-size: 9px;
}


/* ==================== NAVBAR TRANSPARENTE SUR LE FEED ==================== */

/* Quand on est sur la page feed, la navbar bottom devient transparente */
body.is-feed-page .mobile-navbar {
    background: linear-gradient(0deg, rgba(0,0,0,0.6) 0%, transparent 100%) !important;
    box-shadow: none !important;
}

/* On supprime le padding-bottom puisque la navbar est en overlay */
body.is-feed-page #app {
    padding-bottom: 0 !important;
}

/* La vidéo occupe tout l'écran sur le feed */
body.is-feed-page .main-content-scrollable {
    height: 100dvh;
}

body.is-feed-page .video-card {
    height: 100dvh !important;
}

/* Ajuster le padding de l'overlay pour que les infos ne soient pas sous la navbar */
body.is-feed-page .overlay {
    padding-bottom: calc(var(--bottom-nav-h, 70px) + var(--safe-b, 0px) + 16px) !important;
}

/* Ajuster les actions pour qu'elles ne soient pas sous la navbar */
body.is-feed-page .video-actions {
    padding-bottom: 70px !important;
}


/* ==================== DESKTOP : CACHER LA TOPBAR ==================== */
@media (min-width: 1024px) {
    .feed-topbar {
        display: none !important;
    }
}




