/* ==========================================
   USER LAYOUT RESPONSIVE CSS
   Mobile-First Approach for User Pages
   ========================================== */

/* ==========================================
   BASE STYLES (Mobile First)
   ========================================== */

body {
  margin: 0;
  padding: 0;
  font-family: "Segoe UI", Tahoma, Geneva, Verdana, sans-serif;
  background-color: #f8f9fa;
}

/* Navbar Styles */
.navbar {
  background-color: #fff;
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
  position: sticky;
  top: 0;
  z-index: 1030;
  /* height: 70px; Removed to prevent overflow issues */
  min-height: 70px;
  padding: 0.75rem 0;
}

.navbar-brand {
  font-weight: 700;
  font-size: 1.5rem;
  color: #0d6efd;
}

/* ==========================================
   MOBILE STYLES (Default - Mobile First)
   ========================================== */

/* Desktop Sidebar - Hidden on Mobile */
.sidebar-desktop {
  display: none;
}

/* Mobile Offcanvas Sidebar */
.offcanvas {
  background-color: #f8f9fa;
}

.offcanvas-header {
  background-color: #f8f9fa;
  border-bottom: 1px solid #dee2e6;
}

.offcanvas-title {
  font-weight: 600;
  color: #212529;
}

/* Main Content - Full Width on Mobile */
.main-content {
  width: 100%;
  padding: 15px;
  transition: margin-left 0.3s ease, width 0.3s ease;
}

/* Navigation Links - Common Styles */
.nav-link {
  color: #495057;
  text-decoration: none;
  transition: all 0.2s ease;
  border-left: 4px solid transparent;
}

.nav-link:hover {
  background-color: #e9ecef;
  color: #0d6efd;
  text-decoration: none;
}

.nav-link.active {
  background-color: #e7f1ff;
  border-left-color: #0d6efd;
  color: #0d6efd;
  font-weight: 500;
}

.nav-link i {
  width: 20px;
  text-align: center;
}

/* Badge Styles */
.badge {
  font-size: 0.75rem;
  padding: 0.25em 0.5em;
}

/* Circular Notification Badge */
.notification-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 22px;
  min-height: 22px;
  width: 22px;
  height: 22px;
  padding: 0;
  font-size: 0.7rem;
  font-weight: 600;
  line-height: 1;
  border-radius: 50% !important;
}

/* Hamburger Toggle - Visible on Mobile */
.navbar-toggler {
  border: none;
  padding: 0.5rem;
}

.navbar-toggler:focus {
  box-shadow: none;
}

/* ==========================================
   TABLET STYLES (768px - 991px)
   ========================================== */

@media (min-width: 768px) and (max-width: 991px) {
  /* Still use offcanvas on tablets */
  .sidebar-desktop {
    display: none;
  }

  .main-content {
    padding: 20px;
  }
}

/* ==========================================
   DESKTOP STYLES (992px and up)
   ========================================== */

@media (min-width: 992px) {
  /* Hide Mobile Offcanvas */
  .offcanvas {
    display: none !important;
  }

  /* Hide Hamburger Menu */
  .navbar-toggler {
    display: none !important;
  }

  /* Show Desktop Persistent Sidebar */
  .sidebar-desktop {
    display: block !important;
    position: fixed;
    left: 0;
    top: 70px; /* Below navbar */
    width: 260px;
    height: calc(100vh - 70px);
    background-color: #f8f9fa;
    border-right: 1px solid #dee2e6;
    overflow-y: auto;
    overflow-x: hidden;
    z-index: 1020;
    transition: all 0.3s ease;
  }

  /* Sidebar Header */
  .sidebar-desktop .sidebar-header {
    position: sticky;
    top: 0;
    background-color: #f8f9fa;
    z-index: 1;
    padding: 1rem;
    border-bottom: 1px solid #dee2e6;
  }

  .sidebar-desktop .sidebar-header h5 {
    margin: 0;
    font-size: 1.1rem;
    font-weight: 600;
    color: #212529;
  }

  /* Sidebar Body */
  .sidebar-desktop .sidebar-body {
    padding: 0;
  }

  /* Sidebar Navigation */
  .sidebar-desktop .navbar-nav {
    flex-direction: column;
    padding: 0;
    margin: 0;
  }

  .sidebar-desktop .nav-item {
    width: 100%;
    list-style: none;
  }

  .sidebar-desktop .nav-link {
    display: flex;
    align-items: center;
    padding: 0.875rem 1rem;
    color: #495057;
    text-decoration: none;
    border-left: 4px solid transparent;
    transition: all 0.2s ease;
    gap: 0.75rem;
  }

  .sidebar-desktop .nav-link:hover {
    background-color: #e9ecef;
    color: #0d6efd;
    border-left-color: #e9ecef;
  }

  .sidebar-desktop .nav-link.active {
    background-color: #e7f1ff;
    border-left-color: #0d6efd;
    color: #0d6efd;
    font-weight: 500;
  }

  .sidebar-desktop .nav-link i {
    font-size: 1.1rem;
    width: 20px;
    text-align: center;
    flex-shrink: 0;
  }

  .sidebar-desktop .nav-link span {
    flex-grow: 1;
  }

  /* Badge in Sidebar */
  .sidebar-desktop .badge {
    font-size: 0.7rem;
    padding: 0.2em 0.5em;
    border-radius: 10px;
  }

  /* Circular Notification Badge in Desktop Sidebar */
  .sidebar-desktop .notification-badge {
    min-width: 24px;
    min-height: 24px;
    width: 24px;
    height: 24px;
    font-size: 0.7rem;
  }

  /* Custom Scrollbar for Sidebar */
  .sidebar-desktop::-webkit-scrollbar {
    width: 6px;
  }

  .sidebar-desktop::-webkit-scrollbar-track {
    background: #f1f1f1;
  }

  .sidebar-desktop::-webkit-scrollbar-thumb {
    background: #c1c1c1;
    border-radius: 3px;
  }

  .sidebar-desktop::-webkit-scrollbar-thumb:hover {
    background: #a8a8a8;
  }

  /* Main Content - Adjust for Sidebar */
  .main-content {
    margin-left: 260px;
    width: calc(100% - 260px);
    padding: 25px;
    min-height: calc(100vh - 70px);
    transition: margin-left 0.3s ease, width 0.3s ease;
  }

  /* Navbar Adjustments for Desktop */
  .navbar .container-fluid {
    padding-left: 1rem;
    padding-right: 1rem;
  }
}

