/* ============================================================================
   BaciScout Responsive Design - Feature #243
   ============================================================================

   This file implements comprehensive responsive design improvements for
   mobile and tablet devices across all screen sizes.

   Key Features:
   - Table-to-card transformations for mobile
   - Touch target sizing (44x44px minimum per WCAG 2.5.5 AAA)
   - Responsive filter sidebar with offcanvas drawer
   - Mobile-friendly form controls
   - Optimized spacing and padding for touch

   References:
   - Bootstrap 5 Breakpoints: https://getbootstrap.com/docs/5.3/layout/breakpoints/
   - WCAG 2.5.5 Target Size: https://www.w3.org/WAI/WCAG21/Understanding/target-size.html
   - WCAG 2.5.8 Touch Target: https://wcag.dock.codes/documentation/wcag258/

   ============================================================================ */

/* ============================================================================
   SECTION 1: TOUCH TARGET SIZING (WCAG 2.5.5 AAA - 44x44px minimum)
   ============================================================================ */

/* Ensure all buttons meet minimum touch target size */
.btn {
  min-height: 44px;
  min-width: 44px;
  padding: 0.5rem 1rem;
  line-height: 1.5;
}

/* Small buttons still meet minimum requirements */
.btn-sm {
  min-height: 44px;
  min-width: 44px;
  padding: 0.375rem 0.75rem;
  font-size: 0.875rem;
}

/* Icon-only buttons need explicit sizing */
.btn-icon-only,
.btn-link.nav-link,
.navbar-toggler {
  min-height: 44px;
  min-width: 44px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0.5rem;
}

/* Close buttons */
.btn-close {
  min-height: 44px;
  min-width: 44px;
  padding: 0.5rem;
}

/* Form controls need adequate touch targets */
.form-control,
.form-select {
  min-height: 44px;
  padding: 0.5rem 0.75rem;
}

.form-control-sm {
  min-height: 44px;
  padding: 0.375rem 0.75rem;
}

/* Checkboxes and radio buttons */
.form-check-input {
  width: 1.25rem;
  height: 1.25rem;
  min-height: 44px;
  min-width: 44px;
  margin-top: 0;
}

/* Form check label spacing */
.form-check {
  min-height: 44px;
  display: flex;
  align-items: center;
  padding: 0.25rem 0;
}

/* Dropdown items */
.dropdown-item {
  min-height: 44px;
  padding: 0.75rem 1.5rem;
  display: flex;
  align-items: center;
}

/* Pagination links */
.page-link {
  min-height: 44px;
  min-width: 44px;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0.5rem 0.75rem;
}

/* Nav links */
.nav-link {
  min-height: 44px;
  display: flex;
  align-items: center;
  padding: 0.5rem 1rem;
}

/* ============================================================================
   SECTION 2: TABLE-TO-CARD TRANSFORMATION FOR MOBILE
   ============================================================================ */

/* Mobile table cards (< 768px) */
@media (max-width: 767.5px) {
  /* Hide standard tables on mobile */
  .table-responsive-mobile .table-desktop,
  .table-responsive-desktop {
    display: none;
  }

  /* Show card-based layout on mobile */
  .table-responsive-mobile .table-mobile {
    display: block;
  }

  /* Card-based table alternative */
  .table-mobile-card {
    display: block;
    margin-bottom: 1rem;
    border: 1px solid #dee2e6;
    border-radius: 0.375rem;
    background: #fff;
    padding: 1rem;
  }

  .table-mobile-card .card-row {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    padding: 0.5rem 0;
    border-bottom: 1px solid #f8f9fa;
  }

  .table-mobile-card .card-row:last-child {
    border-bottom: none;
  }

  .table-mobile-card .card-label {
    font-weight: 600;
    color: #495057;
    min-width: 120px;
    font-size: 0.875rem;
  }

  .table-mobile-card .card-value {
    text-align: right;
    flex: 1;
    word-break: break-word;
    font-size: 0.875rem;
  }

  /* Action buttons in cards */
  .table-mobile-card .card-actions {
    display: flex;
    gap: 0.5rem;
    margin-top: 1rem;
    flex-wrap: wrap;
  }

  .table-mobile-card .card-actions .btn {
    flex: 1;
    min-width: 100px;
  }
}

