/* ===========================================================
   📱 IPTV SOCIAL MEDIA - Responsive Layout (v3 - stable)
   =========================================================== */

/* === BASE RESET === */
html, body {
  max-width: 100%;
  overflow-x: hidden;
}
/* ===========================================================
   🧭 Correctif : bouton menu burger visible uniquement sur mobile
   =========================================================== */

/* Cacher par défaut sur PC */
.mobile-menu-btn {
  display: none;
}

/* Le montrer seulement sous 768px */
@media (max-width: 768px) {
  .mobile-menu-btn {
    display: block !important;
  }
}

/* ===========================================================
   🔹 GRANDES TABLETTES ET PETITS ORDIS (max 1200px)
   =========================================================== */
@media screen and (max-width: 1200px) {
  .main-header { width: 95%; }

  .header-inner {
    grid-template-columns: 1fr 1fr;
    row-gap: 20px;
  }

  .search-area { grid-column: span 2; justify-content: center; }
  .user-icons { position: static; justify-content: flex-end; }

  .main-menu { flex-wrap: wrap; gap: 18px; padding: 10px 0; }

  .container, .main-layout {
    grid-template-columns: 25% 1fr;
    gap: 20px;
  }
}

/* ===========================================================
   🔹 TABLETTES (max 992px)
   =========================================================== */
@media screen and (max-width: 992px) {
  .main-header {
    width: 96%;
    margin: 20px auto;
    border-radius: 18px;
  }

  .header-inner { grid-template-columns: 1fr; text-align: center; }
  .logo-area { justify-content: center; }
  .search-area { margin-top: 10px; }
  .user-icons { justify-content: center; margin-top: 10px; position: static; }

  .main-menu {
    flex-wrap: wrap;
    gap: 15px;
    font-size: 15px;
  }

  .container, .main-layout { grid-template-columns: 1fr; width: 95%; }

  .sidebar.left, .sidebar.right {
    order: 2;
    flex-direction: row;
    flex-wrap: wrap;
    justify-content: center;
    gap: 15px;
  }

  .content { order: 1; }

  .slider {
    flex-direction: column;
    text-align: center;
  }

  .slider-right { width: 100%; margin-top: 15px; }
}

/* ===========================================================
   🔹 MOBILES HORIZONTAUX (max 768px)
   =========================================================== */
@media screen and (max-width: 768px) {
  .header-top { padding: 15px 20px; }
  .logo-area span { display: none; }
  .search-box { max-width: 90%; }

  .user-icons { flex-wrap: wrap; gap: 12px; }
  .user-menu .avatar { width: 45px; height: 45px; }

  .container, .main-layout {
    grid-template-columns: 1fr;
    width: 95%;
    margin: 20px auto;
  }

  /* Cache les sidebars */
  .sidebar.left, .sidebar.right, .widgets-top {
    display: none !important;
  }

  /* Contenu plein écran */
  .content {
    width: 100% !important;
    max-width: 100% !important;
  }

  /* === Menu mobile === */
  .main-menu {
    display: none !important;
  }

.mobile-menu-btn {
  position: fixed;
  top: 12px;
  right: 12px;
  z-index: 9999;
  background: rgba(0, 80, 200, 0.95);
  color: #fff;
  border: none;
  font-size: 26px;
  line-height: 1;
  border-radius: 10px;
  padding: 8px 12px;
  box-shadow: 0 0 10px rgba(0, 180, 255, 0.4);
  display: block; /* 👈 normal, pas !important */
}

  .mobile-menu-panel {
    position: fixed;
    top: 0;
    right: 0;
    width: 75%;
    height: 100vh;
    background: rgba(0, 15, 40, 0.96);
    padding: 70px 25px 30px;
    display: none;
    flex-direction: column;
    gap: 12px;
    z-index: 9998;
  }

  .mobile-menu-panel.open {
    display: flex;
    animation: slideIn .3s ease forwards;
  }

  .mobile-menu-panel a {
    color: #cfeaff;
    font-size: 18px;
    padding: 12px 0;
    border-bottom: 1px solid rgba(255,255,255,0.1);
  }

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

/* ===========================================================
   🔹 PETITS MOBILES (max 600px)
   =========================================================== */
@media screen and (max-width: 600px) {
  body { font-size: 15px; }

  .main-header {
    width: 100%;
    margin: 0;
    border-radius: 0;
    box-shadow: none;
  }

  .header-top {
    padding: 10px 12px !important;
    border-radius: 0;
    flex-direction: column;
  }

  .logo-area img { height: 55px !important; }
  .logo-area span { font-size: 1.1em !important; }

  .search-box { width: 100%; max-width: 100%; }

  .login-box {
    flex-direction: column !important;
    padding: 25px 20px !important;
    gap: 20px !important;
    width: 92% !important;
    box-sizing: border-box !important;
  }

  .login-left { display: none !important; }
  .login-form { width: 100% !important; }

  .footer {
    padding: 20px;
    font-size: 14px;
  }
}
/* ===========================================================
   📱 CHAT SIDEBAR - Version mobile (slide horizontal à droite)
   =========================================================== */
@media (max-width: 768px) {
  #chat-sidebar {
    position: fixed;
    top: 7;
    right: 0;
    width: 80%;
    max-width: 300px;
    height: calc(100vh - 80px);
    background: #0a1a3a;
    border-radius: 12px 0 0 12px;
    box-shadow: -2px 0 8px rgba(0, 0, 0, 0.4);
    transition: transform 0.35s ease-in-out;
    transform: translateX(0);
    z-index: 9999;
  }

#chat-sidebar.closed {
  transform: translateX(calc(100% - 25px)); /* garde 25px visibles */
}

  .chat-header {
    background: #071838;
    color: #fff;
    text-align: center;
    font-weight: 600;
    font-size: 16px;
    padding: 12px 0;
    border-radius: 12px 0 0 0;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    cursor: pointer;
    user-select: none;
  }

  .chat-toggle-inline {
    font-size: 20px;
    color: #ffffffcc;
    transition: transform 0.3s ease, color 0.3s ease;
  }

  #chat-sidebar.closed .chat-toggle-inline {
    transform: rotate(180deg);
  }

  #chat-friends-list {
    height: calc(100vh - 130px);
    overflow-y: auto;
    padding: 10px;
  }

  /* Fenêtres de chat : plein écran mais en dessous du panneau */
  .chat-window {
    width: 100%;
    right: 0;
    bottom: 0;
    left: 0;
    max-height: 70vh;
    border-radius: 12px 12px 0 0;
    z-index: 9000;
  }
}
/* ===========================================================
   📱 CHAT SIDEBAR - Version mobile (slide horizontal à droite)
   =========================================================== */
