/* responsive.css – Mobile‑first overrides */

/* Global fluid font size */
:root {
  --font-base: clamp(0.875rem, 1vw, 1rem);
}

@media (min-width: 600px) {
  :root { --font-base: clamp(1rem, 1.2vw, 1.125rem); }
}
@media (min-width: 1024px) {
  :root { --font-base: clamp(1.125rem, 1.5vw, 1.25rem); }
}

/* Header – hamburger */
.header .nav-toggle {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 1.2rem;
  cursor: pointer;
}

.mobile-nav {
  position: fixed;
  top: 0; left: -100%;
  width: 80%;
  height: 100vh;
  background: var(--bg-glass);
  backdrop-filter: blur(15px);
  transition: left 0.3s ease;
  z-index: 2000;
  padding: 1rem;
}
.mobile-nav.active { left: 0; }

@media (min-width: 768px) {
  .header .nav-toggle { display: none; }
  .mobile-nav { display: none; }
}

/* Sidebars – slide panels on mobile */
@media (max-width: 767px) {
  .chat-sidebar, .friends-sidebar, .rooms-sidebar {
    position: fixed;
    inset: 0;
    width: 100%;
    height: 100%;
    background: var(--bg-glass);
    transform: translateX(-100%);
    transition: transform 0.3s ease;
    z-index: 1900;
    overflow-y: auto;
    padding: 1rem;
  }
  body.show-panel .chat-sidebar,
  body.show-panel .friends-sidebar,
  body.show-panel .rooms-sidebar {
    transform: translateX(0);
  }
}

/* Poem grid – responsive columns */
.poems-grid, .discoverGrid, .active-duels-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 16px;
}

/* Form inputs – touch friendly */
input, textarea, select {
  width: 100%;
  min-height: 44px;
  padding: 12px;
  font-size: var(--font-base);
}

/* Buttons – larger tap area */
button, .btn-primary, .fab-btn {
  min-height: 48px;
  min-width: 48px;
  padding: 12px 20px;
  font-size: var(--font-base);
}

/* Touch feedback */
button:active, .nav-item:active {
  transform: scale(0.97);
}
:focus-visible {
  outline: 2px dashed var(--primary);
  outline-offset: 2px;
}

/* === DESKTOP OVERRIDES === */
@media (min-width: 901px) {
  .nav-menu {
    display: none !important;
  }
}

/* === MOBILE OVERRIDES (max-width: 768px) === */
@media (max-width: 768px) {
  /* Header Gem Badge Adjustments */
  #headerPointsBadge {
    padding: 5px 10px !important;
    font-size: 0.85rem !important;
    gap: 4px !important;
  }

  /* Friends (DMs) Mobile Toggle Layout */
  .friends-container {
    grid-template-columns: 1fr !important;
    height: calc(100vh - 160px) !important;
  }
  .friends-container .friends-sidebar {
    display: flex !important;
  }
  .friends-container .friends-main {
    display: none !important;
  }
  .friends-container.active-chat .friends-sidebar {
    display: none !important;
  }
  .friends-container.active-chat .friends-main {
    display: flex !important;
  }
  .friends-container.active-chat .back-dm-btn {
    display: inline-block !important;
  }

  /* General Chat Mobile Users Panel Overlay Fix */
  .chat-container {
    position: relative !important;
  }
  .chat-container.show-users .chat-sidebar {
    display: flex !important;
    position: absolute !important;
    top: 0;
    left: 0;
    width: 100% !important;
    height: 100% !important;
    z-index: 100 !important;
    background: var(--bg-surface) !important; /* Theme adaptive background */
  }
  .chat-container.show-users .mobile-close-users {
    display: block !important;
  }

  /* Music Room Mobile Layout Stack */
  .music-room-layout {
    flex-direction: column !important;
    overflow-y: auto !important;
    padding-bottom: 80px !important;
  }
  .music-room-layout > div {
    flex: none !important;
    width: 100% !important;
  }
  .queue-container {
    height: 350px !important;
    margin-bottom: 40px !important;
  }

  /* Tombala Grid Stacking */
  .tombala-grid-layout {
    grid-template-columns: 1fr !important;
    gap: 15px !important;
  }
}

