:root {
    --color-primary: #667eea;
    --color-primary-light: #f0f3ff;
    --color-primary-dark: #5568d3;
    --color-background: #71a7d6;
    --color-text-primary: #333;
    --color-text-secondary: #666;
    --color-text-tertiary: #999;
    --color-border: #e0e0e0;
    --color-border-light: #f0f0f0;
    --color-success: #4caf50;
    --color-warning: #ff9800;
    --color-danger: #e74c3c;
    --border-radius: 8px;
    --border-radius-large: 12px;
    --spacing-small: 10px;
    --spacing-medium: 20px;
    --spacing-large: 30px;
    --box-shadow: 0 10px 40px rgba(0, 0, 0, 0.2);
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Inter', system-ui, -apple-system, sans-serif;
    background: var(--color-background);
    min-height: 100vh;
    padding: var(--spacing-medium);
}

body,
button,
input,
select,
textarea {
    font-family: 'Inter', system-ui, -apple-system, sans-serif;
}

.container {
    max-width: 800px;
    margin: 0 auto;
}

.header {
    text-align: center;
    color: white;
    margin-bottom: 30px;
}

.header h1 {
    font-size: 2.5em;
    margin-bottom: 10px;
}

#loading {
    background: white;
    padding: var(--spacing-large);
    border-radius: var(--border-radius-large);
    text-align: center;
    box-shadow: var(--box-shadow);
}

#loading {
    background: white;
    padding: var(--spacing-large);
    border-radius: var(--border-radius-large);
    text-align: center;
    box-shadow: var(--box-shadow);
}

#loading .spinner {
    border: 4px solid #f3f3f3;
    border-top-color: var(--color-primary);
    border-radius: 50%;
    width: 50px;
    height: 50px;
    animation: spin 1s linear infinite;
    margin: 0 auto var(--spacing-medium);
}

@keyframes spin {
    0% {
        transform: rotate(0deg);
    }
    100% {
        transform: rotate(360deg);
    }
}

.search-box {
    background: white;
    padding: var(--spacing-medium);
    border-radius: var(--border-radius-large);
    box-shadow: var(--box-shadow);
    border: 1px solid #e6e6e6;
    margin-bottom: var(--spacing-medium);
    display: none;
}

.search-box.active {
    display: block;
}

.search-input-wrapper {
    position: relative;
    display: flex;
    align-items: center;
}

#searchInput {
    width: 100%;
    padding: 15px var(--spacing-medium);
    padding-right: 45px;
    font-size: 1.1em;
    border: 2px solid var(--color-border);
    border-radius: var(--border-radius);
    outline: none;
    transition: border-color 0.3s;
}

#searchInput:focus {
    border-color: var(--color-primary);
}

.search-clear-btn {
    position: absolute;
    right: 8px;
    background: none;
    border: none;
    font-size: 1.6em;
    color: #999;
    cursor: pointer;
    padding: 4px 8px;
    border-radius: 4px;
    display: none;
    line-height: 1;
    transition: all 0.2s;
    min-width: 32px;
    min-height: 32px;
}

.search-clear-btn.visible {
    display: block;
}

.search-clear-btn:hover {
    background: #f0f0f0;
    color: #666;
}

.search-history {
    display: none;
    margin-top: 12px;
    padding-top: 12px;
    border-top: 1px solid var(--color-border-light);
}

.search-history.visible {
    display: block;
}

/* Carousel mode (unfocused) */
.search-history.carousel-mode {
    border-top: none;
    padding-top: 0;
    margin-top: 8px;
}

.search-history-carousel-wrapper {
    position: relative;
    overflow: hidden;
}

.search-history-carousel-wrapper::before,
.search-history-carousel-wrapper::after {
    content: '';
    position: absolute;
    top: 0;
    bottom: 0;
    width: 30px;
    pointer-events: none;
    opacity: 0;
    transition: opacity 0.3s;
    z-index: 1;
}

.search-history-carousel-wrapper::before {
    left: 0;
    background: linear-gradient(to right, white 0%, transparent 100%);
}

.search-history-carousel-wrapper::after {
    right: 0;
    background: linear-gradient(to left, white 0%, transparent 100%);
}

.search-history-carousel-wrapper.has-scroll-left::before,
.search-history-carousel-wrapper.has-scroll-right::after {
    opacity: 1;
}