/* Desktop table styles (>= 768px) */
@media (min-width: 768px) {
  /* Show standard tables on desktop */
  .table-responsive-mobile .table-desktop,
  .table-responsive-desktop {
    display: table;
  }

  /* Hide mobile card layout */
  .table-responsive-mobile .table-mobile,
  .table-mobile-card {
    display: none;
  }
}

/* Ensure tables are horizontally scrollable on all devices */
.table-responsive {
  display: block;
  width: 100%;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}

/* ============================================================================
   SECTION 3: RESPONSIVE FILTER SIDEBAR (OFFCANVAS ON MOBILE)
   ============================================================================ */

/* Desktop: persistent sidebar (>= 992px) */
@media (min-width: 992px) {
  .filter-sidebar-container {
    display: block !important;
  }

  .filter-sidebar-toggle {
    display: none !important;
  }
}

/* t_e5b84b0e — tender inbox desktop filter panel.
   The panel uses Bootstrap .collapse, toggled by the Refine button.
   Bootstrap display utilities (d-none d-lg-block) CANNOT gate it by
   viewport: they carry !important, which also overrides
   .collapse:not(.show){display:none} — the panel then rendered permanently
   visible at lg+ even when collapsed, while the results column stayed
   col-12, stacking the results below the fold with the right half of the
   viewport blank.
   At lg+ Bootstrap's own .collapse rules are sufficient (collapsed →
   display:none; .show → default block). Only the <lg hide needs stating:
   on phones the panel must never render (mobile uses the #filterSidebar
   offcanvas clone), even when .show is set server-side for active filters. */
@media (max-width: 991.98px) {
  #filterPanel.filter-sidebar-desktop {
    display: none !important;
  }
}

/* Tablet: collapsible sidebar (768px - 991px) */
@media (min-width: 768px) and (max-width: 991.5px) {
  .filter-sidebar {
    position: fixed;
    left: 0;
    top: 56px;
    height: calc(100vh - 56px);
    width: 280px;
    z-index: 1000;
    transition: transform 0.3s ease;
    overflow-y: auto;
  }

  .filter-sidebar.collapsed {
    transform: translateX(-100%);
  }

  .filter-sidebar-toggle {
    display: block;
    position: fixed;
    left: 0;
    top: 50%;
    transform: translateY(-50%);
    z-index: 999;
    border-radius: 0 0.5rem 0.5rem 0;
    padding: 0.75rem;
  }
}

/* Mobile: offcanvas drawer (< 768px) */
@media (max-width: 767.5px) {
  .filter-sidebar {
    position: fixed;
    left: 0;
    top: 0;
    height: 100vh;
    width: 85%;
    max-width: 320px;
    z-index: 1050;
    transform: translateX(-100%);
    transition: transform 0.3s ease;
    overflow-y: auto;
    box-shadow: 2px 0 8px rgba(0, 0, 0, 0.15);
  }

  .filter-sidebar.show {
    transform: translateX(0);
  }

  .filter-sidebar-backdrop {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    z-index: 1040;
  }

  .filter-sidebar-backdrop.show {
    display: block;
  }

  .filter-sidebar-toggle {
    display: flex;
    min-height: 44px;
    min-width: 44px;
  }
}

/* ============================================================================
   SECTION 3B: TENDER INBOX TOOLBAR (t_e5b84b0e)
   ============================================================================
   The inbox action toolbar (pagination mode, sort, export, analyze) is a
   ~684px wide action group. On a 390px viewport it overflowed the ~342px
   content area and pushed the document to 781px wide (horizontal scroll,
   sort control clipped, Export/Analyze beyond the viewport). Rules below
   let the group wrap and collapse secondary labels to icons at narrow
   widths — no horizontal page overflow. */

.tender-toolbar-actions {
  /* Let the flex row wrap instead of forcing one unwrappable line. */
  min-width: 0;
  justify-content: flex-end;
}

@media (max-width: 575.98px) {
  .tender-toolbar-actions {
    justify-content: flex-start;
    width: 100%;
  }

  /* Collapse secondary text labels to icon-only buttons on phones: the
     icons are self-explanatory and title/aria attributes carry the full
     meaning. */
  .tender-toolbar-actions .btn .toolbar-label {
    display: none;
  }
}

