/* ASObot Mobile Responsive Fixes */

/* Mobile header bar (hidden on desktop) */
.mobile-header {
  display: none;
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  height: 56px;
  background: rgb(17 24 39);
  border-bottom: 1px solid rgb(45 58 82);
  z-index: 90;
  align-items: center;
  justify-content: space-between;
  padding: 0 16px;
}

.mobile-header-logo {
  display: flex;
  align-items: center;
  gap: 8px;
  font-weight: 800;
  font-size: 1rem;
  color: white;
}

.mobile-header-logo-icon {
  width: 28px;
  height: 28px;
  border-radius: 6px;
  background: linear-gradient(to bottom right, #6366f1, #a855f7);
  display: flex;
  align-items: center;
  justify-content: center;
  color: white;
  font-size: 12px;
}

.mobile-hamburger {
  display: flex;
  flex-direction: column;
  gap: 5px;
  background: none;
  border: none;
  cursor: pointer;
  padding: 8px;
  z-index: 102;
}

.mobile-hamburger span {
  display: block;
  width: 22px;
  height: 2px;
  background: #e5e7eb;
  border-radius: 2px;
  transition: all 0.3s ease;
}

.mobile-hamburger.active span:nth-child(1) {
  transform: rotate(45deg) translate(5px, 5px);
}

.mobile-hamburger.active span:nth-child(2) {
  opacity: 0;
}

.mobile-hamburger.active span:nth-child(3) {
  transform: rotate(-45deg) translate(5px, -5px);
}

/* Sidebar overlay backdrop */
.sidebar-overlay {
  display: none;
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.6);
  z-index: 95;
}

.sidebar-overlay.open {
  display: block;
}

@media (max-width: 768px) {
  /* Show mobile header */
  .mobile-header {
    display: flex !important;
  }

  /* Hide desktop sidebar, show as overlay when open */
  .flex.min-h-screen > aside {
    position: fixed !important;
    top: 0 !important;
    left: 0 !important;
    bottom: 0 !important;
    width: 280px !important;
    z-index: 100 !important;
    transform: translateX(-100%);
    transition: transform 0.3s ease;
    overflow-y: auto;
  }

  body.sidebar-open .flex.min-h-screen > aside {
    transform: translateX(0);
  }

  body.sidebar-open .sidebar-overlay {
    display: block;
  }

  /* Main content takes full width */
  .flex.min-h-screen > main {
    margin-left: 0 !important;
    width: 100% !important;
    padding: 72px 16px 16px !important;
  }

  /* Layout fix */
  .flex.min-h-screen {
    flex-direction: column !important;
  }

  /* Grid fixes for dashboard cards */
  .grid.grid-cols-1.sm\:grid-cols-2.lg\:grid-cols-4 {
    grid-template-columns: 1fr !important;
  }

  .grid.grid-cols-1.lg\:grid-cols-2 {
    grid-template-columns: 1fr !important;
  }

  .grid.grid-cols-1.lg\:grid-cols-3 {
    grid-template-columns: 1fr !important;
  }

  /* Fix modal positioning */
  .fixed.inset-0.z-50 > div,
  .fixed.inset-0.z-\[60\] {
    margin: 16px !important;
  }

  /* Fix toast on mobile */
  .fixed.top-6.right-6 {
    top: 68px !important;
    right: 12px !important;
    left: 12px !important;
    max-width: none !important;
  }

  /* Table horizontal scroll */
  .overflow-x-auto {
    -webkit-overflow-scrolling: touch;
  }

  /* Fix padding for pages */
  .p-8 {
    padding: 16px !important;
  }

  .p-6 {
    padding: 12px !important;
  }

  /* Admin page header stack on mobile */
  .flex.items-center.justify-between.mb-8 {
    flex-direction: column !important;
    align-items: flex-start !important;
    gap: 12px !important;
  }

  /* Card padding reduction */
  .card.p-5 {
    padding: 14px !important;
  }

  /* App analysis tabs - horizontal scroll */
  .flex.gap-1 {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
  }

  .flex.gap-1::-webkit-scrollbar {
    display: none;
  }

  /* Reports page grid */
  .md\:grid-cols-2 {
    grid-template-columns: 1fr !important;
  }

  /* Fix button wrapping */
  .flex.items-center.gap-3.flex-wrap {
    gap: 8px;
  }

  /* Login/Register pages */
  .max-w-sm, .max-w-md, .max-w-lg {
    max-width: calc(100vw - 32px) !important;
  }

  /* Fix upgrade banner on mobile */
  .flex.items-center.justify-between > .flex.items-center.gap-3 {
    flex-direction: column;
    align-items: flex-start;
    gap: 8px;
  }

  /* Fix chart containers */
  .h-64 {
    height: 200px !important;
  }
}

/* Small phones */
@media (max-width: 375px) {
  .mobile-header {
    padding: 0 12px;
  }

  .flex.min-h-screen > main {
    padding: 68px 12px 12px !important;
  }

  .text-2xl {
    font-size: 1.25rem !important;
  }

  .text-3xl {
    font-size: 1.5rem !important;
  }
}
