/* Responsive Layout System */

/* Mobile Bottom Navigation Bar (Hidden by Default on Desktop) */
#bottom-nav {
  display: none;
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  height: 64px;
  background-color: #0C3B2E; /* Deep Forest Green */
  border-top: 1px solid rgba(255, 255, 255, 0.06);
  z-index: 999;
  display: none; /* controlled by media queries */
  justify-content: space-around;
  align-items: center;
  padding: 0 1rem;
}

.bottom-nav-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0.25rem;
  color: rgba(244, 245, 239, 0.65);
  font-size: 0.6875rem;
  font-weight: 550;
  text-decoration: none;
  width: 55px;
  height: 100%;
}

.bottom-nav-item.active {
  color: #BB8A52; /* Warm Sand active icon */
}

.bottom-nav-item svg, .bottom-nav-item .nav-icon {
  font-size: 1.25rem;
}

.bottom-nav-add-btn {
  width: 48px;
  height: 48px;
  background-color: #6D9773; /* Sage Green */
  color: #F4F5EF;
  border-radius: var(--radius-full);
  display: flex;
  align-items: center;
  justify-content: center;
  margin-top: -24px;
  box-shadow: 0 4px 12px rgba(109, 151, 115, 0.3);
  font-size: 1.5rem;
  transition: transform var(--transition-fast);
}

.bottom-nav-add-btn:active {
  transform: scale(0.9);
}

/* Responsive Media Queries */

/* --- TABLETS & MOBILES (Max-Width: 768px) --- */
@media (max-width: 768px) {
  #sidebar {
    display: none !important; /* Hide sidebar completely */
  }

  #main-content {
    margin-left: 0 !important; /* Full width main area */
    padding: 1.25rem 1.25rem 5rem 1.25rem; /* bottom padding for bottom nav */
  }

  #bottom-nav {
    display: flex; /* Show mobile bottom navigation */
  }

  /* Grid adaptations */
  .grid-2, .grid-3, .grid-sidebar-layout {
    grid-template-columns: 1fr !important;
    gap: 1.25rem;
  }

  .grid-4 {
    grid-template-columns: repeat(2, 1fr) !important;
    gap: 1rem;
  }

  .app-header {
    flex-direction: column;
    align-items: flex-start;
    gap: 1rem;
  }

  .app-header .btn {
    width: 100%;
  }

  /* Keep shortcut navigation side-by-side with equal 50% width */
  .analytics-shortcut-buttons {
    width: 100% !important;
  }

  .analytics-shortcut-buttons .btn {
    width: auto !important;
    flex: 1 !important;
    justify-content: center !important;
  }

  /* Modal responsive sizing */
  .modal-container {
    width: 100%;
    max-width: 100%;
    border-radius: var(--radius-lg) var(--radius-lg) 0 0;
    position: absolute;
    bottom: 0;
    transform: translateY(100%);
    max-height: 90vh;
  }

  .modal-overlay.active .modal-container {
    transform: translateY(0);
  }

  /* Compact spacing for dashboard */
  .card {
    padding: 1.25rem;
  }

  /* Profile page mobile fixes */
  .profile-header-card {
    flex-direction: column !important;
    align-items: center !important;
    text-align: center !important;
    gap: 1.5rem !important;
    padding: 1.5rem 1rem !important;
  }

  .profile-avatar-section {
    flex-direction: column !important;
    align-items: center !important;
    text-align: center !important;
    gap: 1rem !important;
  }

  .profile-avatar-section > div {
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
  }

  .dashboard-stats-card {
    padding: 1.25rem !important;
  }
}

/* --- SMALL MOBILE PHONES (Max-Width: 430px) --- */
@media (max-width: 430px) {
  html {
    font-size: 15px; /* slightly smaller font scale for small mobile */
  }

  #main-content {
    padding: 1rem 1rem 4.5rem 1rem;
  }

  .app-title-section h1 {
    font-size: 1.5rem;
  }
}

/* --- DESKTOPS AND LARGE SCREENS (Min-Width: 1024px) --- */
@media (min-width: 1024px) {
  /* Sidebar styles styling details */
  .nav-menu {
    display: flex;
    flex-direction: column;
    gap: 0.375rem;
    margin-top: 1.5rem;
  }

  .nav-item {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.625rem 0.875rem;
    font-size: 0.9375rem;
    font-weight: 550;
    color: var(--text-muted);
    border-radius: var(--radius-md);
    transition: all var(--transition-fast);
  }

  .nav-item:hover {
    color: var(--text-main);
    background-color: var(--bg-hover);
  }

  .nav-item.active {
    color: var(--primary);
    background-color: var(--primary-light);
  }

  .nav-icon {
    font-size: 1.125rem;
    display: flex;
    align-items: center;
  }

  .sidebar-footer {
    margin-top: auto;
    border-top: 1px solid var(--border-color);
    padding-top: 1rem;
    display: flex;
    flex-direction: column;
    gap: 0.375rem;
  }

  .sidebar-logo {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.5rem;
    font-weight: 700;
    font-size: 1.25rem;
    color: var(--text-main);
  }
}