.search-history-carousel {
    display: flex;
    gap: 6px;
    overflow-x: auto;
    overflow-y: hidden;
    scroll-behavior: smooth;
    scrollbar-width: none;
    -ms-overflow-style: none;
    padding: 2px 0;
}

.search-history-carousel::-webkit-scrollbar {
    display: none;
}

/* Expanded mode (focused) */
.search-history-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 8px;
}

.search-history-title {
    font-size: 0.85em;
    color: var(--color-text-secondary);
    font-weight: 600;
}

.search-history-clear-all {
    color: var(--color-primary);
    cursor: pointer;
    font-size: 0.85em;
    font-weight: 500;
    text-decoration: none;
    transition: color 0.2s;
}

.search-history-clear-all:hover {
    color: var(--color-primary-dark);
}

.search-history-pills {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
}

.history-pill {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 6px 12px;
    background: #f5f5f5;
    border: 1px solid var(--color-border-light);
    border-radius: 16px;
    font-size: 0.9em;
    cursor: pointer;
    transition: all 0.2s;
    max-width: 200px;
}

.history-pill:hover {
    background: #e8e8e8;
    border-color: var(--color-border);
}

.history-pill.carousel-pill {
    flex-shrink: 0;
    white-space: nowrap;
}

.history-pill-icon {
    font-size: 1em;
    opacity: 0.6;
}

.history-pill-text {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.history-pill-remove {
    font-size: 1.2em;
    opacity: 0.5;
    margin-left: 2px;
}

.history-pill-remove:hover {
    opacity: 1;
}

.search-stats {
    margin-top: var(--spacing-small);
    font-size: 0.9em;
    color: var(--color-text-secondary);
}

.stats-link {
    color: var(--color-primary);
    font-weight: 500;
    text-decoration: none;
    cursor: pointer;
}

.results {
    background: white;
    border-radius: var(--border-radius-large);
    box-shadow: var(--box-shadow);
    max-height: 500px;
    overflow-y: auto;
    border: 1px solid #e6e6e6;
    display: none;
}

.results.active {
    display: block;
}

.result-item {
    padding: 15px var(--spacing-medium);
    border-bottom: 1px solid var(--color-border-light);
    cursor: pointer;
    transition: background-color 0.2s;
    background-color: #f5f5f5;
    border-radius: 6px;
    margin-bottom: 8px;
    min-height: 44px; /* Touch-friendly tap target */
    touch-action: manipulation; /* Disable double-tap zoom */
}

.result-item:hover {
    background-color: #ececec;
}

.result-item.keyboard-selected {
    background-color: var(--color-primary-light);
    border: 2px solid var(--color-primary);
    padding: 13px calc(var(--spacing-medium) - 2px);
}

/* Remove hover effects on touch devices */
@media (hover: none) {
    .result-item:hover {
        background-color: #f5f5f5;
    }
    .result-item.keyboard-selected:hover {
        background-color: var(--color-primary-light);
    }
}

.result-item:last-child {
    border-bottom: none;
}

.route-number {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 6px 12px;
    border-radius: 6px;
    font-weight: bold;
    font-size: 0.9em;
    margin-right: 10px;
    box-shadow: inset 0 0 0 2px rgba(0, 0, 0, 0.18);
}

.route-name {
    font-size: 1.1em;
    font-weight: 600;
    margin-bottom: 5px;
}

.route-desc {
    color: #666;
    font-size: 0.9em;
}

.agency-name {
    color: #999;
    font-size: 0.85em;
    margin-top: 5px;
}

.agency-group {
    padding: 10px 0 5px;
}

.agency-group-title {
    font-size: 0.85em;
    font-weight: 600;
    color: var(--color-primary);
    text-transform: uppercase;
    letter-spacing: 0.06em;
    padding: 8px var(--spacing-medium);
    background: var(--color-primary-light);
    border-bottom: 1px solid #e5e9ff;
}

.stops-section {
    border-top: 1px solid var(--color-border-light);
}

.stops-toggle {
    width: 100%;
    padding: 12px var(--spacing-medium);
    text-align: left;
    border: none;
    background: #f8f9fa;
    color: #555;
    font-size: 0.95em;
    cursor: pointer;
    border-bottom: 1px solid var(--color-border-light);
}

.stops-toggle:disabled {
    cursor: default;
    color: #999;
    background: #fafafa;
}

.results .stops-list {
    display: none;
}

.results .stops-list.active {
    display: block;
}

.stop-result-item {
    padding: 14px var(--spacing-medium);
    border-bottom: 1px solid var(--color-border-light);
    cursor: pointer;
    transition: background-color 0.2s;
    min-height: 44px; /* Touch-friendly tap target */
    touch-action: manipulation;
}

.stop-result-item:hover {
    background-color: #f8f9fa;
}

.stop-result-item.keyboard-selected {
    background-color: var(--color-primary-light);
    border: 2px solid var(--color-primary);
    padding: 12px calc(var(--spacing-medium) - 2px);
}

@media (hover: none) {
    .stop-result-item:hover {
        background-color: white;
    }
    .stop-result-item.keyboard-selected:hover {
        background-color: var(--color-primary-light);
    }
}

.search-highlight {
    background-color: #fff59d;
    font-weight: 600;
    border-radius: 4px;
}

.stop-result-name {
    font-size: 1.05em;
    font-weight: 600;
    margin-bottom: 4px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.stop-result-meta {
    font-size: 0.9em;
    color: #5f5f5f;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.no-results {
    padding: 40px var(--spacing-medium);
    text-align: center;
    color: var(--color-text-tertiary);
}

.modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.7);
    z-index: 1000;
    overflow-y: auto;
    padding: 20px;
}

