/* Modern CSS Reset */
*,
*::before,
*::after {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

/* Variables */
:root {
    /* Colors */
    --color-primary-50: #f0f9ff;
    --color-primary-100: #e0f2fe;
    --color-primary-200: #bae6fd;
    --color-primary-300: #7dd3fc;
    --color-primary-400: #38bdf8;
    --color-primary-500: #0ea5e9;
    --color-primary-600: #0284c7;
    --color-primary-700: #0369a1;
    
    --color-gray-50: #f9fafb;
    --color-gray-100: #f3f4f6;
    --color-gray-200: #e5e7eb;
    --color-gray-300: #d1d5db;
    --color-gray-400: #9ca3af;
    --color-gray-500: #6b7280;
    --color-gray-600: #4b5563;
    --color-gray-700: #374151;
    --color-gray-800: #1f2937;
    --color-gray-900: #111827;

    /* Shadows */
    --shadow-sm: 0 1px 2px 0 rgb(0 0 0 / 0.05);
    --shadow: 0 1px 3px 0 rgb(0 0 0 / 0.1), 0 1px 2px -1px rgb(0 0 0 / 0.1);
    --shadow-md: 0 4px 6px -1px rgb(0 0 0 / 0.1), 0 2px 4px -2px rgb(0 0 0 / 0.1);
    --shadow-lg: 0 10px 15px -3px rgb(0 0 0 / 0.1), 0 4px 6px -4px rgb(0 0 0 / 0.1);

    /* Transitions */
    --transition-all: all 0.2s ease;

    /* Background Colors */
    --background-color: #f8f9fa;
    --card-background: #ffffff;
    --card-header-background: #f8f9fa;
    --text-color: #2d3748;
    --label-color: #718096;
    --border-color: #e2e8f0;
    --accent-color: #3182ce;
    --input-background: #ffffff;
    --color-page-bg: #f8f9fa;
}

/* Dark mode */
@media (prefers-color-scheme: dark) {
    :root {
        --background-color: #1a202c;
        --card-background: #2d3748;
        --card-header-background: #2d3748;
        --text-color: #f7fafc;
        --label-color: #a0aec0;
        --border-color: #4a5568;
        --accent-color: #4299e1;
        --input-background: #2d3748;
        --color-page-bg: #1a202c;
    }
}

/* Reset & Base Styles */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    background: var(--color-gray-100);
    color: var(--color-gray-900);
    line-height: 1.5;
}

/* Layout */
.app-container {
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

/* Navigation */
.top-nav {
    background: white;
    border-bottom: 1px solid var(--color-gray-200);
    padding: 1rem 0;
    position: sticky;
    top: 0;
    z-index: 50;
}

.nav-content {
    max-width: 97%;
    margin: 0 auto;
    padding: 0 1.5rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.nav-actions {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.logo {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    font-size: 1.25rem;
    font-weight: 600;
    color: var(--color-gray-900);
}

.logo img {
    height: 3.5rem;
    width: auto;
}

.logo span {
    font-weight: 600;
    font-size: 1.25rem;
    color: var(--color-gray-800);
}

/* Data date information block */
.data-date-info {
    padding: 0.5rem 1rem;
    background-color: var(--color-primary-50);
    border: 1px solid var(--color-primary-100);
    border-radius: 0.375rem;
    font-size: 0.875rem;
    color: var(--color-gray-700);
    margin-left: auto; /* Push to the right side */
    align-self: center; /* Center vertically */
    white-space: nowrap; /* Prevent wrapping */
}

.data-date-info strong {
    color: var(--color-primary-700);
}

@media (max-width: 768px) {
    .data-date-info {
        padding: 0.375rem 0.75rem;
        font-size: 0.75rem;
        margin-left: 0; /* Reset margin on mobile */
        margin-top: 0; /* Remove top margin */
        margin-bottom: 0.5rem; /* Add bottom margin instead */
        order: 1; /* Change the display order */
        width: 100%; /* Full width */
    }
    
    .description-icon {
        order: 0; /* Keep icon first */
    }
    
    .description-text {
        order: 2; /* Move text to be displayed after the date */
        width: 100%; /* Full width */
    }
    
    .description-content {
        width: 100%;
        flex-direction: row;
        flex-wrap: wrap;
    }
}

/* Main Content */
.main-content {
    flex: 1;
    display: flex;
    padding: 1.5rem 2rem;
    max-width: 100%;
    margin: 0 auto;
    width: 100%;
}

/* Content Layout */
.content-layout {
    display: flex;
    gap: 2rem;
    height: 100%;
    width: 100%;
    background: var(--color-gray-50);
    border-radius: 1rem;
    padding: 1.5rem;
    border: 1px solid var(--color-gray-200);
    box-shadow: var(--shadow-lg);
}

/* Filters Section */
.filters-section {
    width: 320px;
    flex-shrink: 0;
    overflow-y: auto;
    padding: 1rem;
    background: white;
    border-radius: 0.75rem;
    border: 1px solid var(--color-gray-200);
}

/* Filter Groups */
.filter-groups {
    display: flex;
    flex-direction: column;
    gap: 1.25rem;
}

.filter-card {
    background: var(--card-background);
    border-radius: 0.75rem;
    box-shadow: var(--shadow-sm);
    overflow: hidden;
    margin-bottom: 0.1875rem;
}

.card-header {
    padding: 1.25rem 1.5rem;
    border-bottom: 1px solid var(--color-gray-200);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.card-header-content {
    display: flex;
    flex-direction: column;
}

.prominent-back {
    font-size: 0.875rem;
    padding: 0.5rem 0.75rem;
}

.card-header h3 {
    font-size: 0.8125rem;
    font-weight: 600;
    margin: 0;
    padding: 0;
}

.range-filters {
    padding: 0.25rem 1rem 0.25rem;
}

/* Completely remove spacing between filter groups */
.filter-group {
    margin: 0;
    padding: 0;
}

.filter-group + .filter-group {
    margin-top: 5px;
}

/* First group should be close to header */
.card-header + .range-filters .filter-group:first-child .group-header {
    margin-top: 0.125rem;
}

/* Group header label and value */
.group-header {
    margin-top: 0.125rem;
    margin-bottom: 0;
    height: 14px;
    line-height: 14px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin: 0;
}

/* Make input field container as small as possible */
.range-slider-container {
    position: relative;
    width: 100%;
    margin: 0;
}

.range-slider {
    -webkit-appearance: none;
    appearance: none;
    position: absolute;
    height: 3px;
    width: 100%;
    background: var(--color-gray-300);
    border-radius: 2px;
    outline: none;
    pointer-events: none;
}

.slider-progress {
    position: absolute;
    height: 3px;
    background: var(--color-primary-500);
    border-radius: 2px;
    top: 50%;
    transform: translateY(-50%);
    z-index: 0;
    pointer-events: none;
}

.range-slider::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 16px;
    height: 16px;
    background: var(--color-primary-500);
    border-radius: 50%;
    cursor: pointer;
    border: 1px solid white;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.2);
    pointer-events: auto;
    transition: background 0.2s ease;
}

.range-slider::-moz-range-thumb {
    width: 16px;
    height: 16px;
    background: var(--color-primary-500);
    border-radius: 50%;
    cursor: pointer;
    border: 1px solid white;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.2);
    pointer-events: auto;
    transition: background 0.2s ease;
}

.range-slider:hover::-webkit-slider-thumb,
.range-slider:focus::-webkit-slider-thumb {
    background: var(--color-primary-600);
}

.range-slider:hover::-moz-range-thumb,
.range-slider:focus::-moz-range-thumb {
    background: var(--color-primary-600);
}

.min-slider {
    z-index: 1;
}

.max-slider {
    z-index: 2;
}

/* Group header styling for the range display */
.group-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 0;
    margin-top: 0.25rem;
    height: 16px;
    line-height: 16px;
}

