/* xOarena/css/responsive.css */
/* Responsive styles for mobile and tablets */

@media (max-width: 768px) {
  /* Adjust main content margin for smaller navbar */
  .main-content {
    margin-left: 0 !important;
    padding: 1rem;
  }

  .nav-vertical {
    position: fixed;
    bottom: 0;
    left: 0;
    top: auto;
    width: 100%;
    height: 65px;
    flex-direction: row;
    justify-content: space-around;
    border-right: none;
    border-top: 2px solid var(--border);
    box-shadow: 0 -2px 10px rgba(0,0,0,0.05);
    z-index: 1000;
    padding: 0 0.5rem;
  }

  .nav-icon {
    width: 42px;
    height: 42px;
    font-size: 1.4rem;
  }

  /* Preloader text smaller */
  .preloader-text {
    font-size: 1.5rem;
  }

  .hero-title {
    font-size: 2.5rem;
  }
  .hero-tagline {
    font-size: 1.1rem;
  }

  .carousel-slide {
    padding: 2rem 1rem;
    min-height: 200px;
  }
  .carousel-slide h2 {
    font-size: 1.5rem;
  }

  .features-grid {
    grid-template-columns: 1fr;
  }

  .game-container {
    padding: 1.5rem 1rem;
  }
  /* inside @media (max-width: 768px) */
.game-board {
  max-width: 280px;
}
.cell {
  font-size: clamp(1.8rem, 8vw, 3rem);
}

  .ai-main {
    grid-template-columns: 1fr;
    gap: 1rem;
    padding: 1rem;
  }
  .bot-panel {
    position: static;
    width: 100%;
  }

  .speech-bubble {
    left: 10px;
    top: -60px;
    max-width: 160px;
    font-size: 0.8rem;
  }

  .learn-page-title {
    font-size: 2rem;
  }
  .learn-card {
    padding: 1.2rem;
  }

  .settings-tabs {
    flex-direction: column;
    align-items: center;
  }

  .profile-stats {
    grid-template-columns: repeat(2, 1fr);
  }

  .creator-grid {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 480px) {
  .hero-title {
    font-size: 2rem;
  }
  .carousel-slide h2 {
    font-size: 1.2rem;
  }
  .turn-indicator {
    font-size: 1rem;
  }
  .scoreboard {
    gap: 0.8rem;
  }
  .game-actions {
    flex-direction: column;
    width: 100%;
  }
  .btn {
    width: 100%;
    justify-content: center;
  }
  .theme-selector {
    flex-direction: column;
  }
  .achievements-grid {
    grid-template-columns: repeat(3, 1fr);
  }
}

/* ========== AI Page Mobile Responsiveness ========== */
/* Place inside your responsive.css or at the end of ai.css */

@media (max-width: 768px) {
  /* Stack panels vertically, remove sticky */
  .ai-main {
    grid-template-columns: 1fr;       /* single column */
    gap: 1.2rem;
    padding: 1rem;
    margin: 0;
    width: 100%;
  }

  .bot-panel {
    position: static;                 /* no sticky on mobile */
    width: 100%;
    padding: 1rem;
    border-radius: 18px;
  }

  .bot-panel-title {
    font-size: 1.1rem;
    margin-bottom: 0.8rem;
  }

  .bot-list {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(130px, 1fr)); /* compact grid */
    gap: 0.5rem;
  }

  .bot-list-item {
    padding: 0.6rem;
    border-radius: 12px;
    gap: 0.5rem;
  }

  .bot-avatar {
    font-size: 1.6rem;
  }

  .bot-name {
    font-size: 0.9rem;
  }

  .bot-difficulty {
    font-size: 0.7rem;
    padding: 2px 6px;
  }

  /* Game container adjustments */
  .ai-game-container {
    padding: 1.2rem 1rem;
    border-radius: 20px;
    gap: 0.8rem;
  }

  /* Bot row (avatar + speech bubble) */
  .ai-bot-row {
    flex-wrap: nowrap;
    gap: 0.5rem;
  }

  .bot-opponent-info {
    gap: 0.3rem;
  }

  .bot-opponent-avatar {
    font-size: 1.8rem;
  }

  .bot-opponent-name {
    font-size: 1rem;
  }

  /* Speech bubble */
  .speech-bubble {
    max-width: 160px;
    padding: 0.5rem 1rem;
    font-size: 0.8rem;
    left: auto;   /* position to the right will stay */
    border-radius: 15px;
  }

  .speech-bubble::before {
    left: -8px;
    border-width: 8px;
  }

  /* Player info */
  .player-info {
    margin-top: 0.3rem;
  }

  .player-avatar {
    font-size: 1.8rem;
  }

  .player-name {
    font-size: 1rem;
  }

  /* Game board sizing */
  .game-board {
    max-width: 280px;
    gap: 6px;
  }

  .cell {
    font-size: 2.2rem;
    border-radius: 12px;
  }

  /* Buttons */
  .game-actions {
    flex-direction: row;
    flex-wrap: wrap;
    justify-content: center;
    gap: 0.5rem;
  }

  .btn {
    padding: 0.6rem 1.2rem;
    font-size: 0.9rem;
  }

  /* Status text */
  .game-status {
    font-size: 0.95rem;
    min-height: 1.2rem;
  }

  .turn-indicator {
    font-size: 1rem;
  }
}