/* ============================================================================
   SECTION 3C: TENDER INBOX MOBILE FIRST VIEWPORT (VA-012)
   ============================================================================
   On a 375x812 phone the inbox initial viewport was consumed by control
   chrome — search bar + heading block + standalone Refine row + toolbar
   heading + a ~684px-wrapping toolbar + a 288px bulk-actions bar — so the
   first tender card started ~295px BELOW the fixed bottom-nav boundary
   (live-measured 2026-09-09: first title bottom y=1047 vs nav top y=752).

   Strategy (audit fix direction): keep search prominent, collapse
   sort/filter/view controls into ONE compact toolbar row, surface a
   one-line result summary, and keep the desktop (>=768px) layout byte
   -identical in content order. Rules below apply to phones (<768px)
   only; the desktop density the audit approved is untouched. */

@media (max-width: 767.5px) {
  /* Header block: tighten the mb-4 row + heading rhythm. The eyebrow is
     decorative context (kept in DOM for md+); on phones the H1 + count
     badge + one-line summary carry the identity. */
  .inbox-header-row {
    margin-bottom: 0.75rem !important;
  }

  .inbox-header-row .bacimo-eyebrow {
    display: none;
  }

  .inbox-header-row h1.h3 {
    font-size: 1.15rem;
    margin-bottom: 0.125rem !important;
  }

  /* Toolbar row directly above the list: kill its mb-3 and the "All
     Tenders" heading block — the mobile summary line in the header
     already states what is shown. */
  #tender-list-col > .d-flex.justify-content-between {
    margin-bottom: 0.5rem !important;
  }

  #tender-list-col > .d-flex.justify-content-between > .min-w-0 {
    display: none;
  }

  /* One compact toolbar row: keep the action group tight (labels
     collapse to icons at <=575px via Section 3B) and cap the sort
     label's width so long option names ("Publication Date Newest
     First") cannot re-wrap the row. The group must fit ONE row in the
     ~327px phone content area: Refine + Pages/Scroll + Sort + Export
     + Analyze, all icon-scale. */
  .tender-toolbar-actions {
    gap: 0.25rem !important;
    row-gap: 0.25rem !important;
  }

  .tender-toolbar-actions .btn {
    padding: 0.25rem 0.4rem;
  }

  .tender-toolbar-actions .btn-group .btn {
    padding: 0.25rem 0.3rem;
  }

  /* The compact Refine entry button: cap its footprint so the whole
     group (Refine + Pages/Scroll + Sort + Export + Analyze) fits the
     ~327px phone content width on ONE row. Height keeps the 44px WCAG
     touch-target floor; width tightens (44px min stays on the
     icon-only buttons). */
  .tender-toolbar-actions .btn.filter-sidebar-toggle {
    padding: 0.25rem 0.45rem;
    gap: 0.25rem;
    min-width: 0;
    font-size: 0.8125rem;
  }

  /* Icon margin collapse: every toolbar icon carries a me-1 (4px)
     meant for text labels that no longer render at phone widths —
     reclaim it so the row fits ONE line. */
  .tender-toolbar-actions .btn > .bi.me-1 {
    margin-right: 0 !important;
  }

  .tender-toolbar-actions .btn.filter-sidebar-toggle .bi {
    margin-right: 0 !important;
  }

  .tender-toolbar-actions .btn.filter-sidebar-toggle .badge {
    /* The header summary line already states "N filters active" — the
       button badge is redundant on phones and its ~20px is the
       difference between one row and a wrap with a filter applied. */
    display: none;
  }

  /* mobile-forms.css stacks every .btn-group vertically on phones
     (a form-page rule: full-width stacked buttons). In the inbox
     toolbar that vertically stacked the Pages/Scroll toggle into a
     2-button column (live-measured 44x104px) and pushed the first
     card down. The toolbar group is a compact horizontal control —
     restore Bootstrap's inline row here. */
  .tender-toolbar-actions .btn-group {
    display: inline-flex;
    flex-direction: row;
  }

  .tender-toolbar-actions .btn-group .btn {
    width: auto;
  }

  .tender-toolbar-actions .sort-label-value {
    display: inline-block;
    max-width: 72px;
    overflow: hidden;
    text-overflow: ellipsis;
    vertical-align: bottom;
    white-space: nowrap;
  }

  /* Desktop search section (Feature #167) never renders on phones —
     the sticky mobile search bar (mobile-tender-inbox.js) is the search
     entry point. Without this the FILTERED state rendered the full
     desktop search section between heading and list (live-measured
     123px) while remaining unreachable dead markup (its only opener,
     #refine-toggle-btn, is desktop-only now). */
  #searchSection {
    display: none !important;
  }

  /* Bulk-actions bar: the 288px two-row block collapses to one slim
     icon row (labels collapse via the same .toolbar-label mechanism,
     extended to the partial's bulk bar). */
  .inbox-bulk-bar {
    padding: 0.25rem 0.5rem !important;
    gap: 0.5rem !important;
  }

  .inbox-bulk-bar .toolbar-label {
    display: none;
  }

  .inbox-bulk-bar .btn {
    padding: 0.25rem 0.5rem;
  }

  .inbox-bulk-bar .form-check-input {
    /* keep the 16px+ touch target of the box itself */
    width: 1rem;
    height: 1rem;
  }

  /* The mb-3 wrapper row of the bulk bar (rendered inside the tender
     list partial) plus the list's own top margin — one 0.5rem gap
     total between toolbar and first card. */
  #tender-list .row.mb-3[aria-label="Bulk tender actions"] {
    margin-bottom: 0.5rem !important;
  }
}