.group-header label {
    font-size: 0.75rem;
    font-weight: 500;
    color: var(--color-gray-700);
    margin: 0;
    padding: 0;
}

.group-header .value {
    font-size: 0.75rem;
    color: var(--color-primary-600);
    font-weight: 500;
    margin: 0;
    padding: 0;
}

/* Results Section */
.results-section {
    flex: 1;
    min-width: 0;
    background: white;
    border-radius: 0.75rem;
    border: 1px solid var(--color-gray-200);
    display: flex;
    flex-direction: column;
}

/* Chart Section */
.chart-section {
    padding: 1.5rem;
    background: white;
    border-bottom: 1px solid var(--color-gray-200);
    height: 400px;
    min-height: 400px;
}

.chart-container {
    height: calc(100% - 3rem);
    width: 100%;
}

/* Chart Selection Area */
.chart-container {
    position: relative;
}

#chart-selection-area {
    position: absolute;
    border: 1px dashed var(--color-primary-600);
    background-color: rgba(56, 189, 248, 0.1);
    pointer-events: none;
    z-index: 10;
}

.chart-btn[data-view="reset-selection"] {
    background-color: var(--color-gray-100);
    color: var(--color-gray-800);
    border: 1px solid var(--color-gray-300);
}

.chart-btn[data-view="reset-selection"]:hover {
    background-color: var(--color-gray-200);
}

/* Table Section */
.table-section {
    background: white;
    display: flex;
    flex-direction: column;
}

