
:root {
    --primary: #2563EB;
    /* Royal Blue */
    --primary-dark: #1E40AF;
    --accent: #3B82F6;
    /* Bright Blue */
    --accent-light: #EFF6FF;
    --accent-hover: #1D4ED8;
    --bg-primary: #FFFFFF;
    --bg-secondary: #F9FAFB;
    --text-primary: #000000;
    --text-secondary: #4B5563;
    --border: #E5E7EB;
    --success: #10B981;
    --danger: #EF4444;
    --radius-sm: 0.375rem;
    --radius-md: 0.5rem;
    --radius-lg: 0.75rem;
    --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
    --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
    --font-main: 'Inter', sans-serif;
    --font-header: 'Poppins', sans-serif;
    --safe-area-top: env(safe-area-inset-top);
    --safe-area-bottom: env(safe-area-inset-bottom);
}

* {
    box-sizing: border-box;
    -webkit-tap-highlight-color: transparent;
}

.hidden {
    display: none !important;
}

body {
    margin: 0;
    font-family: var(--font-main);
    background: var(--bg-primary);
    color: var(--text-primary);
    height: 100vh;
    height: 100dvh;
    overflow: hidden;
}

h1,
h2,
h3,
h4,
h5 {
    font-family: var(--font-header);
    margin-top: 0;
}

.app-container {
    display: flex;
    flex-direction: column;
    height: 100%;
    max-width: 600px;
    margin: 0 auto;
    background: var(--bg-primary);
    position: relative;
    overflow: hidden;
    box-shadow: 0 0 20px rgba(0, 0, 0, 0.05);
}

/* Header */
.app-header {
    padding: 0.75rem 1rem;
    background: var(--bg-primary);
    border-bottom: 1px solid var(--border);
    flex-shrink: 0;
    text-align: center;
    /* Ensure z-index is high enough if needed */
    z-index: 50;
    display: flex;
    align-items: center;
    justify-content: center;
}

.logo-title {
    font-size: 1.1rem;
    font-weight: 700;
    color: var(--text-primary);
    margin: 0;
    letter-spacing: -0.5px;
}

.logo-title span {
    color: var(--accent);
}

/* Views */
.view {
    flex: 1;
    overflow-y: auto;
    display: none;
    flex-direction: column;
    -webkit-overflow-scrolling: touch;
    position: relative;
    height: 100%;
}

.view.active {
    display: flex;
    animation: fadeIn 0.2s ease-in-out;
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

#view-results {
    background: var(--bg-secondary);
    position: relative;
}

#view-results>* {
    max-width: 100%;
}

/* Utilities */
.mt-2 {
    margin-top: 0.5rem;
}

.mt-3 {
    margin-top: 0.75rem;
}

.mt-4 {
    margin-top: 1rem;
}

.ml-2 {
    margin-left: 0.5rem;
}

.hidden {
    display: none !important;
}

.text-right {
    text-align: right;
}

.text-center {
    text-align: center;
}

@media (max-width: 400px) {
    .col-hide-mobile {
        display: none;
    }
}


/* Typography */
.stage-title {
    font-size: 1.3rem;
    margin-bottom: 1rem;
    text-align: center;
    color: var(--text-primary);
    font-weight: 400; /* Not bold */
}

.section-title {
    font-size: 0.85rem;
    margin-bottom: 0.25rem;
    font-weight: 600;
}

/* Search Stages (State 1 & 2) */
.search-stage {
    padding: 2rem 0.75rem;
}

#view-hospital-search .search-stage:focus-within .intro-text,
#view-item-search .search-stage:focus-within .intro-text {
    display: none !important;
}

#view-item-search .search-stage {
    padding-top: 1rem;
}

#view-item-search .stage-title {
    font-size: 1.2rem;
    text-align: left;
    margin-bottom: 0.5rem;
    line-height: 1.4;
    font-weight: 600;
}

#view-item-search #edit-hospital {
    color: var(--text-primary);
    font-size: 1.25rem;
    margin-right: 0.25rem;
    padding: 0 1rem;
}

