html {
    height: 100%;
}

body {
    background: #fafafa;
    color: #333333;
    margin: 0;
    min-height: 100%;
    display: flex;
    flex-direction: column;
}

h1,
h2,
h3,
h4,
h5,
h6 {
    color: #444444;
}

ul {
    margin: 0;
}

.site-header .navbar-nav .nav-link {
    color: #cbd5db;
}

.site-header .navbar-nav .nav-link:hover {
    color: #ffffff;
}

.site-header .navbar-nav .nav-link.active {
    font-weight: 500;
}

.content-section {
    background: #ffffff;
    padding: 10px 20px;
    border: 1px solid #dddddd;
    border-radius: 3px;
    margin-bottom: 20px;
}

.account-img {
    height: 125px;
    width: 125px;
    margin-right: 20px;
    margin-bottom: 16px;
}

.account-heading {
    font-size: 2.5rem;
}

.bi {
    vertical-align: -.125em;
    fill: currentColor;
}

.nav-scroller {
    position: relative;
    z-index: 2;
    height: 2.75rem;
    overflow-y: hidden;
}

.nav-scroller .nav {
    display: flex;
    flex-wrap: nowrap;
    padding-bottom: 1rem;
    margin-top: -1px;
    overflow-x: auto;
    text-align: center;
    white-space: nowrap;
    -webkit-overflow-scrolling: touch;
}

.btn-bd-primary {
    --bd-violet-bg: #712cf9;
    --bd-violet-rgb: 112.520718, 44.062154, 249.437846;

    --bs-btn-font-weight: 600;
    --bs-btn-color: var(--bs-white);
    --bs-btn-bg: var(--bd-violet-bg);
    --bs-btn-border-color: var(--bd-violet-bg);
    --bs-btn-hover-color: var(--bs-white);
    --bs-btn-hover-bg: #6528e0;
    --bs-btn-hover-border-color: #6528e0;
    --bs-btn-focus-shadow-rgb: var(--bd-violet-rgb);
    --bs-btn-active-color: var(--bs-btn-hover-color);
    --bs-btn-active-bg: #5a23c8;
    --bs-btn-active-border-color: #5a23c8;
}

.bd-mode-toggle {
    z-index: 1500;
}

/* Leaflet Map Styles */
#hiveDetailMap {
    border-radius: 0.25rem;
    border: 1px solid #dee2e6;
}

/* Overview Map for Hive List */
#hiveOverviewMap {
    height: 500px;
    width: 100%;
}

/* Responsive map heights */
@media (max-width: 767px) {
    #hiveDetailMap {
        height: 250px !important;
    }

    #hiveOverviewMap {
        height: 350px !important;
    }
}

@media (min-width: 768px) and (max-width: 991px) {
    #hiveDetailMap {
        height: 280px !important;
    }

    #hiveOverviewMap {
        height: 400px !important;
    }
}

@media (min-width: 992px) and (max-width: 1199px) {
    #hiveOverviewMap {
        height: 450px !important;
    }
}

/* Ensure Leaflet map is displayed correctly */
.leaflet-container {
    font-family: inherit;
}

/* Custom marker styles */
.custom-marker {
    background: transparent;
    border: none;
}

/* Sticky map on larger screens */
@media (min-width: 992px) {
    .sticky-top {
        position: sticky;
        z-index: 100;
    }
}

/* Form Map for Coordinate Selection */
#hiveFormMap {
    height: 400px;
    width: 100%;
    border-radius: 0.25rem;
    border: 1px solid #dee2e6;
    cursor: crosshair;
}

/* Responsive form map heights */
@media (max-width: 767px) {
    #hiveFormMap {
        height: 300px !important;
    }
}

@media (min-width: 768px) and (max-width: 991px) {
    #hiveFormMap {
        height: 350px !important;
    }
}

/* Coordinate display styling */
#coordinateDisplay {
    padding: 8px 12px;
    background-color: #f8f9fa;
    border-radius: 0.25rem;
    border: 1px solid #dee2e6;
}