.table-header {
    padding: 1.25rem 1.5rem;
    background: white;
    border-bottom: 1px solid var(--color-gray-200);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.bonds-table {
    padding: 0 1rem;
    overflow-x: auto;
}

/* Table Styles */
table {
    width: 100%;
    border-collapse: separate;
    border-spacing: 0;
    margin: 1rem 0;
    min-width: 1200px; /* Ensure table can accommodate all columns */
}

thead {
    background: white;
}

th, td {
    padding: 0.75rem 0.5rem;
    text-align: left;
    font-size: 0.875rem;
    max-width: 200px; /* Limit cell width */
    white-space: nowrap; /* Prevent text wrapping */
    overflow: hidden;
    text-overflow: ellipsis; /* Add ellipsis for overflowing text */
}

th {
    font-weight: 600;
    color: var(--color-gray-600);
    background: var(--color-gray-50);
    border-bottom: 1px solid var(--color-gray-200);
}

/* Sortable table headers */
th.sortable {
    cursor: pointer;
    position: relative;
    padding-right: 2rem; /* Increased from 1.25rem to create more space */
    user-select: none;
    transition: background-color 0.2s;
}

th.sortable:hover {
    background-color: var(--color-gray-100);
}

th.sortable .sort-icon {
    position: absolute;
    right: 0.75rem; /* Adjusted from 0.5rem to provide more space from text */
    top: 50%;
    transform: translateY(-50%);
    width: 0.75rem;
    height: 0.75rem;
    display: inline-block;
    opacity: 0.3;
}

th.sortable .sort-icon::before,
th.sortable .sort-icon::after {
    content: '';
    position: absolute;
    left: 0;
    width: 0;
    height: 0;
}

th.sortable .sort-icon::before {
    top: -0.25rem;
    border-left: 0.375rem solid transparent;
    border-right: 0.375rem solid transparent;
    border-bottom: 0.375rem solid var(--color-gray-500);
}

th.sortable .sort-icon::after {
    bottom: -0.25rem;
    border-left: 0.375rem solid transparent;
    border-right: 0.375rem solid transparent;
    border-top: 0.375rem solid var(--color-gray-500);
}

th.sortable.sort-asc .sort-icon::before {
    opacity: 1;
    border-bottom-color: var(--color-primary-600);
}

th.sortable.sort-desc .sort-icon::after {
    opacity: 1;
    border-top-color: var(--color-primary-600);
}

th.sortable.sort-asc .sort-icon::after,
th.sortable.sort-desc .sort-icon::before {
    opacity: 0.3;
}

th.sortable.sort-asc .sort-icon,
th.sortable.sort-desc .sort-icon {
    opacity: 1;
}

td {
    border-bottom: 1px solid var(--color-gray-100);
    color: var(--color-gray-700);
}

tr:hover td {
    background: var(--color-primary-50);
}

/* Make table rows clickable */
.bonds-table tbody tr {
    cursor: pointer;
    transition: var(--transition-all);
}

.bonds-table tbody tr:hover {
    background-color: rgba(14, 165, 233, 0.1);
}

/* Results Header */
.results-header {
    padding: 1.25rem 1.5rem;
    border-bottom: 1px solid var(--color-gray-200);
    background: white;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.header-left {
    display: flex;
    align-items: center;
    gap: 2rem;
}

.results-count {
    font-size: 0.875rem;
    color: var(--color-gray-600);
}

.results-count strong {
    color: var(--color-gray-900);
}

/* Sort Control */
.sort-control {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.5rem 0.75rem;
    background: var(--color-gray-50);
    border: 1px solid var(--color-gray-200);
    border-radius: 0.5rem;
    transition: var(--transition-all);
}

.sort-control:hover {
    border-color: var(--color-primary-300);
    background: white;
}

.sort-control svg {
    color: var(--color-gray-400);
}

.sort-select {
    appearance: none;
    border: none;
    background: transparent;
    padding-right: 1.5rem;
    font-size: 0.875rem;
    color: var(--color-gray-700);
    cursor: pointer;
}

.sort-select:focus {
    outline: none;
    color: var(--color-primary-600);
}

/* Pagination */
.pagination {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.pagination-btn {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.5rem 1rem;
    border: 1px solid var(--color-gray-200);
    border-radius: 0.5rem;
    background: white;
    color: var(--color-gray-700);
    font-size: 0.875rem;
    font-weight: 500;
    cursor: pointer;
    transition: var(--transition-all);
}

.pagination-btn:hover:not(:disabled) {
    border-color: var(--color-primary-300);
    color: var(--color-primary-600);
    background: var(--color-primary-50);
}

.pagination-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    background: var(--color-gray-50);
}

.pagination-info {
    font-size: 0.875rem;
    color: var(--color-gray-600);
}

.current-page {
    color: var(--color-primary-600);
    font-weight: 600;
}

/* Pagination Section */
.pagination-section {
    padding: 1rem 1.5rem;
    background: white;
    border-top: 1px solid var(--color-gray-200);
    margin-top: auto;
}

/* Filter Options */
.filter-options {
    padding: 1rem;
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.checkbox-label {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.875rem;
    color: var(--color-gray-700);
    cursor: pointer;
    padding: 0.375rem;
    border-radius: 0.375rem;
    transition: var(--transition-all);
}

.checkbox-label:hover {
    background: var(--color-gray-100);
}

/* Range Filters */
.range-filters {
    padding: 1rem;
    display: flex;
    flex-direction: column;
    gap: 1.25rem;
}

.filter-group {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    margin-top: 0.125rem;
    margin-bottom: 0.125rem;
}

.group-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 0.875rem;
}

.group-header label {
    font-size: 0.8125rem;
    font-weight: 500;
    color: var(--color-gray-700);
}

.group-header .value {
    font-size: 0.75rem;
    color: var(--color-primary-600);
    font-weight: 500;
}

/* Search Box */
.search-box {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    background: var(--color-gray-50);
    border: 1px solid var(--color-gray-200);
    padding: 0.75rem;
    border-radius: 0.75rem;
    margin: 1rem;
    transition: var(--transition-all);
}

.search-box:focus-within {
    background: white;
    border-color: var(--color-primary-300);
    box-shadow: var(--shadow-md);
}

.search-box svg {
    color: var(--color-gray-400);
    width: 20px;
    height: 20px;
}

.search-input {
    border: none;
    outline: none;
    width: 100%;
    background: transparent;
    font-size: 0.9375rem;
    color: var(--color-gray-700);
}

.search-input::placeholder {
    color: var(--color-gray-400);
}

/* Filter Group */
.filter-group {
    padding: 0 1rem 1rem;
}

.filter-group label {
    display: block;
    font-size: 0.875rem;
    font-weight: 500;
    color: var(--color-gray-600);
    margin-bottom: 0.5rem;
}

/* Select Input */
.select-input {
    width: 100%;
    padding: 0.75rem;
    font-size: 0.9375rem;
    color: var(--color-gray-700);
    background-color: white;
    border: 1px solid var(--color-gray-200);
    border-radius: 0.75rem;
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg width='16' height='16' viewBox='0 0 16 16' fill='none' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M4 6L8 10L12 6' stroke='%236B7280' stroke-width='1.5' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 0.75rem center;
    padding-right: 2.5rem;
    cursor: pointer;
    transition: var(--transition-all);
}

.select-input:hover {
    border-color: var(--color-primary-200);
}

.select-input:focus {
    outline: none;
    border-color: var(--color-primary-300);
    box-shadow: var(--shadow-md);
}

.select-input option {
    font-size: 0.9375rem;
    padding: 0.5rem;
    background-color: white;
}

/* Multi-select styling */
.select-input[multiple] {
    height: auto;
    min-height: 120px;
    background-image: none;
    padding-right: 0.75rem;
    overflow-y: auto;
}

.select-input[multiple] option {
    padding: 0.5rem 0.75rem;
    margin: 0.25rem 0;
    border-radius: 0.375rem;
    transition: var(--transition-all);
}

.select-input[multiple] option:checked {
    background-color: var(--color-primary-100);
    color: var(--color-primary-700);
}

.select-input[multiple] option:hover {
    background-color: var(--color-gray-100);
}

.select-info {
    font-size: 0.75rem;
    color: var(--color-gray-500);
    margin-top: 0.375rem;
    font-style: italic;
}

/* Chart Section */
.chart-section {
    padding: 1.5rem;
    background: white;
    border-bottom: 1px solid var(--color-gray-200);
}

.chart-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1.5rem;
}

.chart-controls {
    display: flex;
    gap: 0.5rem;
}

.chart-btn {
    padding: 0.5rem 1rem;
    font-size: 0.875rem;
    font-weight: 500;
    color: var(--color-gray-600);
    background: var(--color-gray-50);
    border: 1px solid var(--color-gray-200);
    border-radius: 0.5rem;
    cursor: pointer;
    transition: var(--transition-all);
}

.chart-btn:hover {
    background: white;
    border-color: var(--color-primary-300);
    color: var(--color-primary-600);
}

.chart-btn.active {
    background: var(--color-primary-50);
    border-color: var(--color-primary-300);
    color: var(--color-primary-600);
}

.chart-container {
    position: relative;
    height: 300px;
    width: 100%;
}

/* Chart Selection Area */
#chart-selection-area {
    position: absolute;
    border: 1px dashed var(--color-primary-600);
    background-color: rgba(56, 189, 248, 0.1);
    pointer-events: none;
    z-index: 10;
}