#label-hospital {
    color: var(--text-primary);
    font-weight: 600;
}

.input-modern {
    position: relative;
    display: flex;
    align-items: center;
    background: #FFFFFF;
    border-radius: var(--radius-md);
    border: 2px solid #374151;
    padding: 0.75rem 0.6rem;
    box-shadow: var(--shadow-sm);
    transition: all 0.2s ease;
}

.input-modern:focus-within {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px var(--accent-light);
}

#view-hospital-search .search-stage {
    flex: 1 0 auto;
    padding-bottom: 2rem;
}

#view-hospital-search .app-footer {
    flex-shrink: 0;
    margin-top: auto;
}

.icon-left {
    margin-right: 0.4rem;
    color: #374151;
    font-size: 1.25rem;
}

.input-modern input {
    flex: 1;
    border: none;
    background: transparent;
    font-family: inherit;
    font-size: 1rem;
    color: var(--text-primary);
    width: 100%;
}

.input-modern input:focus {
    outline: none;
}

.input-modern input::placeholder {
    color: #6B7280;
    opacity: 1;
}

.btn-clear {
    background: transparent;
    border: none;
    color: var(--text-secondary);
    font-size: 1.25rem;
    cursor: pointer;
    padding: 0.25rem;
}

.suggestions-dropdown {
    background: #ffffff;
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    margin-top: 0.25rem;
    box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05);
    max-height: 300px;
    overflow-y: auto;
    position: absolute;
    top: 100%;
    left: -2px;
    right: -2px;
    z-index: 1000;
}

.suggestion-item {
    padding: 0.75rem 1rem;
    border-bottom: 1px solid var(--border);
    color: var(--text-primary);
    font-size: 0.95rem;
    cursor: pointer;
}

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

.suggestion-item:hover, .suggestion-item:active {
    background-color: var(--bg-secondary);
}

.suggestion-content {
    display: flex;
    flex-direction: column;
    flex: 1;
    min-width: 0;
}

.suggestion-sub {
    font-size: 0.8rem;
    color: var(--text-secondary);
}

/* Results Header (State 3) */
.results-header {
    display: flex;
    align-items: center;
    padding: 0.5rem 0.75rem;
    background: var(--bg-primary);
    border-bottom: 1px solid var(--border);
    z-index: 10;
}

.results-header-info {
    flex: 1;
    margin-left: 1rem;
}

.btn-icon {
    background: transparent;
    border: 2px solid var(--border);
    border-radius: 50%;
    color: var(--text-secondary);
    font-size: 1.5rem;
    cursor: pointer;
    padding: 0.5rem;
    margin-right: 0.5rem;
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: border-color 0.2s, background-color 0.2s;
}

.btn-icon:hover {
    border-color: var(--primary);
    background-color: rgba(37, 99, 235, 0.05);
}

.btn-icon:active {
    background-color: rgba(37, 99, 235, 0.1);
}

#btn-toggle-details {
    margin-right: 0;
    font-size: 1.25rem;
    color: var(--accent);
    background: var(--bg-primary);
    border-radius: var(--radius-sm);
    width: 2rem;
    height: 2rem;
    display: flex;
    align-items: center;
    justify-content: center;
}



#result-hospital-name {
    font-size: 1rem;
    font-weight: 600;
    margin: 0;
    color: var(--text-primary);
    line-height: 1.2;
}

#result-hospital-name::before {
    content: "Finding Hospital Prices for:";
    display: block;
    font-size: 0.65rem;
    color: var(--text-secondary);
    font-weight: 500;
    text-transform: uppercase;
    margin-bottom: 2px;
}

#result-item-name {
    font-size: 0.8rem;
    color: var(--text-secondary);
    margin: 0;
    line-height: 1.2;
}

/* Price Range Graph (Custom CSS Distribution) */
.visual-graph-container {
    padding-top: 0.25rem !important;
    margin-top: 0 !important;
    padding: 0 1rem;
    width: 100%;
}