/* === MOBILE OVERRIDES (max-width: 600px) === */
@media (max-width: 600px) {
  /* Ludo Canvas Responsiveness */
  #ludoCanvas {
    width: 100% !important;
    max-width: 100% !important;
    height: auto !important;
    aspect-ratio: 1 / 1 !important;
  }

  /* Word Duel Mobile Layout */
  .word-duel-cols {
    grid-template-columns: 1fr !important;
    gap: 15px !important;
  }
  .word-list-box {
    height: 140px !important;
  }

  /* Tombala Cell Scaling & Fluid Grids */
  .tombala-card-grid {
    padding: 6px !important;
    gap: 4px !important;
  }
  .tombala-cell {
    font-size: clamp(0.7rem, 2.5vw, 0.95rem) !important;
    border-radius: 4px !important;
  }
  .master-board-grid {
    padding: 6px !important;
    gap: 2px !important;
  }
  .master-board-cell {
    font-size: clamp(0.6rem, 2vw, 0.8rem) !important;
    border-radius: 2px !important;
  }

  /* Dice Duel Stacking Adjustments */
  #diceActivePlayView {
    padding: 20px 10px !important;
  }
  #dicePlayer1Box, #dicePlayer2Box {
    width: 100% !important;
    min-width: 0 !important;
  }

  /* Daily Inspiration Layout */
  .daily-inspiration-card {
    padding: 16px !important;
    margin-bottom: 20px !important;
  }
  .inspiration-content h3 {
    font-size: 1.3rem !important;
    margin: 8px 0 !important;
  }
  .inspiration-bg {
    display: none !important;
  }

  /* Zen Mode Reader Text Size */
  #poemModal.zen-mode .poem-content {
    font-size: 1.35rem !important;
    padding: 15px !important;
    line-height: 1.5 !important;
  }

  /* Profile Tabs adjustments */
  .profile-tabs-modern {
    gap: 15px !important;
    top: 55px !important;
  }
  .ptab-btn-modern {
    padding: 10px 5px !important;
    font-size: 0.85rem !important;
  }
}

/* === MOBILE OVERRIDES (max-width: 480px) === */
@media (max-width: 480px) {
  /* Auth Screen Card padding */
  .auth-card {
    padding: 20px !important;
  }
  .auth-header h1 {
    font-size: 2.2rem !important;
  }

  /* Poem Card padding */
  .poem-card {
    padding: 18px !important;
  }
  .poem-card-body p {
    font-size: 0.9rem !important;
  }

  #headerPointsBadge {
    padding: 4px 8px !important;
    font-size: 0.8rem !important;
  }
}

/* === LIVE ROOM OVERLAY COLLAPSIBLE & RESPONSIVE FIX === */
#roomOverlay {
  position: fixed;
  bottom: 90px;
  right: 16px;
  z-index: 5000;
  width: 290px;
  max-height: 480px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 20px;
  box-shadow: 0 20px 50px rgba(0,0,0,0.25);
  animation: popIn 0.3s ease;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  transition: max-height 0.3s cubic-bezier(0.4, 0, 0.2, 1), 
              width 0.3s cubic-bezier(0.4, 0, 0.2, 1), 
              left 0.3s ease, 
              right 0.3s ease, 
              bottom 0.3s ease, 
              border-radius 0.3s ease, 
              background 0.3s ease;
}

#roomOverlayContent {
  padding: 18px;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 12px;
  height: 100%;
}

/* Collapsed State - Elegant Floating Bubble */
#roomOverlay.collapsed {
  width: 56px !important;
  height: 56px !important;
  max-height: 56px !important;
  border-radius: 50% !important;
  left: auto !important;
  right: 16px !important;
  bottom: 85px !important;
  background: linear-gradient(135deg, var(--primary), #4f46e5) !important;
  border: 2px solid rgba(255, 255, 255, 0.25) !important;
  box-shadow: 0 10px 25px rgba(99, 102, 241, 0.5) !important;
  cursor: pointer;
  justify-content: center;
  align-items: center;
}

#roomOverlay.collapsed #roomOverlayContent {
  display: none !important;
}

#roomOverlayMiniBubble {
  display: none;
}

#roomOverlay.collapsed #roomOverlayMiniBubble {
  display: flex;
  width: 100%;
  height: 100%;
  align-items: center;
  justify-content: center;
  color: white;
  font-size: 1.35rem;
}

#roomOverlayMiniBubble i {
  animation: miniBubblePulse 1.5s infinite alternate ease-in-out;
}

@keyframes miniBubblePulse {
  0% { transform: scale(0.9); opacity: 0.8; }
  100% { transform: scale(1.1); opacity: 1; }
}

/* Mobile responsive layout */
@media (max-width: 768px) {
  #roomOverlay {
    left: 16px;
    right: 16px;
    width: auto;
    max-height: 380px;
    bottom: 80px; /* Stay above bottom navigation on mobile */
  }
  
  #roomOverlay.collapsed {
    width: 56px !important;
    height: 56px !important;
    max-height: 56px !important;
    border-radius: 50% !important;
    left: auto !important;
    right: 16px !important;
    bottom: 85px !important;
  }
}

/* === GAMES MOBILE RESPONSIVENESS OVERRIDES === */

