/* General table styling */
#countriesTable {
    cursor: pointer;
    width: 100%;
    border-collapse: collapse;
    background: transparent;
}

/* Enhanced table row styling */
#countriesTable.table-striped > tbody > tr {
    background-color: white;
    transition: background-color 0.2s ease;
}

/* Alternate row colors */
#countriesTable.table-striped > tbody > tr:nth-child(even) {
    background-color: white;
}

/* Hover effect */
#countriesTable.table-striped > tbody > tr:hover {
    background-color: #e9ecef;
    box-shadow: inset 0 0 0 2px #dee2e6;
}

/* Make table headers more prominent for sorting */
#countriesTable thead th {
    font-weight: bold;
    cursor: pointer;
    position: relative;
    padding-right: 20px; /* Space for sort indicator */
    white-space: nowrap;
    border-bottom: 2px solid #dee2e6;
}

/* Add sort indicators */
#countriesTable thead th.sorting:after {
    content: "↕";
    position: absolute;
    right: 8px;
    color: #999;
    font-size: 0.8em;
}

#countriesTable thead th.sorting_asc:after {
    content: "↑";
    position: absolute;
    right: 8px;
    color: #333;
}

#countriesTable thead th.sorting_desc:after {
    content: "↓";
    position: absolute;
    right: 8px;
    color: #333;
}

/* Hover effect for sortable headers */
#countriesTable thead th:hover {
    text-decoration: underline;
}

/* Income level filter for scatter plots */
.row.mb-3 {
    width: 100%;
    margin-left: 0;
    margin-right: 0;
    display: flex;
    flex-wrap: nowrap;
}

.row.mb-3 .col-md-4 {
    padding-left: 15px;
    padding-right: 15px;
    flex: 0 0 50%;
    max-width: 50%;
}

/* Make search-filter-container 80% width */
.search-filter-container {
    width: 80% !important;
    margin: 0 auto;
}

/* Enhanced search bar for scatter plots */
#economySearch {
    height: 38px;
    font-size: 1rem;
    border-radius: 4px 0 0 4px;
    width: 200px;
}

/* Improve search button styling */
#searchButton {
    border-radius: 0;
}

#clearHighlight {
    border-radius: 0 4px 4px 0;
}

/* Improved autocomplete appearance */
.autocomplete-results {
    position: absolute;
    z-index: 1050;
    background: white;
    width: 100%;
    border: 1px solid #ced4da;
    border-top: none;
    border-radius: 0 0 4px 4px;
    max-height: 300px;
    overflow-y: auto;
    box-shadow: 0 6px 12px rgba(0,0,0,0.15);
}

.autocomplete-item {
    padding: 10px 15px;
    cursor: pointer;
    border-bottom: 1px solid #f0f0f0;
    transition: background-color 0.2s;
}

.autocomplete-item:hover {
    background-color: #e9ecef;
}

/* Column width adjustments */
#countriesTable th:first-child,
#countriesTable td:first-child {
    width: 30%;
    min-width: 150px;
    text-align: left !important;
    padding-left: 15px;
}

#countriesTable th:nth-child(2),
#countriesTable td:nth-child(2) {
    width: 15%;
    min-width: 100px;
}

/* Equal width for financing columns */
#countriesTable th:nth-child(3),
#countriesTable th:nth-child(4),
#countriesTable th:nth-child(5),
#countriesTable td:nth-child(3),
#countriesTable td:nth-child(4),
#countriesTable td:nth-child(5) {
    width: 18%;
    min-width: 150px;
}

/* Center the h2 title */
h2 {
    text-align: center;
    margin-bottom: 20px;
}

/* Financing bars styling */
.financing-bar {
    width: 100%;
    height: 20px;
    position: relative;
    background: transparent;
    border-radius: 3px;
    cursor: pointer;
    margin: 0 auto;
    max-width: 150px;
}

/* Tooltip styling */
.financing-tooltip {
    position: absolute;
    display: none;
    background: white;
    border: 1px solid #ccc;
    border-radius: 4px;
    padding: 0;
    box-shadow: 0 2px 10px rgba(0,0,0,0.2);
    z-index: 1000;
    min-width: 250px;
    max-width: 350px;
    pointer-events: none;
}

.tooltip-header {
    background: #f5f5f5;
    padding: 8px 12px;
    border-bottom: 1px solid #ddd;
    font-weight: bold;
    border-radius: 4px 4px 0 0;
}

.tooltip-body {
    padding: 8px 12px;
}

.tooltip-row {
    margin: 4px 0;
    display: flex;
    align-items: center;
}

.color-box {
    display: inline-block;
    width: 12px;
    height: 12px;
    margin-right: 8px;
    border-radius: 2px;
}

/* Add styles for the search input */
#economySearch:focus {
    box-shadow: 0 0 0 0.25rem rgba(13, 110, 253, 0.25);
    border-color: #86b7fe;
}

/* Style for highlighted points */
.highlighted-point {
    stroke: #ff0000;
    stroke-width: 2px;
}

/* Fullscreen icon styling */
.fullscreen-icon {
    position: absolute;
    top: 10px;
    right: 10px;
    z-index: 100;
    cursor: pointer;
    background: rgba(255, 255, 255, 0.8);
    border-radius: 50%;
    width: 30px;
    height: 30px;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.2);
    transition: all 0.2s ease;
}

.fullscreen-icon:hover {
    background: rgba(255, 255, 255, 0.9);
    transform: scale(1.1);
}

.fullscreen-icon svg {
    width: 16px;
    height: 16px;
    fill: #333;
}

/* Fullscreen mode styling */
.chart-container.fullscreen {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    z-index: 1000;
    background: white;
    padding: 20px;
}

/* Improve form text appearance */
.form-text {
    font-size: 0.85rem;
    color: #6c757d;
    margin-top: 0.25rem;
}

/* Improve table row hover effect */
#countriesTable tbody tr:hover {
    background-color: #fff2cc !important; /* Softer yellow highlight */
    transition: background-color 0.2s ease; /* Smooth transition */
    box-shadow: 0 0 5px rgba(0,0,0,0.1); /* Subtle shadow on hover */
}

/* Add zebra striping for better readability */
#countriesTable tbody tr:nth-of-type(odd) {
    background-color: transparent;
}

/* Ensure proper cell padding */
#countriesTable td, 
#countriesTable th {
    padding: 10px 8px;
    vertical-align: middle;
}

/* Responsive adjustments */
@media (max-width: 767px) {
    .search-filter-container {
        width: 95% !important; /* Wider on mobile */
    }
    
    .search-filter-container .row:first-child > div {
        margin-bottom: 15px;
    }
    
    #countriesTable th,
    #countriesTable td {
        padding: 8px 4px;
        font-size: 0.9em;
    }
    
    .financing-bar {
        max-width: 100px;
    }
}

/* Fix for DataTables sorting arrows */
table.dataTable thead .sorting:after,
table.dataTable thead .sorting_asc:after,
table.dataTable thead .sorting_desc:after {
    position: absolute;
    right: 8px;
    top: 50%;
    transform: translateY(-50%);
    display: block;
    opacity: 0.5;
}

table.dataTable thead .sorting_asc:after,
table.dataTable thead .sorting_desc:after {
    opacity: 1;
}