/* Description Banner */
.description-banner {
    background: white;
    border-bottom: 1px solid var(--color-gray-200);
    padding: 1rem 0;
}

.description-content {
    max-width: 97%;
    margin: 0 auto;
    padding: 1.25rem 1.5rem;
    display: flex;
    gap: 1rem;
    align-items: flex-start;
    flex-wrap: wrap; /* Allow wrapping on smaller screens */
}

.description-icon {
    flex-shrink: 0;
    width: 20px;
    height: 20px;
    margin-top: 0.25rem;
    color: var(--color-primary-500);
}

.description-text {
    flex: 1;
    max-width: 800px;
}

.description-text p {
    font-size: 0.9375rem;
    line-height: 1.5;
    color: var(--color-gray-600);
    margin: 0;
}

/* Media Queries for Description Banner */
@media (max-width: 1280px) {
    .description-content {
        padding: 0 1.5rem;
    }
    
    .description-text p {
        font-size: 1rem;
    }
}

@media (max-width: 768px) {
    .description-banner {
        padding: 1.5rem 0;
    }
    
    .description-content {
        padding: 0 1rem;
        gap: 1rem;
    }
    
    .description-icon {
        width: 2.5rem;
        height: 2.5rem;
    }
    
    .description-text p {
        font-size: 0.9375rem;
        line-height: 1.6;
    }
}

@media (max-width: 480px) {
    .description-banner {
        padding: 1rem 0;
    }
    
    .description-content {
        padding: 0 0.75rem;
    }
    
    .description-icon {
        width: 2rem;
        height: 2rem;
    }
    
    .description-text p {
        font-size: 0.875rem;
    }
}

/* Media Queries */
@media (max-width: 1280px) {
    .main-content {
        padding: 1rem;
    }
    
    .content-layout {
        padding: 1rem;
        gap: 1rem;
    }
    
    .filters-section {
        width: 280px;
    }
}

@media (max-width: 1024px) {
    .content-layout {
        flex-direction: column;
    }
    
    .filters-section {
        width: 100%;
        max-height: 300px;
    }
    
    
    .chart-section {
        height: 300px;
        min-height: 300px;
    }
}