/* Horizontal scrollable game tabs on mobile */
@media (max-width: 768px) {
  .games-tabs {
    display: flex !important;
    overflow-x: auto !important;
    flex-wrap: nowrap !important;
    padding-bottom: 10px !important;
    gap: 10px !important;
    border-bottom: 1px solid rgba(255, 255, 255, 0.08) !important;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none; /* Firefox */
  }
  .games-tabs::-webkit-scrollbar {
    display: none; /* Chrome, Safari, Opera */
  }
  .game-tab-btn {
    flex: 0 0 auto !important;
    width: auto !important;
    min-width: 0 !important;
    padding: 10px 16px !important;
    font-size: 0.85rem !important;
  }
}

/* Ludo lobby stacking & layout */
@media (max-width: 768px) {
  .ludo-lobby-grid {
    grid-template-columns: 1fr !important;
    gap: 15px !important;
  }
}

/* Ludo game board stacking, centering, & scaling */
@media (max-width: 768px) {
  .ludo-game-layout {
    flex-direction: column !important;
    align-items: center !important;
    gap: 15px !important;
  }
  .ludo-game-layout > div {
    width: 100% !important;
    flex: none !important;
  }
  #ludoCanvas {
    margin: 0 auto !important;
    width: 100% !important;
    height: auto !important;
    max-width: 480px !important;
    aspect-ratio: 1/1 !important;
  }
}

/* Tombala responsive adjustments & grid stacking */
@media (max-width: 768px) {
  .tombala-grid-layout {
    grid-template-columns: 1fr !important;
    gap: 15px !important;
  }
  #tombalaActivePlayView > div:first-child {
    flex-direction: column !important;
    align-items: center !important;
    text-align: center !important;
    gap: 15px !important;
  }
  #tombalaActivePlayView > div:first-child > div {
    flex-direction: column !important;
    align-items: center !important;
  }
  .cinko-buttons-container {
    flex-direction: column !important;
    gap: 8px !important;
  }
  .cinko-btn {
    width: 100% !important;
    min-height: 44px !important;
  }
}

/* Tombala cell size optimization on small screens */
@media (max-width: 480px) {
  .tombala-card-grid {
    gap: 3px !important;
    padding: 8px !important;
    border-radius: 8px !important;
  }
  .tombala-cell {
    font-size: 0.65rem !important;
  }
  .master-board-grid {
    gap: 2px !important;
    padding: 6px !important;
  }
  .master-board-cell {
    font-size: 0.6rem !important;
  }
}

/* Word Duel column stacking */
@media (max-width: 768px) {
  .word-duel-cols {
    grid-template-columns: 1fr !important;
    gap: 15px !important;
  }
}

/* Dice Duel player box stacking on mobile */
@media (max-width: 600px) {
  #diceActivePlayView > div[style*="display: flex;"] {
    flex-direction: column !important;
    align-items: center !important;
    gap: 15px !important;
  }
  #dicePlayer1Box, #dicePlayer2Box {
    width: 100% !important;
    min-width: 0 !important;
    flex: none !important;
  }
}

/* Active Game Views padding optimizations for mobile screens */
@media (max-width: 600px) {
  .games-container {
    padding: 10px !important;
  }
  #gamesActivePlayView {
    padding: 15px !important;
  }
  #tombalaActivePlayView {
    padding: 15px !important;
  }
  #diceActivePlayView {
    padding: 20px 10px !important;
  }
}


/* === GUNLUK ODUL MODAL RESPONSIVE === */
.daily-reward-modal-inner { border-radius: 20px; overflow: hidden; }
.daily-cal-day { transition: transform 0.2s ease; }
.daily-cal-day:hover { transform: translateY(-2px); }
@media (max-width: 480px) {
  #dailyRewardCalendar { gap: 4px !important; }
  #dailyCoinDisplay { font-size: 2rem !important; }
}
@media (max-width: 600px) {
  .modal-content {
    margin: 0 !important; border-radius: 20px 20px 0 0 !important;
    max-height: 90vh !important; overflow-y: auto !important;
    position: fixed !important; bottom: 0 !important; left: 0 !important; right: 0 !important;
    max-width: 100% !important;
  }
  .modal { align-items: flex-end !important; }
  #poolCanvas { width: 100% !important; height: auto !important; max-width: 100% !important; }
}
@media (max-width: 768px) {
  .notif-btn { width: 36px !important; height: 36px !important; }
  #notificationDropdown { right: -10px !important; width: min(360px, 95vw) !important; }
}
@keyframes streakPulse { 0%,100% { transform: scale(1); } 50% { transform: scale(1.08); } }
#dailyRewardEmoji { display: inline-block; animation: streakPulse 1.5s infinite ease-in-out; }