.graph-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 0;
    background: var(--bg-secondary);
    border: 1px solid var(--border);
    border-bottom: none;
    border-radius: var(--radius-md) var(--radius-md) 0 0;
    padding: 0.5rem 0.75rem;
}

.graph-header .section-title {
    font-variant: all-small-caps;
    letter-spacing: 0.05em;
}

.graph-header .section-title {
    margin-bottom: 0;
}

.btn-text {
    background: none;
    border: none;
    color: var(--accent);
    font-size: 0.8rem;
    cursor: pointer;
}

.distribution-graph {
    background: var(--bg-secondary);
    border: 1px solid var(--border);
    border-top: none;
    border-radius: 0 0 var(--radius-md) var(--radius-md);
    padding: 1rem;
    position: relative;
}

.graph-axis {
    width: 100%;
    height: 30px;
    border-bottom: 1px solid var(--text-secondary);
    position: relative;
    margin-bottom: 0.5rem;
}

.graph-tick {
    position: absolute;
    bottom: 0;
    width: 4px;
    height: 100%;
    background: rgba(37, 99, 235, 0.4);
    /* translucent accent */
    border-radius: 2px 2px 0 0;
    transform: translateX(-50%);
}

.graph-tick-highlight {
    background: rgba(239, 68, 68, 0.7);
    /* translucent red for high */
}

.graph-tick-low {
    background: rgba(16, 185, 129, 0.7);
    /* translucent green for low */
}

/* Axis Scale Ticks (Downward) */
.graph-axis-tick {
    position: absolute;
    top: 100%; /* Below the axis line */
    width: 1px;
    height: 6px;
    background-color: var(--text-secondary);
    transform: translateX(-50%);
}

.graph-labels {
    display: flex;
    justify-content: space-between;
    font-size: 0.75rem;
    color: var(--text-secondary);
    margin-top: 0.5rem; /* Space for ticks */
}

/* Interactive Graph Elements */
.graph-info-panel {
    background: var(--bg-secondary);
    padding: 0.5rem 0.75rem;
    border-radius: var(--radius-sm);
    margin-bottom: 0.5rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
    border: 1px solid var(--border);
    transition: opacity 0.2s;
    min-height: 2.5rem;
    /* prevent layout shift */
}

.info-val {
    font-weight: 700;
    font-size: 0.9rem;
    color: var(--text-primary);
    font-family: 'Poppins', sans-serif;
}

.info-desc {
    font-size: 0.75rem;
    color: var(--text-secondary);
    flex: 1;
    margin-left: 1rem;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    text-align: right;
}

.graph-hover-line {
    position: absolute;
    bottom: 0;
    width: 2px;
    height: 45px;
    /* extends above axis */
    background: var(--text-primary);
    transform: translateX(-50%);
    pointer-events: none;
    z-index: 5;
}

.graph-selection-marker {
    position: absolute;
    bottom: -4px;
    width: 10px;
    height: 10px;
    background: var(--accent);
    border: 2px solid white;
    border-radius: 50%;
    transform: translateX(-50%);
    pointer-events: none;
    z-index: 6;
    box-shadow: 0 0 0 2px var(--accent-light);
}

/* Filters Scroll */
.filters-scroll {
    display: flex;
    overflow-x: auto;
    padding: 0;
    scrollbar-width: none;
    -webkit-overflow-scrolling: touch;
}

.filters-scroll::-webkit-scrollbar {
    display: none;
}

.filter-group {
    display: flex;
    background: #e2e8f0;
    padding: 3px;
    border-radius: var(--radius-md);
    flex-shrink: 0;
    gap: 3px;
}

.filter-toggle {
    background: transparent;
    border: none;
    padding: 0.4rem 0.6rem;
    font-size: 0.75rem;
    color: var(--text-secondary);
    cursor: pointer;
    font-weight: 600;
    border-radius: calc(var(--radius-md) - 2px);
    transition: all 0.15s ease;
}

.filter-toggle.active {
    background: var(--primary);
    color: white;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.1);
}