@media (max-width: 768px) {
    .main-content {
        padding: 0.5rem;
    }
    
    .content-layout {
        padding: 0.5rem;
    }
    
    /* Hide chart on mobile */
    .chart-section {
        display: none;
    }
    
    .table-header {
        flex-direction: column;
        gap: 1rem;
        align-items: stretch;
    }
    
    .bonds-table {
        padding: 0 0.5rem;
    }
    
    /* Only show specified columns on mobile */
    .bonds-table table {
        table-layout: fixed;
        width: 100%;
    }

    /* Hide all columns by default */
    .bonds-table th, 
    .bonds-table td {
        display: none;
    }

    /* Show only the specified columns */
    .bonds-table th:nth-child(1), .bonds-table td:nth-child(1),  /* Issue Name */
    .bonds-table th:nth-child(3), .bonds-table td:nth-child(3),  /* ISIN */
    .bonds-table th:nth-child(4), .bonds-table td:nth-child(4),  /* Coupon */
    .bonds-table th:nth-child(6), .bonds-table td:nth-child(6),  /* Maturity */
    .bonds-table th:nth-child(9), .bonds-table td:nth-child(9),  /* Price */
    .bonds-table th:nth-child(10), .bonds-table td:nth-child(10), /* Current Yield */
    .bonds-table th:nth-child(12), .bonds-table td:nth-child(12)  /* Yield to Maturity */ {
        display: table-cell;
    }

    /* Adjust cell sizing for mobile */
    .bonds-table th, 
    .bonds-table td {
        padding: 0.5rem 0.25rem;
        font-size: 0.75rem;
        min-width: auto;
        max-width: none;
    }

    /* Truncate long text on mobile */
    .bonds-table td {
        white-space: nowrap;
        overflow: hidden;
        text-overflow: ellipsis;
    }
    
    /* Bond details page optimizations */
    .bond-details-layout {
        display: block;
    }
    
    /* Adjust card padding for mobile */
    .bond-details-wrapper .results-card,
    .calculator-wrapper .results-card {
        padding: 0;
        margin-bottom: 1rem;
    }
    
    /* Stack bond details sections vertically */
    .bond-details-grid {
        display: flex;
        flex-direction: column;
        gap: 1rem;
        padding: 0.75rem;
        overflow: visible;
    }
    
    /* Fix overlap issue between sections */
    .details-section {
        position: relative;
        z-index: 1;
        margin-bottom: 1rem !important; 
        border-radius: 8px;
        overflow: hidden;
        box-shadow: 0 1px 2px rgba(0, 0, 0, 0.05);
        border: 1px solid var(--color-gray-200);
        background-color: white;
        width: 100%;
    }
    
    /* Adjust spacing in detail rows */
    .detail-row {
        padding: 0.5rem 0.75rem;
        border-bottom: 1px solid var(--color-gray-100);
        min-height: 38px;
        align-items: center;
    }
    
    .detail-row:last-child {
        border-bottom: none;
    }
    
    /* Make the bond section headers match the reference design */
    .section-header {
        padding: 0.75rem 1rem;
        background-color: white;
        border-bottom: 1px solid var(--color-gray-200);
    }
    
    .section-title {
        font-size: 1rem;
        margin: 0;
        font-weight: 600;
    }
    
    .details-grid {
        padding: 0;
    }
    
    /* Optimize calculator for mobile */
    .calculator-wrapper {
        position: relative;
        margin-top: 1rem;
        clear: both;
    }
    
    .calculator-content {
        padding: 0;
    }
    
    /* Force calculator section to appear below other sections */
    .calculator-section {
        position: relative;
        z-index: 1;
        width: 100%;
        padding: 0;
        margin: 0;
        clear: both;
    }
    
    .calculator-section .details-grid {
        padding: 0;
    }
    
    /* Make calculator inputs more finger-friendly */
    .calculator-input {
        height: 38px;
        font-size: 1rem;
        padding: 0.5rem;
        background-color: white;
    }
    
    /* Fix date input display */
    .calculator-input[type="date"] {
        min-width: 140px;
        padding-right: 0;
    }
    
    /* Fix calculator layout */
    .calculator-section .detail-row {
        display: flex;
        flex-direction: row;
        justify-content: space-between;
        align-items: center;
        height: auto;
        min-height: 44px;
        max-height: none;
        margin-bottom: 0;
        border-bottom: 1px solid var(--color-gray-100);
        padding: 0.5rem 0.75rem;
    }
    
    .calculator-section .detail-label {
        width: 45%;
        font-weight: normal;
        margin-bottom: 0;
        font-size: 0.9rem;
        color: var(--color-text-dark);
    }
    
    .calculator-section .detail-value {
        width: 55%;
        display: flex;
        justify-content: flex-end;
        align-items: center;
        overflow: hidden;
        padding-left: 0.5rem;
        text-align: right;
    }
    
    /* Ensure inputs don't overflow */
    .calculator-section .detail-value input,
    .calculator-section .detail-value select {
        max-width: 100%;
        text-overflow: ellipsis;
    }
    
    /* Improve number input appearance */
    .calculator-input[type="number"] {
        text-align: right;
        appearance: textfield;
        -moz-appearance: textfield;
    }
    
    .calculator-input[type="number"]::-webkit-outer-spin-button,
    .calculator-input[type="number"]::-webkit-inner-spin-button {
        -webkit-appearance: none;
        margin: 0;
    }
    
    /* Make sure the calculator header is styled properly */
    .calculator-section .section-header {
        padding: 1rem;
        border-bottom: 1px solid var(--color-gray-200);
    }
    
    /* Bond title adjustments */
    .bond-title-container {
        flex-direction: column;
        align-items: flex-start;
        gap: 0.25rem;
        padding: 1rem;
        border-bottom: 1px solid var(--color-gray-200);
    }
    
    .bond-name {
        font-size: 1.25rem;
    }
    
    .bond-isin {
        margin-top: 0;
        font-size: 0.8rem;
    }
    
    /* Fix card header spacing */
    .card-header {
        padding: 1rem;
    }
    
    /* Display sections with proper margins to avoid crowding */
    .results-section + .results-section {
        margin-top: 1rem;
    }
    
    /* Fix for any layout issues in detail-value columns */
    .detail-value {
        margin-left: auto;
    }
    
    /* Ensure detail sections are well-separated */
    .bond-details-grid > div {
        margin-bottom: 1rem;
    }
    
    /* Bond detail value overrides for mobile */
    .bond-details-grid .detail-row {
        display: flex;
        flex-direction: row;
    }
    
    .bond-details-grid .detail-value {
        text-align: right;
    }
}

/* Responsive adjustments for bond details layout */
@media (max-width: 1200px) and (min-width: 769px) {
    .bond-details-layout {
        grid-template-columns: 1fr;
    }
}

/* Table Row Hover */
.bonds-table tr {
    cursor: pointer;
    transition: var(--transition-all);
}

.bonds-table tr:hover {
    background-color: var(--color-primary-50);
}

/* Bond Calculator Specific Styles */
.calculator-content {
    padding: 0;
    padding-top: 25px;
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center; /* Center the details section */
}

.details-section.calculator-section {
    margin-bottom: 1.5rem;
}