@media (max-width: 480px) {
  .bot-list {
    grid-template-columns: 1fr 1fr;   /* two columns for small phones */
    gap: 0.4rem;
  }

  .bot-list-item {
    padding: 0.5rem;
  }

  .bot-avatar {
    font-size: 1.4rem;
  }

  .bot-name {
    font-size: 0.8rem;
  }

  .ai-bot-row {
    flex-direction: column;
    align-items: flex-start;
    gap: 0.3rem;
  }

  .speech-bubble {
    max-width: 100%;
    width: 100%;
    border-radius: 12px;
    margin-left: 0;
  }

  .speech-bubble::before {
    display: none; /* arrow removed when bubble is below bot */
  }

  .game-board {
    max-width: 260px;
    gap: 5px;
  }

  .cell {
    font-size: 2rem;
    border-radius: 10px;
  }

  .btn {
    width: 100%;
    justify-content: center;
  }

  .game-actions {
    flex-direction: column;
    width: 100%;
  }
}

/* ========== AI Page Mobile Enhancements ========== */

/* Hamburger button – visible only on mobile */
.bot-toggle-btn {
  display: none;
  position: fixed;
  top: 1rem;
  right: 1rem;
  z-index: 1100;
  width: 48px;
  height: 48px;
  border-radius: 50%;
  background: var(--primary);
  color: #fff;
  font-size: 1.5rem;
  border: none;
  box-shadow: 0 4px 12px rgba(0,0,0,0.3);
  cursor: pointer;
  align-items: center;
  justify-content: center;
}

@media (max-width: 768px) {
  .bot-toggle-btn {
    display: flex;               /* show hamburger */
  }

  .ai-main {
    grid-template-columns: 1fr;  /* single column */
    padding: 1rem 0.5rem;
    gap: 0;
    position: relative;
  }

  /* Bot panel wrapper – hidden by default, slides in from left */
  .bot-panel-wrapper {
    position: fixed;
    top: 0;
    left: -100%;
    width: 280px;
    height: 100vh;
    background: var(--surface);
    z-index: 1050;
    transition: left 0.3s ease;
    box-shadow: 2px 0 20px rgba(0,0,0,0.2);
    overflow-y: auto;
    padding-top: 4rem;
  }

  .bot-panel-wrapper.show-panel {
    left: 0;
  }

  /* Make bot panel inside scrollable and fill the wrapper */
  .bot-panel {
    background: none;
    box-shadow: none;
    border: none;
    padding: 1rem;
  }

  /* Game container full width, remove extra padding */
  .ai-game-container {
    width: 100%;
    max-width: 100%;
    padding: 1rem;
    margin: 0;
    border-radius: 0;
    box-shadow: none;
    border: none;
    background: transparent;
  }

  /* Game board takes full available width */
  .game-board {
    max-width: 100%;
    width: 100%;
    aspect-ratio: 1 / 1;
  }

  /* Adjust cell font so X/O remains proportional */
  .cell {
    font-size: clamp(2rem, 10vw, 3.5rem);
  }
}

@media (max-width: 480px) {
  .bot-panel-wrapper {
    width: 260px;
  }

  .game-container {
    padding: 0.5rem;
  }

  .game-actions .btn {
    font-size: 0.9rem;
    padding: 0.6rem 1rem;
  }
}