/* ==========================================
   LARGE DESKTOP STYLES (1200px and up)
   ========================================== */

@media (min-width: 1200px) {
  .main-content {
    padding: 30px;
  }

  .main-content .container-fluid {
    max-width: 1400px;
    margin: 0 auto;
  }
}

/* ==========================================
   SMOOTH TRANSITIONS FOR VIEWPORT RESIZING
   ========================================== */

.sidebar-desktop,
.main-content,
.navbar-toggler {
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

/* ==========================================
   Z-INDEX LAYERING
   ========================================== */

/* Z-index hierarchy:
   - Navbar: 1030 (highest - always on top)
   - Offcanvas: 1045 (Bootstrap default)
   - Sidebar Desktop: 1020 (below navbar)
   - Main Content: 1 (base layer)
*/

.navbar {
  z-index: 1030;
}

.sidebar-desktop {
  z-index: 1020;
}

.main-content {
  z-index: 1;
  position: relative;
}

/* ==========================================
   ACCESSIBILITY IMPROVEMENTS
   ========================================== */

/* Focus Styles */
.nav-link:focus,
.navbar-toggler:focus {
  outline: 2px solid #0d6efd;
  outline-offset: 2px;
}

/* Reduced Motion Support */
@media (prefers-reduced-motion: reduce) {
  .sidebar-desktop,
  .main-content,
  .nav-link,
  .navbar-toggler {
    transition: none;
  }
}

/* ==========================================
   PRINT STYLES
   ========================================== */

@media print {
  .sidebar-desktop,
  .offcanvas,
  .navbar-toggler,
  .navbar {
    display: none !important;
  }

  .main-content {
    margin-left: 0 !important;
    width: 100% !important;
    padding: 0 !important;
  }
}

/* ==========================================
   UTILITY CLASSES
   ========================================== */

/* Hover Background Utility */
.hover-bg-light:hover {
  background-color: #e9ecef;
}

/* Transition Utility */
.transition {
  transition: all 0.2s ease;
}

/* ==========================================
   RESPONSIVE CONTAINER ADJUSTMENTS
   ========================================== */

@media (max-width: 991px) {
  .container-fluid {
    padding-left: 15px;
    padding-right: 15px;
  }
}

@media (min-width: 992px) {
  .container-fluid {
    padding-left: 20px;
    padding-right: 20px;
  }
}

/* ==========================================
   CARD AND CONTENT RESPONSIVE ADJUSTMENTS
   ========================================== */

.card {
  margin-bottom: 1.5rem;
  border-radius: 0.5rem;
  box-shadow: 0 0.125rem 0.25rem rgba(0, 0, 0, 0.075);
}

@media (max-width: 991px) {
  .card {
    margin-bottom: 1rem;
  }
}

/* ==========================================
   RESPONSIVE GRID ADJUSTMENTS
   ========================================== */

@media (max-width: 991px) {
  .row {
    margin-left: -10px;
    margin-right: -10px;
  }

  .row > * {
    padding-left: 10px;
    padding-right: 10px;
  }
}