/* Bond Details Page */
.bond-details-wrapper {
    width: 100%;
}

.bond-name {
    font-size: 1.5rem;
    font-weight: 600;
    margin: 0;
    color: var(--color-text-dark);
}

.bond-isin {
    font-size: 0.875rem;
    color: var(--color-text-muted);
    margin-top: 0.25rem;
}

.bond-details-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 1.5rem;
    padding: 1.5rem;
}

.details-section {
    background-color: var(--color-white);
    border-radius: 0.5rem;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
    overflow: hidden;
    transition: box-shadow 0.3s ease;
}

.details-section:hover {
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
}

.section-header {
    padding: 1rem;
    border-bottom: 1px solid var(--color-border);
    background-color: var(--color-bg-light);
}

.section-title {
    font-size: 1rem;
    font-weight: 600;
    margin: 0;
    color: var(--color-text-dark);
}

.details-grid {
    padding: 1rem;
}

.detail-row {
    display: flex;
    justify-content: space-between;
    padding: 0.5rem 0;
    border-bottom: 1px solid var(--color-border-light);
}

.detail-row:last-child {
    border-bottom: none;
}

.detail-label {
    font-size: 0.875rem;
    color: var(--color-text-muted);
    font-weight: 500;
}

.detail-value {
    font-size: 0.875rem;
    color: var(--color-text-dark);
    font-weight: 600;
    text-align: right;
}

.back-button {
    display: inline-flex;
    align-items: center;
    padding: 0.5rem 1rem;
    background-color: var(--color-primary);
    color: white;
    border-radius: 0.375rem;
    font-weight: 500;
    text-decoration: none;
    transition: all 0.2s ease;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.back-button:hover {
    background-color: var(--color-primary-dark);
    transform: translateY(-1px);
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
}

.back-button:active {
    transform: translateY(0);
}

/* Responsive adjustments for bond details */
@media (max-width: 1200px) {
    .bond-details-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}

@media (max-width: 768px) {
    .bond-details-grid {
        grid-template-columns: 1fr;
    }
    
    .detail-row {
        flex-direction: column;
        gap: 0.25rem;
    }
    
    .detail-value {
        text-align: left;
    }
}

/* Header back button */
.header-back-button {
    background-color: white;
    color: black;
    border: 1px solid #ddd;
    font-weight: 600;
    font-size: 0.9rem;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.1);
    position: relative;
    padding: 0.6rem 1rem;
}

.header-back-button:hover {
    background-color: #f5f5f5;
    color: black;
    border-color: #ccc;
}

/* Bond Details Layout */
.bond-details-layout {
    display: grid;
    grid-template-columns: 2fr 1fr;
    gap: 1.5rem;
}

.bond-details-wrapper .results-card,
.calculator-wrapper .results-card {
    display: flex;
    flex-direction: column;
    height: auto;
}

.calculator-content {
    height: 100%;
}

.calculator-section {
    height: 100%;
}

/* Fix for calculator grid height */
.calculator-section .details-grid {
    height: auto;
    overflow-y: visible;
    padding-bottom: 0;
}

/* Ensure calculator detail rows match bond details rows */
.calculator-section .detail-row {
    height: 37px;
    min-height: 37px;
    max-height: 37px;
    box-sizing: border-box;
    display: flex;
    align-items: center;
}

.calculator-section .detail-value {
    display: flex;
    align-items: center;
}

.calculator-input {
    width: 100%;
    height: 25px;
    box-sizing: border-box;
    padding: 4px 8px;
    border: 1px solid var(--color-border);
    border-radius: 4px;
    font-size: 0.875rem;
    text-align: right;
    transition: border-color 0.2s;
}

.calculator-input:focus {
    border-color: var(--color-primary);
    outline: none;
    box-shadow: 0 0 0 2px rgba(14, 165, 233, 0.2);
}

/* Responsive adjustments for bond details layout */
@media (max-width: 1200px) {
    .bond-details-layout {
        grid-template-columns: 1fr;
    }
}

.bond-details-wrapper .results-card,
.calculator-wrapper .results-card {
    display: flex;
    flex-direction: column;
}

.calculator-section {
    flex: 1;
    display: flex;
    flex-direction: column;
}

.calculator-section .details-grid {
    flex: 1;
}

/* Bond Title Container */
.bond-title-container {
    display: flex;
    align-items: baseline;
    gap: 12px;
}

.bond-title-container .bond-name {
    margin: 0;
}

.bond-title-container .bond-isin {
    font-size: 0.875rem;
    color: var(--color-text-muted);
    font-weight: normal;
}

/* Bond Details Layout */
.bond-details-layout {
    display: grid;
    grid-template-columns: 2fr 1fr;
    gap: 1.5rem;
}

/* Card Styles */
.bond-details-wrapper .results-card,
.calculator-wrapper .results-card {
    display: flex;
    flex-direction: column;
}

/* Calculator Styles */
.calculator-section {
    flex: 1;
    display: flex;
    flex-direction: column;
    width: 90%; /* Make the calculator section slightly smaller */
    margin: 0 auto; /* Center the section */
    padding-top: 16px; /* Add some padding at the top since we removed the header */
}

.calculator-section .details-grid {
    flex: 1;
}

/* Add a bit more spacing to the first row since we removed the header */
.calculator-section .details-grid .detail-row:first-child {
    border-top: none;
}

/* Ensure calculator detail rows match bond details rows */
.calculator-section .detail-row {
    height: 37px;
    min-height: 37px;
    max-height: 37px;
    box-sizing: border-box;
    display: flex;
    align-items: center;
}

.calculator-section .detail-value {
    display: flex;
    align-items: center;
}