/* ============================================================================
   SECTION 4: RESPONSIVE NAVIGATION IMPROVEMENTS
   ============================================================================ */

/* Mobile navbar adjustments */
@media (max-width: 991.5px) {
  /* Increase touch targets in collapsed navbar */
  .navbar-nav .nav-link {
    padding: 0.75rem 1rem;
    min-height: 48px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
  }

  /* User dropdown in mobile menu */
  .navbar-nav .dropdown-menu {
    position: static;
    width: 100%;
    border: none;
    box-shadow: none;
    background: rgba(255, 255, 255, 0.05);
  }

  .navbar-nav .dropdown-item {
    color: #fff;
    padding-left: 2rem;
  }

  .navbar-nav .dropdown-item:hover {
    background: rgba(255, 255, 255, 0.1);
  }
}

/* ============================================================================
   SECTION 5: RESPONSIVE FORMS AND INPUTS
   ============================================================================ */

/* Mobile form adjustments */
@media (max-width: 767.5px) {
  /* Stack form groups vertically */
  .form-row > .col,
  .row > .col {
    width: 100%;
    margin-bottom: 1rem;
  }

  /* Full-width inputs on mobile */
  .form-control,
  .form-select {
    width: 100%;
  }

  /* Increase spacing between form elements */
  .form-group,
  .mb-3 {
    margin-bottom: 1rem !important;
  }

  /* Action buttons stack on mobile */
  .form-actions {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
  }

  .form-actions .btn {
    width: 100%;
  }
}

/* ============================================================================
   SECTION 6: RESPONSIVE CARDS AND DASHBOARDS
   ============================================================================ */

/* Mobile card adjustments */
@media (max-width: 767.5px) {
  /* Stack cards vertically */
  .card-deck {
    display: flex;
    flex-direction: column;
  }

  /* Reduce padding in cards */
  .card-body {
    padding: 1rem;
  }

  /* Adjust stat cards for mobile */
  .stat-card .card-body {
    padding: 1rem;
  }

  .stat-count {
    font-size: 2rem !important;
  }

  .stat-icon {
    font-size: 1.5rem !important;
  }
}

/* ============================================================================
   SECTION 7: MODAL RESPONSIVENESS
   ============================================================================ */

/* Mobile modal adjustments */
@media (max-width: 575.5px) {
  .modal-dialog {
    margin: 0.5rem;
    max-width: calc(100% - 1rem);
  }

  .modal-body {
    padding: 1rem;
  }

  .modal-footer {
    flex-direction: column;
    gap: 0.5rem;
  }

  .modal-footer .btn {
    width: 100%;
  }
}

/* ============================================================================
   SECTION 8: PAGINATION AND TOOLBARS
   ============================================================================ */

/* Mobile pagination */
@media (max-width: 767.5px) {
  .pagination {
    flex-wrap: wrap;
    justify-content: center;
  }

  .pagination .page-item {
    margin: 0.25rem;
  }
}

/* Mobile toolbar with actions */
@media (max-width: 767.5px) {
  .toolbar {
    flex-direction: column;
    gap: 1rem;
  }

  .toolbar .btn {
    width: 100%;
  }
}

/* ============================================================================
   SECTION 9: ACCESSIBILITY IMPROVEMENTS
   ============================================================================ */