.modifier-filter-btn {
    background: transparent;
    border: none;
    padding: 0.4rem 0.6rem;
    font-size: 0.75rem;
    color: var(--text-secondary);
    cursor: pointer;
    font-weight: 600;
    border-radius: calc(var(--radius-md) - 2px);
    transition: all 0.15s ease;
}

.modifier-filter-btn.active {
    background: var(--primary);
    color: white;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.1);
}

/* Modifier Menu */
.modifier-menu {
    position: fixed;
    z-index: 10001 !important;
    background: white;
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    box-shadow: 0 4px 12px rgba(0,0,0,0.15);
    min-width: 200px;
    margin-top: 5px;
    display: flex;
    flex-direction: column;
}

.modifier-menu.hidden {
    display: none;
}

.modifier-menu-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 8px 12px;
    border-bottom: 1px solid var(--border);
    font-weight: 600;
    font-size: 0.8rem;
    color: var(--text-primary);
}

.modifier-options {
    max-height: 250px;
    overflow-y: auto;
    padding: 4px 0;
}

.modifier-option {
    display: flex;
    align-items: center;
    padding: 6px 12px;
    gap: 8px;
    cursor: pointer;
    font-size: 0.75rem;
    color: var(--text-secondary);
}

.modifier-option:hover {
    background: #f8fafc;
}

.modifier-option input {
    margin: 0;
}

.modifier-option label {
    flex: 1;
    cursor: pointer;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.modifier-menu-footer {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 8px 12px;
    border-top: 1px solid var(--border);
    gap: 8px;
}

/* Data Table Container */
.table-container {
    padding: 0 1rem;
    background: var(--bg-secondary);
    border-top: 1px solid var(--border);
    border-bottom: 1px solid var(--border);
    flex: 1;
    min-height: 0;
    overflow-y: auto;
    overflow-x: hidden;
    padding-bottom: 2rem;
}

.pricing-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.85rem;
}

.pricing-table th {
    background: var(--accent-light);
    padding: 0.75rem 0.5rem;
    font-size: 0.95rem;
    text-align: left;
    color: var(--text-primary);
    font-weight: 600;
    font-variant: all-small-caps;
    letter-spacing: 0.02em;
    border-bottom: 1px solid var(--border);
    position: sticky;
    top: 0;
    z-index: 5;
    user-select: none;
}

.pricing-table th.sortable {
    cursor: pointer;
    transition: background-color 0.2s;
}

.pricing-table th.sortable:hover {
    background-color: var(--border);
    color: var(--text-primary);
}

/* Ensure border stays visible on sticky th */
.pricing-table th::after {
    content: '';
    position: absolute;
    bottom: -1px;
    left: 0;
    width: 100%;
    border-bottom: 1px solid var(--border);
}

.pricing-table th:first-child,
.pricing-table td:first-child {
    padding-left: 1rem;
}

.pricing-table th:last-child,
.pricing-table td:last-child {
    padding-right: 1rem;
}

.pricing-table td {
    padding: 0.75rem 0.5rem;
    border-bottom: 1px solid var(--border);
    color: var(--text-primary);
    vertical-align: middle;
    word-wrap: break-word;
    overflow-wrap: break-word;
}

.pricing-table tr:last-child td {
    border-bottom: none;
}

.table-cell-payer {
    font-weight: 400;
}

.table-cell-plan {
    color: var(--text-secondary);
}

.table-cell-charge {
    font-weight: 400 !important;
    font-family: 'Inter', sans-serif;
    font-variant-numeric: tabular-nums !important;
    text-align: right !important;
    padding-right: 1rem !important;
}

/* Expandable Data Rows */
.data-row {
    cursor: pointer;
    transition: background-color 0.15s ease;
}

.data-row:active,
.data-row.expanded {
    background-color: var(--accent-light);
}

.data-row.expanded {
    border-bottom-color: transparent; /* Seamless connection to details */
}

.data-row.expanded td:first-child {
    border-left: 4px solid var(--accent);
}

.data-row.pinned {
    position: sticky;
    top: 44px; /* Approximate header height */
    z-index: 4;
}

.data-row.pinned td {
    background-color: #f3f4f6;
    color: var(--text-primary);
    font-weight: 400;
}