/* ========================================
   Organization Selector Styles
   ======================================== */

/* Organization selector visual distinction */
.organization-selector {
    border-left: 2px solid color-mix(in srgb, var(--bs-primary) 30%, transparent) !important;
}

.organization-selector .nav-link {
    background-color: color-mix(in srgb, var(--bs-primary) 8%, transparent);
    border-radius: 0.375rem;
    padding: 0.5rem 1rem;
    transition: all 0.2s ease;
}

.organization-selector .nav-link:hover {
    background-color: color-mix(in srgb, var(--bs-primary) 15%, transparent);
    transform: translateY(-1px);
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

/* Make current organization name stand out */
.current-org-name {
    color: var(--bs-primary) !important;
    font-weight: 600;
}

/* Badge for organization type */
.org-type-badge {
    font-size: 0.7rem;
    vertical-align: middle;
    font-weight: 500;
}

/* Enhanced dropdown header */
.organization-selector .dropdown-header {
    font-size: 0.875rem;
    padding: 0.75rem 1rem;
    background-color: #f8f9fa;
    border-bottom: 2px solid var(--bs-primary);
    margin-bottom: 0;
}

/* Active organization in dropdown */
.organization-selector .dropdown-item.active {
    background-color: var(--bs-primary);
    font-weight: 600;
}

.organization-selector .dropdown-item.active .org-type-badge {
    background-color: rgba(255, 255, 255, 0.9) !important;
    color: var(--bs-primary) !important;
}

/* Dropdown menu styling */
.organization-selector .dropdown-menu {
    min-width: 280px;
    box-shadow: 0 0.5rem 1rem rgba(0, 0, 0, 0.15);
    border: 1px solid rgba(0, 0, 0, 0.1);
}

/* Organization icon in dropdown toggle */
.organization-selector .bi-building {
    vertical-align: -0.2em;
}

/* ========================================
   Organization Context Indicator Bar
   ======================================== */

.org-context-bar {
    background: linear-gradient(135deg, #f8f9fa 0%, #e9ecef 100%);
    border-bottom: 2px solid var(--bs-primary);
    padding: 0.75rem 0;
    font-size: 0.9rem;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.05);
    position: sticky;
    top: 0;
    z-index: 1020;
}

.org-context-bar .org-context-name {
    color: var(--bs-primary);
    font-weight: 700;
    font-size: 1.05rem;
}

.org-context-bar .org-context-icon {
    vertical-align: -0.15em;
    margin-right: 0.5rem;
}

.org-context-bar .org-context-role {
    background-color: var(--bs-secondary);
    color: white;
    font-size: 0.75rem;
    padding: 0.25rem 0.6rem;
    border-radius: 0.25rem;
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.org-context-bar .org-context-role.role-owner {
    background-color: #dc3545;
}

.org-context-bar .org-context-role.role-admin {
    background-color: #fd7e14;
}

.org-context-bar .org-context-role.role-member {
    background-color: #198754;
}

/* Responsive adjustments for organization selector */
@media (max-width: 1199px) {
    .organization-selector .dropdown-menu {
        min-width: 240px;
    }
}

@media (max-width: 991px) {
    .organization-selector {
        border-left: none !important;
        border-top: 2px solid color-mix(in srgb, var(--bs-primary) 30%, transparent) !important;
        padding-left: 0 !important;
        padding-top: 0.75rem;
        margin-top: 0.5rem;
    }

    .organization-selector .nav-link {
        width: 100%;
        text-align: left;
    }

    .org-context-bar {
        font-size: 0.85rem;
        padding: 0.6rem 0;
    }

    .org-context-bar .org-context-name {
        font-size: 0.95rem;
    }
}

@media (max-width: 767px) {
    .organization-selector .dropdown-menu {
        min-width: 100%;
    }

    .org-context-bar {
        font-size: 0.8rem;
        padding: 0.5rem 0;
    }

    .org-context-bar .org-context-name {
        font-size: 0.9rem;
    }

    .org-context-bar .org-context-role {
        font-size: 0.7rem;
        padding: 0.2rem 0.5rem;
    }
}

/* ========================================
   Select Dropdown Height Control
   ======================================== */

/* Limit height of select elements with size attribute (list boxes) */
.form-select[size] {
    max-height: 300px;
    overflow-y: auto;
}

/* For dropdowns rendered with size attribute, ensure proper scrolling */
select.form-select[size] {
    max-height: 300px;
}

/* Responsive adjustments for smaller screens */
@media (max-width: 767px) {
    .form-select[size],
    select.form-select[size] {
        max-height: 250px;
    }
}

/* ========================================
   Compact Filter Styles
   ======================================== */

/* Container for filter form fields to allow overlapping dropdowns */
#filterForm .col-md-3,
#filterForm .col-md-2,
#filterForm .col-md-4,
#filterForm .col-lg-2 {
    position: relative;
}

/* Make select dropdowns and their options overlap other fields */
#filterForm .form-select {
    position: relative;
    z-index: 1;
}