.modal.active {
    display: flex;
    align-items: center;
    justify-content: center;
}

.modal-content {
    background: white;
    border-radius: var(--border-radius-large);
    padding: var(--spacing-large);
    max-width: 600px;
    width: 100%;
    max-height: 90vh;
    overflow-y: auto;
    position: relative;
    transition: min-height 0.25s ease;
}

.modal-content.is-loading {
    min-height: 90vh;
}

.modal-content.is-loading .modal-header h2,
.modal-content.is-loading .modal-header p {
    visibility: hidden;
}

.modal-close {
    position: absolute;
    top: 8px;
    right: 8px;
    background: none;
    border: none;
    font-size: 1.6em;
    cursor: pointer;
    color: #bbb;
    width: 38px;
    height: 38px;
    line-height: 1;
    z-index: 10;
    border-radius: 8px;
    transition: all 0.2s;
}

.modal-close:hover {
    color: #666;
    background: #f5f5f5;
}

.modal-header {
    margin-bottom: var(--spacing-medium);
    padding-right: 46px;
}

.modal-header.route-header {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 10px;
}

.modal-header-top {
    display: flex;
    justify-content: flex-start;
    align-items: center;
    gap: 1vh;
    margin-bottom: 8px;
}

.modal-header-top h2 {
    flex: 1;
    margin: 0;
    min-width: 0;
    font-size: 1.4em;
}

.tooltip-target {
    position: relative;
    cursor: pointer;
}

.tooltip-target.tooltip-open::after {
    content: attr(data-tooltip);
    position: absolute;
    left: 0;
    top: calc(100% + 6px);
    background: #1b1b1b;
    color: #ffffff;
    padding: 6px 8px;
    border-radius: 6px;
    font-size: 0.85em;
    line-height: 1.3;
    max-width: min(280px, 70vw);
    white-space: normal;
    box-shadow: 0 6px 18px rgba(0, 0, 0, 0.2);
    z-index: 5;
    pointer-events: none;
}

.save-stop-btn {
    display: none;
}

.modal-route-number {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 6px 14px;
    border-radius: 6px;
    font-weight: bold;
    font-size: 1.05em;
    margin-bottom: 10px;
    box-shadow: inset 0 0 0 2px rgba(0, 0, 0, 0.18);
    min-height: 32px;
}

.modal-route-name {
    font-size: 1.5em;
    font-weight: 600;
    margin-bottom: 10px;
    min-width: 0;
}

