:root {
    --primary-color: #062868;
    --success-color: #4CAF50;
    --warning-color: #FF9800;
    --error-color: #f44336;
    --border-radius: 4px;
    --exact-match-bg: #e8f5e9;        /* Exact match: 300 points - Light green */
    --close-match-bg: #fff3e0;        /* Close match: 200-299 points - Light orange */
    --partial-match-bg: #e3f2fd;      /* Partial match: 100-199 points - Light blue */
    --poor-match-bg: #ffebee;         /* Poor match: <100 points - Light red */
    --exact-match-border: #81c784;
    --close-match-border: #ffb74d;
    --partial-match-border: #64b5f6;
    --poor-match-border: #e57373;
}

/* Accessibility improvements */
.sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

/* Focus indicators for keyboard navigation */
input:focus,
button:focus,
textarea:focus,
.autocomplete-item:focus {
    outline: 2px solid #062868;
    outline-offset: 2px;
}

/* High contrast mode support */
@media (prefers-contrast: high) {
    .din-card {
        border: 2px solid #000;
    }
    
    .match-category-header {
        border: 2px solid #000;
    }
    
    input, textarea, button {
        border: 2px solid #000;
    }
}

/* Reduced motion support */
@media (prefers-reduced-motion: reduce) {
    * {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
}

/* Improved color contrast */
.din-card .details {
    color: #212529;
}

.match-category-header {
    color: #212529;
}

/* Higher contrast for text elements */
.toggle-label {
    color: #212529;
}

.ndc-section-header .ndc-title {
    color: #212529;
}

.autocomplete-item .ndc {
    color: #495057;
}

.autocomplete-item .ingredient-strength {
    color: #212529;
}

/* Ensure sufficient contrast for buttons */
button {
    color: #212529;
}

.btn-default {
    background-color: #f8f9fa;
    border-color: #dee2e6;
    color: #212529;
}

.btn-default:hover {
    background-color: #e2e6ea;
    border-color: #dae0e5;
    color: #212529;
}

/* Skip link for keyboard users */
.skip-link {
    position: absolute;
    top: -40px;
    left: 6px;
    background: #062868;
    color: white;
    padding: 8px;
    text-decoration: none;
    z-index: 100;
}

.skip-link:focus {
    top: 6px;
}

body {
    font-family: 'Lato', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, 'Open Sans', 'Helvetica Neue', sans-serif;
    line-height: 1.6;
    margin: 0;
    padding: 20px;
    background-color: #f5f5f5;
}

.container {
    max-width: 100%;
    margin: 0 auto;
    padding: 20px;
    background-color: white;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
    transition: margin 0.3s ease-out;
}

/* Specific styling for simple view */
.simple-view .container {
    max-width: 100%;
    margin: 0 auto;
    padding: 20px;
    background-color: white;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
    transition: margin 0.3s ease-out;
}

/* Keep the original container style for advanced view */
.advanced-view .container {
    max-width: 1400px;
    margin: 0 auto;
    padding: 20px;
    background-color: white;
    border-radius: 8px;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
    margin-left: 320px;
    margin-right: 320px;
    transition: margin 0.3s ease-out;
}

@media (max-width: 1600px) {
    .advanced-view .container {
        margin-left: 20px;
        margin-right: 20px;
    }
}

@media (max-width: 768px) {
    .container,
    .simple-view .container,
    .advanced-view .container {
        margin: 0;
        padding: 10px;
    }
}

.view-controls{
    display: flex;
}
.results-layout {
    display: flex;
    gap: 20px;
    position: relative;
    margin-top: 20px;
}

.ndc-info-column {
    width: 320px;
    position: relative;
}

.ndc-info-panel {
    position: sticky;
    top: 105px;
    background: white;
    border-radius: 12px;
    box-shadow: 0 4px 20px rgba(0,0,0,0.1);
    padding: 25px;
    height: fit-content;
    max-height: calc(100vh - 40px);
    overflow-y: auto;
    transition: all 0.3s ease;
    border: 1px solid #e0e0e0;
    z-index: 1;
}

.ndc-info-panel:hover {
    transform: translateY(-5px);
    box-shadow: 0 6px 25px rgba(0,0,0,0.15);
}

.ndc-info-panel .ndc-number {
    font-size: 1.2em;
    color: #062868;
    padding: 8px 15px;
    background: #e3f2fd;
    border-radius: 8px;
    margin-bottom: 20px;
    display: inline-block;
}

.ndc-info-panel .drug-name {
    font-size: 1.8em;
    font-weight: 700;
    color: #062868;
    margin-bottom: 10px;
    line-height: 1.2;
    border-bottom: 2px solid #e3f2fd;
    padding-bottom: 10px;
}

.ndc-info-panel .generic-name {
    font-size: 1.2em;
    color: #666;
    margin-bottom: 20px;
    line-height: 1.3;
    font-style: italic;
}

.ndc-info-panel .ingredients {
    margin: 20px 0;
    padding: 20px;
    background: #f8f9fa;
    border-radius: 10px;
    border: 1px solid #e0e0e0;
}

.ndc-info-panel .ingredient-item {
    margin-bottom: 15px;
    padding-bottom: 15px;
    border-bottom: 1px solid #e0e0e0;
}

.ndc-info-panel .ingredient-item:last-child {
    margin-bottom: 0;
    padding-bottom: 0;
    border-bottom: none;
}

.ndc-info-panel .ingredient-name {
    font-weight: 600;
    color: #c00e34;
    margin-bottom: 5px;
}

.ndc-info-panel .ingredient-strength {
    font-size: 1.1em;
    color: #333;
}

.ndc-info-panel .drug-type {
    display: inline-block;
    padding: 8px 16px;
    border-radius: 20px;
    font-size: 0.9em;
    font-weight: 600;
    margin-top: 15px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
    transition: all 0.3s ease;
}

.ndc-info-panel .drug-type.badge-generic {
    background: linear-gradient(135deg, #e3f2fd 0%, #bbdefb 100%);
    color: #1565c0;
    border: 1px solid #90caf9;
}

.ndc-info-panel .drug-type.badge-brand {
    background: linear-gradient(135deg, #f3e5f5 0%, #e1bee7 100%);
    color: #6a1b9a;
    border: 1px solid #ce93d8;
}

.ndc-info-panel .drug-type:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 8px rgba(0,0,0,0.15);
}

.ndc-info-panel .additional-info {
    margin-top: 20px;
    padding: 15px;
    background: #fff;
    border-radius: 8px;
    border: 1px solid #e0e0e0;
}

.ndc-info-panel .info-item {
    margin-bottom: 10px;
    display: flex;
        /* align-items: center; */
    gap: 10px;
    flex-direction: row;
}

.ndc-info-panel .info-item i {
    color: #062868;
    width: 20px;
}

.din-results-section {
    flex: 1;
    padding: 20px;
    background: #f8f9fa;
    border-radius: 12px;
    margin-bottom: 40px;
}

.match-category {
    margin-bottom: 30px;
    border-radius: 8px;
    overflow: hidden;
    box-shadow: 0 2px 4px rgba(0,0,0,0.05);
    border: 1px solid #e0e0e0;
}

.match-category-header {
    font-size: 1.3em;
    color: #333;
    padding: 15px 20px;
    background: white;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: space-between;
    transition: all 0.3s ease;
    border-left: 4px solid #062868;
}

.match-category-header:hover {
    background: #f8f9fa;
}

.match-category-header .header-content {
    display: flex;
    align-items: center;
    gap: 10px;
}

.match-category-header .count-badge {
    background: rgba(0,0,0,0.1);
    padding: 4px 8px;
    border-radius: 12px;
    font-size: 0.8em;
    margin-left: 10px;
}

.match-category-header .toggle-icon {
    font-size: 1.2em;
    transition: transform 0.3s ease;
}

.match-category-header.collapsed .toggle-icon {
    transform: rotate(-90deg);
}

.match-category-content {
    background: white;
    overflow: hidden;
    transition: max-height 0.3s ease;
    max-height: 0;
}

.match-category-content.expanded {
    max-height: none;
}

.match-category.exact-match .match-category-header {
    border-left-color: var(--exact-match-border);
    background: linear-gradient(to right, var(--exact-match-bg), white);
}

.match-category.similar-match .match-category-header {
    border-left-color: var(--close-match-border);
    background: linear-gradient(to right, var(--close-match-bg), white);
}

.match-category.multiple-ingredients .match-category-header {
    border-left-color: #9575cd;
    background: linear-gradient(to right, #ede7f6, white);
}

.match-category.other-dins .match-category-header {
    border-left-color: #90a4ae;
    background: linear-gradient(to right, #eceff1, white);
}

.drug-type-section {
    margin: 20px;
    padding: 15px;
    border-radius: 8px;
    background: #f8f9fa;
}

.drug-type-header {
    font-size: 1.1em;
    color: #666;
    margin-bottom: 15px;
    padding: 10px 15px;
    border-radius: 6px;
    background: white;
    border: 1px solid #e0e0e0;
}

.drug-type-header.matching {
    background: linear-gradient(to right, var(--exact-match-bg), white);
    border-color: var(--exact-match-border);
    color: #2e7d32;
    font-weight: 500;
}

.dosage-group {
    /* margin: 15px; */
    padding: 15px;
    background: white;
    border-radius: 6px;
    border: 1px solid #e0e0e0;
}

.dosage-header {
    font-size: 1em;
    color: #666;
    margin-bottom: 15px;
    padding-bottom: 8px;
    border-bottom: 1px solid #e0e0e0;
    font-style: italic;
    font-size: 1em;
    color: #666;
    margin-bottom: 15px;
    padding: 8px 15px;
    background: #f8f9fa;
    border-radius: 6px;
    border: 1px solid #e0e0e0;
}

.din-results-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 20px;
    padding: 10px;
    margin-bottom: 20px;
    width: 95%;
}

/* Responsive grid adjustments */
@media (min-width: 1600px) {
    .din-results-grid {
        grid-template-columns: repeat(4, 1fr);
    }
}

@media (min-width: 1200px) and (max-width: 1599px) {
    .din-results-grid {
        grid-template-columns: repeat(3, 1fr);
    }
}

@media (min-width: 768px) and (max-width: 1199px) {
    .din-results-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}

@media (max-width: 767px) {
    .din-results-grid {
        grid-template-columns: 1fr;
    }
}

/* Grid size button styles */
.grid-size-selector {
    display: flex;
    gap: 5px;
}

.grid-btn {
    padding: 8px 12px;
    border: 1px solid #ddd;
    border-radius: 4px;
    background: #062868;
    cursor: pointer;
    transition: all 0.2s ease;
}

.grid-btn:hover {
    background: #e3f2fd;
}

.grid-btn.active {
    background: #e3f2fd;
    border-color: #c00e34;
    color: #062868;
}

.grid-btn i {
    margin-right: 4px;
}

.din-card {
    background: white;
    border-radius: 12px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
    padding: 20px;
    transition: all 0.3s ease-in-out;
    transform-origin: top center;
    display: flex;
    flex-direction: column;
    border: 1px solid #e0e0e0;
    min-width: 0; /* Prevent overflow in grid */
}

.din-card.exact-match {
    background-color: var(--exact-match-bg);
    border: 2px solid var(--exact-match-border);
     background: white;
}

.din-card.close-match {
    background-color: var(--close-match-bg);
    border: 2px solid var(--close-match-border);
    background: white;
}

.din-card.poor-match {
    background-color: var(--poor-match-bg);
    border: 2px solid var(--poor-match-border);
    background: white;
}

.din-card .din-number {
    font-size: 1.2em;
    font-weight: 600;
    color: #062868;
    margin-bottom: 12px;
    padding: 8px;
    background: #e3f2fd;
    border-radius: 6px;
    text-align: center;
    transition: all 0.3s ease-in-out;
}

.din-card .brand-name {
    font-size: 1.1em;
    font-weight: 500;
    margin-bottom: 10px;
    color: #333;
    padding-bottom: 8px;
    border-bottom: 1px solid #eee;
    transition: all 0.3s ease-in-out;
}

.din-card .details {
    font-size: 0.95em;
    color: #666;
    flex-grow: 1;
    display: flex;
    flex-direction: column;
    gap: 8px;
    transition: all 0.3s ease-in-out;
}

.din-card .match-scores {
    margin-top: 15px;
    font-size: 0.9em;
    padding: 12px;
    background: #f8f9fa;
    border-radius: 8px;
    border: 1px solid #e0e0e0;
}

.ndc-section {
    margin-bottom: 40px;
    border-bottom: 2px solid #e0e0e0;
    padding-bottom: 40px;
    position: relative;
}

.ndc-section:last-child {
    border-bottom: none;
}

.ndc-section-header {
    background: linear-gradient(to right, #062868, #c00e34);
    color: white;
    padding: 15px 25px;
    border-radius: 12px;
    margin-bottom: 25px;
    box-shadow: 0 4px 12px rgba(0,0,0,0.1);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.ndc-section-header .ndc-title {
    font-size: 1.4em;
    font-weight: 500;
}

.ndc-section-header .ndc-number {
    background: rgba(255,255,255,0.2);
    padding: 8px 15px;
    border-radius: 20px;
    font-size: 1.1em;
    font-family: monospace;
}

.ndc-section-header .ndc-info {
    display: flex;
    align-items: center;
    gap: 15px;
}

.ndc-section-header .result-count {
    background: rgba(255,255,255,0.15);
    padding: 4px 12px;
    border-radius: 15px;
    font-size: 0.9em;
}

.search-container {
    display: flex;
    gap: 10px;
    margin-bottom: 20px;
    position: relative;
}

.autocomplete-container {
    position: relative;
    flex: 1;
}

.autocomplete-results {
    position: absolute;
    top: calc(100% + 5px);
    left: 0;
    right: 0;
    background: white;
    border: 1px solid #ddd;
    border-radius: 4px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
    max-height: 300px;
    overflow-y: auto;
    z-index: 1000;
    display: none;
}

.autocomplete-item {
    padding: 12px 15px;
    cursor: pointer;
    border-bottom: 1px solid #f0f0f0;
    transition: all 0.3s ease;
    display: grid;
    grid-template-columns: 2fr 2fr 1fr;
    gap: 15px;
    align-items: center;
    position: relative;
    overflow: hidden;
}

.autocomplete-item:before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 4px;
    height: 100%;
    transition: background-color 0.3s ease;
}

.autocomplete-item.match-exact {
    background-color: var(--exact-match-bg);
    border-color: var(--exact-match-border);
}

.autocomplete-item.match-exact:before {
    background-color: var(--exact-match-border);
}

.autocomplete-item.match-close {
    background-color: var(--close-match-bg);
    border-color: var(--close-match-border);
}

.autocomplete-item.match-close:before {
    background-color: var(--close-match-border);
}

.autocomplete-item:hover {
    transform: translateX(5px);
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
}

.autocomplete-item .primary-info {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.autocomplete-item .brand-name-container {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
}

.autocomplete-item .brand-name {
    font-size: 1em;
    font-weight: 500;
    color: #333;
}

.autocomplete-item .pharmacist-choice {
    background-color: #28a745;
    color: white;
    padding: 2px 8px;
    border-radius: 12px;
    font-size: 0.75em;
    font-weight: 500;
    white-space: nowrap;
}

.autocomplete-item .ndc {
    color: #2196F3;
    font-weight: 500;
    font-size: 0.85em;
}

.autocomplete-item .ingredients-info {
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 0.9em;
}

.autocomplete-item .ingredients-title {
    color: #666;
    font-weight: 500;
    white-space: nowrap;
}

.autocomplete-item .ingredients-list {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
}

.autocomplete-item .ingredient-item {
    display: flex;
    align-items: center;
    gap: 8px;
    background: #f8f9fa;
    padding: 2px 8px;
    border-radius: 4px;
    border: 1px solid #e0e0e0;
}

.autocomplete-item .ingredient-name {
    color: #333;
    font-size: 0.85em;
}

.autocomplete-item .ingredient-strength {
    color: #4CAF50;
    font-weight: 500;
    font-size: 0.85em;
}

.autocomplete-item .additional-info {
    display: flex;
    flex-direction: column;
    gap: 4px;
    font-size: 0.85em;
    color: #666;
}

.autocomplete-item .dosage-form,
.autocomplete-item .route {
    color: #FF9800;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

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

.autocomplete-item.match-exact {
    background-color: var(--exact-match-bg) !important;
}

.autocomplete-item.match-close {
    background-color: var(--close-match-bg) !important;
}

.autocomplete-item:hover {
    opacity: 0.9;
}

.autocomplete-item.selected {
    opacity: 0.8;
}

.primary-info {
    margin-bottom: 6px;
}

.secondary-info {
    font-size: 0.9em;
    color: #666;
}

.brand-name {
    font-weight: 500;
    color: #333;
}

.strength, .dosage-form, .ndc {
    color: #666;
}

input[type="text"] {
    width: 100%;
    padding: 12px;
    border: 1px solid #ddd;
    border-radius: var(--border-radius);
    font-size: 16px;
}

button {
    padding: 12px 24px;
    background-color: var(--primary-color);
    color: white;
    border: none;
    border-radius: var(--border-radius);
    cursor: pointer;
    font-size: 16px;
    transition: background-color 0.2s;
}

button:hover {
    background-color: #062868;
}

.results-container {
    margin-top: 20px;
}

.card {
    background-color: white;
    border-radius: 8px;
    padding: 20px;
    margin-bottom: 20px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
    transition: transform 0.2s ease, box-shadow 0.2s ease;
    border: 1px solid #eee;
}

.card:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0,0,0,0.15);
}

.card h3 {
    margin-top: 0;
    color: #c00e34;
    font-size: 1.4em;
    border-bottom: 2px solid #e3f2fd;
    padding-bottom: 10px;
}

.card-body {
    padding: 15px;
}

.card-title {
    color: #062868;
    font-size: 1.2em;
    margin-bottom: 10px;
}

.card-subtitle {
    color: #666;
    font-size: 0.95em;
    margin-bottom: 15px;
}

.card-text {
    color: #333;
    line-height: 1.6;
}

.badge {
    display: inline-block;
    padding: 4px 12px;
    font-size: 0.85em;
    font-weight: 500;
    border-radius: 20px;
    margin-left: 8px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.badge-success {
    background-color: #e8f5e9;
    color: #2e7d32;
    border: 1px solid #a5d6a7;
}

.badge-primary {
    background-color: #e3f2fd;
    color: #062868;
    border: 1px solid #90caf9;
}

.match-scores {
    background-color: #f8f9fa;
    padding: 12px;
    border-radius: 6px;
    margin-top: 15px;
}

.match-scores div {
    margin-bottom: 6px;
    padding: 4px 8px;
    border-radius: 4px;
}

.match-scores div:last-child {
    margin-bottom: 0;
}

.text-success {
    background-color: #e8f5e9;
    color: #2e7d32;
}

.text-warning {
    background-color: #fff3e0;
    color: #f57c00;
}

.text-danger {
    background-color: #ffebee;
    color: #c62828;
}

.results-table {
    border-radius: 8px;
    overflow: hidden;
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
    margin-bottom: 30px;
}

.results-table th {
    background-color: #f5f5f5;
    color: #333;
    font-weight: 600;
    padding: 15px;
    text-transform: uppercase;
    font-size: 0.9em;
    letter-spacing: 0.5px;
}

.results-table td {
    padding: 15px;
    vertical-align: top;
}

.scoring-explanation {
    background-color: #fff;
    border-radius: 8px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
    padding: 25px;
    margin-top: 40px;
}

.explanation-grid {
    gap: 25px;
}

.explanation-item {
    background-color: #f8f9fa;
    border-radius: 8px;
    padding: 20px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.05);
    border: 1px solid #eee;
}

.explanation-item h4 {
    color: #062868;
    margin-bottom: 15px;
    padding-bottom: 8px;
    border-bottom: 2px solid #e3f2fd;
}

.color-box {
    width: 20px;
    height: 20px;
    border-radius: 4px;
    margin-right: 10px;
}

.loading {
    display: none;
    text-align: center;
    padding: 20px;
}

.loading .spinner {
    border: 4px solid #f3f3f3;
    border-top: 4px solid var(--primary-color);
    border-radius: 50%;
    width: 40px;
    height: 40px;
    animation: spin 1s linear infinite;
    margin: 0 auto;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

.error-message {
    color: var(--error-color);
    padding: 10px;
    border-radius: var(--border-radius);
    background-color: #ffebee;
    margin: 10px 0;
}

.match-score {
    display: inline-block;
    padding: 4px 8px;
    border-radius: 12px;
    font-size: 0.9em;
    margin-left: 10px;
}

.strength-match { color: var(--success-color); }
.strength-close { color: var(--warning-color); }
.strength-different { color: var(--error-color); }

/* Add new styles for textarea and table */
.input-toggle {
    margin-bottom: 15px;
}

.input-toggle button {
    margin-right: 10px;
    opacity: 0.7;
}

.input-toggle button.active {
    opacity: 1;
}

textarea {
    width: 100%;
    height: 150px;
    padding: 12px;
    border: 1px solid #ddd;
    border-radius: var(--border-radius);
    font-size: 16px;
    font-family: monospace;
    margin-bottom: 10px;
    resize: vertical;
}

.results-table {
    width: 100%;
    border-collapse: collapse;
    margin-top: 20px;
    background: white;
    box-shadow: 0 1px 3px rgba(0,0,0,0.1);
    border-radius: var(--border-radius);
    overflow: hidden;
}

.results-table th,
.results-table td {
    padding: 12px;
    text-align: left;
    border-bottom: 1px solid #eee;
}

.results-table th {
    background-color: #f8f9fa;
    font-weight: 600;
    color: #495057;
}

.results-table tr:hover {
    background-color: #f8f9fa;
}

.results-table td.matches {
    padding: 0;
}

.match-item {
    padding: 8px 12px;
    border-bottom: 1px solid #eee;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.match-item:last-child {
    border-bottom: none;
}

.match-details {
    flex: 1;
}

.match-score-badge {
    padding: 4px 8px;
    border-radius: 12px;
    font-size: 0.85em;
    margin-left: 10px;
    white-space: nowrap;
}

.processing-status {
    font-size: 0.9em;
    margin-top: 10px;
    color: #666;
}

.status-count {
    display: inline-block;
    padding: 2px 8px;
    border-radius: 12px;
    background: #e3f2fd;
    margin: 0 5px;
}

.badge {
    display: inline-block;
    padding: 2px 6px;
    font-size: 0.8em;
    font-weight: 500;
    border-radius: 4px;
    margin-left: 8px;
}

.badge-generic {
    background-color: #e3f2fd;
    color: #062868;
    border: 1px solid #bbdefb;
}
.badge-brand {
    background-color: var(--exact-match-bg);
    color: rgb(0, 0, 0);
    border: 1px solid var(--exact-match-bg);
}

.share-button {
    background-color: var(--primary-color);
    color: white;
    padding: 8px 16px;
    border: none;
    border-radius: var(--border-radius);
    cursor: pointer;
    font-size: 14px;
    display: none;
    margin-left: 10px;
    align-items: center;
    gap: 8px;
}

.share-button:hover {
    background-color: #062868;
}

.share-button i {
    font-size: 16px;
}

.toast {
    position: fixed;
    top: 80px; /* Position below fixed header */
    right: 20px;
    padding: 16px 24px;
    border-radius: 8px;
    color: white;
    z-index: 10000; /* Higher than header */
    display: none;
    max-width: 400px;
    min-width: 250px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.25);
    font-weight: 500;
    font-size: 14px;
    line-height: 1.4;
    border-left: 4px solid rgba(255, 255, 255, 0.3);
    backdrop-filter: blur(10px);
    opacity: 0;
    transform: translateX(100%);
    transition: all 0.4s cubic-bezier(0.25, 0.46, 0.45, 0.94);
    background-color: #062868 !important;
}

.toast.show {
    display: block;
    opacity: 1;
    transform: translateX(0);
}

.toast.fade-out {
    opacity: 0;
    transform: translateX(100%);
    transition: all 0.3s ease-in-out;
}

.toast-success {
    background: linear-gradient(135deg, #28a745 0%, #20c997 100%);
    border-left-color: #155724;
}

.toast-error {
    background: linear-gradient(135deg, #dc3545 0%, #e74c3c 100%);
    border-left-color: #721c24;
}

.toast-info {
    background: linear-gradient(135deg, #17a2b8 0%, #3498db 100%);
    border-left-color: #0c5460;
}

.toast-warning {
    background: linear-gradient(135deg, #ffc107 0%, #f39c12 100%);
    border-left-color: #856404;
    color: #212529;
}

/* Adjust toast position for simple view */
.simple-view .toast {
    top: 20px;
}

/* Adjust toast position when header is fixed */
body.fixed-header .toast {
    top: 90px;
}

/* Mobile responsive */
@media (max-width: 768px) {
    .toast {
        top: 70px;
        right: 10px;
        left: 10px;
        max-width: none;
        transform: translateY(-100%);
        border-radius: 6px;
        padding: 14px 18px;
        font-size: 13px;
    }
    
    .toast.show {
        transform: translateY(0);
    }
    
    .toast.fade-out {
        transform: translateY(-100%);
    }
    
    .simple-view .toast {
        top: 10px;
    }
    
    body.fixed-header .toast {
        top: 80px;
    }
}

/* Add subtle animation for toast content */
.toast.show {
    animation: toastSlideIn 0.4s cubic-bezier(0.25, 0.46, 0.45, 0.94);
}

@keyframes toastSlideIn {
    0% {
        opacity: 0;
        transform: translateX(100%) scale(0.9);
    }
    100% {
        opacity: 1;
        transform: translateX(0) scale(1);
    }
}

.match-indicator {
    display: inline-flex;
    align-items: center;
    padding: 4px 8px;
    border-radius: 4px;
    font-size: 0.85em;
    margin-top: 4px;
    font-weight: 500;
}

.match-indicator.exact {
    background-color: var(--exact-match-bg);
    color: #2e7d32;
    border: 1px solid var(--exact-match-border);
}

.match-indicator.close {
    background-color: var(--close-match-bg);
    color: #f57c00;
    border: 1px solid var(--close-match-border);
}

.match-indicator.poor {
    background-color: var(--poor-match-bg);
    color: #c62828;
    border: 1px solid var(--poor-match-border);
}

.match-details {
    display: flex;
    flex-direction: column;
    gap: 8px;
    margin-top: 12px;
}

.match-item {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 6px 10px;
    border-radius: 6px;
    font-size: 0.9em;
}

.match-icon {
    width: 20px;
    height: 20px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    font-size: 0.8em;
    font-weight: bold;
}

.match-icon.exact {
    background-color: var(--exact-match-bg);
    color: #2e7d32;
    border: 1px solid var(--exact-match-border);
}

.match-icon.close {
    background-color: var(--close-match-bg);
    color: #f57c00;
    border: 1px solid var(--close-match-border);
}

.match-icon.poor {
    background-color: var(--poor-match-bg);
    color: #c62828;
    border: 1px solid var(--poor-match-border);
}

.ndc-info-panel .drug-info {
    margin-bottom: 20px;
}

.ndc-info-panel .drug-info-item {
    margin-bottom: 10px;
    padding: 8px 12px;
    background: #f8f9fa;
    border-radius: 6px;
    border: 1px solid #e0e0e0;
}

.ndc-info-panel .drug-info-label {
    font-weight: 500;
    color: #666;
    margin-bottom: 4px;
}

.ndc-info-panel .drug-info-value {
    color: #333;
}

.din-card .match-type {
    display: inline-flex;
    align-items: center;
    padding: 3px 8px;
    border-radius: 22px;
    font-size: 0.500em;
    background: var(--exact-match-bg);
    color: #2e7d32;
    border: 1px solid var(--exact-match-border);
}

.din-card .drug-type-badge {
    display: inline-block;
    padding: 4px 8px;
    border-radius: 4px;
    font-size: 0.85em;
    margin-top: 8px;
    background: #e3f2fd;
    color: #062868;
    border: 1px solid #90caf9;
}

/* Add new styles for route grouping and exact match headers */
.route-group {
    margin: 15px 0;
    padding: 15px;
    background: white;
    border-radius: 6px;
    border: 1px solid #e0e0e0;
}

.route-header {
    font-size: 1em;
    color: #666;
    margin-bottom: 15px;
    padding: 8px 15px;
    background: #f8f9fa;
    border-radius: 6px;
    border: 1px solid #e0e0e0;
}

.exact-match-header {
    background: var(--exact-match-bg) !important;
    color: #2e7d32 !important;
    border-color: var(--exact-match-border) !important;
    font-weight: 500;
}

.dosage-header.exact-match-header {
    background: linear-gradient(to right, var(--exact-match-bg), white) !important;
}

.route-header.exact-match-header {
    background: linear-gradient(to right, var(--exact-match-bg), white) !important;
}

/* Add new styles for collapsible sections and match-based colors */
.collapsible-header {
    cursor: pointer;
    display: flex;
    justify-content: space-between;
    align-items: center;
    transition: all 0.3s ease;
}

.collapsible-header .header-content {
    display: flex;
    align-items: center;
    gap: 10px;
}

.collapsible-header .count-badge {
    background: rgba(0,0,0,0.1);
    padding: 2px 8px;
    border-radius: 12px;
    font-size: 0.8em;
}

.collapsible-header .toggle-icon {
    transition: transform 0.3s ease;
    font-size: 0.8em;
}

.collapsible-header.collapsed .toggle-icon {
    transform: rotate(-90deg);
}

.collapsible-content {
    overflow: hidden;
    transition: max-height 0.3s ease;
    max-height: 2000px; /* Adjust this value based on your content */
}

.collapsible-content.collapsed {
    max-height: 0;
}

/* Match-based colors for headers */
.dosage-header.exact-match,
.route-header.exact-match {
    background: linear-gradient(to right, var(--exact-match-bg), white);
    border-color: var(--exact-match-border);
    color: #2e7d32;
}

.dosage-header.close-match,
.route-header.close-match {
    background: linear-gradient(to right, var(--close-match-bg), white);
    border-color: var(--close-match-border);
    color: #f57c00;
}

.dosage-header.poor-match,
.route-header.poor-match {
    background: linear-gradient(to right, var(--poor-match-bg), white);
    border-color: var(--poor-match-border);
    color: #c62828;
}

/* Hover effects */
.collapsible-header:hover {
    opacity: 0.9;
    transform: translateY(-1px);
}

/* Updated match-based colors for headers */
.dosage-header.exact-match {
    background: linear-gradient(to right, var(--exact-match-bg), #f8f9fa);
    border-color: var(--exact-match-border);
    color: #2e7d32;
}

.dosage-header.close-match {
    background: linear-gradient(to right, var(--close-match-bg), #f8f9fa);
    border-color: var(--close-match-border);
    color: #f57c00;
}

.dosage-header.poor-match {
    background: linear-gradient(to right, var(--poor-match-bg), #f8f9fa);
    border-color: var(--poor-match-border);
    color: #c62828;
}

.route-header.exact-match {
    background: linear-gradient(to right, var(--exact-match-bg), #f8f9fa);
    border-color: var(--exact-match-border);
    color: #2e7d32;
}

.route-header.close-match {
    background: linear-gradient(to right, var(--close-match-bg), #f8f9fa);
    border-color: var(--close-match-border);
    color: #f57c00;
}

.route-header.poor-match {
    background: linear-gradient(to right, var(--poor-match-bg), #f8f9fa);
    border-color: var(--poor-match-border);
    color: #c62828;
}

/* Add match indicators */
.header-content {
    position: relative;
}

.dosage-header .header-content::after,
.route-header .header-content::after {
    content: '';
    display: inline-block;
    width: 8px;
    height: 8px;
    border-radius: 50%;
    margin-left: 8px;
}

.exact-match .header-content::after {
    background-color: #2e7d32;
}

.close-match .header-content::after {
    background-color: #f57c00;
}

.poor-match .header-content::after {
    background-color: #c62828;
}

/* Previous styles remain unchanged */

.dosage-header.exact-match {
    background: linear-gradient(to right, var(--exact-match-bg), #f8f9fa);
    border-color: var(--exact-match-border);
    color: #2e7d32;
    font-weight: 500;
}

.dosage-header.exact-match .header-content span:first-child {
    display: flex;
    align-items: center;
    gap: 4px;
}

.dosage-header.poor-match {
    background: linear-gradient(to right, var(--poor-match-bg), #f8f9fa);
    border-color: var(--poor-match-border);
    color: #c62828;
}

.header-content span:first-child {
    flex: 1;
    display: flex;
    align-items: center;
}

/* Previous styles remain unchanged */

.match-checkmark, .match-checkmarks {
    display: inline-flex;
    align-items: center;
    margin-left: 8px;
    color: #2e7d32;
    font-weight: bold;
}

.match-checkmarks {
    letter-spacing: -2px;
}

.dosage-header.exact-match {
    background: linear-gradient(to right, var(--exact-match-bg), #f8f9fa);
    border-color: var(--exact-match-border);
    color: #2e7d32;
    font-weight: 500;
}

.dosage-header.exact-match .header-content span:first-child {
    display: flex;
    align-items: center;
    gap: 4px;
}

.dosage-header.poor-match {
    background: linear-gradient(to right, var(--poor-match-bg), #f8f9fa);
    border-color: var(--poor-match-border);
    color: #c62828;
}

.header-content span:first-child {
    flex: 1;
    display: flex;
    align-items: center;
}

/* Previous styles remain unchanged */

.route-header.exact-match {
    background: linear-gradient(to right, var(--exact-match-bg), #f8f9fa);
    border-color: var(--exact-match-border);
    color: #2e7d32;
}

.route-header.poor-match {
    background: linear-gradient(to right, var(--poor-match-bg), #f8f9fa);
    border-color: var(--poor-match-border);
    color: #c62828;
}

.route-header .match-checkmark {
    display: inline-flex;
    align-items: center;
    margin-left: 8px;
    color: #2e7d32;
    font-weight: bold;
}

.route-header.exact-match .header-content span:first-child {
    display: flex;
    align-items: center;
}

/* Previous styles remain unchanged */

.collapsible-content {
    overflow: hidden;
    transition: max-height 0.5s ease-in-out;
    max-height: none !important; /* Remove height restriction */
}

.collapsible-content.collapsed {
    max-height: 0 !important;
}

.din-results-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 20px;
    padding: 10px;
    margin-bottom: 20px;
    width: 95%;
}

/* Responsive grid adjustments */
@media (min-width: 1600px) {
    .din-results-grid {
        grid-template-columns: repeat(4, 1fr);
    }
}

@media (min-width: 1200px) and (max-width: 1599px) {
    .din-results-grid {
        grid-template-columns: repeat(3, 1fr);
    }
}

@media (min-width: 768px) and (max-width: 1199px) {
    .din-results-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}

@media (max-width: 767px) {
    .din-results-grid {
        grid-template-columns: 1fr;
    }
}

/* Grid size button styles */
.grid-size-selector {
    display: flex;
    gap: 5px;
    padding-right:5px;
}

/* .grid-btn {
    padding: 8px 12px;
    border: 1px solid #ddd;
    border-radius: 4px;
    background: white;
    cursor: pointer;
    transition: all 0.2s ease;
} */

.grid-btn:hover {
    /* background: #f8f9fa; */
    background: #e3f2fd;
}

.grid-btn.active {
    background: #e3f2fd;
    border-color: #c00e34;
    color: #062868;
}

.grid-btn i {
    margin-right: 4px;
}

.route-group {
    margin: 15px 0;
    padding: 15px;
    background: white;
    border-radius: 6px;
    border: 1px solid #e0e0e0;
    height: auto; /* Allow height to grow */
    overflow: visible; /* Ensure content is visible */
}

.route-header {
    margin-bottom: 15px;
    position: relative;
    z-index: 1;
}

.dosage-group {
    height: auto;
    overflow: visible;
    margin-bottom: 20px;
}

/* Ensure smooth transitions */
.collapsible-content {
    opacity: 1;
    visibility: visible;
    transition: 
        max-height 0.5s ease-in-out,
        opacity 0.3s ease-in-out,
        visibility 0s linear;
}

.collapsible-content.collapsed {
    opacity: 0;
    visibility: hidden;
    transition: 
        max-height 0.5s ease-in-out,
        opacity 0.3s ease-in-out,
        visibility 0s linear 0.3s;
}

/* Ensure grid items don't get cut off */
.din-card {
    break-inside: avoid;
    page-break-inside: avoid;
    height: fit-content;
    min-height: 200px; /* Minimum height for consistency */
}

/* Navigation Preview Panel Styles */
.nav-preview-panel {
    position: fixed;
    right: 20px;
    top: 100px !important;
    width: 300px;
    height: calc(100vh - 140px);
    background: white;
    border-radius: 12px;
    box-shadow: 0 4px 20px rgba(0,0,0,0.15);
    z-index: 1000;
    border: 1px solid #e0e0e0;
    font-size: 14px;
    min-width: 250px;
    min-height: 200px;
    transition: opacity 0.3s ease-out;
    opacity: 0;
    pointer-events: none;
    will-change: opacity, transform;
    transform: translateY(10px);
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.nav-preview-panel.visible {
    opacity: 1;
    pointer-events: auto;
    transform: translateY(0);
}

.nav-preview-header {
    cursor: move;
    user-select: none;
    padding: 12px 15px;
    background: #062868;
    color: white;
    border-top-left-radius: 12px;
    border-top-right-radius: 12px;
    flex: 0 0 auto;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.nav-preview-title {
    display: flex;
    align-items: center;
    gap: 8px;
}

.nav-preview-controls {
    display: flex;
    gap: 8px;
}

.nav-btn {
    background: none;
    border: none;
    color: white;
    cursor: pointer;
    padding: 6px;
    border-radius: 4px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
    width: 28px;
    height: 28px;
}

.nav-btn:hover {
    background: rgba(255, 255, 255, 0.2);
}

.nav-btn#navClosePanel:hover,
.nav-btn[id^="filterClosePanel"]:hover {
    background: rgba(255, 0, 0, 0.2);
}

.nav-preview-content {
    flex: 1 1 0%;
    padding: 15px;
    overflow-y: auto;
    min-height: 0;
    height: 100%;
}

#navPreviewTree {
    font-size: 13px;
    height: 100%;
}

.nav-tree-item {
    margin: 4px 0;
}

.nav-tree-content {
    display: flex;
    align-items: center;
    padding: 6px 8px;
    border-radius: 4px;
    cursor: pointer;
    transition: all 0.2s;
    gap: 8px;
}

.nav-tree-toggle {
    width: 16px;
    height: 16px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 10px;
    color: #666;
    transition: transform 0.2s;
}

.nav-tree-toggle.collapsed {
    transform: rotate(-90deg);
}

.nav-tree-children {
    margin-left: 24px;
    position: relative;
    overflow: hidden;
    transition: max-height 0.3s ease-out;
}

.nav-tree-children::before {
    content: '';
    position: absolute;
    left: 0;
    top: 0;
    bottom: 0;
    width: 1px;
    background: #e0e0e0;
}

.nav-tree-item[data-match-type="exact-match"] > .nav-tree-content {
    background: var(--exact-match-bg);
    border: 1px solid var(--exact-match-border);
    color: #2e7d32;
}

.nav-tree-item[data-match-type="similar-match"] > .nav-tree-content {
    background: var(--close-match-bg);
    border: 1px solid var(--close-match-border);
    color: #f57c00;
}

.nav-tree-item[data-match-type="multiple-ingredients"] > .nav-tree-content {
    background: #ede7f6;
    border: 1px solid #9575cd;
    color: #4527a0;
}

.nav-tree-item[data-match-type="other-dins"] > .nav-tree-content {
    background: #eceff1;
    border: 1px solid #90a4ae;
    color: #455a64;
}

.nav-tree-content:hover {
    transform: translateX(5px);
    opacity: 0.9;
}

.nav-tree-content.active {
    font-weight: 500;
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
}

/* Add animation styles */
.nav-preview-panel {
    opacity: 0;
    transition: opacity 0.3s ease;
}

.nav-tree-children {
    transition: max-height 0.3s ease-out;
}

.nav-tree-toggle {
    transition: transform 0.3s ease;
}

.nav-tree-content {
    position: relative;
    overflow: hidden;
}

.nav-tree-content::after {
    content: '';
    position: absolute;
    left: 0;
    right: 0;
    top: 0;
    bottom: 0;
    background: currentColor;
    opacity: 0;
    transition: opacity 0.2s;
}

.nav-tree-content:active::after {
    opacity: 0.1;
}

.nav-tree-children {
    transition: max-height 0.5s ease-out;
    overflow: hidden;
    margin-left: 24px;
    position: relative;
}

.nav-tree-toggle {
    transition: transform 0.3s ease;
    cursor: pointer;
    width: 20px;
    height: 20px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.nav-tree-toggle.collapsed {
    transform: rotate(-90deg);
}

/* Improve visibility of current section */
.nav-tree-content.active {
    font-weight: 600;
    box-shadow: 0 2px 8px rgba(0,0,0,0.15);
    transform: translateX(5px);
}

.nav-ndc-header {
    background: linear-gradient(to right, #062868, #c00e34);
    color: white;
    padding: 10px 15px;
    border-radius: 8px;
    margin-bottom: 15px;
    font-size: 0.9em;
}

.nav-ndc-header .nav-ndc-title {
    font-weight: 500;
    margin-bottom: 5px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.nav-ndc-header .nav-ndc-number {
    background: rgba(255,255,255,0.2);
    padding: 3px 8px;
    border-radius: 12px;
    font-size: 0.9em;
    font-family: monospace;
    display: inline-block;
    margin-right: 8px;
}

.nav-ndc-header .nav-result-count {
    background: rgba(255,255,255,0.15);
    padding: 2px 8px;
    border-radius: 10px;
    font-size: 0.85em;
}

.nav-ndc-section {
    margin-bottom: 20px;
    padding-bottom: 15px;
    border-bottom: 1px solid rgba(0,0,0,0.1);
}

.nav-ndc-section:last-child {
    border-bottom: none;
    margin-bottom: 0;
    padding-bottom: 0;
}

.nav-preview-content {
    padding: 15px;
    height: calc(100% - 50px);
    overflow-y: auto;
}

.nav-preview-content::-webkit-scrollbar {
    width: 8px;
}

.nav-preview-content::-webkit-scrollbar-track {
    background: rgba(0,0,0,0.05);
    border-radius: 4px;
}

.nav-preview-content::-webkit-scrollbar-thumb {
    background: rgba(0,0,0,0.2);
    border-radius: 4px;
}

.nav-preview-content::-webkit-scrollbar-thumb:hover {
    background: rgba(0,0,0,0.3);
}

.drug-type-badge {
    display: inline-block;
    padding: 4px 12px;
    border-radius: 4px;
    font-size: 0.85em;
    margin-top: 8px;
    font-weight: 500;
}

.drug-type-badge.matching {
    background: var(--exact-match-bg);
    color: #2e7d32;
    border: 1px solid var(--exact-match-border);
}

.drug-type-badge.non-matching {
    background: #e3f2fd;
    color: #062868;
    border: 1px solid #90caf9;
}

/* Filter Panel Styles */
.filter-panel {
    position: fixed;
    left: 20px;
    width: 280px;
    background: white;
    border-radius: 12px;
    box-shadow: 0 4px 20px rgba(0,0,0,0.15);
    z-index: 1000;
    border: 1px solid #e0e0e0;
    font-size: 14px;
    display: none;
    resize: both;
    min-width: 250px;
    min-height: 200px;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    opacity: 0;
    pointer-events: none;
    will-change: transform, opacity;
    transform: translateY(10px);
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.filter-panel.visible {
    opacity: 1;
    pointer-events: auto;
    transform: translateY(0);
}

.filter-panel-header {
    cursor: move;
    user-select: none;
    padding: 12px 15px;
    background: #062868;
    color: white;
    border-top-left-radius: 12px;
    border-top-right-radius: 12px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}
.filter-panel-header i {
    padding-right: 10px;
}

.filter-panel-title {
    display: flex;
    align-items: center;
    gap: 8px;
}

.filter-panel-controls {
    display: flex;
    gap: 8px;
}

.filter-panel-content {
    padding: 15px;
    flex: 1;
    overflow-y: auto;
    min-height: 0;
}

.filter-section {
    margin-bottom: 20px;
    padding-bottom: 15px;
    border-bottom: 1px solid #e0e0e0;
}

.filter-section:last-child {
    border-bottom: none;
    margin-bottom: 0;
    padding-bottom: 0;
}

.filter-section-title {
    font-weight: 500;
    margin-bottom: 10px;
    color: #062868;
}

.filter-group {
    margin-bottom: 15px;
}

.filter-checkbox {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 6px 0;
    cursor: pointer;
    transition: all 0.2s ease;
}

.filter-checkbox:hover {
    background: rgba(0,0,0,0.05);
}

.filter-checkbox input[type="checkbox"] {
    width: 16px;
    height: 16px;
    cursor: pointer;
}

.filter-checkbox label {
    cursor: pointer;
    user-select: none;
    flex: 1;
}

.filter-checkbox.exact-match label {
    color: #2e7d32;
}

.filter-checkbox.similar-match label {
    color: #f57c00;
}

.filter-checkbox.multiple-ingredients label {
    color: #4527a0;
}

.filter-checkbox.other-dins label {
    color: #455a64;
}

.filter-badge {
    background: rgba(0,0,0,0.1);
    padding: 2px 6px;
    border-radius: 10px;
    font-size: 0.85em;
    margin-left: auto;
}

.filter-panel-content::-webkit-scrollbar {
    width: 8px;
}

.filter-panel-content::-webkit-scrollbar-track {
    background: rgba(0,0,0,0.05);
    border-radius: 4px;
}

.filter-panel-content::-webkit-scrollbar-thumb {
    background: rgba(0,0,0,0.2);
    border-radius: 4px;
}

.filter-panel-content::-webkit-scrollbar-thumb:hover {
    background: rgba(0,0,0,0.3);
}

/* Show navigation panel only when results are present */
.results:not(:empty) ~ .nav-preview-panel {
    display: block;
}

@media (max-width: 1600px) {
    .container {
        /* margin-left: 20px; */
        /* margin-right: 20px; */
    }
    
    .filter-panel,
    .nav-preview-panel {
        background: rgba(255, 255, 255, 0.95);
        backdrop-filter: blur(5px);
    }
}

/* Match category transitions */
.match-category {
    transition: opacity 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    will-change: opacity;
}

.match-category.hidden {
    opacity: 0;
    pointer-events: none;
}

/* Improve collapsible content transitions */
.collapsible-content {
    transition: max-height 0.3s cubic-bezier(0.4, 0, 0.2, 1), opacity 0.2s ease;
    will-change: max-height, opacity;
    opacity: 1;
}

.collapsible-content.collapsed {
    opacity: 0;
    max-height: 0 !important;
}

/* Navigation panel transitions */
.nav-preview-panel {
    /* transition: opacity 0.3s cubic-bezier(0.4, 0, 0.2, 1), transform 0.3s cubic-bezier(0.4, 0, 0.2, 1); */
    will-change: opacity, transform;
    transform: translateY(10px);
}

.nav-preview-panel.visible {
    opacity: 1;
    transform: translateY(0);
}

/* Navigation tree transitions */
.nav-tree-children {
    transition: max-height 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    will-change: max-height;
}

.nav-tree-toggle {
    transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    will-change: transform;
}

/* Filter checkbox transitions */
.filter-checkbox {
    transition: background-color 0.2s ease;
}

.filter-checkbox:hover {
    background: rgba(0,0,0,0.05);
}

.header {
    background: linear-gradient(to right, #062868, #c00e34);
    color: white;
    padding: 20px;
    border-radius: 12px;
    margin-bottom: 25px;
    box-shadow: 0 4px 12px rgba(0,0,0,0.1);
    transition: all 0.3s ease;
    z-index: 1000;
}

.header.fixed-top {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    border-radius: 0;
    margin-bottom: 0;
    padding: 15px 20px;
}

/* Add padding to body when header is fixed */
body.fixed-header {
    padding-top: 100px; /* Adjust this value based on your header height */
}

.header-content {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.header-controls {
    display: flex;
    align-items: center;
    gap: 20px;
}

.nav-toggle {
    display: flex;
    align-items: center;
    gap: 10px;
}

.toggle-label {
    color: white;
    font-size: 14px;
}

/* Toggle Switch */
.switch {
    position: relative;
    display: inline-block;
    width: 50px;
    height: 24px;
}

.switch input {
    opacity: 0;
    width: 0;
    height: 0;
}

.slider {
    position: absolute;
    cursor: pointer;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: rgba(255, 255, 255, 0.3);
    transition: .4s;
}

.slider:before {
    position: absolute;
    content: "";
    height: 16px;
    width: 16px;
    left: 4px;
    bottom: 4px;
    background-color: white;
    transition: .4s;
}

input:checked + .slider {
    background-color: rgba(255, 255, 255, 0.8);
}

input:checked + .slider:before {
    transform: translateX(26px);
}

.slider.round {
    border-radius: 24px;
}

.slider.round:before {
    border-radius: 50%;
}

.view-mode-toggle {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-right: 20px;
}

.view-mode-toggle .toggle-label {
    font-size: 14px;
    color: #ffffff;
}

.simple-view {
    padding: 20px;
    background: #fff;
    border-radius: 8px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
    margin-bottom: 20px;
}

.simple-view .ndc-info {
    font-size: 16px;
    line-height: 1.6;
}

.simple-view .ndc-info h3 {
    color: #062868;
    margin-bottom: 10px;
}

.simple-view .ndc-info p {
    margin: 5px 0;
}

.simple-view .ndc-info .label {
    font-weight: bold;
    color: #666;
    display: inline-block;
    width: 120px;
}

.advanced-view {
    display: none;
}

.advanced-view.active {
    display: block;
}

/* DataTables Custom Styling */
.dataTables_wrapper {
    position: relative;
    overflow-x: auto; /* Enable horizontal scrolling */
    width: 100%;
}

/* Ensure the table scrolls horizontally when needed */
.dataTables_wrapper .dataTables_scroll {
    overflow-x: auto;
}

.dataTables_wrapper .dataTables_scrollBody {
    overflow-x: auto;
    overflow-y: visible;
}

/* Table container should never overflow */
.table-responsive {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    max-width: 100%;
    margin-bottom: 1rem;
}

/* Ensure Canadian matches table container is responsive */
.canadian-matches {
    overflow-x: auto;
    width: 100%;
}

/* Scrollbar styling for horizontal scrolling */
.dataTables_wrapper::-webkit-scrollbar,
.table-responsive::-webkit-scrollbar,
.canadian-matches::-webkit-scrollbar {
    height: 8px;
}

.dataTables_wrapper::-webkit-scrollbar-track,
.table-responsive::-webkit-scrollbar-track,
.canadian-matches::-webkit-scrollbar-track {
    background: #f1f1f1;
    border-radius: 4px;
}

.dataTables_wrapper::-webkit-scrollbar-thumb,
.table-responsive::-webkit-scrollbar-thumb,
.canadian-matches::-webkit-scrollbar-thumb {
    background: #c1c1c1;
    border-radius: 4px;
}

.dataTables_wrapper::-webkit-scrollbar-thumb:hover,
.table-responsive::-webkit-scrollbar-thumb:hover,
.canadian-matches::-webkit-scrollbar-thumb:hover {
    background: #a8a8a8;
}

.card {
    position: relative;
    display: flex;
    flex-direction: column;
    min-width: 0;
    word-wrap: break-word;
    background-color: #fff;
    background-clip: border-box;
    border: 0 solid rgba(0,0,0,.125);
    border-radius: 0.25rem;
    box-shadow: 0 0 1px rgba(0,0,0,.125), 0 1px 3px rgba(0,0,0,.2);
    margin-bottom: 1rem;
}

.card-body {
    flex: 1 1 auto;
    padding: 1.25rem;
}

.btn-default {
    background-color: #f8f9fa;
    border-color: #ddd;
    color: #444;
}

.btn-default:hover {
    background-color: #e9ecef;
    border-color: #c1c9d0;
    color: #2b3035;
}

.btn-sm {
    padding: 0.25rem 0.5rem;
    font-size: 0.875rem;
    line-height: 1.5;
    border-radius: 0.2rem;
}

.dt-buttons {
    display: inline-block;
    margin-bottom: 0.5rem;
}

.dt-buttons .btn {
    margin-right: 0.25rem;
}

.dataTables_filter {
    float: right;
}

.dataTables_filter input {
    margin-left: 0.5rem;
    border: 1px solid #ced4da;
    border-radius: 0.25rem;
    padding: 0.25rem 0.5rem;
}

.table {
    margin-bottom: 0;
    width: 100% !important;
    table-layout: auto;
    min-width: 1200px; /* Ensure minimum width for all columns */
}

.table thead th {
    background-color: #f8f9fa;
    border-bottom: 2px solid #dee2e6;
    font-weight: 600;
    padding: 12px 8px;
    vertical-align: middle;
    white-space: nowrap; /* Prevent header text wrapping */
    min-width: 120px; /* Minimum column width */
}

.table td {
    padding: 12px 8px;
    vertical-align: middle;
}

/* First Column (Expand Control) */
.table td.dtr-control {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 12px 8px;
}

/* Expand Control */
.expand-control {
    display: flex;
    align-items: center;
    justify-content: center;
    min-width: 20px;
}

.expand-control i {
    font-size: 16px;
    color: #6c757d;
    transition: all 0.2s ease;
}

/* Row Hover Effects */
.table tbody tr {
    cursor: pointer;
    transition: background-color 0.2s ease;
}

.table tbody tr:hover {
    background-color: rgba(0, 123, 255, 0.05) !important;
}

.table tbody tr:hover .expand-control i {
    color: #007bff;
    transform: scale(1.1);
}

.table tbody tr.shown {
    background-color: #f8f9fa !important;
}

.table tbody tr.shown .expand-control i.fa-minus-circle {
    color: #dc3545;
}

.table tbody tr.shown + tr > td {
    padding: 0;
    background: #f8f9fa;
}

/* DIN Link */
.table td .din-link {
    color: #007bff;
    text-decoration: none;
    font-weight: 500;
}

.table td .din-link:hover {
    text-decoration: underline;
}

/* Loading State */
.expand-control i.fa-spinner {
    color: #007bff;
}

/* Score Column */
.table td .exact-match {
    color: #28a745;
    font-weight: 600;
}

.table td .close-match {
    color: #ffc107;
    font-weight: 600;
}

.table td .poor-match {
    color: #dc3545;
    font-weight: 600;
}

.table-striped tbody tr:nth-of-type(odd) {
    background-color: rgba(0,0,0,.05);
}

.table-hover tbody tr:hover {
    background-color: rgba(0,0,0,.075);
}

.dataTables_info {
    padding-top: 0.85em;
}

.dataTables_paginate {
    margin: 0;
    white-space: nowrap;
    text-align: right;
}

.paginate_button {
    display: inline-block;
    padding: 0.5rem 0.75rem;
    margin-left: -1px;
    line-height: 1.25;
    color: #007bff;
    background-color: #fff;
    border: 1px solid #dee2e6;
    cursor: pointer;
}

.paginate_button:hover {
    color: #0056b3;
    text-decoration: none;
    background-color: #e9ecef;
    border-color: #dee2e6;
}

.paginate_button.current {
    z-index: 3;
    color: #fff;
    background-color: #007bff;
    border-color: #007bff;
}

.paginate_button.disabled {
    color: #6c757d;
    pointer-events: none;
    background-color: #fff;
    border-color: #dee2e6;
}

/* Responsive table styles */
@media screen and (max-width: 767px) {
    .dataTables_wrapper .dataTables_info,
    .dataTables_wrapper .dataTables_paginate {
        float: none;
        text-align: center;
    }
    
    .dataTables_wrapper .dataTables_paginate {
        margin-top: 0.5em;
    }
}

/* Custom styling for exact/close/poor match indicators */
.exact-match {
    color: #28a745;
    font-weight: 500;
}

.close-match {
    color: #ffc107;
    font-weight: 500;
}

.poor-match {
    color: #dc3545;
    font-weight: 500;
}

/* Responsive table content */
table.dataTable.dtr-inline.collapsed > tbody > tr > td.dtr-control,
table.dataTable.dtr-inline.collapsed > tbody > tr > th.dtr-control {
    position: relative;
    padding-left: 30px;
    cursor: pointer;
}

table.dataTable.dtr-inline.collapsed > tbody > tr > td.dtr-control:before,
table.dataTable.dtr-inline.collapsed > tbody > tr > th.dtr-control:before {
    top: 50%;
    left: 5px;
    height: 14px;
    width: 14px;
    margin-top: -7px;
    display: block;
    position: absolute;
    color: white;
    border: 2px solid white;
    border-radius: 14px;
    box-shadow: 0 0 3px #444;
    box-sizing: content-box;
    text-align: center;
    text-indent: 0 !important;
    font-family: 'Courier New', Courier, monospace;
    line-height: 14px;
    content: '+';
    background-color: #007bff;
}

/* Responsive DataTables Styling */
.modal-responsive {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background: white;
    padding: 20px;
    border-radius: 8px;
    box-shadow: 0 5px 15px rgba(0,0,0,.5);
    max-width: 90%;
    max-height: 90vh;
    overflow-y: auto;
    z-index: 1050;
}

.modal-responsive .close {
    position: absolute;
    right: 10px;
    top: 10px;
    font-size: 1.5rem;
    font-weight: 700;
    color: #000;
    opacity: .5;
    cursor: pointer;
}

.modal-responsive .close:hover {
    opacity: .75;
}

.modal-responsive-backdrop {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0,0,0,.5);
    z-index: 1040;
}

/* Child row styling */
table.dataTable > tbody > tr.child {
    padding: 0.5rem 1rem;
}

table.dataTable > tbody > tr.child:hover {
    background: none !important;
}

table.dataTable > tbody > tr.child ul.dtr-details {
    display: inline-block;
    list-style-type: none;
    margin: 0;
    padding: 0;
    width: 100%;
}

table.dataTable > tbody > tr.child ul.dtr-details > li {
    border-bottom: 1px solid #efefef;
    padding: 0.5rem 0;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

table.dataTable > tbody > tr.child ul.dtr-details > li:last-child {
    border-bottom: none;
}

table.dataTable > tbody > tr.child span.dtr-title {
    font-weight: 600;
    color: #344767;
    min-width: 120px;
    padding-right: 1rem;
}

table.dataTable > tbody > tr.child span.dtr-data {
    flex: 1;
}

/* Responsive control button */
table.dataTable.dtr-inline.collapsed > tbody > tr[role="row"] > td:first-child:before,
table.dataTable.dtr-inline.collapsed > tbody > tr[role="row"] > th:first-child:before {
    top: 50%;
    left: 4px;
    height: 16px;
    width: 16px;
    margin-top: -8px;
    border: 2px solid white;
    border-radius: 16px;
    box-shadow: 0 0 3px #444;
    background-color: #007bff;
    font-family: 'Font Awesome 6 Free';
    font-weight: 900;
    content: '\f067';
    font-size: 10px;
    line-height: 14px;
    text-align: center;
}

table.dataTable.dtr-inline.collapsed > tbody > tr.parent > td:first-child:before,
table.dataTable.dtr-inline.collapsed > tbody > tr.parent > th:first-child:before {
    content: '\f068';
    background-color: #dc3545;
}

/* Updated responsive breakpoints - now focusing on UI elements rather than hiding columns */
@media screen and (max-width: 1200px) {
    .table td, .table th {
        min-width: 100px; /* Keep minimum width but don't hide columns */
    }
}

@media screen and (max-width: 992px) {
    .dt-buttons {
        margin-bottom: 1rem;
    }
    
    .dataTables_filter {
        margin-bottom: 1rem;
        float: none;
    }
}

@media screen and (max-width: 768px) {
    .dt-buttons {
        display: flex;
        flex-wrap: wrap;
        gap: 0.5rem;
        justify-content: center;
    }
    
    .dt-buttons .btn {
        flex: 1;
        min-width: 120px;
        margin: 0;
    }
    
    .dataTables_filter input {
        width: 100%;
        margin: 0;
    }
    
    /* Ensure table containers are scrollable on mobile */
    .dataTables_wrapper,
    .canadian-matches,
    .table-responsive {
        overflow-x: auto !important;
    }
}

/* Export collection dropdown */
.dt-button-collection {
    position: absolute;
    background: white;
    border: 1px solid rgba(0,0,0,.15);
    border-radius: 4px;
    padding: 0.5rem 0;
    margin: 2px 0 0;
    box-shadow: 0 2px 5px rgba(0,0,0,.1);
    z-index: 1000;
    min-width: 160px;
}

.dt-button-collection .dt-button {
    display: block;
    width: 100%;
    padding: 0.5rem 1.5rem;
    clear: both;
    font-weight: 400;
    text-align: left;
    border: 0;
    background: none;
    border-radius: 0;
    white-space: nowrap;
}

.dt-button-collection .dt-button:hover {
    background-color: #f8f9fa;
    color: #16181b;
}

.dt-button-collection .dt-button.active {
    background-color: #e9ecef;
    color: #16181b;
}

.dt-button-collection .dt-button-split {
    border-top: 1px solid #dee2e6;
    margin-top: 0.5rem;
    padding-top: 0.5rem;
}

.dt-button-collection-title {
    padding: 0.5rem 1rem;
    margin: 0;
    font-size: 0.875rem;
    color: #6c757d;
    font-weight: 600;
    border-bottom: 1px solid #dee2e6;
}

/* Position the dropdown below the button */
.dt-button-collection[role="menu"] {
    transform: translate3d(0, 38px, 0px) !important;
}

/* Tooltip styling */
.tooltip {
    position: absolute;
    z-index: 1070;
    display: block;
    font-size: 0.875rem;
    opacity: 0;
    transition: opacity 0.15s;
}

.tooltip.show {
    opacity: .9;
}

.tooltip-inner {
    max-width: 200px;
    padding: 0.25rem 0.5rem;
    color: #fff;
    text-align: center;
    background-color: #000;
    border-radius: 0.25rem;
}

/* Loading indicator */
.dataTables_processing {
    position: absolute;
    top: 50%;
    left: 50%;
    width: 200px;
    margin-left: -100px;
    text-align: center;
    padding: 1rem;
    background: rgba(255,255,255,0.9);
    border-radius: 4px;
    box-shadow: 0 0 10px rgba(0,0,0,0.1);
}

/* Expand/Collapse Button Styling */
.dtr-control {
    position: relative;
    padding-left: 15px !important;
    cursor: pointer;
}

.arrow-icon {
    position: absolute;
    left: 10px;
    top: 50%;
    transform: translateY(-50%);
    width: 20px;
    height: 20px;
    background-color: #f8f9fa;
    border: 1px solid #dee2e6;
    border-radius: 4px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease-in-out;
}

.arrow-icon::before {
    content: '';
    display: block;
    width: 6px;
    height: 6px;
    border-right: 2px solid #6c757d;
    border-bottom: 2px solid #6c757d;
    transform: rotate(-45deg) translateX(-1px);
    transition: all 0.2s ease-in-out;
}

.arrow-icon.expanded::before {
    transform: rotate(45deg) translateY(-1px);
    border-color: #0d6efd;
}

.arrow-icon.loading::before {
    content: '↻';
    border: none;
    transform: none;
    font-size: 14px;
    color: #0d6efd;
    animation: spin 1s linear infinite;
}

.arrow-icon.hover,
tr:hover .arrow-icon {
    background-color: #e9ecef;
    border-color: #ced4da;
}

.arrow-icon.expanded {
    background-color: #e7f1ff;
    border-color: #0d6efd;
}

/* Table Row Styling */
.dataTables_wrapper tr.shown {
    background-color: #f8f9fa;
}

.dataTables_wrapper tr.shown td {
    border-bottom: none;
}

.dataTables_wrapper tr.shown + tr > td {
    background-color: #f8f9fa;
    padding: 0;
}

/* Loading Animation */
@keyframes spin {
    from { transform: rotate(0deg); }
    to { transform: rotate(360deg); }
}

/* Hover effect for the entire row */
.dataTables_wrapper tbody tr:hover {
    background-color: #f8f9fa;
}

.dataTables_wrapper tbody tr:hover .arrow-icon::before {
    border-color: #0d6efd;
}

/* Rest of the existing CSS remains the same */

/* DataTable Expand Control */
.expand-control {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 10px;
    height: 10px;
    cursor: pointer;
    margin-right: 8px;
}

.expand-control i {
    font-size: 18px;
    color: #666;
    transition: all 0.2s ease;
}

.expand-control:hover i {
    color: #007bff;
    transform: scale(1.1);
}

.expand-control i.fa-minus-circle {
    color: #dc3545;
}

.expand-control i.fa-spinner {
    color: #007bff;
}

/* DIN Details Styling */
.din-details-wrapper {
    padding: 20px;
    background: #f8f9fa;
    border-radius: 8px;
    margin: 10px 0;
}

.din-details-container {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 20px;
    max-width: 100%;
}

.din-detail-card {
    background: white;
    border-radius: 8px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
    overflow: hidden;
}

.din-detail-card .card-header {
    background: #f8f9fa;
    padding: 15px 20px;
    border-bottom: 1px solid #dee2e6;
    display: flex;
    align-items: center;
    gap: 10px;
}

.din-detail-card .card-header i {
    font-size: 1.2em;
    color: #007bff;
}

.din-detail-card .card-header h4 {
    margin: 0;
    color: #333;
    font-size: 1.1em;
    font-weight: 600;
}

.din-detail-card .card-content {
    padding: 20px;
}

/* Basic Info Card */
.info-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 15px;
}

.info-item {
    display: flex;
    flex-direction: column;
    gap: 5px;
}

.info-item label {
    font-weight: 600;
    color: #666;
    font-size: 0.9em;
}

.info-item span {
    color: #333;
    font-size: 1.1em;
}

/* Ingredients Card */
.ingredients-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 20px;
}

.ingredient-item {
    background: #f8f9fa;
    padding: 15px;
    border-radius: 6px;
    border-left: 4px solid #007bff;
}

.ingredient-item h5 {
    margin: 0 0 10px 0;
    color: #333;
    font-size: 1em;
    font-weight: 600;
}

.ingredient-details {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.ingredient-details span {
    display: flex;
    align-items: center;
    gap: 8px;
    color: #666;
    font-size: 0.9em;
}

.ingredient-details i {
    color: #007bff;
    width: 16px;
}

/* Forms and Routes Card */
.forms-routes-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 20px;
}

.forms-section, .routes-section {
    background: #f8f9fa;
    padding: 15px;
    border-radius: 6px;
}

.forms-section h5, .routes-section h5 {
    margin: 0 0 15px 0;
    color: #333;
    font-size: 1em;
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 8px;
}

.forms-section h5 i, .routes-section h5 i {
    color: #007bff;
}

.forms-section ul, .routes-section ul {
    list-style: none;
    padding: 0;
    margin: 0;
}

.forms-section li, .routes-section li {
    padding: 8px 0;
    border-bottom: 1px solid #dee2e6;
    color: #666;
}

.forms-section li:last-child, .routes-section li:last-child {
    border-bottom: none;
}

/* Companies Card */
.companies-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 20px;
}

.company-item {
    background: #f8f9fa;
    padding: 15px;
    border-radius: 6px;
    border-left: 4px solid #28a745;
}

.company-item h5 {
    margin: 0 0 10px 0;
    color: #333;
    font-size: 1em;
    font-weight: 600;
}

.company-type {
    display: flex;
    align-items: center;
    gap: 8px;
    color: #666;
    font-size: 0.9em;
    margin-bottom: 10px;
}

.company-address {
    display: flex;
    gap: 8px;
    color: #666;
    font-size: 0.9em;
}

.company-address i {
    color: #28a745;
    margin-top: 3px;
}

.company-address address {
    margin: 0;
    font-style: normal;
    line-height: 1.4;
}

/* Status History Card */
.status-timeline {
    display: flex;
    flex-direction: column;
    gap: 15px;
}

.status-item {
    display: flex;
    align-items: center;
    gap: 15px;
    padding: 10px;
    background: #f8f9fa;
    border-radius: 6px;
    border-left: 4px solid #6c757d;
}

.status-item.current {
    border-left-color: #28a745;
    background: #e8f5e9;
}

.status-date {
    display: flex;
    align-items: center;
    gap: 8px;
    color: #666;
    font-size: 0.9em;
    min-width: 120px;
}

.status-date i {
    color: #6c757d;
}

.status-label {
    flex: 1;
    color: #333;
    display: flex;
    align-items: center;
    gap: 10px;
}

.current-badge {
    background: #28a745;
    color: white;
    padding: 2px 8px;
    border-radius: 12px;
    font-size: 0.8em;
    font-weight: 500;
}

/* Responsive Adjustments */
@media (max-width: 768px) {
    .din-details-container {
        grid-template-columns: 1fr;
    }
    
    .info-grid, .ingredients-grid, .forms-routes-grid, .companies-grid {
        grid-template-columns: 1fr;
    }
}

/* DataTable Row Expansion */
.dataTables_wrapper tr.shown {
    background-color: #f8f9fa;
}

.dataTables_wrapper tr.shown td {
    border-bottom: none;
}

.dataTables_wrapper tr.shown + tr > td {
    padding: 0;
    background: #f8f9fa;
}

.ndc-header {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 20px;
}

.ndc-header .ndc-number {
    margin-bottom: 0;
}

.filter-toggle-btn {
    background: #ffffff;
    border: 2px solid #062868;
    color: #062868;
    padding: 8px 12px;
    border-radius: 20px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
    margin-left: 15px;
    font-size: 14px;
}

.filter-toggle-btn:hover {
    background: #062868;
    color: white;
    transform: translateY(-2px);
    box-shadow: 0 4px 8px rgba(25, 118, 210, 0.2);
}

.filter-toggle-btn.active {
    background: #062868;
    color: white;
    border-color: #062868;
    box-shadow: inset 0 2px 4px rgba(0, 0, 0, 0.1);
    transform: translateY(1px);
}

.filter-toggle-btn i {
    font-size: 14px;
    margin-right: 6px;
}

.header-controls {
    display: flex;
    align-items: center;
    gap: 20px;
}

.advanced-controls {
    display: none;
    align-items: center;
    gap: 20px;
    transition: all 0.3s ease;
}

.advanced-controls.visible {
    display: flex;
}

@media (max-width: 768px) {
    .header-controls {
        flex-direction: column;
        align-items: flex-start;
        gap: 10px;
    }

    .advanced-controls {
        flex-direction: column;
        align-items: flex-start;
        width: 100%;
    }

    .view-controls {
        width: 100%;
        justify-content: space-between;
    }
}

.badge.bg-success {
    background-color: #28a745;
    color: white;
    font-size: 0.75em;
    padding: 4px 8px;
    border-radius: 12px;
    margin-left: 8px;
    font-weight: 500;
    display: inline-block;
    vertical-align: middle;
}

.table-success {
    background-color: var(--exact-match-bg) !important;
}

.table-warning {
    background-color: var(--close-match-bg) !important;
}

.table-info {
    background-color: var(--partial-match-bg) !important;
}

.table-danger {
    background-color: var(--poor-match-bg) !important;
}

.table td.dtr-control .badge {
    font-size: 0.75rem;
    padding: 0.25rem 0.5rem;
    margin-left: 0.5rem;
    vertical-align: middle;
    white-space: nowrap;
    display: inline-block;
}

.table td.dtr-control {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.table td.dtr-control .din-link {
    flex-shrink: 0;
}

.table td.dtr-control .expand-control {
    margin-left: auto;
}

.score-indicator {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 4px 8px;
    border-radius: 4px;
    font-size: 0.85em;
    font-weight: 500;
    margin-top: 4px;
    width: 130px;
}

.score-indicator.exact {
    background-color: var(--exact-match-bg);
    color: #2e7d32;
    border: 1px solid var(--exact-match-border);
}

.score-indicator.close {
    background-color: var(--close-match-bg);
    color: #f57c00;
    border: 1px solid var(--close-match-border);
}

.score-indicator i {
    font-size: 1em;
}

.autocomplete-item.match-exact {
    background-color: var(--exact-match-bg);
    border-left: 4px solid var(--exact-match-border);
}

.autocomplete-item.match-close {
    background-color: var(--close-match-bg);
    border-left: 4px solid var(--close-match-border);
}

.autocomplete-item:hover {
    transform: translateX(5px);
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
}

/* DIN Details Layout */
.din-details-container {
    display: grid;
    grid-template-columns: 1fr 300px;
    gap: 20px;
    align-items: start;
}

.din-details-left {
    min-width: 0;
}

.din-details-right {
    width: 300px;
    position: sticky;
    top: 20px;
}

/* Scoring Breakdown Styles */
.din-detail-card.scoring {
    border: 1px solid #dee2e6;
    border-radius: 8px;
    overflow: hidden;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    width: 100%;
    margin-bottom: 0;
}

/* Match type backgrounds */
.din-detail-card.scoring.match-exact {
    background: var(--exact-match-bg);
    border-color: var(--exact-match-border);
}

.din-detail-card.scoring.match-close {
    background: var(--close-match-bg);
    border-color: var(--close-match-border);
}

.din-detail-card.scoring.match-partial {
    background: var(--partial-match-bg);
    border-color: var(--partial-match-border);
}

.din-detail-card.scoring.match-poor {
    background: var(--poor-match-bg);
    border-color: var(--poor-match-border);
}

.din-detail-card.scoring .card-header {
    background: rgba(255, 255, 255, 0.9);
    padding: 12px;
    border-bottom: 1px solid rgba(0, 0, 0, 0.1);
}

.din-detail-card.scoring .header-content {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 8px;
}

.din-detail-card.scoring .header-left {
    display: flex;
    align-items: center;
    gap: 8px;
}

.din-detail-card.scoring .header-left i {
    color: #062868;
    font-size: 16px;
}

.din-detail-card.scoring .header-left h4 {
    margin: 0;
    font-size: 16px;
    font-weight: 600;
    color: #062868;
}

.din-detail-card.scoring .score-badge {
    background: #062868;
    color: white;
    padding: 4px 8px;
    border-radius: 12px;
    font-size: 12px;
    font-weight: 600;
}

.din-detail-card.scoring .match-type-badge {
    background: rgba(6, 40, 104, 0.1);
    color: #062868;
    padding: 4px 8px;
    border-radius: 12px;
    font-size: 11px;
    font-weight: 600;
    text-align: center;
}

.din-detail-card.scoring .card-content {
    padding: 12px;
}

.scoring-grid {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.score-row {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px;
    border-radius: 6px;
    background: rgba(255, 255, 255, 0.7);
    border: 1px solid rgba(255, 255, 255, 0.5);
}

.score-row.achieved {
    /* background: rgba(76, 175, 80, 0.1);
    border-color: rgba(76, 175, 80, 0.3); */
}

.score-row.missed {
    background: rgba(244, 67, 54, 0.1);
    border-color: rgba(244, 67, 54, 0.3);
}

.score-row.bonus {
    background: linear-gradient(135deg, rgba(255, 193, 7, 0.1), rgba(255, 152, 0, 0.1));
    border-color: rgba(255, 193, 7, 0.4);
}

.score-icon {
    width: 20px;
    height: 20px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 10px;
    flex-shrink: 0;
}

.score-row.achieved .score-icon {
    background: #4caf50;
    color: white;
}

.score-row.missed .score-icon {
    background: #f44336;
    color: white;
}

.score-row.bonus .score-icon {
    background: #ffc107;
    color: #333;
}

.score-details {
    flex: 1;
    min-width: 0;
}

.score-label {
    font-size: 12px;
    font-weight: 600;
    color: #333;
    line-height: 1.2;
}

.score-desc {
    font-size: 10px;
    color: #666;
    line-height: 1.2;
    margin-top: 1px;
}

.score-points {
    font-size: 11px;
    font-weight: 600;
    color: #062868;
    white-space: nowrap;
    flex-shrink: 0;
}

@media (max-width: 1024px) {
    .din-details-container {
        grid-template-columns: 1fr;
        gap: 15px;
    }
    
    .din-details-right {
        width: 100%;
        position: static;
    }
}

@media (max-width: 768px) {
    .din-detail-card.scoring .card-header {
        padding: 10px;
    }
    
    .din-detail-card.scoring .card-content {
        padding: 10px;
    }
    
    .scoring-grid {
        gap: 6px;
    }
    
    .score-row {
        padding: 6px;
    }
}

/* Column Visibility Dropdown */
.dt-button-collection {
    position: fixed !important; 
    margin-top: 45px !important;
    transform: none !important; 
    top: auto !important;
    left: auto !important;
    margin-left: 0px !important;
}

/* Position the dropdown relative to its button */
.dt-button {
    position: relative;
}

/* Ensure dropdown appears on top of other elements */
.dt-button-collection {
    z-index: 1000;
    background: white;
    border: 1px solid rgba(0,0,0,.15);
    border-radius: 4px;
    padding: 0.5rem 0;
    box-shadow: 0 2px 5px rgba(0,0,0,.1);
    min-width: 160px;
    max-height: 400px;
    overflow-y: auto;
}

/* Override any DataTables absolute positioning */
.dt-button-collection-title {
    position: relative !important;
}

/* Ensure buttons container doesn't affect dropdown positioning */
.dt-buttons {
    position: relative;
}

/* Remove transform that might interfere with positioning */
.dt-button-collection[role="menu"] {
    transform: none !important;
}

/* NDCs with same active ingredients section */
.same-ingredients-section {
    margin-top: 30px;
    padding: 20px;
    background: #f8f9fa;
    border-radius: 12px;
    border: 1px solid #e9ecef;
}

.same-ingredients-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
}

.same-ingredients-header h4 {
    margin: 0;
    color: var(--primary-color);
    font-size: 1.25rem;
    font-weight: 600;
}

.loading-indicator {
    color: #6c757d;
    font-style: italic;
}

.ndc-cards-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 20px;
    margin-top: 15px;
}

.ndc-card-link {
    text-decoration: none;
    color: inherit;
    display: block;
    transition: all 0.3s ease;
}

.ndc-card-link:hover {
    text-decoration: none;
    color: inherit;
    transform: translateY(-2px);
}

.ndc-card {
    background: white;
    border: 1px solid #dee2e6;
    border-radius: 8px;
    padding: 20px;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

.ndc-card-link:hover .ndc-card {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0,0,0,0.15);
    border-color: var(--primary-color);
}

.ndc-card-header {
    margin-bottom: 15px;
}

.ndc-card-header .ndc-brand-name {
    margin: 0 0 8px 0;
    color: var(--primary-color);
    font-size: 1.1rem;
    font-weight: 600;
}

.ndc-card-header .ndc-number {
    color: #6c757d;
    font-size: 0.9rem;
    font-weight: 500;
}

.ndc-card-body {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.ndc-details {
    display: flex;
    flex-direction: column;
    gap: 8px;
    font-size: 0.9rem;
    color: #495057;
}

.ndc-details div {
    line-height: 1.4;
}

.ndc-details strong {
    color: #212529;
}

.ndc-matches {
    display: flex;
    justify-content: flex-end;
    margin-top: auto;
}

.ndc-matches .badge {
    font-size: 0.8rem;
    padding: 6px 12px;
}

.no-results {
    text-align: center;
    color: #6c757d;
    font-style: italic;
    padding: 20px;
}

.error {
    text-align: center;
    color: var(--error-color);
    padding: 20px;
}

/* Responsive design for NDC cards */
@media (max-width: 768px) {
    .ndc-cards-grid {
        grid-template-columns: 1fr;
        gap: 15px;
    }
    
    .ndc-card {
        padding: 15px;
    }
    
    .same-ingredients-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 10px;
    }
    
    .same-ingredients-header h4 {
        font-size: 1.1rem;
    }
}

@media (max-width: 480px) {
    .ndc-card {
        padding: 12px;
    }
    
    .ndc-card-header .ndc-brand-name {
        font-size: 1rem;
    }
    
    .ndc-details {
        font-size: 0.85rem;
    }
}

/* How to Use Section Styles */
.how-to-use-section {
    margin-top: 2rem;
    margin-bottom: 2rem;
}

.how-to-use-section .card {
    border: 1px solid #e9ecef;
    border-radius: 8px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    transition: box-shadow 0.3s ease;
}

.how-to-use-section .card:hover {
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

.how-to-use-section .card-header {
    background: linear-gradient(135deg, #062868 0%, #1e3a8a 100%);
    color: white;
    border-bottom: none;
    border-radius: 8px 8px 0 0;
    padding: 1rem 1.5rem;
}

.how-to-use-section .card-header h5 {
    margin: 0;
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.how-to-use-section .card-header i {
    font-size: 1.2em;
}

.how-to-use-section .card-body {
    padding: 1.5rem;
}

.how-to-use-section h6 {
    color: #062868;
    font-weight: 600;
    margin-bottom: 1rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.how-to-use-section h6 i {
    font-size: 1.1em;
}

.how-to-use-section ul {
    margin-bottom: 0;
}

.how-to-use-section li {
    margin-bottom: 0.5rem;
    padding-left: 0.5rem;
    position: relative;
}

.how-to-use-section li:last-child {
    margin-bottom: 0;
}

.how-to-use-section li strong {
    color: #062868;
    font-weight: 600;
}

.how-to-use-section .text-success {
    color: #28a745 !important;
}

.how-to-use-section .text-warning {
    color: #ffc107 !important;
}

.how-to-use-section .text-info {
    color: #17a2b8 !important;
}

.how-to-use-section .text-primary {
    color: #062868 !important;
}

/* Responsive adjustments for How to Use section */
@media (max-width: 768px) {
    .how-to-use-section .card-body {
        padding: 1rem;
    }
    
    .how-to-use-section .row {
        margin: 0;
    }
    
    .how-to-use-section .col-md-6 {
        margin-bottom: 1rem;
    }
    
    .how-to-use-section .col-md-6:last-child {
        margin-bottom: 0;
    }
    
    .how-to-use-section h6 {
        font-size: 1rem;
    }
    
    .how-to-use-section li {
        font-size: 0.9rem;
    }
}

@media (max-width: 480px) {
    .how-to-use-section .card-header {
        padding: 0.75rem 1rem;
    }
    
    .how-to-use-section .card-header h5 {
        font-size: 1rem;
    }
    
    .how-to-use-section .card-body {
        padding: 0.75rem;
    }
    
    .how-to-use-section h6 {
        font-size: 0.9rem;
        margin-bottom: 0.75rem;
    }
    
    .how-to-use-section li {
        font-size: 0.85rem;
        margin-bottom: 0.4rem;
    }
}