/* When select is focused/opened, increase z-index to appear above siblings */
#filterForm .form-select:focus,
#filterForm .form-select:active {
    z-index: 10;
}

/* Ensure date inputs also have proper stacking */
#filterForm .form-control[type="date"] {
    position: relative;
    z-index: 1;
}

#filterForm .form-control[type="date"]:focus {
    z-index: 10;
}

/* Reduce vertical and horizontal spacing in filter form */
#filterForm {
    row-gap: 0.5rem !important;
    column-gap: 0.5rem !important;
}

/* Tighter spacing for filter labels */
#filterForm .form-label {
    margin-bottom: 0.25rem;
}

/* Ensure filter columns don't have excessive padding */
#filterForm [class*="col-"] {
    padding-left: 0.25rem;
    padding-right: 0.25rem;
}

/* ========================================
   Page Layout for Sticky Footer
   ======================================== */

.page-wrapper {
    flex: 1 0 auto;
}

/* ========================================
   Footer Styles
   ======================================== */

.bifolk-footer {
    flex-shrink: 0;
    width: 100%;
    padding: 0.75rem 1rem;
    font-size: 0.75rem;
    color: #6c757d;
    background-color: #f8f9fa;
    border-top: 1px solid #dee2e6;
    text-align: center;
    margin-top: 2rem;
}

.bifolk-footer a {
    color: #6c757d;
    text-decoration: none;
}

.bifolk-footer a:hover {
    color: var(--bs-primary);
}

/* Responsive footer adjustments */
@media (max-width: 767px) {
    .bifolk-footer {
        font-size: 0.7rem;
        padding: 0.5rem 0.75rem;
        margin-top: 1.5rem;
    }
}

/* ========================================
   Cookie Consent Banner Styles
   ======================================== */

.cookie-banner {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    z-index: 1050;
    background-color: #ffffff;
    border-top: 1px solid #dee2e6;
    box-shadow: 0 -4px 12px rgba(0, 0, 0, 0.1);
    transform: translateY(100%);
    transition: transform 0.3s ease-in-out;
}

.cookie-banner-visible {
    transform: translateY(0);
}

.cookie-banner-content {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    padding: 1rem 1.5rem;
    max-width: 1400px;
    margin: 0 auto;
}

.cookie-banner-text {
    flex: 1;
    min-width: 280px;
}

.cookie-banner-title {
    font-size: 1rem;
    font-weight: 600;
    color: #333;
    margin-bottom: 0.25rem;
}

.cookie-banner-description {
    font-size: 0.875rem;
    color: #666;
    margin-bottom: 0;
    line-height: 1.5;
}

.cookie-policy-link {
    color: var(--bs-primary);
    text-decoration: underline;
    white-space: nowrap;
}