.data-row.pinned .table-cell-plan {
    color: var(--text-secondary);
}

.btn-pin-toggle {
    background: var(--accent);
    border: 1px solid var(--accent);
    border-radius: var(--radius-sm);
    padding: 0.35rem 0.75rem;
    font-size: 0.8rem;
    color: white;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    width: fit-content;
    white-space: nowrap;
}

.btn-pin-toggle:active {
    transform: scale(0.98);
}

.btn-pin-toggle.active {
    background: transparent;
    color: var(--accent);
    border-color: var(--accent);
}

/* Info Modal */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.2s;
}

.modal-overlay.active {
    opacity: 1;
    pointer-events: auto;
}

.modal-card {
    background: var(--bg-secondary);
    width: 90%;
    max-width: 400px;
    border-radius: var(--radius-lg);
    padding: 1.5rem;
    box-shadow: var(--shadow-md);
    position: relative;
    transform: translateY(10px);
    transition: transform 0.2s;
}

.modal-overlay.active .modal-card {
    transform: translateY(0);
}

#close-item-modal {
    position: absolute;
    top: 0.75rem;
    right: 0.75rem;
    margin: 0;
    padding: 0.4rem;
    background: var(--bg-primary);
    border: 2px solid var(--border);
    border-radius: 50%;
    width: 2rem;
    height: 2rem;
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 10;
    font-size: 1.25rem;
    color: var(--text-secondary);
    cursor: pointer;
    transition: border-color 0.2s, background-color 0.2s;
}

#close-item-modal:hover {
    border-color: var(--primary);
    background-color: rgba(37, 99, 235, 0.05);
}

#close-item-modal:active {
    background-color: rgba(37, 99, 235, 0.1);
}

.modal-title {
    display: none;
}

.modal-body {
    font-size: 0.9rem;
    color: var(--text-secondary);
    line-height: 1.5;
}

.modal-footer {
    display: flex;
    justify-content: flex-end;
    padding-top: 1rem;
}

.btn-suggestion-info {
    background: none;
    border: none;
    color: var(--accent);
    padding: 0.5rem;
    font-size: 1.25rem;
    cursor: pointer;
    margin-left: 0.5rem;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
}

.btn-suggestion-info:active {
    background-color: var(--bg-primary);
}

/* Details Row / Card Styles */
.details-row td {
    padding: 0 !important;
    border-bottom: 2px solid var(--border) !important;
    background: var(--accent-light); /* Background continuation */
    border-left: 4px solid var(--accent);
}

.details-card {
    padding: 1rem;
    background-color: var(--accent-light);
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    font-size: 0.8rem;
    position: relative;
    /* ensure it covers any gap */
    margin-top: -1px;
}

.details-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 1rem;
    width: 100%;
}

.detail-item {
    display: flex;
    flex-direction: column;
}

.detail-label {
    font-size: 0.7rem;
    text-transform: uppercase;
    color: var(--text-secondary);
    font-weight: 600;
    letter-spacing: 0.5px;
    margin-bottom: 0.15rem;
}

.detail-value {
    color: var(--text-primary);
    font-weight: 500;
}

.detail-item.full-width {
    grid-column: 1 / -1;
}

.details-actions {
    display: flex;
    justify-content: flex-end;
    margin-top: 0;
    width: 100%;
}

.loading-state {
    padding: 2rem;
    text-align: center;
    color: var(--text-secondary);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
}

.spinner-icon {
    font-size: 2rem;
    color: var(--accent);
    animation: spin 1s linear infinite;
    margin-bottom: 0.5rem;
}

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

@keyframes spin {
    to {
        transform: rotate(360deg);
    }
}

/* Buttons */
.btn-primary {
    width: 100%;
    background: var(--accent);
    color: white;
    border: none;
    border-radius: var(--radius-md);
    padding: 1rem;
    font-size: 1.05rem;
    font-weight: 600;
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 0.5rem;
    cursor: pointer;
    box-shadow: 0 4px 14px 0 rgba(37, 99, 235, 0.39);
    transition: transform 0.1s, box-shadow 0.2s, background 0.2s, opacity 0.2s;
}

