/* Custom navbar optimizations */
.navbar .nav-link {
    padding: 0.5rem 0.75rem;
}

/* Filter Bar Styling - always-visible pills showing the active org/project/
   assignee scope, so the current filter is obvious instead of buried in a
   dropdown. See static/base-app.js updateFilterPills()/attachFilterPillHandlers(). */
#filterBar {
    background-color: var(--surface-color);
    border-bottom: 1px solid var(--border-color);
    padding-top: 0.25rem;
    padding-bottom: 0.25rem;
}

.filter-pill {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    font-size: 0.85rem;
    font-weight: 500;
    padding: 0.25rem 0.75rem;
    border-radius: var(--radius-pill);
    border: 1px solid var(--border-color);
    background-color: var(--surface-hover);
    color: var(--text-secondary);
    cursor: pointer;
    transition: var(--transition);
    line-height: 1.4;
}

.filter-pill:hover {
    border-color: var(--primary-color);
    color: var(--text-primary);
}

.filter-pill.has-filter {
    background-color: var(--primary-dark);
    border-color: var(--primary-dark);
    color: var(--on-primary);
}

.filter-pill.has-filter:hover {
    color: var(--on-primary);
    opacity: 0.9;
}

/* The pill and its clear button are sibling <button>s. The clear control used to be a
   <span> nested inside the pill: unreachable by keyboard and only 16px to tap. */
.filter-pill-group {
    display: inline-flex;
    align-items: center;
    gap: 2px;
}

.filter-pill-clear {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 1.75rem;
    height: 1.75rem;
    padding: 0;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-full);
    background: var(--surface-hover);
    color: var(--text-secondary);
    cursor: pointer;
}

.filter-pill-clear:hover {
    border-color: var(--danger-color);
    color: var(--danger-color);
}

.filter-pill--label {
    background: transparent;
    border-color: transparent;
}

/* Touch devices: full-size hit areas for the pills and clear buttons. */
@media (pointer: coarse) {
    .filter-pill,
    .filter-pill-clear {
        min-height: var(--touch-target-min);
    }
    .filter-pill-clear {
        min-width: var(--touch-target-min);
    }
}

/* Scope-bar picker menu (#quickFiltersMenu) */
#quickFiltersMenu {
    max-height: 60vh;
    overflow-y: auto;
    min-width: 200px;
}

#quickFiltersMenu .dropdown-header {
    font-weight: 600;
    color: var(--primary-color);
    font-size: 0.8rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.navbar .nav-link i {
    font-size: 1.1rem;
}

/* Ensure icons are visible on all screen sizes */
.navbar .nav-link i.bi {
    display: inline-block;
    vertical-align: middle;
}

/* Smooth transitions for navbar */
.navbar {
    transition: all 0.3s ease;
}

/* Optimize dropdown menu on mobile */
@media (max-width: 991px) {
    .navbar .dropdown-menu {
        position: absolute;
        width: 100%;
        background: var(--surface-color);
        border: 1px solid var(--border-color);
        margin-top: 0;
    }

    .navbar-nav .nav-link {
        padding: 0.75rem 1rem;
    }

    /* Ensure icons have proper spacing on mobile */
    .navbar .nav-link > i {
        width: 24px;
        text-align: center;
    }
}

/* Larger touch targets on mobile */
@media (max-width: 576px) {
    .navbar .nav-item {
        margin: 0;
    }

    .navbar .nav-link {
        padding: 0.75rem;
    }

    /* Show icons only on xs screens */
    .navbar .nav-link i.bi {
        font-size: 1.25rem;
    }
}

/* Mobile: sticky first column on wide tables so users don't lose row context */
@media (max-width: 767.98px) {
    .table-responsive .table thead th:first-child,
    .table-responsive .table tbody td:first-child {
        position: sticky;
        left: 0;
        z-index: 10;
        box-shadow: 2px 0 6px rgba(0,0,0,0.1);
    }
    .table-responsive .table thead th:first-child {
        background: var(--bs-body-bg);
    }
    .table-responsive .table tbody td:first-child {
        background: var(--bs-body-bg);
    }
}