@media (max-width: 768px) {
  #chat-sidebar {
    position: fixed;
    top: 300; /* sera ajusté dynamiquement */
    right: 0;
    width: 78%;
    max-width: 290px;
    height: calc(100vh - 140px);
    background: rgba(10, 26, 58, 0.95);
    backdrop-filter: blur(6px);
    border-radius: 16px 0 0 16px;
    box-shadow: -2px 0 8px rgba(0, 0, 0, 0.4);
    transition: transform 0.35s ease-in-out, top 0.3s ease;
    transform: translateX(0);
    z-index: 9999;
  }

  /* --- Fermé (avec languette visible) --- */
  #chat-sidebar.closed {
    transform: translateX(calc(100% - 25px));
  }

  /* --- Languette flottante (❮ / ❯) --- */
  #chat-toggle-btn {
    position: absolute;
    left: -22px;
    top: 18px;
    width: 28px;
    height: 28px;
    border-radius: 50%;
    background: #0a1a3a;
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 16px;
    cursor: pointer;
    box-shadow: 0 0 4px rgba(0, 0, 0, 0.3);
    transition: background 0.3s ease;
    z-index: 10000;
  }

  #chat-toggle-btn:hover {
    background: #133f8b;
  }

  .chat-header {
    background: #071838;
    color: #fff;
    font-weight: 600;
    font-size: 15px;
    padding: 10px;
    border-radius: 16px 0 0 0;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
  }

  .chat-toggle-inline {
    font-size: 20px;
    color: #ffffffcc;
    transition: transform 0.3s ease, color 0.3s ease;
  }

  #chat-sidebar.closed .chat-toggle-inline {
    transform: rotate(180deg);
  }

  #chat-friends-list {
    height: calc(100vh - 180px);
    overflow-y: auto;
    padding: 10px;
  }

  /* --- Fenêtres de chat : compactes et bien placées --- */
  .chat-window {
    position: fixed !important;
    bottom: 0;
    right: 0;
    width: 88% !important; /* 🔸 plus étroite */
    max-width: 370px;
    height: 60vh;
    border-radius: 16px 16px 0 0;
    z-index: 9000;
    background: #fff;
    box-shadow: 0 -4px 10px rgba(0, 0, 0, 0.25);
  }

  .chat-window-header {
    font-size: 15px;
    padding: 10px;
    background: #071838;
    color: #fff;
    border-radius: 16px 16px 0 0;
  }

  .chat-window-input textarea {
    font-size: 15px;
  }
}