/* Focus indicators for touch */
@media (hover: none) and (pointer: coarse) {
  *,
  *::before,
  *::after {
    -webkit-tap-highlight-color: rgba(13, 110, 253, 0.2);
  }
}

/* Reduce motion for users who prefer it */
@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}

/* High contrast mode support */
@media (prefers-contrast: high) {
  .btn,
  .card,
  .table-mobile-card {
    border-width: 2px;
  }
}

/* ============================================================================
   SECTION 10: UTILITY CLASSES
   ============================================================================ */

/* Touch-friendly spacing */
.touch-spacer {
  padding: 0.5rem;
}

.touch-margin {
  margin: 0.5rem;
}

/* Hide on desktop but show on mobile */
.d-mobile-none {
  display: none;
}

@media (max-width: 767.5px) {
  .d-mobile-none {
    display: block;
  }

  .d-mobile-block {
    display: block !important;
  }

  .d-mobile-flex {
    display: flex !important;
  }
}

/* Hide on mobile but show on desktop */
@media (max-width: 767.5px) {
  .d-desktop-block {
    display: none !important;
  }
}

@media (min-width: 768px) {
  .d-desktop-block {
    display: block !important;
  }
}

/* Safe area insets for notched devices */
@supports (padding: env(safe-area-inset-bottom)) {
  .navbar,
  .modal-dialog,
  .filter-sidebar {
    padding-bottom: env(safe-area-inset-bottom);
    padding-left: env(safe-area-inset-left);
    padding-right: env(safe-area-inset-right);
  }
}

/* ============================================================================
   SECTION 11: MOBILE BOTTOM NAVIGATION BAR (Feature #349)
   ============================================================================ */

/* Bottom navigation bar for mobile (< 768px) */
@media (max-width: 767.5px) {
  .mobile-bottom-nav {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    height: 60px;
    background: #fff;
    border-top: 1px solid #dee2e6;
    box-shadow: 0 -2px 10px rgba(0, 0, 0, 0.1);
    z-index: 1030;
    display: flex;
    justify-content: space-around;
    align-items: center;
    padding: 0;
    margin: 0;
    padding-bottom: env(safe-area-inset-bottom, 0);
  }

  .mobile-bottom-nav .nav-item {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    min-height: 60px;
    padding: 0.5rem 0.25rem;
    text-decoration: none;
    color: #6c757d;
    transition: all 0.2s ease;
    border: none;
    background: transparent;
    cursor: pointer;
  }

  .mobile-bottom-nav .nav-item:hover {
    color: #0d6efd;
    background: rgba(13, 110, 253, 0.05);
  }

  .mobile-bottom-nav .nav-item.active {
    color: #0d6efd;
  }

  .mobile-bottom-nav .nav-item.active .nav-icon {
    color: #0d6efd;
  }

  .mobile-bottom-nav .nav-icon {
    font-size: 1.25rem;
    line-height: 1;
    margin-bottom: 0.25rem;
    color: inherit;
  }

  .mobile-bottom-nav .nav-label {
    font-size: 0.65rem;
    line-height: 1.2;
    font-weight: 500;
    color: inherit;
    text-align: center;
  }

  /* Add spacing between nav items */
  .mobile-bottom-nav .nav-item + .nav-item {
    border-left: 1px solid #f8f9fa;
  }

  /* Make bottom nav items meet touch target requirements */
  .mobile-bottom-nav .nav-item {
    min-height: 60px;
    min-width: 60px;
  }

  /* Dark mode bottom navigation */
  [data-bs-theme="dark"] .mobile-bottom-nav {
    background: #212529;
    border-top-color: #495057;
  }

  [data-bs-theme="dark"] .mobile-bottom-nav .nav-item {
    color: #adb5bd;
  }

  [data-bs-theme="dark"] .mobile-bottom-nav .nav-item:hover {
    color: #0d6efd;
    background: rgba(13, 110, 253, 0.1);
  }

  [data-bs-theme="dark"] .mobile-bottom-nav .nav-item.active {
    color: #0d6efd;
  }

  [data-bs-theme="dark"] .mobile-bottom-nav .nav-item + .nav-item {
    border-left-color: #343a40;
  }

  /* Adjust main content to account for bottom nav */
  main {
    padding-bottom: 70px;
  }

  /* Hide desktop navbar on mobile when bottom nav is present */
  .navbar-collapse {
    display: none !important;
  }
}