.cookie-policy-link:hover {
    color: var(--bs-primary);
    text-decoration: none;
}

.cookie-banner-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    flex-shrink: 0;
}

.cookie-banner-actions .btn {
    white-space: nowrap;
}

/* Mobile responsive adjustments */
@media (max-width: 767px) {
    .cookie-banner-content {
        flex-direction: column;
        align-items: stretch;
        padding: 1rem;
    }

    .cookie-banner-text {
        min-width: auto;
    }

    .cookie-banner-title {
        font-size: 0.9375rem;
    }

    .cookie-banner-description {
        font-size: 0.8125rem;
    }

    .cookie-banner-actions {
        justify-content: stretch;
    }

    .cookie-banner-actions .btn {
        flex: 1;
    }
}

/* ========================================
   Hive Structure Visualization
   ======================================== */

.hive-structure-stack {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 3px;
    padding: 1rem 0;
}

.hive-component {
    width: 80%;
    max-width: 200px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 4px;
    font-weight: 600;
    font-size: 0.85rem;
    transition: transform 0.15s ease, box-shadow 0.15s ease;
    border: 1px solid rgba(0, 0, 0, 0.15);
}

.hive-component:hover {
    transform: scale(1.03);
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.15);
}

.hive-component-label {
    user-select: none;
}