/* Global Search Modal */
#globalSearchModal .modal-dialog {
    margin-top: 10vh;
    max-width: 580px;
}
#globalSearchModal .modal-content {
    border-radius: 12px;
    border: none;
    box-shadow: 0 20px 60px rgba(0,0,0,0.3);
}
#globalSearchModal .modal-header {
    border-bottom: 1px solid var(--border-color);
    padding-bottom: 12px;
}
#globalSearchInput {
    font-size: 17px;
    padding: 10px 14px;
    border: 2px solid var(--border-color);
    border-radius: var(--radius-sm);
    outline: none;
    transition: border-color 0.2s;
}
#globalSearchInput:focus {
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(99,102,241,0.15);
}
#globalSearchFilters {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
}
#globalSearchFilters .form-select {
    font-size: 13px;
    padding: 6px 28px 6px 10px;
    border-radius: 6px;
}
/* Live results scroll inside the modal instead of growing it past the viewport. */
#globalSearchResults {
    max-height: 50vh;
    overflow-y: auto;
}
#globalSearchResults [role="option"] {
    min-height: var(--touch-target-min);
}
/* Bootstrap 5.3 hardcodes blue for the active list item; use the brand color. */
#globalSearchResults {
    --bs-list-group-active-bg: var(--primary-dark);
    --bs-list-group-active-border-color: var(--primary-dark);
    --bs-list-group-active-color: var(--on-primary);
}
#globalSearchFilters .form-select:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}
.search-kbd {
    display: inline-block;
    padding: 2px 6px;
    font-size: 11px;
    font-family: monospace;
    background: var(--surface-hover);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-xs);
    color: var(--text-secondary);
}

/* ============================================
   Mobile chrome (< lg): bottom nav, one-action FAB, More sheet
   ============================================ */
:root {
    /* Bottom nav bar height, excluding the iOS home-indicator inset. */
    --bottom-nav-height: 56px;
    /* FAB diameter and its gap above the bottom nav / from the right edge. */
    --fab-size: 52px;
    --fab-offset-bottom: 72px;
    --fab-offset-right: 16px;
}

@media (max-width: 991.98px) {
    /* Keep the last content row clear of the fixed bottom nav. */
    body {
        padding-bottom: calc(var(--bottom-nav-height) + env(safe-area-inset-bottom, 0px));
    }
}

.bottom-nav {
    position: fixed;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 1030;
    display: flex;
    height: calc(var(--bottom-nav-height) + env(safe-area-inset-bottom, 0px));
    padding-bottom: env(safe-area-inset-bottom, 0px);
    background: var(--surface-color);
    border-top: 1px solid var(--border-color);
    box-shadow: var(--shadow-sm);
}

.bottom-nav__item {
    flex: 1 1 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 2px;
    min-height: var(--touch-target-min);
    padding: 0;
    border: none;
    background: none;
    color: var(--text-secondary);
    font-size: 0.7rem;
    font-weight: 500;
    text-decoration: none;
}

.bottom-nav__item .bi {
    font-size: 1.25rem;
}

/* Active tab: color and weight only — no filled background bubble. */
.bottom-nav__item.active {
    color: var(--primary-color);
    font-weight: 700;
}

.mobile-fab {
    position: fixed;
    right: var(--fab-offset-right);
    bottom: calc(var(--fab-offset-bottom) + env(safe-area-inset-bottom, 0px));
    z-index: 1031;
    display: flex;
    align-items: center;
    justify-content: center;
    width: var(--fab-size);
    height: var(--fab-size);
    border-radius: var(--radius-full);
    background: linear-gradient(135deg, var(--primary-color), var(--accent-violet));
    color: var(--on-primary);
    font-size: 1.4rem;
    box-shadow: var(--shadow-lg);
    text-decoration: none;
}

.mobile-fab:hover,
.mobile-fab:focus-visible {
    color: var(--on-primary);
}

.more-sheet {
    /* Tall enough for the full menu, short enough to read as a sheet over the page. */
    --bs-offcanvas-height: 80vh;
    border-radius: var(--radius-lg) var(--radius-lg) 0 0;
    padding-bottom: env(safe-area-inset-bottom, 0px);
}

.more-sheet__heading {
    margin: 0.75rem 0 0.25rem;
    font-size: 0.75rem;
    font-weight: 600;
    letter-spacing: 0.5px;
    text-transform: uppercase;
    color: var(--text-muted);
}

.more-sheet .list-group-item {
    min-height: var(--touch-target-min);
    display: flex;
    align-items: center;
    background: transparent;
}

/* Icon-only buttons in the top bar (search). */
.nav-icon-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: var(--touch-target-min);
    height: var(--touch-target-min);
    padding: 0;
    border: none;
    border-radius: var(--radius-full);
    background: none;
    color: var(--text-secondary);
    font-size: 1.15rem;
}

