/* ============================================================
   GRIT — Mobile Styles
   mobile.css
   ============================================================ */

/* ── Bottom Navigation Bar ───────────────────────────────── */
.mobile-nav {
  display: none;
  position: fixed;
  bottom: 0; left: 0; right: 0;
  height: 60px;
  background: rgba(6,7,16,0.97);
  border-top: 1px solid rgba(255,255,255,0.08);
  backdrop-filter: blur(24px);
  -webkit-backdrop-filter: blur(24px);
  z-index: 998;
  padding: 0 8px;
  padding-bottom: env(safe-area-inset-bottom);
}

.mobile-nav-inner {
  display: flex;
  align-items: center;
  justify-content: space-around;
  height: 100%;
}

.mobile-nav-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 3px;
  padding: 6px 12px;
  border-radius: 12px;
  text-decoration: none;
  color: rgba(255,255,255,0.4);
  font-size: 10px;
  font-weight: 600;
  font-family: 'Rajdhani', sans-serif;
  letter-spacing: 0.05em;
  transition: all 0.18s;
  min-width: 52px;
  position: relative;
}

.mobile-nav-item svg {
  width: 22px;
  height: 22px;
  stroke-width: 1.8;
}

.mobile-nav-item.active {
  color: #7c7cff;
}

.mobile-nav-item.active svg {
  filter: drop-shadow(0 0 6px rgba(124,124,255,0.6));
}