.calculator-input {
    width: 100%;
    height: 25px;
    box-sizing: border-box;
    padding: 4px 8px;
    border: 1px solid var(--color-border);
    border-radius: 4px;
    font-size: 0.875rem;
    text-align: right;
    transition: border-color 0.2s;
}

.calculator-input:focus {
    border-color: var(--color-primary);
    outline: none;
    box-shadow: 0 0 0 2px rgba(14, 165, 233, 0.2);
}

/* Responsive adjustments for bond details layout */
@media (max-width: 1200px) {
    .bond-details-layout {
        grid-template-columns: 1fr;
    }
}

.filter-card .filter-group {
    margin: 0;
    padding: 0.75rem 1.5rem;
}

/* Mobile Optimizations for Bond Details */
@media (max-width: 768px) {
    .main-content {
        padding: 0.5rem;
    }
    
    .content-layout {
        padding: 0.5rem;
    }
    
    /* Hide chart on mobile */
    .chart-section {
        display: none;
    }
    
    .table-header {
        flex-direction: column;
        gap: 1rem;
        align-items: stretch;
    }
    
    .bonds-table {
        padding: 0 0.5rem;
    }
    
    /* Only show specified columns on mobile */
    .bonds-table table {
        table-layout: fixed;
        width: 100%;
    }

    /* Hide all columns by default */
    .bonds-table th, 
    .bonds-table td {
        display: none;
    }

    /* Show only the specified columns */
    .bonds-table th:nth-child(1), .bonds-table td:nth-child(1),  /* Issue Name */
    .bonds-table th:nth-child(3), .bonds-table td:nth-child(3),  /* ISIN */
    .bonds-table th:nth-child(4), .bonds-table td:nth-child(4),  /* Coupon */
    .bonds-table th:nth-child(6), .bonds-table td:nth-child(6),  /* Maturity */
    .bonds-table th:nth-child(9), .bonds-table td:nth-child(9),  /* Price */
    .bonds-table th:nth-child(10), .bonds-table td:nth-child(10), /* Current Yield */
    .bonds-table th:nth-child(12), .bonds-table td:nth-child(12)  /* Yield to Maturity */ {
        display: table-cell;
    }

    /* Adjust cell sizing for mobile */
    .bonds-table th, 
    .bonds-table td {
        padding: 0.5rem 0.25rem;
        font-size: 0.75rem;
        min-width: auto;
        max-width: none;
    }

    /* Truncate long text on mobile */
    .bonds-table td {
        white-space: nowrap;
        overflow: hidden;
        text-overflow: ellipsis;
    }
    
    /* Bond details page optimizations */
    .bond-details-layout {
        display: block;
    }
    
    /* Adjust card padding for mobile */
    .bond-details-wrapper .results-card,
    .calculator-wrapper .results-card {
        padding: 0;
        margin-bottom: 1rem;
    }
    
    /* Stack bond details sections vertically */
    .bond-details-grid {
        display: flex;
        flex-direction: column;
        gap: 1rem;
        padding: 0.75rem;
    }
    
    /* Make each details section more compact with clear spacing */
    .details-section {
        margin-bottom: 1rem !important;
        border-radius: 8px;
        overflow: hidden;
        box-shadow: 0 1px 2px rgba(0, 0, 0, 0.05);
        border: 1px solid var(--color-gray-200);
        background-color: white;
    }
    
    /* Adjust spacing in detail rows */
    .detail-row {
        padding: 0.5rem 0.75rem;
        border-bottom: 1px solid var(--color-gray-100);
        min-height: 38px;
        align-items: center;
    }
    
    .detail-row:last-child {
        border-bottom: none;
    }
    
    /* Make the bond section headers match the reference design */
    .section-header {
        padding: 0.75rem 1rem;
        background-color: white;
        border-bottom: 1px solid var(--color-gray-200);
    }
    
    .section-title {
        font-size: 1rem;
        margin: 0;
        font-weight: 600;
    }
    
    .details-grid {
        padding: 0;
    }
    
    /* Optimize calculator for mobile */
    .calculator-wrapper {
        margin-top: 0;
    }
    
    .calculator-content {
        padding: 0;
    }
    
    .calculator-section {
        width: 100%;
        padding: 0;
        margin: 0;
    }
    
    .calculator-section .details-grid {
        padding: 0;
    }
    
    /* Make calculator inputs more finger-friendly */
    .calculator-input {
        height: 38px;
        font-size: 1rem;
        padding: 0.5rem;
        background-color: white;
    }
    
    /* Fix date input display */
    .calculator-input[type="date"] {
        min-width: 140px;
        padding-right: 0;
    }
    
    /* Fix calculator layout */
    .calculator-section .detail-row {
        display: flex;
        flex-direction: row;
        justify-content: space-between;
        align-items: center;
        height: auto;
        min-height: 44px;
        max-height: none;
        margin-bottom: 0;
        border-bottom: 1px solid var(--color-gray-100);
        padding: 0.5rem 0.75rem;
    }
    
    .calculator-section .detail-label {
        width: 45%;
        font-weight: normal;
        margin-bottom: 0;
        font-size: 0.9rem;
        color: var(--color-text-dark);
    }
    
    .calculator-section .detail-value {
        width: 55%;
        display: flex;
        justify-content: flex-end;
        align-items: center;
        overflow: hidden;
        padding-left: 0.5rem;
        text-align: right;
    }
    
    /* Ensure inputs don't overflow */
    .calculator-section .detail-value input,
    .calculator-section .detail-value select {
        max-width: 100%;
        text-overflow: ellipsis;
    }
    
    /* Improve number input appearance */
    .calculator-input[type="number"] {
        text-align: right;
        appearance: textfield;
        -moz-appearance: textfield;
    }
    
    .calculator-input[type="number"]::-webkit-outer-spin-button,
    .calculator-input[type="number"]::-webkit-inner-spin-button {
        -webkit-appearance: none;
        margin: 0;
    }
    
    /* Make sure the calculator header is styled properly */
    .calculator-section .section-header {
        padding: 1rem;
        border-bottom: 1px solid var(--color-gray-200);
    }
    
    /* Bond title adjustments */
    .bond-title-container {
        flex-direction: column;
        align-items: flex-start;
        gap: 0.25rem;
        padding: 1rem;
        border-bottom: 1px solid var(--color-gray-200);
    }
    
    .bond-name {
        font-size: 1.25rem;
    }
    
    .bond-isin {
        margin-top: 0;
        font-size: 0.8rem;
    }
    
    /* Fix card header spacing */
    .card-header {
        padding: 1rem;
    }
    
    /* Display sections with proper margins to avoid crowding */
    .results-section + .results-section {
        margin-top: 1rem;
    }
    
    /* Fix for any layout issues in detail-value columns */
    .detail-value {
        margin-left: auto;
    }
    
    /* Ensure detail sections are well-separated */
    .bond-details-grid > div {
        margin-bottom: 1rem;
    }
    
    /* Bond detail value overrides for mobile */
    .bond-details-grid .detail-row {
        display: flex;
        flex-direction: row;
    }
    
    .bond-details-grid .detail-value {
        text-align: right;
    }
}

