body {
    background-color: #f8f9fa;
    margin: 0;
    padding: 0;
    height: 100vh;
    overflow: hidden;
}

#wrapper {
    display: flex;
    height: 100vh;
}

/* Sidebar Styling */
#sidebar-wrapper {
    min-width: 250px;
    max-width: 250px;
    background-color: #1f2937;
    color: white;
    transition: all 0.3s ease-in-out;
    white-space: nowrap;
    overflow-x: hidden;
}

#sidebar-wrapper.collapsed {
    min-width: 0;
    max-width: 0;
    padding-left: 0 !important;
    padding-right: 0 !important;
}

#sidebar-wrapper .list-group-item {
    background-color: transparent;
    border: none;
    color: #e2e8f0;
    padding: 15px 20px;
    display: flex;
    align-items: center;
    gap: 10px;
}

#sidebar-wrapper .list-group-item:hover,
#sidebar-wrapper .list-group-item.active {
    color: #ffffff;
    background-color: rgba(255, 255, 255, 0.12);
}

#sidebar-wrapper .sidebar-heading {
    color: #cbd5e1;
}

#sidebar-wrapper .list-group-item .material-icons {
    font-size: 20px;
    color: #94a3b8;
}

#sidebar-wrapper .list-group-item:hover .material-icons,
#sidebar-wrapper .list-group-item.active .material-icons {
    color: #ffffff;
}

#participants-table th.sortable {
    cursor: pointer;
    position: relative;
}

#participants-table th.sortable::after {
    content: '\25b2';
    opacity: 0.25;
    position: absolute;
    right: 10px;
    font-size: 0.65rem;
    transition: opacity 0.2s;
}

#participants-table th.sortable.sorted::after {
    opacity: 0.8;
}

#participants-table th.sortable.sorted[data-direction="desc"]::after {
    content: '\25bc';
}

/* Main Content Styling */
#page-content-wrapper {
    width: 100%;
    display: flex;
    flex-direction: column;
    overflow-y: auto;
}

.top-header {
    background-color: white;
    box-shadow: 0 2px 4px rgba(0,0,0,0.08);
}

.main-content {
    padding: 20px;
    flex-grow: 1;
}

/* App Grid Styling for Dashboard Home */
.app-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 20px;
}

.app-card {
    background: white;
    border-radius: 8px;
    padding: 20px;
    text-align: center;
    box-shadow: 0 2px 4px rgba(0,0,0,0.05);
    border: 1px solid #dee2e6;
    cursor: pointer;
    transition: transform 0.2s, box-shadow 0.2s;
}

.app-card:hover {
    transform: translateY(-3px);
    box-shadow: 0 4px 8px rgba(0,0,0,0.1);
    border-color: #0d6efd;
}

.app-card .material-icons {
    font-size: 40px;
    color: #0d6efd;
    margin-bottom: 10px;
}

.app-card-title {
    font-weight: 600;
    color: #495057;
}

