/* Scottish Witchcraft Database - Custom Styles */

body {
    font-size: 0.95rem;
}

.navbar-brand {
    font-weight: bold;
}

/* Compact tables */
.table th {
    white-space: nowrap;
}

.table-sm td, .table-sm th {
    padding: 0.3rem 0.5rem;
}

/* Accordion styling */
.accordion-button:not(.collapsed) {
    background-color: #f8f9fa;
    color: #212529;
}

/* Card headers */
.card-header {
    background-color: #f8f9fa;
}

/* Form labels */
.form-label {
    font-weight: 500;
    font-size: 0.875rem;
    margin-bottom: 0.25rem;
}

/* Search page tabs */
.tab-content {
    min-height: 200px;
}

/* Filter form */
form.card .card-body {
    padding: 0.75rem;
}

/* Admin warning bar */
.admin-bar {
    background: #ffc107;
    color: #212529;
    padding: 0.25rem 1rem;
    font-size: 0.85rem;
    text-align: center;
}

/* Pagination spacing */
.pagination {
    margin-top: 1rem;
}

/* Footer */
footer {
    font-size: 0.875rem;
}

/* Boolean icons */
.text-success {
    font-weight: bold;
}

/* Glossary popover terms */
.glossary-term {
    text-decoration: underline dotted;
    text-decoration-thickness: 1px;
    text-underline-offset: 2px;
    cursor: help;
    color: inherit;
}
.glossary-term:hover {
    text-decoration: underline solid;
    background-color: rgba(0,0,0,0.04);
    border-radius: 2px;
}
[data-bs-theme="dark"] .glossary-term:hover {
    background-color: rgba(255,255,255,0.08);
}

/* Glossary definition list */
dt {
    font-size: 1.05rem;
    margin-top: 0.75rem;
    scroll-margin-top: 80px;
}
dt:target {
    background-color: #fff3cd;
    padding: 2px 6px;
    border-radius: 3px;
}

/* ========================================
   Dark Mode Overrides
   Bootstrap 5.3 handles most components automatically via data-bs-theme="dark".
   These overrides are only for our custom hardcoded colours above.
   ======================================== */

[data-bs-theme="dark"] .card-header {
    background-color: #2b3035;
}

[data-bs-theme="dark"] .accordion-button:not(.collapsed) {
    background-color: #2b3035;
    color: #dee2e6;
}

[data-bs-theme="dark"] .admin-bar {
    background: #664d03;
    color: #ffc107;
}

[data-bs-theme="dark"] dt:target {
    background-color: #664d03;
}

/* btn-dark and btn-outline-dark are invisible on dark backgrounds */
[data-bs-theme="dark"] .btn-dark {
    --bs-btn-bg: #495057;
    --bs-btn-border-color: #6c757d;
    --bs-btn-hover-bg: #5c636a;
    --bs-btn-hover-border-color: #6c757d;
}

[data-bs-theme="dark"] .btn-outline-dark {
    --bs-btn-color: #dee2e6;
    --bs-btn-border-color: #dee2e6;
    --bs-btn-hover-bg: #dee2e6;
    --bs-btn-hover-color: #212529;
}

/* Theme toggle button */
#themeToggle {
    width: 2rem;
    padding: 0.2rem;
    line-height: 1;
    font-size: 1.1rem;
}

/* ========================================
   Leaflet Map - Dark Mode
   ======================================== */

[data-bs-theme="dark"] .leaflet-popup-content-wrapper,
[data-bs-theme="dark"] .leaflet-popup-tip {
    background-color: #2b3035;
    color: #dee2e6;
}

[data-bs-theme="dark"] .leaflet-popup-content a {
    color: #6ea8fe;
}

[data-bs-theme="dark"] .leaflet-control-zoom a {
    background-color: #2b3035;
    color: #dee2e6;
    border-color: #495057;
}

[data-bs-theme="dark"] .leaflet-control-zoom a:hover {
    background-color: #495057;
}

[data-bs-theme="dark"] .leaflet-control-attribution {
    background-color: rgba(43, 48, 53, 0.8);
    color: #adb5bd;
}

[data-bs-theme="dark"] .leaflet-control-attribution a {
    color: #6ea8fe;
}

[data-bs-theme="dark"] .leaflet-tooltip {
    background-color: #2b3035;
    color: #dee2e6;
    border-color: #495057;
}

[data-bs-theme="dark"] .leaflet-tooltip-top::before {
    border-top-color: #495057;
}

/* ========================================
   Network Diagram
   ======================================== */

#network-container {
    border-top: 1px solid #dee2e6;
}

[data-bs-theme="dark"] #network-container {
    border-color: #495057;
    background-color: #212529;
}

.network-legend-item {
    display: inline-flex;
    align-items: center;
    margin-right: 1rem;
    margin-bottom: 0.25rem;
    font-size: 0.875rem;
}

.network-legend-dot {
    width: 12px;
    height: 12px;
    border-radius: 50%;
    display: inline-block;
    margin-right: 0.35rem;
    border: 2px solid rgba(0,0,0,0.15);
}

.network-legend-line {
    width: 20px;
    height: 3px;
    display: inline-block;
    margin-right: 0.35rem;
    border-radius: 1px;
}

/* ========================================
   Admin FK Lookup Widget
   ======================================== */

.fk-lookup-dropdown {
    border: 1px solid #dee2e6;
    border-radius: 0.375rem;
    background: #fff;
    box-shadow: 0 0.5rem 1rem rgba(0,0,0,0.15);
}

.fk-lookup-dropdown .list-group-item {
    font-size: 0.875rem;
}

[data-bs-theme="dark"] .fk-lookup-dropdown {
    background: #2b3035;
    border-color: #495057;
}

[data-bs-theme="dark"] .fk-lookup-dropdown .list-group-item {
    background-color: #2b3035;
    color: #dee2e6;
    border-color: #495057;
}

[data-bs-theme="dark"] .fk-lookup-dropdown .list-group-item-action:hover {
    background-color: #495057;
}