/* Hide bottom navigation on desktop (>= 768px) */
@media (min-width: 768px) {
  .mobile-bottom-nav {
    display: none !important;
  }

  main {
    padding-bottom: 0;
  }
}

/* ============================================================================
   SECTION 12: OFF-CANVAS MAIN NAVIGATION SIDEBAR (Feature #349)
   ============================================================================ */

/* Off-canvas navigation sidebar for mobile (< 992px) */
@media (max-width: 991.5px) {
  .offcanvas-main-nav {
    position: fixed;
    top: 0;
    left: 0;
    width: 280px;
    max-width: 85vw;
    height: 100vh;
    background: #fff;
    box-shadow: 2px 0 10px rgba(0, 0, 0, 0.15);
    z-index: 1050;
    transform: translateX(-100%);
    transition: transform 0.3s ease;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
  }

  .offcanvas-main-nav.show {
    transform: translateX(0);
  }

  .offcanvas-main-nav-backdrop {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    z-index: 1040;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.3s ease, visibility 0.3s ease;
  }

  .offcanvas-main-nav-backdrop.show {
    opacity: 1;
    visibility: visible;
  }

  /* Offcanvas header with close button */
  .offcanvas-main-nav-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 1rem;
    border-bottom: 1px solid #dee2e6;
    background: #f8f9fa;
  }

  .offcanvas-main-nav-header h5 {
    margin: 0;
    font-size: 1.1rem;
    font-weight: 600;
  }

  .offcanvas-main-nav-close {
    min-height: 44px;
    min-width: 44px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: transparent;
    border: none;
    color: #6c757d;
    cursor: pointer;
    border-radius: 0.25rem;
    transition: background 0.2s ease;
  }

  .offcanvas-main-nav-close:hover {
    background: rgba(0, 0, 0, 0.05);
    color: #000;
  }

  /* Navigation links in offcanvas */
  .offcanvas-main-nav .nav-list {
    list-style: none;
    padding: 0;
    margin: 0;
  }

  .offcanvas-main-nav .nav-item {
    border-bottom: 1px solid #f8f9fa;
  }

  .offcanvas-main-nav .nav-link {
    display: flex;
    align-items: center;
    padding: 1rem;
    color: #212529;
    text-decoration: none;
    min-height: 56px;
    transition: background 0.2s ease;
  }

  .offcanvas-main-nav .nav-link:hover {
    background: #f8f9fa;
    color: #0d6efd;
  }

  .offcanvas-main-nav .nav-link.active {
    background: rgba(13, 110, 253, 0.1);
    color: #0d6efd;
    font-weight: 500;
  }

  .offcanvas-main-nav .nav-link i {
    margin-right: 0.75rem;
    font-size: 1.1rem;
  }

  /* Section headers in offcanvas nav */
  .offcanvas-main-nav .nav-section-header {
    padding: 0.75rem 1rem;
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
    color: #6c757d;
    background: #f8f9fa;
    letter-spacing: 0.05em;
  }

  /* User info section in offcanvas */
  .offcanvas-main-nav-user {
    padding: 1rem;
    border-bottom: 1px solid #dee2e6;
    background: linear-gradient(135deg, #0d6efd 0%, #0a58ca 100%);
    color: #fff;
  }

  .offcanvas-main-nav-user .user-email {
    font-weight: 600;
    margin-bottom: 0.25rem;
    word-break: break-all;
  }

  .offcanvas-main-nav-user .user-role {
    font-size: 0.75rem;
    opacity: 0.9;
  }

  /* Dark mode offcanvas */
  [data-bs-theme="dark"] .offcanvas-main-nav {
    background: #212529;
  }

  [data-bs-theme="dark"] .offcanvas-main-nav-header {
    background: #2c3034;
    border-bottom-color: #495057;
  }

  [data-bs-theme="dark"] .offcanvas-main-nav .nav-item {
    border-bottom-color: #343a40;
  }

  [data-bs-theme="dark"] .offcanvas-main-nav .nav-link {
    color: #f8f9fa;
  }

  [data-bs-theme="dark"] .offcanvas-main-nav .nav-link:hover {
    background: #2c3034;
  }

  [data-bs-theme="dark"] .offcanvas-main-nav .nav-link.active {
    background: rgba(13, 110, 253, 0.2);
  }

  [data-bs-theme="dark"] .offcanvas-main-nav .nav-section-header {
    background: #2c3034;
    color: #adb5bd;
  }

  [data-bs-theme="dark"] .offcanvas-main-nav-close {
    color: #adb5bd;
  }

  [data-bs-theme="dark"] .offcanvas-main-nav-close:hover {
    background: rgba(255, 255, 255, 0.1);
    color: #f8f9fa;
  }
}

