/* ==========================================================================
   CPES AI — responsive.css
   Breakpoints follow Bootstrap 5:
   sm ≥576 · md ≥768 · lg ≥992 · xl ≥1200 · xxl ≥1400
   ========================================================================== */


/* --------------------------------------------------------------------------
   XL and below
   -------------------------------------------------------------------------- */
@media (max-width: 1199.98px) {
  .suggestion-grid {
    grid-template-columns: repeat(3, 1fr);
  }
}


/* --------------------------------------------------------------------------
   LG and below — mobile offcanvas sidebar becomes the main navigation
   -------------------------------------------------------------------------- */
@media (max-width: 991.98px) {
  .app-sidebar,
  .app-sidebar.offcanvas {
    width: 288px;
  }

  .app-sidebar.offcanvas {
    position: fixed;
    top: 0;
    left: 0;
    height: 100vh;
    height: 100dvh;
    background-color: var(--bg-sidebar);
    border-right: 1px solid var(--border-1);
  }

  .app-main {
    height: 100vh;
    height: 100dvh;
  }

  /* Always allow collapsing state styles to be ignored on mobile */
  body.sidebar-collapsed .app-sidebar,
  body.sidebar-collapsed .app-sidebar.offcanvas {
    width: 288px;
  }

  body.sidebar-collapsed .brand-name,
  body.sidebar-collapsed .sidebar-search,
  body.sidebar-collapsed .sidebar-nav .nav-link span,
  body.sidebar-collapsed .profile-meta,
  body.sidebar-collapsed .profile-caret,
  body.sidebar-collapsed .history-title,
  body.sidebar-collapsed .history-group-label {
    display: block;
  }

  body.sidebar-collapsed .btn-new-chat span {
    display: inline;
  }

  body.sidebar-collapsed .brand,
  body.sidebar-collapsed .btn-new-chat,
  body.sidebar-collapsed .sidebar-nav .nav-link,
  body.sidebar-collapsed .profile-btn,
  body.sidebar-collapsed .history-item {
    justify-content: flex-start;
    padding: 0.65rem 0.85rem;
  }

  body.sidebar-collapsed .history-item {
    padding: 0.62rem 0.85rem;
  }

  body.sidebar-collapsed .history-delete {
    display: block;
    opacity: 0;
  }

  /* Auth page: hide the visual branding panel, show compact card */
  .auth-visual {
    display: none;
  }

  .auth-panel {
    width: 100%;
  }

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


/* --------------------------------------------------------------------------
   MD and below
   -------------------------------------------------------------------------- */
@media (max-width: 767.98px) {
  .suggestion-grid {
    grid-template-columns: repeat(2, 1fr);
    gap: 0.6rem;
  }

  .suggestion-card {
    min-height: 104px;
    padding: 0.9rem 0.95rem 0.85rem;
    font-size: 0.82rem;
  }

  .welcome-view {
    padding: 1.5rem 1rem 3.5rem;
  }

  .chat-view {
    padding: 1.5rem 1rem 1.5rem;
  }

  .chat-msg {
    gap: 0.65rem;
    margin-bottom: 1.4rem;
  }

  .msg-avatar {
    width: 30px;
    height: 30px;
  }

  .msg-body {
    max-width: 84%;
  }

  .chat-input-area {
    padding: 0.6rem 0.75rem 0.75rem;
  }

  .chat-input-card {
    border-radius: 16px;
    padding: 0.5rem 0.5rem 0.5rem 0.65rem;
  }

  .navbar-inner {
    padding: 0.5rem 0.9rem;
    min-height: 60px;
  }

  .navbar-title {
    font-size: 0.98rem;
  }

  .page-container {
    padding: 1.5rem 1rem 2.5rem;
  }

  .page-card {
    padding: 1.2rem;
  }

  .theme-picker {
    grid-template-columns: 1fr 1fr;
  }
}


/* --------------------------------------------------------------------------
   SM and below
   -------------------------------------------------------------------------- */
@media (max-width: 575.98px) {
  .suggestion-grid {
    grid-template-columns: 1fr 1fr;
  }

  .navbar-actions .btn-icon {
    width: 36px;
    height: 36px;
    font-size: 1.05rem;
  }

  .welcome-logo {
    width: 62px;
    height: 62px;
  }

  .welcome-sub {
    margin-bottom: 1.75rem;
  }

  .msg-body {
    max-width: 92%;
  }

  .msg-bubble {
    padding: 0.7rem 0.9rem;
    font-size: 0.9rem;
    border-radius: 16px;
  }

  .msg-action-btn {
    opacity: 1;
  }

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

  .profile-card {
    justify-content: center;
    text-align: center;
    flex-direction: column;
    gap: 1rem;
  }

  .theme-picker {
    grid-template-columns: 1fr;
  }

  .auth-panel {
    padding: 4.5rem 1.25rem 2rem;
  }

  .auth-form-wrap {
    max-width: 100%;
  }

  .auth-back {
    top: 1rem;
    left: 1rem;
  }

  .auth-topbar {
    top: 1rem;
    right: 1rem;
  }

  .chat-send-btn {
    width: 38px;
    height: 38px;
  }

  .page-title {
    font-size: 1.25rem;
  }
}


/* --------------------------------------------------------------------------
   Extra small phones
   -------------------------------------------------------------------------- */
@media (max-width: 374.98px) {
  .suggestion-grid {
    grid-template-columns: 1fr;
  }

  .navbar-actions .btn-icon:nth-child(1) {
    display: none; /* hide search on very narrow screens */
  }
}


/* --------------------------------------------------------------------------
   Short viewport heights — keep input & sidebar usable
   -------------------------------------------------------------------------- */
@media (max-height: 640px) {
  .sidebar-history {
    max-height: 40vh;
  }

  .app-sidebar {
    overflow-y: auto;
  }
}