.truncate-text {
    display: block;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.modal-header.route-header .modal-route-number,
.modal-header.route-header .modal-route-name {
    margin-bottom: 0;
}

.modal-header.route-header .modal-route-name {
    flex: 1;
    min-width: 0;
}

.detail-section {
    margin-bottom: var(--spacing-medium);
}

.detail-section h3 {
    color: var(--color-primary);
    font-size: 1.1em;
    margin-bottom: var(--spacing-small);
    border-bottom: 2px solid var(--color-primary);
    padding-bottom: 5px;
}

.direction-selector {
    display: flex;
    gap: 10px;
    margin: 15px 0;
}

.direction-control {
    flex: auto;
    padding: 12px var(--spacing-medium);
    border: 2px solid var(--color-primary);
    background: white;
    color: var(--color-primary);
    border-radius: var(--border-radius);
    font-size: 1em;
    font-weight: 600;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: var(--spacing-small);
    text-align: center;
}

.direction-btn {
    cursor: pointer;
    transition: all 0.3s;
}

.direction-btn:hover {
    background: #f0f0ff;
}

.direction-btn.active {
    background: var(--color-primary);
    color: white;
}

.direction-btn:disabled {
    opacity: 0.4;
    cursor: not-allowed;
}

.direction-card {
    background: #f5f7ff;
    color: #444;
    border-left-width: 4px;
    justify-content: flex-start;
    text-align: left;
}

.direction-card-title {
    font-size: 0.8em;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: var(--color-primary);
}

.direction-card-body {
    font-size: 0.95em;
    font-weight: 600;
    color: #444;
}

.stops-list {
    margin-top: 20px;
}

.stop-item {
    padding: 15px;
    border-left: 3px solid var(--color-primary);
    background: #f8f9fa;
    margin-bottom: var(--spacing-small);
    border-radius: 0 var(--border-radius) var(--border-radius) 0;
    position: relative;
    cursor: pointer;
}

.stop-item::before {
    content: '';
    position: absolute;
    left: -8px;
    top: 50%;
    transform: translateY(-50%);
    width: 14px;
    height: 14px;
    background: white;
    border: 3px solid var(--color-primary);
    border-radius: 50%;
}

.stop-item:first-of-type::before,
.stop-item:last-of-type::before {
    width: 16px;
    height: 16px;
    background: var(--color-primary);
    border-color: var(--color-primary);
    border-radius: 0;
}

.stop-name {
    font-weight: 600;
    margin-bottom: 5px;
    color: #1f1f1f;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.stops-title {
    margin-bottom: 15px;
    color: var(--color-primary);
}

.stop-code {
    font-size: 0.85em;
    color: #999;
}

.loading-spinner {
    text-align: center;
    padding: 40px;
    color: var(--color-primary);
}

.loading-spinner::after {
    content: '';
}

.alert-box {
    background: #fff3cd;
    border-left: 4px solid #ffc107;
    padding: 15px;
    margin: 15px 0;
    border-radius: 0 8px 8px 0;
}

.alert-box h4 {
    color: #856404;
    margin-bottom: 6px;
}

.alert-item {
    border-top: 1px solid #f0e5a0;
    padding: 8px 0;
}

.alert-item:first-of-type {
    border-top: none;
}

.alert-item summary {
    list-style: none;
    display: flex;
    align-items: center;
    gap: 8px;
    cursor: pointer;
    color: #856404;
}

.alert-item summary::before {
    content: '▶';
    font-size: 0.8em;
    color: #856404;
    flex-shrink: 0;
}

.alert-item[open] summary::before {
    content: '▼';
}

.alert-item summary::-webkit-details-marker {
    display: none;
}

.alert-title {
    font-weight: 700;
}

.alert-desc {
    margin-top: 6px;
    color: #6c5b2a;
    font-size: 0.9em;
}

.arrival-item {
    background: white;
    padding: 12px 15px;
    margin-bottom: 10px;
    border-radius: 8px;
    border: 1px solid #e8e8e8;
    display: flex;
    flex-direction: column;
    gap: 0;
    transition: all 0.2s ease;
    animation: cardSlideIn 0.4s ease backwards;
    will-change: transform;
}

.arrival-item:nth-child(1) { animation-delay: 0.1s; }
.arrival-item:nth-child(2) { animation-delay: 0.15s; }
.arrival-item:nth-child(3) { animation-delay: 0.2s; }
.arrival-item:nth-child(4) { animation-delay: 0.25s; }
.arrival-item:nth-child(5) { animation-delay: 0.3s; }
.arrival-item:nth-child(n+6) { animation-delay: 0.35s; }

.arrival-item:hover {
    border-color: var(--color-primary);
    box-shadow: 0 2px 8px rgba(102, 126, 234, 0.1);
    transform: translateY(-2px);
}

.arrival-header {
    display: flex;
    align-items: center;
    gap: 10px;
    width: 100%;
}

.arrival-destination {
    flex: auto;
    font-weight: 500;
    font-size: 0.95em;
    color: #1f1f1f;
    min-width: 0;
    overflow: visible;
}

.arrival-destination .truncate-text {
    display: block;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.arrival-icons {
    display: flex;
    gap: 6px;
    align-items: center;
    flex-shrink: 0;
}

.arrival-icon {
    font-size: 1.1em;
    display: flex;
    align-items: center;
    justify-content: center;
}

.arrival-icon-live {
    color: var(--color-success);
}

.arrival-icon-delayed {
    color: var(--color-warning);
}

.arrival-delay-indicator {
    display: flex;
    align-items: center;
    gap: 4px;
    color: var(--color-warning);
    font-weight: 600;
    font-size: 0.9em;
}

.arrival-delay-indicator .arrival-icon-delayed {
    margin: 0;
}

.arrival-time-value {
    font-size: 1.1em;
    font-weight: 700;
    color: var(--color-primary);
    flex-shrink: 0;
    margin-left: auto;
    text-align: right;
    max-width: 40%;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.arrival-time-value.soon {
    color: var(--color-success);
    font-weight: 800;
}

.muted {
    color: var(--color-text-secondary);
}

.no-arrivals {
    text-align: center;
    padding: var(--spacing-large);
    color: var(--color-text-tertiary);
}

.arrivals-title {
    display: flex;
    align-items: baseline;
    gap: 8px;
}

.arrivals-refresh {
    font-size: 0.85em;
    color: #777;
    font-weight: 500;
}

.map-link {
    display: inline;
    margin-top: 0;
    padding: 0;
    border-radius: 0;
    background: none;
    color: var(--color-primary-dark);
    font-size: 0.9em;
    font-weight: 600;
    text-decoration: none;
}

.map-link:hover {
    text-decoration: underline;
}

.stop-connections {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-top: 8px;
}

.route-pill {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 6px 12px;
    border-radius: 6px;
    font-weight: 600;
    font-size: 0.85em;
    cursor: pointer;
    transition: opacity 0.2s;
    margin: .25vh 0;
    box-shadow: inset 0 0 0 2px rgba(0, 0, 0, 0.18);
    white-space: nowrap;
}

.route-pill:hover {
    opacity: 0.9;
}

@media (max-width: 600px) {
    body {
        padding: 10px;
    }

    .header h1 {
        font-size: 1.8em;
    }

    /* Bottom sheet style modal for mobile */
    .modal.active {
        align-items: flex-end;
        padding: 0;
    }

    .modal-content {
        max-height: 85vh;
        border-radius: 16px 16px 0 0;
        margin: 0;
        animation: slideUp 0.3s ease-out;
    }

    .modal-content.is-loading {
        min-height: 85vh;
    }

    @keyframes slideUp {
        from {
            transform: translateY(100%);
        }
        to {
            transform: translateY(0);
        }
    }

    .arrival-header {
        gap: 6px 8px;
    }

    .arrival-icons {
        margin-left: auto;
    }

    .arrival-time-value {
        margin-left: auto;
        text-align: right;
        white-space: nowrap;
    }

    .arrival-destination {
        flex-basis: 100%;
        overflow: visible;
    }

    .arrival-destination .truncate-text {
        white-space: nowrap;
    }

    .direction-selector {
        display: grid;
        grid-template-columns: 1fr;
        gap: 8px;
        margin: 12px 0;
    }

    .direction-control {
        padding: 10px 12px;
        font-size: 0.95em;
    }

    .modal-route-number {
        font-size: 0.95em;
        padding: 4px 10px;
        min-height: 28px;
    }

    .modal-route-name {
        font-size: 1.25em;
    }

    .modal-header-top h2 {
        font-size: 1.15em;
    }
    /* Larger tap targets for mobile */
    .direction-btn,
    .stop-item {
        min-height: 44px;
    }

    .modal-close {
        min-width: 44px;
        min-height: 44px;
        top: 6px;
        right: 6px;
        font-size: 1.5em;
    }

    .modal-header {
        padding-right: 50px;
    }
}

/* Saved Stops Section */
.saved-stops-section {
    display: none;
    background: white;
    border-radius: var(--border-radius-large);
    box-shadow: var(--box-shadow);
    margin-bottom: var(--spacing-medium);
    overflow: hidden;
}

.saved-stops-section.active {
    display: block;
}

.saved-stops-header {
    padding: 16px var(--spacing-medium);
    border-bottom: 1px solid var(--color-border-light);
    background: #f8f9fa;
}

.saved-stops-header h3 {
    margin: 0;
    font-size: 1em;
    font-weight: 600;
    color: var(--color-text-primary);
}

.saved-stops-updated {
    margin-left: 8px;
    color: var(--color-text-tertiary);
    font-weight: 400;
    font-size: 0.9em;
}

.saved-stops-list {
    max-height: 400px;
    overflow-y: auto;
}

.saved-stop-item {
    padding: 16px var(--spacing-medium);
    border-bottom: 1px solid var(--color-border-light);
    position: relative;
}

.saved-stop-item:last-child {
    border-bottom: none;
}

.saved-stop-item:hover {
    background-color: #f8f9fa;
}

.saved-stop-header-line {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 12px;
}

.saved-stop-name {
    font-size: 0.95em;
    font-weight: 600;
    color: var(--color-text-primary);
    flex: auto;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.saved-stop-town {
    font-style: italic;
    color: var(--color-text-tertiary);
    font-size: 0.9em;
    font-weight: 400;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    max-width: 40%;
}

.saved-stop-details-link {
    color: var(--color-primary);
    cursor: pointer;
    font-size: 0.9em;
    font-weight: 500;
    white-space: nowrap;
    flex-shrink: 0;
    transition: color 0.2s;
}

.saved-stop-details-link:hover {
    color: var(--color-primary-dark);
}

.saved-stop-arrivals-wrapper {
    position: relative;
    overflow: hidden;
}

.saved-stop-arrivals-wrapper::before,
.saved-stop-arrivals-wrapper::after {
    content: '';
    position: absolute;
    top: 0;
    bottom: 0;
    width: 40px;
    pointer-events: none;
    opacity: 0;
    transition: opacity 0.3s;
    z-index: 1;
}

.saved-stop-arrivals-wrapper::before {
    left: 0;
    background: linear-gradient(to right, white 0%, transparent 100%);
}

.saved-stop-arrivals-wrapper::after {
    right: 0;
    background: linear-gradient(to left, white 0%, transparent 100%);
}

.saved-stop-arrivals-wrapper.has-scroll-left::before,
.saved-stop-arrivals-wrapper.has-scroll-right::after {
    opacity: 1;
}

.saved-stop-item:hover .saved-stop-arrivals-wrapper::before {
    background: linear-gradient(to right, #f8f9fa 0%, transparent 100%);
}

.saved-stop-item:hover .saved-stop-arrivals-wrapper::after {
    background: linear-gradient(to left, #f8f9fa 0%, transparent 100%);
}

.saved-stop-arrivals {
    display: flex;
    gap: 8px;
    overflow-x: auto;
    overflow-y: hidden;
    scroll-behavior: smooth;
    scrollbar-width: none; /* Firefox */
    -ms-overflow-style: none; /* IE/Edge */
}

.saved-stop-arrivals::-webkit-scrollbar {
    display: none; /* Chrome/Safari/Opera */
}

.saved-arrival-pill {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 0px 8px 0px 0px;
    border-radius: 6px;
    font-size: 0.9em;
    white-space: nowrap;
    flex-shrink: 0;
}

.saved-arrival-pill .route-pill {
    padding: 4px 8px;
    border-radius: 4px;
    font-size: 1em;
    min-width: 32px;
    margin: 0;
    cursor: default;
}

.saved-arrival-pill .arrival-info {
    display: inline;
}

.saved-stops-empty {
    padding: 24px var(--spacing-medium);
    text-align: center;
    color: var(--color-text-tertiary);
    font-size: 0.95em;
}

/* Mobile optimizations */
button, 
.stop-item,
.result-item,
.stop-result-item,
.route-pill {
    -webkit-tap-highlight-color: rgba(102, 126, 234, 0.2);
}

/* Disable text selection on interactive elements */
.result-item,
.stop-result-item,
.stop-item,
button {
    -webkit-user-select: none;
    user-select: none;
}

/* Offline indicator */
.offline-indicator {
    position: fixed;
    bottom: 20px;
    left: 50%;
    transform: translateX(-50%);
    background: #ff9800;
    color: white;
    padding: 12px 24px;
    border-radius: 24px;
    font-size: 0.9em;
    font-weight: 600;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
    z-index: 1001;
    display: none;
}

.offline-indicator.show {
    display: block;
    animation: slideInUp 0.3s ease-out;
}

@keyframes slideInUp {
    from {
        transform: translateX(-50%) translateY(100px);
        opacity: 0;
    }
    to {
        transform: translateX(-50%) translateY(0);
        opacity: 1;
    }
}