/* Override for modal select button to be right-aligned and not full width */
#btn-select-item-modal {
    width: auto;
    padding-left: 2rem;
    padding-right: 2rem;
    justify-content: center;
    align-self: flex-end;
}

.btn-primary:active {
    transform: scale(0.98);
    background: var(--accent-hover);
}

.btn-primary.disabled {
    background: var(--accent);
    color: white;
    box-shadow: none;
    border: none;
    cursor: not-allowed;
    opacity: 0.5;
}

/* Tags */
.tags-container {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
}

.tag {
    background: var(--bg-primary);
    border: 1px solid var(--border);
    padding: 0.4rem 0.75rem;
    border-radius: 2rem;
    font-size: 0.8rem;
    color: var(--text-primary);
    cursor: pointer;
    transition: all 0.2s;
}

.tag:active {
    background: var(--accent-light);
    border-color: var(--accent);
    color: var(--accent);
}

/* Results Summary */
.price-summary-card {
    background: var(--bg-primary);
    color: var(--text-primary);
    padding: 0;
    margin: 0;
    border: none;
    border-left: 4px solid var(--primary);
    border-radius: 0;
    box-shadow: none;
    border-top: 1px solid var(--border);
    border-bottom: 1px solid var(--border);
}

.price-summary-row {
    display: flex;
    justify-content: space-around;
}

.summary-stat {
    text-align: center;
}

.stat-label {
    display: block;
    font-size: 0.75rem;
    color: var(--text-secondary);
    margin-bottom: 0.15rem;
    font-variant: all-small-caps;
    letter-spacing: 0.05em;
}

.stat-value {
    display: block;
    font-size: 0.9rem;
    font-weight: 700;
    font-family: 'Inter', sans-serif;
    font-variant-numeric: tabular-nums;
}

/* Thicker, darker bottom border for pinned row */
.pricing-table tr.data-row.pinned td {
    border-bottom: none !important;
    box-shadow: inset 0 -2px 0 0 #6b7280, 0 4px 6px -1px rgba(0, 0, 0, 0.1) !important;
}

/* Results Mode */
body.results-mode .app-header {
    display: none !important;
}

body.results-mode .results-header {
    padding-top: max(0.5rem, env(safe-area-inset-top));
    background: var(--bg-secondary);
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.05);
    border-bottom: none;
    position: sticky;
    top: 0;
}

.results-details-wrapper {
    overflow: hidden;
    transition: max-height 0.3s ease-out, opacity 0.3s ease-out;
    max-height: 500px;
    opacity: 1;
}

.results-details-wrapper.collapsed {
    max-height: 0;
    opacity: 0;
}

/* Filter Status Toast Overlay */
.filter-status-toast {
    position: fixed;
    bottom: 15%;
    left: 50%;
    transform: translateX(-50%) translateY(100px);
    background: rgba(30, 41, 59, 0.95);
    color: white;
    padding: 0.75rem 1.5rem;
    border-radius: 2rem;
    font-size: 0.9rem;
    font-weight: 500;
    z-index: 20000;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    transition: transform 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275), opacity 0.3s ease;
    opacity: 0;
    pointer-events: none;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    border: 1px solid rgba(255, 255, 255, 0.1);
}

.filter-status-toast.active {
    transform: translateX(-50%) translateY(0);
    opacity: 1;
}

.filter-status-toast i {
    color: var(--accent);
    font-size: 1.1rem;
}