.nav-icon-btn:hover {
    color: var(--primary-color);
}

/* Quick tip toast: clear of the bottom-left keyboard-help button. */
.quick-tip-container {
    z-index: 1045;
    max-width: 400px;
}

/* ============================================
   Overlay stacking on mobile
   ============================================ */
@media (max-width: 991.98px) {
    /* The cookie banner sits above the bottom nav instead of covering it. */
    .bottom-nav ~ .cookie-consent {
        bottom: calc(var(--bottom-nav-height) + env(safe-area-inset-bottom, 0px));
        padding-bottom: 16px;
    }
}

/* The task swiper's full-screen mode (body.swiper-mode, z-index 999) has its own
   action row along the bottom edge; the bottom nav and FAB sit above it and would
   cover those buttons. The swiper's own toggle exits back to the normal shell. */
.swiper-mode .bottom-nav,
.swiper-mode .mobile-fab {
    display: none;
}

/* While the cookie banner is up, the FAB steps aside rather than overlapping it. */
.has-cookie-banner .mobile-fab {
    display: none;
}

/* ============================================
   Skip Link
   Visually hidden until focused, then pinned to the top-left. This is the first
   focusable element in the document so keyboard users can jump the ~40-link navbar.
   ============================================ */
.skip-link {
    position: absolute;
    top: var(--space-skip-link-offset);
    left: var(--space-skip-link-offset);
    z-index: 2000;                      /* above the sticky navbar (1000) and status bars (1060) */
    padding: 12px 20px;
    background: var(--primary-color);
    color: var(--on-primary);           /* stays white on the indigo chip in both themes */
    border-radius: var(--radius-sm);
    box-shadow: var(--shadow-lg);
    font-weight: 600;
    text-decoration: none;
    transform: translateY(-200%);       /* parked off-screen; not display:none, so it stays focusable */
    transition: transform 0.15s ease;
}
.skip-link:focus {
    transform: translateY(0);
    color: var(--on-primary);
}

/* The <main> target takes tabindex="-1" so the skip link actually moves focus.
   Suppress the focus ring it would otherwise draw around the whole page. */
#mainContent:focus {
    outline: none;
}

/* ============================================
   Theme Toggle Icon
   Both icons ship in the markup; CSS reveals one based on [data-theme] set in <head>.
   ============================================ */
.theme-icon--dark {
    display: none;
}
[data-theme="dark"] .theme-icon--light {
    display: none;
}
[data-theme="dark"] .theme-icon--dark {
    display: inline-block;
}

/* ============================================
   Cookie Consent Banner
   ============================================ */
.cookie-consent {
    display: none;                      /* cookie-sync.js flips this to block */
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    z-index: 9998;
    background: var(--text-primary);    /* dark slate in light theme, light in dark theme */
    color: var(--surface-color);
    padding: 16px 24px;
    /* Clear the iOS home indicator when installed as a PWA. */
    padding-bottom: calc(16px + env(safe-area-inset-bottom, 0px));
    box-shadow: 0 -2px 12px rgb(0 0 0 / 0.3);
    font-size: 0.875rem;
    line-height: 1.5;
}
.cookie-consent__link {
    color: var(--primary-light);
    text-decoration: underline;
}
.cookie-consent__accept {
    background: var(--primary-dark);
    color: var(--on-primary);           /* fixed-contrast text on the indigo button */
    border: none;
    padding: 8px 20px;
    min-height: var(--touch-target-min);
    border-radius: var(--radius-xs);
    font-weight: 500;
    cursor: pointer;
    white-space: nowrap;
}

/* ============================================
   Keyboard Shortcuts Help Button
   ============================================ */
.keyboard-help-btn {
    position: fixed;
    bottom: 20px;
    bottom: calc(20px + env(safe-area-inset-bottom, 0px));
    left: 20px;
    z-index: 9990;
    background: var(--surface-color);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-full);
    /* Was 42px — below the 44px minimum touch target. */
    width: var(--touch-target-min);
    height: var(--touch-target-min);
    box-shadow: var(--shadow-md);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 18px;
    color: var(--primary-color);
}

/* Keyboard shortcuts are meaningless without a physical keyboard, and on a phone this
   button overlaps the thumb zone the FAB already owns. Hide it on touch-primary devices. */
@media (hover: none) and (pointer: coarse) {
    .keyboard-help-btn {
        display: none;
    }
}