/* Responsive adjustments for bond details layout */
@media (max-width: 1200px) and (min-width: 769px) {
    .bond-details-layout {
        grid-template-columns: 1fr;
    }
}

/* Add styles for Login/Logout buttons */
.nav-login-btn,
.nav-logout-btn {
    display: inline-block;
    padding: 6px 12px;
    margin-left: 10px;
    border: 1px solid #ccc;
    border-radius: 4px;
    text-decoration: none;
    font-size: 0.9em;
    cursor: pointer;
    background-color: #f0f0f0;
    color: #333;
}

.nav-login-btn:hover,
.nav-logout-btn:hover {
    background-color: #e0e0e0;
    border-color: #bbb;
}

.nav-logout-btn {
    background-color: #f8d7da; /* Light red for logout */
    border-color: #f5c6cb;
    color: #721c24;
}

.nav-logout-btn:hover {
    background-color: #f5c6cb;
    border-color: #f1b0b7;
}

/* Style for Delete button (similar to logout) */
.delete-btn {
    background-color: #f8d7da; /* Light red */
    border-color: #f5c6cb;
    color: #721c24;
}

.delete-btn:hover {
    background-color: #f5c6cb;
    border-color: #f1b0b7;
    color: #721c24;
}

/* Base styles for table container */
/* ... */

/* --- Custom Modal Styles --- */
.modal {
    display: none; /* Hidden by default */
    position: fixed; /* Stay in place */
    z-index: 1000; /* Sit on top */
    left: 0;
    top: 0;
    width: 100%; /* Full width */
    height: 100%; /* Full height */
    overflow: auto; /* Enable scroll if needed */
    background-color: rgba(0,0,0,0.6); /* Black w/ opacity - overlay */
}

.modal-content {
    background-color: #fefefe; /* White background */
    margin: 15% auto; /* 15% from the top and centered */
    padding: 25px;
    border: 1px solid #888;
    width: 80%; /* Could be more or less, depending on screen size */
    max-width: 500px; /* Maximum width */
    border-radius: 8px;
    box-shadow: 0 4px 8px 0 rgba(0,0,0,0.2), 0 6px 20px 0 rgba(0,0,0,0.19);
    position: relative;
}

.close-modal {
    color: #aaa;
    position: absolute; /* Position relative to modal-content */
    top: 10px;
    right: 20px;
    font-size: 28px;
    font-weight: bold;
    cursor: pointer;
}

.close-modal:hover,
.close-modal:focus {
    color: black;
    text-decoration: none;
    cursor: pointer;
}

.modal-content p {
    margin-bottom: 15px;
    line-height: 1.5;
}

.modal-actions {
    text-align: right; /* Align buttons to the right */
    margin-top: 20px;
}

/* Style buttons within the modal */
.modal-actions .chart-btn {
    margin-left: 10px;
}

/* Ensure the delete button in modal keeps its specific style */
.modal-actions .delete-btn {
    background-color: #f8d7da; 
    border-color: #f5c6cb;
    color: #721c24;
}

.modal-actions .delete-btn:hover {
    background-color: #f5c6cb;
    border-color: #f1b0b7;
    color: #721c24; 
}

/* --- End Custom Modal Styles --- */

/* Hide mobile reset button by default */
.mobile-reset-button {
    display: none;
}

.results-count span {
    font-size: 0.9em;
    color: #555;
}

/* Show mobile reset button only on smaller screens */
@media (max-width: 768px) {
    .chart-controls .button-group:not(.mobile-only) { /* Example: Hide desktop buttons if needed */
        display: none;
    }
    .mobile-reset-button {
        display: block; /* Show the button */
        margin-bottom: 10px; /* Add some spacing */
    }

    /* Adjust table header for mobile */
    .table-header {
        flex-direction: column; /* Stack items vertically */
        align-items: flex-start; /* Align items to the start */
    }

    .results-count {
        margin-bottom: 10px; /* Add space below count */
    }

    .add-bond-button {
        margin-left: 0 !important; /* Remove left margin */
        margin-top: 10px; /* Add space above add button */
        width: 100%; /* Make button full width */
    }

    .add-bond-button .chart-btn {
         width: 100%; /* Make button link full width */
         text-align: center;
    }
}