.hive-component-stand {
    height: 30px;
    background: linear-gradient(180deg, #adb5bd 0%, #868e96 100%);
    color: #fff;
}

.hive-component-brood {
    background: linear-gradient(180deg, #ffc107 0%, #e0a800 100%);
    color: #333;
}

.hive-component-honey {
    background: linear-gradient(180deg, #0d6efd 0%, #0a58ca 100%);
    color: #fff;
}

/* ========================================
   Dark Mode Styles
   ======================================== */

[data-bs-theme="dark"] body {
    background: #1a1d21;
    color: #e9ecef;
}

[data-bs-theme="dark"] h1,
[data-bs-theme="dark"] h2,
[data-bs-theme="dark"] h3,
[data-bs-theme="dark"] h4,
[data-bs-theme="dark"] h5,
[data-bs-theme="dark"] h6 {
    color: #e9ecef;
}

[data-bs-theme="dark"] .content-section {
    background: #212529;
    border-color: #495057;
}

[data-bs-theme="dark"] .article-title {
    color: #e9ecef;
}

[data-bs-theme="dark"] a.article-title:hover {
    color: #6ea8fe;
}

[data-bs-theme="dark"] .article-metadata {
    border-bottom-color: #495057;
}

[data-bs-theme="dark"] .article-metadata a:hover {
    color: #e9ecef;
}

/* Footer Dark Mode */
[data-bs-theme="dark"] .bifolk-footer {
    background-color: #212529;
    border-top-color: #495057;
    color: #adb5bd;
}

[data-bs-theme="dark"] .bifolk-footer a {
    color: #adb5bd;
}

[data-bs-theme="dark"] .bifolk-footer a:hover {
    color: #6ea8fe;
}

/* Cookie Banner Dark Mode */
[data-bs-theme="dark"] .cookie-banner {
    background-color: #212529;
    border-top-color: #495057;
}

[data-bs-theme="dark"] .cookie-banner-title {
    color: #e9ecef;
}

[data-bs-theme="dark"] .cookie-banner-description {
    color: #adb5bd;
}

[data-bs-theme="dark"] .cookie-policy-link {
    color: #6ea8fe;
}

/* Organization Context Bar Dark Mode */
[data-bs-theme="dark"] .org-context-bar {
    background: linear-gradient(135deg, #212529 0%, #343a40 100%);
}

[data-bs-theme="dark"] .organization-selector .dropdown-header {
    background-color: #343a40;
}

/* Form Elements Dark Mode */
[data-bs-theme="dark"] .form-select[size],
[data-bs-theme="dark"] select.form-select[size] {
    background-color: #212529;
    border-color: #495057;
    color: #e9ecef;
}

[data-bs-theme="dark"] #coordinateDisplay {
    background-color: #212529;
    border-color: #495057;
    color: #e9ecef;
}

/* Map Borders Dark Mode */
[data-bs-theme="dark"] #hiveDetailMap,
[data-bs-theme="dark"] #hiveFormMap {
    border-color: #495057;
}

/* Example Divider Dark Mode */
[data-bs-theme="dark"] .b-example-divider {
    background-color: rgba(255, 255, 255, 0.1);
    border-color: rgba(255, 255, 255, 0.15);
    box-shadow: inset 0 .5em 1.5em rgba(0, 0, 0, 0.3), inset 0 .125em .5em rgba(0, 0, 0, 0.4);
}

/* Cards Dark Mode */
[data-bs-theme="dark"] .card {
    background-color: #212529;
    border-color: #495057;
    color: #e9ecef;
}

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

[data-bs-theme="dark"] .card-footer {
    background-color: #2c3034;
    border-top-color: #495057;
}

[data-bs-theme="dark"] .card-title {
    color: #e9ecef;
}

[data-bs-theme="dark"] .card-text {
    color: #adb5bd;
}

/* Alerts Dark Mode */
[data-bs-theme="dark"] .alert-success {
    background-color: rgba(25, 135, 84, 0.2);
    border-color: rgba(25, 135, 84, 0.4);
    color: #75b798;
}

[data-bs-theme="dark"] .alert-info {
    background-color: rgba(13, 202, 240, 0.2);
    border-color: rgba(13, 202, 240, 0.4);
    color: #6edff6;
}

[data-bs-theme="dark"] .alert-warning {
    background-color: rgba(255, 193, 7, 0.2);
    border-color: rgba(255, 193, 7, 0.4);
    color: #ffda6a;
}

[data-bs-theme="dark"] .alert-danger {
    background-color: rgba(220, 53, 69, 0.2);
    border-color: rgba(220, 53, 69, 0.4);
    color: #ea868f;
}

[data-bs-theme="dark"] .alert-primary {
    background-color: rgba(13, 110, 253, 0.2);
    border-color: rgba(13, 110, 253, 0.4);
    color: #6ea8fe;
}

[data-bs-theme="dark"] .alert-secondary {
    background-color: rgba(108, 117, 125, 0.2);
    border-color: rgba(108, 117, 125, 0.4);
    color: #a7acb1;
}

/* Tables Dark Mode */
[data-bs-theme="dark"] .table {
    color: #e9ecef;
    border-color: #495057;
}

[data-bs-theme="dark"] .table-striped > tbody > tr:nth-of-type(odd) > * {
    background-color: rgba(255, 255, 255, 0.03);
    color: #e9ecef;
}

[data-bs-theme="dark"] .table-hover > tbody > tr:hover > * {
    background-color: rgba(255, 255, 255, 0.075);
    color: #e9ecef;
}

/* List Groups Dark Mode */
[data-bs-theme="dark"] .list-group-item {
    background-color: #212529;
    border-color: #495057;
    color: #e9ecef;
}

[data-bs-theme="dark"] .list-group-item-action:hover,
[data-bs-theme="dark"] .list-group-item-action:focus {
    background-color: #2c3034;
    color: #e9ecef;
}

/* Modal Dark Mode */
[data-bs-theme="dark"] .modal-content {
    background-color: #212529;
    border-color: #495057;
    color: #e9ecef;
}

[data-bs-theme="dark"] .modal-header {
    border-bottom-color: #495057;
}

[data-bs-theme="dark"] .modal-footer {
    border-top-color: #495057;
}

/* Dropdown Menu Dark Mode */
[data-bs-theme="dark"] .dropdown-menu {
    background-color: #212529;
    border-color: #495057;
}

[data-bs-theme="dark"] .dropdown-item {
    color: #e9ecef;
}

[data-bs-theme="dark"] .dropdown-item:hover,
[data-bs-theme="dark"] .dropdown-item:focus {
    background-color: #2c3034;
    color: #e9ecef;
}

[data-bs-theme="dark"] .dropdown-divider {
    border-top-color: #495057;
}

[data-bs-theme="dark"] .dropdown-header {
    color: #adb5bd;
}

/* Text Muted Dark Mode */
[data-bs-theme="dark"] .text-muted {
    color: #adb5bd !important;
}

/* Borders Dark Mode */
[data-bs-theme="dark"] .border {
    border-color: #495057 !important;
}

[data-bs-theme="dark"] .border-top,
[data-bs-theme="dark"] .border-bottom,
[data-bs-theme="dark"] .border-start,
[data-bs-theme="dark"] .border-end {
    border-color: #495057 !important;
}

/* Background utilities Dark Mode */
[data-bs-theme="dark"] .bg-light {
    background-color: #2c3034 !important;
}

[data-bs-theme="dark"] .bg-white {
    background-color: #212529 !important;
}

/* Table contextual backgrounds Dark Mode */
[data-bs-theme="dark"] .table-info {
    --bs-table-bg: rgba(13, 202, 240, 0.08);
    --bs-table-color: #adb5bd;
    --bs-table-border-color: #495057;
    background-color: rgba(13, 202, 240, 0.08) !important;
    color: #adb5bd;
}

[data-bs-theme="dark"] .table-secondary {
    --bs-table-bg: rgba(108, 117, 125, 0.1);
    --bs-table-color: #adb5bd;
    --bs-table-border-color: #495057;
    background-color: rgba(108, 117, 125, 0.1) !important;
    color: #adb5bd;
}

[data-bs-theme="dark"] .table-danger {
    --bs-table-bg: rgba(220, 53, 69, 0.1);
    --bs-table-color: #ea868f;
    --bs-table-border-color: #495057;
    background-color: rgba(220, 53, 69, 0.1) !important;
    color: #ea868f;
}

[data-bs-theme="dark"] .table-success {
    --bs-table-bg: rgba(25, 135, 84, 0.1);
    --bs-table-color: #75b798;
    --bs-table-border-color: #495057;
    background-color: rgba(25, 135, 84, 0.1) !important;
    color: #75b798;
}

[data-bs-theme="dark"] .table-warning {
    --bs-table-bg: rgba(255, 193, 7, 0.1);
    --bs-table-color: #ffda6a;
    --bs-table-border-color: #495057;
    background-color: rgba(255, 193, 7, 0.1) !important;
    color: #ffda6a;
}

/* Warning background with proper text color in dark mode */
[data-bs-theme="dark"] .bg-warning {
    color: #000 !important;
}

[data-bs-theme="dark"] .card-header.bg-warning,
[data-bs-theme="dark"] .card-header.bg-warning h3,
[data-bs-theme="dark"] .card-header.bg-warning h4,
[data-bs-theme="dark"] .card-header.bg-warning h5 {
    color: #000 !important;
}

/* White marking badge readability */
.badge.bg-light.border {
    border-color: #6c757d !important;
}

[data-bs-theme="dark"] .badge.bg-light {
    background-color: #f8f9fa !important;
    color: #212529 !important;
    border-color: #adb5bd !important;
}

/* Hive Structure Visualization Dark Mode */
[data-bs-theme="dark"] .hive-component {
    border-color: rgba(255, 255, 255, 0.15);
}

[data-bs-theme="dark"] .hive-component-stand {
    background: linear-gradient(180deg, #6c757d 0%, #495057 100%);
}

[data-bs-theme="dark"] .hive-component-brood {
    background: linear-gradient(180deg, #e0a800 0%, #c69500 100%);
}

[data-bs-theme="dark"] .hive-component-honey {
    background: linear-gradient(180deg, #3d8bfd 0%, #0d6efd 100%);
}

[data-bs-theme="dark"] .hive-component:hover {
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.4);
}