/* Create button — special */
.mobile-nav-create {
  background: linear-gradient(135deg, #7c7cff, #5a5aff);
  color: #fff !important;
  border-radius: 14px;
  padding: 8px 16px;
  box-shadow: 0 4px 16px rgba(124,124,255,0.4);
}

.mobile-nav-create svg {
  width: 20px;
  height: 20px;
}

/* Notification badge on mobile nav */
.mobile-nav-badge {
  position: absolute;
  top: 2px; right: 6px;
  min-width: 16px; height: 16px;
  background: #ff4d6d;
  border-radius: 99px;
  font-size: 9px; font-weight: 700;
  color: #fff; line-height: 16px;
  text-align: center; padding: 0 3px;
  border: 2px solid #05060f;
}

@media (max-width: 768px) {
  .mobile-nav { display: flex; flex-direction: column; justify-content: flex-end; }

  /* Add padding to body so content doesn't hide behind bottom nav */
  body { padding-bottom: 68px; }

  /* Hide desktop nav items on mobile */
  .nav-icon-pill,
  .nav-create-center { display: none !important; }

  /* Simplify navbar */
  .navbar {
    grid-template-columns: auto 1fr auto;
    padding: 0 16px;
    height: 56px;
  }

  /* Hide nav actions except avatar */
  .nav-actions > *:not(.user-menu):not(.nav-notif-wrap) {
    display: none !important;
  }

  /* Panels full width */
  .nav-notif-panel {
    width: calc(100vw - 24px);
    right: -8px;
  }

  .chat-panel,
  .users-panel {
    width: calc(100vw - 24px);
    right: -8px;
  }

  /* Dropdown full width */
  .dropdown {
    width: calc(100vw - 24px);
    right: -8px;
  }

  /* ── Messages page ── */
  .messages-layout,
  .dm-layout {
    grid-template-columns: 1fr !important;
  }

  .dm-sidebar {
    display: none;
  }

  .dm-sidebar.mobile-visible {
    display: flex !important;
    position: fixed;
    top: 56px; left: 0; right: 0; bottom: 60px;
    z-index: 100;
    background: var(--bg-base);
  }

  /* ── Explore grid ── */
  .posts-grid,
  .explore-grid {
    grid-template-columns: 1fr !important;
  }

  /* ── Profile ── */
  .profile-games-list {
    flex-wrap: wrap;
  }

  /* ── Post page sidebar ── */
  .post-layout {
    grid-template-columns: 1fr !important;
  }

  .post-sidebar {
    display: none !important;
  }

  /* ── Create page ── */
  .create-layout {
    grid-template-columns: 1fr !important;
  }

  /* ── Players grid ── */
  .players-grid {
    grid-template-columns: 1fr 1fr !important;
  }

  /* ── Games layout ── */
  .game-sidebar {
    display: none !important;
  }

  /* ── General ── */
  .page-hero {
    padding: 24px 16px !important;
  }

  .page-content {
    padding: 16px !important;
  }

  h1 { font-size: 1.6rem !important; }
  h2 { font-size: 1.3rem !important; }
}

/* ── Hide feedback & messages floating buttons on mobile ── */
@media (max-width: 768px) {
  #feedbackBtn,
  #messagesBtn,
  .floating-messages-btn {
    display: none !important;
  }

  /* Fix messages page — hide chat panel on right */
  .dm-chat-panel {
    display: none;
  }

  .dm-chat-panel.active {
    display: flex !important;
    position: fixed;
    top: 56px; left: 0; right: 0; bottom: 60px;
    z-index: 200;
    background: var(--bg-base);
    flex-direction: column;
  }

  .dm-list-panel {
    width: 100% !important;
    height: calc(100vh - 56px - 60px);
  }
}

/* ── Extra mobile fixes ───────────────────────────────────── */
@media (max-width: 768px) {

  /* Hide feedback button on mobile — κρύβει το bottom nav */
  #feedbackBtn,
  .feedback-btn,
  [id*="feedback"] { display: none !important; }

  /* Messages floating buttons */
  a[href="./messages.html"][style*="fixed"],
  .floating-messages-btn { display: none !important; }

  /* Messages page — hide chat panel, show full list */
  .dm-chat-panel,
  .messages-chat-area,
  .chat-area { 
    display: none !important; 
  }
  
  .dm-conversations-list,
  .messages-list,
  .conversations-panel {
    width: 100% !important;
    border-right: none !important;
  }

  /* Hide navbar avatar menu on mobile — use bottom nav profile instead */
  .nav-create-center { display: none !important; }

  /* Navbar — show only logo + notifications + avatar */
  .navbar {
    grid-template-columns: auto 1fr auto !important;
  }
}

/* ── Messages — Instagram style ──────────────────────────── */
@media (max-width: 768px) {

  /* Full screen layout */
  .messages-page {
    display: block !important;
    height: calc(100vh - 56px - 68px) !important;
    overflow: hidden !important;
  }

  /* Sidebar — full width list */
  .msg-sidebar {
    width: 100% !important;
    height: 100% !important;
    border-right: none !important;
    display: flex !important;
    flex-direction: column !important;
  }

  /* Chat area — hidden by default, slides in when conv selected */
  .msg-chat {
    position: fixed !important;
    top: 0 !important;
    left: 0 !important;
    right: 0 !important;
    bottom: 0 !important;
    z-index: 997 !important;
    transform: translateX(100%) !important;
    transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1) !important;
    background: var(--bg-base, #080b16) !important;
    display: flex !important;
    flex-direction: column !important;
  }

  .msg-chat.mobile-open {
    transform: translateX(0) !important;
  }

  /* Chat header — add back button */
  .msg-chat-header {
    padding: 12px 16px !important;
    display: flex !important;
    align-items: center !important;
    gap: 12px !important;
    border-bottom: 1px solid rgba(255,255,255,0.08) !important;
    padding-top: calc(12px + env(safe-area-inset-top)) !important;
  }

  /* Bigger conversation items */
  .msg-conv-item {
    padding: 14px 16px !important;
    gap: 14px !important;
  }

  .msg-conv-avatar {
    width: 52px !important;
    height: 52px !important;
    border-radius: 50% !important;
    flex-shrink: 0 !important;
  }

  .msg-conv-name {
    font-size: 15px !important;
    font-weight: 600 !important;
  }

  .msg-conv-preview {
    font-size: 13px !important;
    margin-top: 2px !important;
  }

  /* Messages area full height */
  .msg-messages {
    flex: 1 !important;
    overflow-y: auto !important;
    padding: 16px !important;
    padding-bottom: 8px !important;
  }

  /* Input bar */
  .msg-input-row {
    padding: 10px 16px !important;
    padding-bottom: calc(10px + env(safe-area-inset-bottom)) !important;
    gap: 10px !important;
    border-top: 1px solid rgba(255,255,255,0.08) !important;
  }

  .msg-input {
    border-radius: 24px !important;
    padding: 10px 18px !important;
    font-size: 15px !important;
  }

  /* No conversation placeholder — hide on mobile */
  .msg-no-conv {
    display: none !important;
  }
}

/* ── Hide navbar avatar dropdown on mobile ───────────────── */
@media (max-width: 768px) {
  .user-menu { display: none !important; }
}

/* ── Hamburger Menu ───────────────────────────────────────── */
.mobile-hamburger {
  display: none;
  background: none;
  border: none;
  color: #fff;
  cursor: pointer;
  padding: 8px;
  border-radius: 10px;
  transition: background 0.15s;
}
.mobile-hamburger:hover { background: rgba(255,255,255,0.08); }

.mobile-menu-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.6);
  z-index: 1000;
  backdrop-filter: blur(4px);
}
.mobile-menu-overlay.open { display: block; }

