/* Base layout */
body {
  display: flex;
  min-height: 100vh;
  margin: 0;
  padding: 0;
  overflow-x: hidden;
}

/* Content wrapper */
.content-wrapper {
  flex: 1;
  overflow-y: auto;
  padding: 1rem;
  background-color: #f3f4f6;
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}

/* Main content area */
.content-wrapper > *:not(footer) {
  flex: 1 0 auto;
}

/* Footer fixes */
.content-wrapper > footer {
  flex-shrink: 0;
  margin-left: -1rem;
  margin-right: -1rem;
  width: calc(100% + 2rem);
  margin-bottom: -1rem;
}

/* Sidebar styling */
aside.w-64 {
  height: 100vh;
  position: sticky;
  top: 0;
  display: flex;
  flex-direction: column;
  z-index: 50;
}

/* Navigation styles */
.category-item {
  position: relative;
}

/* Dropdown toggle button */
.dropdown-toggle {
  cursor: pointer;
  padding: 8px;
  border-radius: 4px;
}

.dropdown-toggle:hover {
  background-color: rgba(255, 255, 255, 0.1);
}

/* Hover effect for category items */
.category-link:hover + .dropdown-toggle,
.dropdown-toggle:hover {
  color: white;
}

/* Animation for dropdown */
.category-pages {
  max-height: 0;
  overflow: hidden;
  transition: max-height 0.3s ease;
}

.category-pages:not(.hidden) {
  max-height: 500px;
}

/* Active category styling */
.active-category {
  background-color: rgba(255, 255, 255, 0.1);
  border-left: 3px solid #3b82f6;
}

/* Empty pages message */
.no-pages-message {
  font-style: italic;
  color: #6b7280;
  padding: 4px 8px;
  font-size: 0.875rem;
}

/* Mobile Menu Toggle Button - for all screen sizes but hidden on desktop */
.mobile-menu-toggle {
  display: none;
}

/* Menu overlay */
.menu-overlay {
  display: none;
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background-color: rgba(0, 0, 0, 0.5);
  z-index: 40;
}

/* TABLET STYLES */
@media (min-width: 769px) and (max-width: 1024px) {
  aside.w-64 {
    width: 250px;
  }
}

/* MOBILE STYLES */
@media (max-width: 768px) {
  /* Mobile layout structure */
  body {
    flex-direction: column;
    overflow-x: hidden;
  }
  
  /* Mobile content area */
  .content-wrapper {
    width: 100%;
    padding: 0.5rem;
  }
  
  /* Mobile navigation button */
  .mobile-menu-toggle {
    display: flex;
    position: fixed;
    bottom: 1rem; /* Bottom position */
    right: 1rem; /* Right position */
    background-color: #1f2937;
    color: white;
    width: 3rem;
    height: 3rem;
    border-radius: 50%;
    align-items: center;
    justify-content: center;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
    z-index: 100;
    border: 2px solid #374151;
    transition: all 0.2s ease;
    cursor: pointer;
  }
  
  .mobile-menu-toggle:hover,
  .mobile-menu-toggle:active {
    transform: scale(1.05);
    background-color: #374151;
    border-color: #4b5563;
  }
  
  /* Mobile sidebar */
  aside.w-64 {
    position: fixed;
    left: -100%;
    top: 0;
    bottom: 0;
    width: 80%;
    max-width: 300px;
    height: 100vh;
    transition: left 0.3s ease;
    box-shadow: 4px 0 10px rgba(0, 0, 0, 0.1);
  }
  
  /* When menu is visible */
  aside.mobile-menu-visible {
    left: 0;
  }
  
  /* Hide settings section on mobile */
  aside .mt-6.px-3 {
    display: none;
  }
  
  /* Show navigation when menu is toggled */
  aside nav {
    display: block;
  }
  
  /* Show overlay when menu is open */
  body.menu-open .menu-overlay {
    display: block;
  }
  
  /* Blur content when menu is open */
  body.menu-open .content-wrapper {
    filter: blur(2px);
    pointer-events: none;
  }
  
  /* Mobile footer */
  footer .flex.flex-col.md\:flex-row.justify-between {
    flex-direction: column;
  }
  
  footer .grid.grid-cols-2.gap-8.md\:grid-cols-3 {
    grid-template-columns: 1fr;
    gap: 1.5rem;
  }
  
  /* Responsive grid for home page */
  .grid.grid-cols-1.md\:grid-cols-2.lg\:grid-cols-3,
  .grid.grid-cols-1.md\:grid-cols-2 {
    grid-template-columns: 1fr;
  }
  
  /* Adjust text sizes for mobile */
  h1.text-3xl {
    font-size: 1.75rem;
  }
  
  h2.text-2xl {
    font-size: 1.5rem;
  }
  
  /* Adjust spacing for mobile */
  .container.mx-auto.px-4.py-8 {
    padding: 1rem;
  }
  
  .bg-white.rounded-lg.shadow-md.p-6 {
    padding: 1rem;
  }
}

/* Touch device optimizations */
@media (hover: none) {
  /* Make buttons and links more tappable */
  a, button {
    padding: 0.5rem;
  }
  
  /* Increase spacing between nav items */
  aside nav li {
    margin-bottom: 0.25rem;
  }
  
  /* Make dropdown toggles easier to tap */
  .dropdown-toggle {
    padding: 0.75rem;
  }
}