/* ==================== CORE LAYOUT & NAVIGATION STYLES ==================== */

/* Main layout grid */
.app-layout {
  display: grid;
  grid-template-columns: var(--sidebar-width) 1fr;
  min-height: 100vh;
  width: 100vw;
}

/* Custom Scrollbars */
::-webkit-scrollbar {
  width: 8px;
  height: 8px;
}
::-webkit-scrollbar-track {
  background: var(--bg-secondary);
}
::-webkit-scrollbar-thumb {
  background: var(--border-primary);
  border-radius: var(--border-radius-pill);
}
::-webkit-scrollbar-thumb:hover {
  background: var(--border-focus);
}

/* Sidebar Navigation */
.sidebar {
  border-right: 1px solid var(--border-primary);
  background-color: var(--bg-primary);
  padding: 36px 12px 24px;
  display: flex;
  flex-direction: column;
  position: fixed;
  top: 0;
  left: 0;
  bottom: 0;
  width: var(--sidebar-width);
  z-index: 10;
  transition: width var(--transition-smooth), border-color var(--transition-normal), background-color var(--transition-normal);
}

.sidebar-logo {
  font-family: var(--font-logo);
  font-size: 2.2rem;
  padding: 0 12px;
  margin-bottom: 36px;
  user-select: none;
  cursor: pointer;
  color: var(--text-primary);
}

.sidebar-nav {
  display: flex;
  flex-direction: column;
  gap: 8px;
  flex-grow: 1;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 12px;
  border-radius: var(--border-radius-md);
  color: var(--text-primary);
  font-size: 0.95rem;
  font-weight: 500;
  transition: background-color var(--transition-fast), transform var(--transition-fast);
}

.nav-item i {
  width: 24px;
  height: 24px;
  stroke-width: 2;
  transition: transform var(--transition-fast);
}

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

.nav-item:hover i {
  transform: scale(1.05);
}

.nav-item.active {
  font-weight: 700;
}

.nav-item.active i {
  stroke-width: 2.5;
}

.nav-avatar {
  width: 24px;
  height: 24px;
  border: 1px solid var(--border-primary);
}

/* Badges for notifications / inbox */
.nav-item {
  position: relative;
}

.badge {
  position: absolute;
  top: 8px;
  left: 28px;
  background-color: var(--accent-red);
  color: white;
  font-size: 0.7rem;
  font-weight: bold;
  min-width: 16px;
  height: 16px;
  border-radius: var(--border-radius-pill);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0 4px;
  border: 2px solid var(--bg-primary);
}

/* Sidebar Footer Buttons */
.sidebar-footer {
  display: flex;
  flex-direction: column;
  gap: 8px;
  border-top: 1px solid var(--border-secondary);
  padding-top: 16px;
}

.footer-btn {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 12px;
  border-radius: var(--border-radius-md);
  color: var(--text-primary);
  font-size: 0.95rem;
  font-weight: 500;
  text-align: left;
  width: 100%;
}

.footer-btn i {
  width: 24px;
  height: 24px;
}

.footer-btn:hover {
  background-color: var(--bg-secondary-hover);
}

/* Main Content Area */
.content-container {
  grid-column: 2;
  margin-left: var(--sidebar-width);
  padding: 30px 20px;
  display: flex;
  justify-content: center;
  width: calc(100vw - var(--sidebar-width));
  min-height: 100vh;
  transition: margin-left var(--transition-smooth), width var(--transition-smooth);
}

.page-view {
  width: 100%;
  max-width: var(--content-max-width);
  animation: fade-in 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

@keyframes fade-in {
  from {
    opacity: 0;
    transform: translateY(10px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* Hide mobile header and nav by default */
.mobile-header, .mobile-nav, .mobile-only-btn {
  display: none;
}

/* ==================== RESPONSIVE LAYOUT BREAKPOINTS ==================== */

/* Tablet View: 768px to 1200px */
@media (max-width: 1200px) and (min-width: 768px) {
  .app-layout {
    grid-template-columns: var(--sidebar-width-narrow) 1fr;
  }

  .sidebar {
    width: var(--sidebar-width-narrow);
    padding: 24px 8px;
    align-items: center;
  }

  .sidebar-logo {
    display: none; /* Logo is hidden on narrow sidebar */
  }

  /* Only show icons in navigation, hide labels */
  .nav-item span, .footer-btn span {
    display: none;
  }

  .nav-item {
    justify-content: center;
    width: 48px;
    height: 48px;
    padding: 0;
    border-radius: var(--border-radius-pill);
  }

  .footer-btn {
    justify-content: center;
    width: 48px;
    height: 48px;
    padding: 0;
    border-radius: var(--border-radius-pill);
  }

  .badge {
    left: 26px;
    top: 8px;
  }

  .content-container {
    margin-left: var(--sidebar-width-narrow);
    width: calc(100vw - var(--sidebar-width-narrow));
  }
}

/* Mobile View: Less than 768px */
@media (max-width: 767px) {
  .app-layout {
    grid-template-columns: 1fr;
    padding-top: var(--header-mobile-height);
    padding-bottom: var(--nav-mobile-height);
  }

  .sidebar {
    display: none; /* Desktop sidebar hidden */
  }

  .content-container {
    margin-left: 0;
    width: 100vw;
    padding: 12px;
  }

  /* Mobile Header */
  .mobile-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    height: var(--header-mobile-height);
    background-color: var(--bg-primary);
    border-bottom: 1px solid var(--border-primary);
    padding: 0 16px;
    z-index: 10;
  }

  .mobile-logo {
    font-family: var(--font-logo);
    font-size: 1.8rem;
    color: var(--text-primary);
  }

  .mobile-actions {
    display: flex;
    gap: 16px;
  }

  .mobile-actions button {
    font-size: 1.25rem;
    color: var(--text-primary);
  }

  .mobile-actions button i {
    width: 24px;
    height: 24px;
  }

  /* Mobile Bottom Navigation */
  .mobile-nav {
    display: flex;
    justify-content: space-around;
    align-items: center;
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    height: var(--nav-mobile-height);
    background-color: var(--bg-primary);
    border-top: 1px solid var(--border-primary);
    z-index: 10;
  }

  .mobile-nav-item {
    color: var(--text-secondary);
    display: flex;
    align-items: center;
    justify-content: center;
    width: 44px;
    height: 44px;
  }

  .mobile-nav-item i {
    width: 24px;
    height: 24px;
  }

  .mobile-nav-item.active {
    color: var(--text-primary);
  }

  .mobile-nav-avatar {
    width: 24px;
    height: 24px;
    border: 1px solid var(--border-primary);
  }

  .mobile-only-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
    border: 1px solid var(--border-primary);
    border-radius: var(--border-radius-md);
  }

  .mobile-only-btn i {
    width: 20px;
    height: 20px;
  }
}