.mobile-menu-panel {
  position: fixed;
  top: 0; right: 0; bottom: 0;
  width: 280px;
  background: #080b16;
  border-left: 1px solid rgba(255,255,255,0.08);
  z-index: 1001;
  transform: translateX(100%);
  transition: transform 0.3s cubic-bezier(0.4,0,0.2,1);
  display: flex;
  flex-direction: column;
  padding: 0;
}
.mobile-menu-panel.open { transform: translateX(0); }

.mobile-menu-header {
  padding: 20px 20px 16px;
  border-bottom: 1px solid rgba(255,255,255,0.08);
  display: flex;
  align-items: center;
  gap: 14px;
  background: rgba(124,124,255,0.05);
}

.mobile-menu-avatar {
  width: 48px; height: 48px;
  border-radius: 50%;
  background: linear-gradient(135deg, #7c7cff, #c77dff);
  display: flex; align-items: center; justify-content: center;
  font-size: 20px; font-weight: 700; color: #fff;
  overflow: hidden; flex-shrink: 0;
}
.mobile-menu-avatar img { width: 100%; height: 100%; object-fit: cover; }

.mobile-menu-username {
  font-size: 16px; font-weight: 700; color: #fff;
}
.mobile-menu-tag {
  font-size: 12px; color: #7c7cff; margin-top: 2px;
}

.mobile-menu-body { padding: 12px; flex: 1; }

.mobile-menu-item {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 14px 16px;
  border-radius: 12px;
  color: rgba(230,232,240,0.85);
  font-size: 15px;
  font-weight: 500;
  text-decoration: none;
  cursor: pointer;
  transition: background 0.15s;
  border: none;
  background: none;
  width: 100%;
  font-family: inherit;
}
.mobile-menu-item:hover { background: rgba(255,255,255,0.06); color: #fff; }
.mobile-menu-item svg { width: 20px; height: 20px; flex-shrink: 0; color: #7c7cff; }

.mobile-menu-divider { height: 1px; background: rgba(255,255,255,0.07); margin: 8px 0; }

.mobile-menu-item.logout { color: rgba(255,92,92,0.8); }
.mobile-menu-item.logout svg { color: rgba(255,92,92,0.8); }
.mobile-menu-item.logout:hover { background: rgba(255,92,92,0.1); color: #ff8a8a; }

@media (max-width: 768px) {
  .mobile-hamburger { display: flex; align-items: center; justify-content: center; }
  .user-menu { display: none !important; }
}