/* Hide offcanvas on desktop (>= 992px) */
@media (min-width: 992px) {
  .offcanvas-main-nav,
  .offcanvas-main-nav-backdrop {
    display: none !important;
  }
}

/* ============================================================================
   SECTION 13: IMPROVED HAMBURGER MENU (Feature #349)
   ============================================================================ */

/* Enhanced hamburger button for better touch experience */
.navbar-toggler {
  min-height: 48px;
  min-width: 48px;
  padding: 0.5rem;
  border: 2px solid rgba(255, 255, 255, 0.2);
  transition: all 0.2s ease;
}

.navbar-toggler:hover {
  background: rgba(255, 255, 255, 0.1);
  border-color: rgba(255, 255, 255, 0.4);
}

.navbar-toggler:focus {
  outline: 2px solid rgba(255, 255, 255, 0.5);
  outline-offset: 2px;
  box-shadow: 0 0 0 0.25rem rgba(255, 255, 255, 0.1);
}

/* Hamburger icon animation */
.navbar-toggler .navbar-toggler-icon {
  transition: transform 0.2s ease;
}

.navbar-toggler[aria-expanded="true"] .navbar-toggler-icon {
  transform: rotate(90deg);
}

/* ============================================================================
   SECTION 14: TOUCH-FRIENDLY DROPDOWN IMPROVEMENTS (Feature #349)
   ============================================================================ */

/* Increase dropdown menu touch targets */
@media (max-width: 991.5px) {
  .dropdown-menu {
    min-width: 200px;
    border-radius: 0.5rem;
    box-shadow: 0 0.5rem 1rem rgba(0, 0, 0, 0.15);
  }

  .dropdown-item {
    padding: 0.875rem 1.25rem;
    min-height: 48px;
    font-size: 0.95rem;
  }

  /* Dropdown header improvements */
  .dropdown-header {
    padding: 0.75rem 1.25rem;
    font-size: 0.85rem;
    font-weight: 600;
  }

  /* Dropdown divider spacing */
  .dropdown-divider {
    margin: 0.5rem 0;
  }
}

/* ============================================================================
   SECTION 15: RESPONSIVE DASHBOARD GRID (Feature #349)
   ============================================================================ */

/* Responsive dashboard cards */
@media (max-width: 767.5px) {
  /* Dashboard stat cards - full width on mobile */
  .dashboard .stat-card {
    margin-bottom: 0.75rem;
  }

  /* Dashboard actions - stacked buttons */
  .dashboard .quick-actions .d-flex {
    flex-direction: column;
    gap: 0.5rem;
  }

  .dashboard .quick-actions .btn {
    width: 100%;
    text-align: left;
    justify-content: flex-start;
  }

  .dashboard .quick-actions .btn i {
    margin-right: 0.5rem;
  }
}

/* Tablet improvements (768px - 991px) */
@media (min-width: 768px) and (max-width: 991.5px) {
  /* Dashboard cards - 2 per row on tablet */
  .dashboard .col-lg-3 {
    flex: 0 0 calc(50% - 0.75rem);
    max-width: calc(50% - 0.75rem);
  }

  /* Adjust spacing */
  .dashboard .row.g-4 > .col-lg-3:nth-child(2n) {
    margin-right: 0;
  }
}

/* ============================================================================
   SECTION 16: RESPONSIVE NAVIGATION COLLAPSE BEHAVIOR (Feature #349)
   ============================================================================ */

/* Smooth collapse animation for navbar */
@media (max-width: 991.5px) {
  .navbar-collapse {
    transition: transform 0.3s ease, opacity 0.3s ease;
  }

  .navbar-collapse.collapsing {
    height: auto !important;
  }
}

/* Prevent body scroll when mobile menu is open */
body.navbar-open {
  overflow: hidden;
}

@media (max-width: 991.5px) {
  body.navbar-open {
    overflow: hidden;
    position: fixed;
    width: 100%;
  }
}