/* Moved from index.html */
.app-header {
                position: relative;
                justify-content: center;
                flex-direction: column;
                gap: 0.25rem;
            }
            #global-back-btn {
                position: absolute;
                left: 0.5rem;
                top: 50%;
                transform: translateY(-50%);
                margin: 0;
                z-index: 20;
                border: 1px solid var(--border);
                border-radius: 50%;
                width: 40px;
                height: 40px;
                display: flex;
                align-items: center;
                justify-content: center;
                background: var(--bg-primary);
                box-shadow:
                    0 2px 4px rgba(0, 0, 0, 0.05),
                    0 1px 2px rgba(0, 0, 0, 0.1);
                color: var(--primary);
                font-size: 1.5rem;
                cursor: pointer;
                padding: 0;
                transition: all 0.2s ease;
            }
            #global-back-btn:hover {
                background-color: var(--bg-secondary);
                box-shadow:
                    0 4px 6px rgba(0, 0, 0, 0.05),
                    0 2px 4px rgba(0, 0, 0, 0.1);
            }
            #global-back-btn:active {
                background-color: var(--border);
                transform: translateY(-50%) scale(0.95);
            }
            #btn-back-to-search {
                border: 1px solid var(--border);
                border-radius: 50%;
                width: 40px;
                height: 40px;
                display: flex;
                align-items: center;
                justify-content: center;
                background: var(--bg-primary);
                box-shadow:
                    0 2px 4px rgba(0, 0, 0, 0.05),
                    0 1px 2px rgba(0, 0, 0, 0.1);
                color: var(--primary);
                font-size: 1.5rem;
                cursor: pointer;
                padding: 0;
                margin-right: 0.5rem;
                transition: all 0.2s ease;
            }
            #btn-back-to-search:hover {
                background-color: var(--bg-secondary);
                box-shadow:
                    0 4px 6px rgba(0, 0, 0, 0.05),
                    0 2px 4px rgba(0, 0, 0, 0.1);
            }
            #btn-back-to-search:active {
                background-color: var(--border);
                transform: scale(0.95);
            }
            #btn-more-options {
                padding: 0.4rem 0.6rem;
                border: 1px solid var(--border);
                border-radius: calc(var(--radius-md) - 2px);
                background: var(--bg-primary);
                box-shadow:
                    0 2px 4px rgba(0, 0, 0, 0.05),
                    0 1px 2px rgba(0, 0, 0, 0.1);
                cursor: pointer;
                color: var(--primary);
                display: flex;
                align-items: center;
                justify-content: center;
                transition: all 0.2s ease;
            }
            #btn-more-options:hover {
                background-color: var(--bg-secondary);
                box-shadow:
                    0 4px 6px rgba(0, 0, 0, 0.05),
                    0 2px 4px rgba(0, 0, 0, 0.1);
            }
            #btn-more-options:active {
                background-color: var(--border);
                transform: scale(0.95);
            }
            .font-bold {
                font-weight: 700;
            }
            .stat-value i {
                color: var(--primary);
                font-style: italic;
                cursor: pointer;
            }
            .logo-bar {
                background: transparent;
                border: none;
                padding: 0;
                margin-bottom: 0;
                width: 100%;
                display: flex;
                align-items: center;
                justify-content: flex-start;
            }
            .logo-bar a {
                display: inline-block;
                line-height: 0;
            }
            .logo-bar img {
                height: 32px;
                width: auto;
                display: block;
            }

            /* Branded Footer */
            .app-footer {
                background-color: #1a4b8d;
                color: white;
                padding: 1.5rem;
                margin-top: auto;
                width: 100%;
            }
            .footer-row {
                display: flex;
                align-items: center;
                justify-content: flex-start;
                flex-wrap: wrap;
                gap: 2rem;
                margin-bottom: 1rem;
            }
            .footer-logo img {
                height: 28px;
                filter: brightness(0) invert(1);
            }
            .footer-links {
                display: flex;
                gap: 1.5rem;
                list-style: none;
                padding: 0;
                margin: 0;
            }
            .footer-links a {
                color: white;
                text-decoration: underline;
                text-transform: uppercase;
                font-size: 0.75rem;
                font-weight: 600;
                letter-spacing: 0.5px;
            }
            .footer-copyright {
                font-size: 0.7rem;
                line-height: 1.5;
                opacity: 0.9;
                border-top: 1px solid rgba(255, 255, 255, 0.2);
                padding-top: 1rem;
                text-align: left;
            }
            .footer-copyright p {
                margin: 0 0 0.25rem 0;
            }

            /* Native-Style Mobile Privacy Toast */
            .native-toast {
                position: fixed;
                bottom: 20px;
                left: 50%;
                transform: translateX(-50%);
                width: 90%;
                max-width: 400px;
                background: rgba(255, 255, 255, 0.95);
                backdrop-filter: blur(10px);
                -webkit-backdrop-filter: blur(10px);
                border-radius: 16px;
                padding: 12px 20px;
                display: flex;
                justify-content: space-between;
                align-items: center;
                box-shadow: 0 8px 32px rgba(0, 0, 0, 0.15);
                z-index: 9999;
                font-family:
                    -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto,
                    Helvetica, Arial, sans-serif;
                border: 1px solid rgba(0, 0, 0, 0.05);
            }
            /* Terms of Service & Privacy Modal */
            #tos-modal,
            #privacy-modal,
            #ai-disclaimer-modal,
            #several-explanation-modal {
                position: fixed;
                top: 0;
                left: 0;
                width: 100%;
                height: 100%;
                background: rgba(0, 0, 0, 0.5);
                z-index: 2000;
                display: flex;
                align-items: center;
                justify-content: center;
                padding: 1rem;
            }
            #privacy-modal,
            #ai-disclaimer-modal,
            #several-explanation-modal {
                z-index: 3000;
            }
            .tos-content {
                background: white;
                width: 100%;
                max-width: 600px;
                max-height: 80vh;
                border-radius: var(--radius-lg);
                display: flex;
                flex-direction: column;
                box-shadow: var(--shadow-md);
                overflow: hidden;
            }
            .tos-header {
                padding: 1.25rem;
                border-bottom: 1px solid var(--border);
                display: flex;
                justify-content: space-between;
                align-items: center;
            }
            .tos-header h3 {
                margin: 0;
                font-size: 1.1rem;
            }
            .tos-body {
                padding: 1.25rem;
                overflow-y: auto;
                font-size: 0.9rem;
                line-height: 1.6;
                color: var(--text-primary);
            }
            .tos-body h2 {
                font-size: 1rem;
                margin-top: 1.5rem;
                margin-bottom: 0.5rem;
                color: var(--text-primary);
                text-transform: uppercase;
                letter-spacing: 0.5px;
            }
            .tos-body p {
                margin-bottom: 1rem;
            }
            .tos-body b,
            .tos-body strong {
                color: var(--text-primary);
            }
            .tos-footer {
                padding: 0.75rem 1.25rem;
                border-top: 1px solid var(--border);
                display: flex;
                justify-content: flex-end;
            }

            .native-toast p {
                font-size: 14px;
                margin: 0;
                color: #333;
                line-height: 1.4;
                padding-right: 10px;
            }
            .native-toast a {
                color: var(--primary);
                text-decoration: underline;
            }
            .native-toast button {
                background: #007aff;
                color: white;
                border: none;
                padding: 8px 16px;
                border-radius: 8px;
                font-weight: 600;
                font-size: 14px;
                cursor: pointer;
                flex-shrink: 0;
            }

            /* Table Padding & Overflow Overrides */
            .table-container { padding: 0 0.4rem !important; overflow-x: auto !important; -webkit-overflow-scrolling: touch; }
            .pricing-table th, .pricing-table td { padding: 0.4rem 0.2rem !important; }
            .pricing-table th:first-child, .pricing-table td:first-child { padding-left: 0.4rem !important; }
            .pricing-table th:last-child, .pricing-table td:last-child { padding-right: 0.4rem !important; }
#view-results:has(#results-collapsible-content.collapsed)
                        .overview-hide {
                        display: none;
                    }
                    #view-results:has(
                            #results-collapsible-content:not(.collapsed)
                        )
                        .overview-show {
                        display: none;
                    }
                    #view-results:has(#distribution-graph.hidden)
                        #graph-mode-links {
                        display: none !important;
                    }
                    .visual-graph-container:has(#distribution-graph.hidden) {
                        padding-bottom: 0.5rem;
                        margin-bottom: 0.5rem;
                    }
                    #result-item-friendly {
                        margin-bottom: 0 !important;
                    }
