.sea-af-database {
    max-width: 1200px;
    margin: 0 auto;
}

.database-title {
    color: var(--primary-red, #ff1d26);
    font-size: 1.5rem;
    font-weight: 600;
    margin-bottom: 1rem;
}

.database-instructions {
    color: #333;
    margin-bottom: 2rem;
}

/* Search Box */
.database-search {
    position: sticky;
    top: 2rem;
}

.search-box {
    position: relative;
    width: 100%;
    max-width: 100%; /* Updated for 50/50 layout */
}

.search-box input {
    width: 100%;
    padding: 12px 40px 12px 15px;
    border: 2px solid var(--primary-red, #ff1d26);
    border-radius: 25px;
    font-size: 1rem;
}

.search-icon {
    position: absolute;
    right: 15px;
    top: 50%;
    transform: translateY(-50%);
    color: var(--primary-red, #ff1d26);
    pointer-events: none;
}

/* Filters */
.database-filters {
    margin: 2rem 0;
}

.filter-label {
    display: inline-block;
    font-size: 1.2rem;
    margin-right: 0.2rem;
    color: var(--primary-red, #ff1d26);
}

.filter-group {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    align-items: center;
}

.filter-dropdown {
    position: relative;
}

.filter-button {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 6px 12px;
    border: 1px solid var(--primary-red, #ff1d26);
    border-radius: 20px;
    background: white;
    color: #000000;
    font-size: 0.8rem;
    transition: all 0.3s ease;
}

.filter-button:hover {
    background: var(--primary-red, #ff1d26);
    color: white;
}

.dropdown-content {
    display: none;
    position: absolute;
    top: 100%;
    left: 0;
    background: white;
    border: 1px solid #ddd;
    border-radius: 4px;
    padding: 0.5rem;
    min-width: 200px;
    max-height: 300px;
    overflow-y: auto;
    z-index: 1000;
    box-shadow: 0 2px 5px rgba(0,0,0,0.1);
}

/* Style for dropdowns with many items */
.dropdown-content.multi-column {
    column-count: 2;
    column-gap: 1rem;
    min-width: 400px;
}

.filter-dropdown.active .dropdown-content {
    display: block;
}

/* Custom Checkbox Styling */
.dropdown-content input[type="checkbox"] {
    width: 20px;
    height: 20px;
    margin-right: 8px;
    border: 2px solid var(--primary-red, #ff1d26);
    border-radius: 3px;
    vertical-align: middle;
    position: relative;
    cursor: pointer;
    accent-color: var(--primary-red, #ff1d26);
}

/* Select all option should span both columns */
.dropdown-content label:first-child {
    column-span: all;
    border-bottom: 1px solid #eee;
    margin-bottom: 0.5rem;
}

.dropdown-content label {
    display: flex;
    align-items: center;
    padding: 0.5rem;
    cursor: pointer;
    font-size: 0.95rem;
    break-inside: avoid;
    page-break-inside: avoid;
}

.dropdown-content label:hover {
    background: #f5f5f5;
}

/* Filter Icons */
.filter-icon {
    color: var(--primary-red, #ff1d26);
    font-size: 1.1rem;
}

/* Replace emoji icons with Font Awesome or similar icons */
.filter-icon[data-filter="country"]::before { content: "📍"; }
.filter-icon[data-filter="year"]::before { content: "📅"; }
.filter-icon[data-filter="form"]::before { content: "🎨"; }
.filter-icon[data-filter="agent"]::before { content: "👥"; }
.filter-icon[data-filter="method"]::before { content: "🔧"; }
.filter-icon[data-filter="accusation"]::before { content: "⚖️"; }

.filter-button:hover .filter-icon {
    color: white;
}

/* Reset Button */
.reset-button {
    display: none;
    align-items: center;
    gap: 0.5rem;
    padding: 6px 12px;
    border: 1px solid var(--primary-red, #ff1d26);
    border-radius: 20px;
    background: var(--primary-red, #ff1d26);
    color: white;
    font-size: 0.8rem;
    transition: all 0.3s ease;
    cursor: pointer;
}

.reset-button.show {
    display: flex;
}

.reset-button:hover {
    background: #000000;
    color: white;
    border-color: #000000;
}

.reset-button .icon {
    color: var(--primary-red, #ff1d26);
    font-size: 1.1rem;
}

.reset-button:hover .icon {
    color: white;
}

/* Results Table */
.database-results {
    margin-top: 2rem;
    font-size: 0.9rem;
}

#cases-table {
    width: 100%;
    margin-bottom: 2rem;
    table-layout: fixed; /* This helps with column width control */
    overflow-x: auto;
    display: block;
}

/* Selected row styling */
#cases-table tbody tr.selected {
    background-color: #e6f3ff !important;
}

#cases-table tbody tr.selected td:first-child .case-indicator {
    background-color: var(--primary-red, #ff1d26);
}

#cases-table th,
#cases-table td {
    padding: 0.75rem;
    text-align: left;
    border-bottom: 1px solid #ddd;
    word-wrap: break-word; /* Enable text wrapping */
    white-space: normal; /* Allow text to wrap */
    vertical-align: top; /* Align content to top when wrapped */
}
/* Add text truncation for Method column */
#cases-table td:nth-child(7) {
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* Make Target Name column bold */
#cases-table td:nth-child(1) {
    font-weight: bold;
}

/* Remove bold from Main Creator column */
#cases-table td:nth-child(2) {
    font-weight: normal;
}

#cases-table th {
    background: #f5f5f5;
    font-weight: bold;
    cursor: pointer;
    font-size: 0.85rem; /* Slightly smaller header text */
    text-transform: uppercase; /* Make headers uppercase */
}

#cases-table tbody tr {
    cursor: pointer;
    transition: background-color 0.3s ease;
}

#cases-table tbody tr:hover {
    background-color: #f9f9f9;
}

#cases-table tbody tr.selected {
    background-color: #e6f3ff;
}

/* Circle indicator */
.case-indicator {
    width: 20px;
    height: 20px;
    border: 2px solid var(--primary-red, #ff1d26);
    border-radius: 50%;
    display: inline-block;
    cursor: pointer;
}


/* Responsive table adjustments */
@media (max-width: 1200px) {
    .database-results {
        font-size: 0.85rem;
    }

    #cases-table th,
    #cases-table td {
        padding: 0.5rem;
    }
}

@media (max-width: 768px) {
    .database-results {
        font-size: 0.8rem;
        margin-top: 1rem;
    }

    #cases-table th,
    #cases-table td {
        padding: 0.4rem;
    }
    
    #cases-table {
        font-size: 14px;
    }
    
    .dataTables_wrapper .dataTables_filter {
        float: none;
        text-align: left;
        margin-top: 10px;
    }
    
    .dataTables_wrapper .dataTables_length {
        float: none;
        margin-bottom: 10px;
    }

}

.filter-button .icon {
    display: inline-flex;
    align-items: center;
    margin-right: 4px;
}

.filter-button .icon img {
    width: 16px;
    height: 16px;
    display: block;
}

/* Ensure SVG icons are visible */
.filter-button .icon img[src$=".svg"] {
    width: 16px;
    height: 16px;
    fill: currentColor;
}

/* Add a fallback color for SVG icons */
.filter-button .icon img[src$=".svg"] path {
    fill: currentColor;
}

/* DataTables Custom Styling */
.dataTables_filter input {
    padding: 5px 10px;
    border-radius: 4px;
    border: 1px solid #ddd;
    margin-left: 10px;
}

.dataTables_paginate {
    margin-top: 1rem;
    text-align: center;
}

.dataTables_paginate .paginate_button {
    padding: 5px 10px;
    margin: 0 2px;
    border-radius: 4px;
    cursor: pointer;
}

.dataTables_paginate .paginate_button.current {
    background: var(--primary-red, #ff1d26);
    color: white !important;
    border: none;
}

.dataTables_paginate .paginate_button:hover {
    background: #f5f5f5;
    border: 1px solid #ddd;
}

.dataTables_wrapper {
    padding: 20px 0;
}

.dataTables_info,
.dataTables_length {
    padding: 10px;
}

/* Position the info text on the right */
.dataTables_wrapper .bottom {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-top: 1rem;
}

.dataTables_wrapper .dataTables_info {
    text-align: right;
    padding-right: 0;
}

.dataTables_wrapper .dataTables_length {
    padding-left: 0;
}

.dataTables_length select {
    padding: 5px;
    border-radius: 4px;
    border: 1px solid #ddd;
}

/* Style sorting arrows */
table.dataTable thead .sorting:after,
table.dataTable thead .sorting_asc:after,
table.dataTable thead .sorting_desc:after {
    color: var(--primary-red, #ff1d26);
    opacity: 1;
}

table.dataTable thead .sorting:before,
table.dataTable thead .sorting_asc:before,
table.dataTable thead .sorting_desc:before {
    color: var(--primary-red, #ff1d26);
    opacity: 1;
}

/* Make inactive sorting arrows slightly transparent */
table.dataTable thead .sorting:after,
table.dataTable thead .sorting:before {
    opacity: 0.5;
}

/* Case Summary Styles */
.case-summary {
    margin-top: 2rem;
    padding: 2rem;
    border-radius: 4px;
    display: grid;
    grid-template-columns: 1fr 2fr;
    gap: 2rem;
    overflow-x: visible !important;
}

.case-summary-header {
    margin-bottom: 1.5rem;
    padding-bottom: 1rem;
    border-bottom: 2px solid var(--primary-red, #ff1d26);
    grid-column: 1 / -1;
}

.case-summary-header h3 {
    color: var(--primary-red, #ff1d26);
    font-size: 1.5rem;
    font-weight: 700;
}

.case-title {
    color: var(--primary-red, #ff1d26);
    margin: 0 0 0.5rem 0;
    font-size: 1.5rem;
}

.case-metadata {
    display: flex;
    flex-direction: column;
    gap: 0;
}

.metadata-item {
    padding: 0.5rem 0;
}

.metadata-item .label {
    font-weight: bold;
    color: #333;
    margin-right: 0.5rem;
}

.metadata-item.target-name {
    font-size: 1.2rem;
    font-weight: bold;
}

.metadata-item.agent,
.metadata-item.year,
.metadata-item.country {
    font-size: 0.9rem;
    color: var(--primary-red, #ff1d26);
}

.case-description {
    padding-top: 0;
    border-top: none;
}

.case-description h3 {
    color: var(--primary-red, #ff1d26);
    margin: 0 0 1rem 0;
}

.summary-content {
    line-height: 1.6;
    color: #333;
    white-space: pre-wrap; /* Preserve whitespace and line breaks */
}

.summary-content p {
    margin-bottom: 1rem; /* Add space between paragraphs */
}

.summary-content p:last-child {
    margin-bottom: 0; /* Remove margin from last paragraph */
}

/* Navigation buttons */
.case-navigation {
    display: flex;
    justify-content: space-between;
    margin-top: 1rem;
    grid-column: 1 / -1;
    padding-top: 1rem;
    border-top: 1px solid #ddd;
}

.nav-button {
    padding: 8px 16px;
    border: 1px solid var(--primary-red, #ff1d26);
    border-radius: 20px;
    background: white;
    color: var(--primary-red, #ff1d26);
    font-size: 0.9rem;
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.nav-button:hover {
    background: var(--primary-red, #ff1d26);
    color: white;
}

.nav-button:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    border-color: #ccc;
    color: #666;
}

.nav-button:disabled:hover {
    background: white;
    color: #666;
}

/* Responsive adjustments */
@media screen and (max-width: 768px) {
    .case-summary {
        grid-template-columns: 1fr;
        padding: 1rem;
        gap: 1rem;
    }

    .case-metadata {
        margin-bottom: 1rem;
    }

    .case-navigation {
        flex-direction: column;
        gap: 1rem;
    }

    .nav-button {
        width: 100%;
        justify-content: center;
    }
}

/* --- Improved noUiSlider styles for Year Filter --- */
#year-slider-container {
    background: #fff;
    border-radius: 16px;
    padding: 2.5rem 1.5rem 1rem 1.5rem !important;
    box-shadow: 0 2px 8px rgba(0,0,0,0.03);
    min-width: 220px;
    max-width: 500px;
    margin: 0 auto;
    overflow: hidden;
    position: relative;
}

#year-slider {
    margin: 0.5rem 0 0.8rem 0;
    padding: 0 0.5rem;
}

.noUi-target {
    background: none;
    border: none;
    box-shadow: none;
    margin: 0 auto;
}
.noUi-tooltip {
    border: none;
}

.noUi-base {
    background: none;
}

.noUi-connects {
    background: none;
}
.noUi-target {
    background: #cccccc;
    border: none !important;
    box-shadow: none !important;
}

.noUi-connect {
    background: var(--primary-red, #ff1d26) !important;
    height: 4px !important;
    top: 40% !important;
    transform: translateY(-50%);
    border-radius: 2px;
    border: none !important;
}

.noUi-horizontal .noUi-handle {
    width: 28px !important;
    height: 28px !important;
    border-radius: 50%;
    background: var(--primary-red, #ff1d26);
    border: 2px solid #fff;
    box-shadow: 0 2px 6px rgba(255,29,38,0.10);
    top: -7px;
    cursor: pointer;
    transition: box-shadow 0.2s;
}

.noUi-horizontal .noUi-handle:before,
.noUi-horizontal .noUi-handle:after {
    display: none;
}

.noUi-handle:hover, .noUi-handle:focus {
    box-shadow: 0 0 0 4px rgba(255,29,38,0.15);
}

.noUi-horizontal {
    height: 4px;
    background: #ccc;
    border-radius: 2px;
}

/* Tooltip styles */
.noUi-tooltip {
    background: #fff;
    color: var(--primary-red, #ff1d26);
    border: 1px solid var(--primary-red, #ff1d26);
    border-radius: 8px;
    font-size: 0.85rem;
    font-weight: 500;
    box-shadow: 0 2px 8px rgba(0,0,0,0.04);
    padding: 2px 6px;
    margin-top: 6px;
}

#year-slider-values {
    color: #888;
    font-size: 0.95rem;
    margin-top: 0.7rem;
    letter-spacing: 0.01em;
    padding: 0 0.5rem;
    text-align: center;
}
#year-slider-min, #year-slider-max {
    color: #222;
    font-weight: bold;
    font-size: 1rem;
}

@media (max-width: 600px) {
    #year-slider-container {
        min-width: 0;
        max-width: 100%;
        padding: 1rem 0.5rem 1rem 0.5rem;
    }
}