/* Hide desktop sidebar on smaller screens */
@media (max-width: 767.98px) {
    /* Participants: hide less-important columns on small screens */
    #participants-table .col-mobile,
    #participants-table .col-auxiliary,
    #participants-table .col-stake,
    #participants-table .col-ward {
        display: none !important;
    }
    /* Staff: hide these columns on small screens */
    #staff-table .col-ward,
    #staff-table .col-stake,
    #staff-table .col-role,
    #staff-table .col-mobile,
    #staff-table .col-nickname {
        display: none !important;
    }
    /* adjust table header sizing when columns hidden */
    #participants-table th,
    #staff-table th { font-size: 0.85rem; }
}
body.dark-mode .top-header {
    background-color: #343a40;
    box-shadow: 0 2px 4px rgba(0,0,0,0.2);
}
body.dark-mode .navbar-brand {
    color: #6ea8fe !important;
}
body.dark-mode .top-header .text-muted, 
body.dark-mode .top-header #user-display,
body.dark-mode .top-header #role-display {
    color: #f8f9fa !important;
}
body.dark-mode .btn-outline-secondary {
    color: #f8f9fa;
    border-color: #6c757d;
}
body.dark-mode .app-card {
    background: #343a40;
    border-color: #495057;
    color: #f8f9fa;
}
body.dark-mode .app-card-title {
    color: #e9ecef;
}
body.dark-mode .app-card:hover {
    box-shadow: 0 4px 8px rgba(0,0,0,0.3);
    border-color: #6ea8fe;
}
body.dark-mode .text-secondary {
    color: #adb5bd !important;
}
body.dark-mode .dropdown-menu {
    background-color: #343a40;
    border-color: #495057;
}
body.dark-mode .dropdown-menu .dropdown-item,
body.dark-mode .dropdown-menu .form-check-label {
    color: #e9ecef;
}
body.dark-mode .dropdown-menu .dropdown-item:hover,
body.dark-mode .dropdown-menu .form-check-input:focus {
    background-color: #495057;
}
body.dark-mode .dropdown-menu .dropdown-divider {
    border-top-color: #495057;
}
body.dark-mode .card {
    background-color: #343a40;
    border-color: #495057;
}
body.dark-mode .card-body {
    color: #f8f9fa;
}
body.dark-mode .table {
    color: #f8f9fa;
    background-color: #212529;
}
body.dark-mode .table th,
body.dark-mode .table td,
body.dark-mode .table thead th,
body.dark-mode .table tbody tr {
    color: #f8f9fa !important;
}
body.dark-mode .table th,
body.dark-mode .table td {
    border-color: #495057;
}
body.dark-mode .table-responsive {
    background-color: #212529;
}
body.dark-mode .table tbody tr,
body.dark-mode .table tbody td,
body.dark-mode .table tbody th {
    background-color: transparent;
}
body.dark-mode .table-striped > tbody > tr:nth-of-type(odd) {
    background-color: rgba(255, 255, 255, 0.04);
}
body.dark-mode .table-striped > tbody > tr:nth-of-type(even) {
    background-color: rgba(255, 255, 255, 0.02);
}
body.dark-mode .table-hover > tbody > tr:hover {
    background-color: rgba(255, 255, 255, 0.08);
}
body.dark-mode .table thead th {
    color: #f8f9fa;
    background-color: #2d333b;
}
#participants-table.hide-auxiliary .col-auxiliary,
#participants-table.hide-stake .col-stake,
#participants-table.hide-ward .col-ward,
#participants-table.hide-age .col-age {
    display: none;
}
#staff-table.hide-committee .col-committee,
#staff-table.hide-role .col-role,
#staff-table.hide-stake .col-stake,
#staff-table.hide-ward .col-ward {
    display: none;
}
#participants-table th,
#staff-table th {
    font-size: 0.85rem;
    white-space: nowrap;
}
.participant-id-link {
    color: inherit;
    text-decoration: none;
}
.participant-id-link:hover,
.participant-id-link:focus {
    text-decoration: underline;
}
#participants-filters .input-group {
    min-width: 0;
}
#participants-filters .input-group-text {
    white-space: nowrap;
}
#participants-filters .form-select {
    min-width: 0;
}
#participants-filters .d-flex.flex-column.flex-sm-row > .input-group {
    min-width: 170px;
}
/* Hide mobile and auxiliary columns on small screens (show on web) */
@media (max-width: 767.98px) {
    #participants-table .col-mobile,
    #participants-table .col-auxiliary,
    #participants-table .col-stake,
    #participants-table .col-ward {
        display: none !important;
    }
    /* adjust table header sizing when columns hidden */
    #participants-table th { font-size: 0.85rem; }
}
#participants-page-info {
    white-space: nowrap;
}
#participants-pagination {
    white-space: nowrap;
}
body.dark-mode #sidebar-wrapper {
    background-color: #111827;
}
body.dark-mode #sidebar-wrapper .list-group-item {
    color: #cbd5e1;
}
body.dark-mode #sidebar-wrapper .sidebar-heading {
    color: #94a3b8;
}
body.dark-mode #sidebar-wrapper .list-group-item:hover,
body.dark-mode #sidebar-wrapper .list-group-item.active {
    background-color: rgba(255, 255, 255, 0.08);
    color: #ffffff;
}
body.dark-mode #sidebar-wrapper .list-group-item .material-icons {
    color: #9ca3af;
}
body.dark-mode #sidebar-wrapper .list-group-item:hover .material-icons,
body.dark-mode #sidebar-wrapper .list-group-item.active .material-icons {
    color: #ffffff;
}