/* Island Times - Dark Theme (Spotify/Apple Music Style) */

/* Google Fonts */
@import url('https://fonts.googleapis.com/css2?family=Space+Grotesk:wght@300;400;500;600;700&display=swap');

:root {
    --bg-primary: #121212;
    --bg-secondary: #181818;
    --bg-elevated: #282828;
    --bg-highlight: #333;
    --text-primary: #fff;
    --text-secondary: #b3b3b3;
    --text-muted: #727272;
    --accent: #1db954;
    --accent-hover: #1ed760;
    --border-color: #333;
    --schedule-bg: #1a1a1a;

    /* Journey quality colors - saturated */
    --quality-fast: #22c55e;
    --quality-meh: #fde047;
    --quality-slow: #9ca3af;

    /* Port colors - Using Scheme 4 (Green) as default */
    --port-hsb: #6b7280;
    --port-langdale: #78866b;
    --port-gambier: #166534;

    /* Phone icon color */
    --phone-color: #0891b2;
}

/* Scheme 1: Geographic/Thematic */
[data-scheme="1"] {
    --port-hsb: #6366f1;
    --port-langdale: #06b6d4;
    --port-gambier: #f59e0b;
}

/* Scheme 2: Cool Gradient */
[data-scheme="2"] {
    --port-hsb: #3b82f6;
    --port-langdale: #14b8a6;
    --port-gambier: #a855f7;
}

/* Scheme 3: High Contrast */
[data-scheme="3"] {
    --port-hsb: #818cf8;
    --port-langdale: #fb7185;
    --port-gambier: #34d399;
}

/* Scheme 4: Green Ports */
[data-scheme="4"] {
    --port-hsb: #6b7280;
    --port-langdale: #78866b;
    --port-gambier: #166534;
}

/* Light mode */
[data-theme="light"] {
    --bg-primary: #f5f5f5;
    --bg-secondary: #ffffff;
    --bg-elevated: #e8e8e8;
    --bg-highlight: #d4d4d4;
    --text-primary: #1a1a1a;
    --text-secondary: #525252;
    --text-muted: #737373;
    --border-color: #d4d4d4;
    --schedule-bg: #ffffff;
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

body {
    font-family: 'Space Grotesk', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    background-color: var(--bg-primary);
    color: var(--text-primary);
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

/* Update Banner */
.update-banner {
    background: linear-gradient(135deg, #10b981 0%, #059669 100%);
    color: white;
    padding: 0.75rem 1.5rem;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 1rem;
    font-size: 0.9rem;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    z-index: 1000;
    animation: slideDown 0.3s ease-out;
}

@keyframes slideDown {
    from {
        transform: translateY(-100%);
        opacity: 0;
    }
    to {
        transform: translateY(0);
        opacity: 1;
    }
}

.update-banner span {
    font-weight: 500;
}

.update-reload-btn {
    background: white;
    color: #059669;
    border: none;
    padding: 0.5rem 1rem;
    border-radius: 6px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
    font-size: 0.85rem;
}

.update-reload-btn:hover {
    background: #f0fdf4;
    transform: translateY(-1px);
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.update-reload-btn:active {
    transform: translateY(0);
}

.update-dismiss-btn {
    background: transparent;
    color: white;
    border: none;
    padding: 0.25rem 0.5rem;
    cursor: pointer;
    font-size: 1.5rem;
    line-height: 1;
    opacity: 0.8;
    transition: opacity 0.2s;
}

.update-dismiss-btn:hover {
    opacity: 1;
}

@media (max-width: 640px) {
    .update-banner {
        padding: 0.6rem 1rem;
        font-size: 0.85rem;
        gap: 0.75rem;
    }

    .update-reload-btn {
        padding: 0.4rem 0.8rem;
        font-size: 0.8rem;
    }
}

/* Header */
header {
    background-color: var(--bg-secondary);
    padding: 1rem 1.5rem;
    border-bottom: 1px solid var(--border-color);
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
}

.header-left {
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
}

.site-title {
    font-size: 1.5rem;
    font-weight: 700;
    margin: 0;
    line-height: 1.2;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.ferry-icon {
    font-size: 1em;
}

.title-text {
    display: inline;
}

.subtitle {
    font-size: 0.75rem;
    color: var(--text-secondary);
    line-height: 1.3;
}

/* Mobile adjustments */
@media (max-width: 640px) {
    header {
        padding: 0.75rem 1rem;
    }

    .site-title {
        font-size: 1.25rem;
    }

    .subtitle {
        font-size: 0.625rem;
    }
}

/* Controls */
.controls {
    background: var(--bg-secondary);
    padding: 0.75rem 1.5rem;
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
    border-bottom: 1px solid var(--border-color);
    position: sticky;
    top: 0;
    z-index: 100;
}

@media (min-width: 600px) {
    .controls {
        flex-direction: row;
        justify-content: flex-start;
        align-items: center;
        gap: 1.5rem;
    }
}

/* Direction toggle - pill style */
.direction-toggle {
    display: flex;
    background: var(--bg-elevated);
    border-radius: 500px;
    padding: 4px;
}

.direction-toggle button {
    padding: 0.5rem 1.25rem;
    border: none;
    background: transparent;
    color: var(--text-secondary);
    font-size: 0.875rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
    border-radius: 500px;
}

.direction-toggle button.active {
    background: var(--accent);
    color: var(--bg-primary);
}

.direction-toggle button:hover:not(.active) {
    color: var(--text-primary);
}

/* Date selector */
.date-selector {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    flex: 1;
    min-width: 0;
}

.date-chips {
    display: flex;
    gap: 0.375rem;
    overflow-x: auto;
    scrollbar-width: none;
    -ms-overflow-style: none;
    padding: 2px;
    scroll-behavior: smooth;
}

.date-chips::-webkit-scrollbar {
    display: none;
}

.date-chip {
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 0.375rem 0.625rem;
    border: none;
    background: var(--bg-elevated);
    color: var(--text-secondary);
    border-radius: 8px;
    cursor: pointer;
    font-family: inherit;
    transition: all 0.15s ease;
    flex-shrink: 0;
    min-width: 52px;
}

.date-chip:hover {
    background: var(--bg-highlight);
    color: var(--text-primary);
}

.date-chip.active {
    background: var(--accent);
    color: var(--bg-primary);
}

.date-chip.weekend:not(.active) {
    background: var(--bg-highlight);
}

.chip-label {
    font-size: 0.6875rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.02em;
}

.chip-date {
    font-size: 1rem;
    font-weight: 700;
    line-height: 1.2;
}

.date-picker-wrap {
    flex-shrink: 0;
}

.date-picker-wrap input[type="date"] {
    padding: 0.5rem 0.625rem;
    border: none;
    background: var(--bg-elevated);
    color: var(--text-primary);
    border-radius: 8px;
    font-size: 0.875rem;
    font-family: inherit;
    cursor: pointer;
}

.date-picker-wrap input[type="date"]::-webkit-calendar-picker-indicator {
    cursor: pointer;
}

/* Invert calendar icon only in dark mode */
[data-theme="dark"] .date-picker-wrap input[type="date"]::-webkit-calendar-picker-indicator {
    filter: invert(1);
}

/* Main content */
.main-content {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 0.5rem;
    overflow: auto;
    min-height: 0;
    background: var(--bg-primary);
}

.main-content .loading {
    color: var(--text-secondary);
    font-size: 1rem;
    padding: 2rem;
}

.main-content .error {
    color: #e74c3c;
    font-size: 0.9rem;
    padding: 2rem;
    text-align: center;
}

/* Chart wrapper */
.chart-wrapper {
    display: flex;
    flex-direction: column;
    align-items: center;
    width: 100%;
    max-width: 1800px;
    padding: 0 0.5rem;
}

/* Direction tabs - shared between chart and cards */
.direction-tabs {
    display: flex;
    gap: 0.5rem;
    margin-bottom: 0.5rem;
    width: 100%;
    max-width: 400px;
}

.direction-tab {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    padding: 0.5rem 1rem;
    border: 2px solid var(--bg-elevated);
    background: var(--bg-secondary);
    color: var(--text-secondary);
    border-radius: 8px;
    font-size: 0.8125rem;
    font-weight: 600;
    cursor: pointer;
    font-family: inherit;
    transition: all 0.2s ease;
    white-space: nowrap;
}

.direction-tab svg {
    width: 18px;
    height: 18px;
}

.direction-tab[data-direction="island"] svg {
    color: var(--port-gambier);
}

.direction-tab[data-direction="city"] svg {
    color: var(--port-hsb);
}

.direction-tab.active {
    background: var(--bg-highlight);
    color: var(--text-primary);
}

.direction-tab[data-direction="island"].active {
    border-color: var(--port-gambier);
}

.direction-tab[data-direction="city"].active {
    border-color: var(--port-hsb);
}

.direction-tab:not(.active):hover {
    background: var(--bg-elevated);
    color: var(--text-primary);
}

/* Chart Mobile Tabs - shown only on mobile */
.chart-mobile-tabs {
    display: flex;
    gap: 0.5rem;
    margin-bottom: 0.5rem;
    width: 100%;
    max-width: 400px;
}

@media (min-width: 1024px) {
    .chart-mobile-tabs {
        display: none;
    }
}

.chart-mobile-tab {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    padding: 0.75rem 1rem;
    border: none;
    background: var(--bg-secondary);
    color: var(--text-secondary);
    border-radius: 8px;
    font-size: 0.875rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
}

.chart-mobile-tab svg {
    width: 20px;
    height: 20px;
}

.chart-mobile-tab.active {
    background: var(--bg-highlight);
    color: var(--text-primary);
}

.chart-mobile-tab[data-direction="island"].active {
    border: 2px solid var(--port-gambier);
}

.chart-mobile-tab[data-direction="city"].active {
    border: 2px solid var(--port-hsb);
}

.chart-mobile-tab[data-direction="island"] svg {
    color: var(--port-gambier);
}

.chart-mobile-tab[data-direction="city"] svg {
    color: var(--port-hsb);
}

.chart-mobile-tab:not(.active):hover {
    background: var(--bg-elevated);
    color: var(--text-primary);
}

/* Chart Dual Column Layout */
.chart-svg-dual {
    display: flex;
    flex-direction: column;
    gap: 2rem;
    width: 100%;
}

@media (min-width: 1024px) {
    .chart-svg-dual {
        flex-direction: row;
        gap: 1rem;
    }
}

.chart-column {
    flex: 1;
    min-width: 0;
    display: none;
}

.chart-column.active {
    display: block;
}

@media (min-width: 1024px) {
    .chart-column {
        display: block;
    }
}

.chart-column-header {
    display: none;
}

@media (min-width: 1024px) {
    .chart-column-header {
        display: flex;
        align-items: center;
        justify-content: center;
        gap: 0.5rem;
        margin-bottom: 0.5rem;
        padding-bottom: 0.375rem;
        border-bottom: 1px solid var(--border-color);
    }

    .chart-column-header h2 {
        font-size: 1rem;
        font-weight: 700;
    }

    .chart-column-header .column-icon {
        width: 20px;
        height: 20px;
    }

    .chart-column[data-direction="island"] .column-icon {
        color: var(--port-gambier);
    }

    .chart-column[data-direction="city"] .column-icon {
        color: var(--port-hsb);
    }
}

/* Chart SVG */
.chart-svg-container {
    width: 100%;
    display: flex;
    justify-content: center;
    position: relative;
    color: var(--text-primary); /* Ensure currentColor works in embedded SVG */
}

.chart-svg-container svg {
    width: 100%;
    height: auto;
    max-height: calc(100vh - 160px); /* Use more viewport space for better mobile experience */
    background: var(--schedule-bg);
    border-radius: 8px;
    color: var(--text-primary); /* Explicit color inheritance for currentColor in SVG */
}

/* Ensure SVG text elements inherit the correct color in light mode */
.chart-svg-container svg text {
    fill: var(--text-primary);
}

/* Lines should also use the text color */
.chart-svg-container svg line[stroke="currentColor"] {
    stroke: var(--text-primary);
}

/* For smaller screens, maximize viewport usage */
@media (max-height: 700px) {
    .chart-svg-container svg {
        max-height: calc(100vh - 140px);
    }
}

/* Boost MAJOR times on smallest devices (iPhone SE: 375px) - only scale important departure/arrival times */
@media (max-width: 375px) {
    .chart-svg-container svg text.major-time {
        font-size: 3em !important;
    }
    .chart-svg-container svg text.minor-time {
        font-size: 1em; /* Keep minor times at base size */
    }
    /* Port labels inherit SVG font-size, hour labels stay small */
}

/* Boost MAJOR times on small devices (iPhone 12/13/14/15/16/17 Pro: 390-430px) */
@media (min-width: 376px) and (max-width: 430px) {
    .chart-svg-container svg text.major-time {
        font-size: 2.5em;
    }
    .chart-svg-container svg text.minor-time {
        font-size: 1em; /* Keep minor times at base size */
    }
    /* Port labels inherit SVG font-size, hour labels stay small */
}

/* Boost MAJOR times on larger phones (iPhone Pro models: 430-480px) */
@media (min-width: 431px) and (max-width: 480px) {
    .chart-svg-container svg text.major-time {
        font-size: 2.3em;
    }
    .chart-svg-container svg text.minor-time {
        font-size: 1em;
    }
}

/* Tablets and narrow desktop windows (481px-1023px) - use desktop font sizes */
@media (min-width: 481px) and (max-width: 1023px) {
    .chart-svg-container svg text.major-time {
        font-size: 45px !important;
    }
}

/* Desktop layout adjustments */
@media (min-width: 1024px) {
    .chart-svg-container svg {
        max-height: calc(100vh - 200px); /* Less aggressive on desktop */
    }

    /* Scale down major times by 25% on desktop (60px -> 45px) */
    .chart-svg-container svg text.major-time {
        font-size: 45px !important;
    }
}

/* Current time indicator */
/* Bottom controls */
.bottom-controls {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 1.5rem;
    padding: 0.5rem 1rem;
    background: var(--bg-secondary);
    border-top: 1px solid var(--border-color);
    flex-shrink: 0;
}

/* Chart legend - at bottom */
.chart-legend {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 1rem;
    padding: 0.5rem 1rem;
    margin-top: 0.5rem;
    flex-wrap: wrap;
}

.chart-legend-item {
    display: flex;
    align-items: center;
    gap: 0.375rem;
    font-size: 0.6875rem;
    color: var(--text-secondary);
}

.chart-legend-line {
    width: 24px;
    height: 3px;
    border-radius: 2px;
}

.chart-legend-item.fast .chart-legend-line {
    background: var(--quality-fast);
}

.chart-legend-item.meh .chart-legend-line {
    background: var(--quality-meh);
}

.chart-legend-item.slow .chart-legend-line {
    background: var(--quality-slow);
}

.chart-legend-item.wait .chart-legend-line {
    background: #4a9eff;
}

.chart-legend-item.useless .chart-legend-line {
    background: var(--text-muted);
    height: 2px;
    border-style: dashed;
}

.chart-legend-item.phone .phone-icon {
    color: var(--phone-color);
    width: 16px;
    height: 16px;
    vertical-align: middle;
    margin-right: 0.25rem;
}

.chart-legend-item.phone a {
    color: var(--phone-color);
    text-decoration: none;
}

.chart-legend-item.phone a:hover {
    text-decoration: underline;
}

.chart-legend-item.stopwatch .stopwatch-emoji {
    font-size: 1.1em;
    margin-right: 0.125rem;
}

/* Mobile adjustments */
@media (max-width: 480px) {
    header {
        padding: 0.625rem 0.75rem;
        gap: 0.5rem;
    }

    .site-title {
        font-size: 1.125rem;
    }

    .subtitle {
        font-size: 0.5625rem;
    }

    .header-controls {
        gap: 0.5rem;
    }
}

/* Extra small phones (iPhone SE: 375px) - prevent title wrapping */
@media (max-width: 375px) {
    .site-title {
        font-size: 1rem;
        gap: 0.4rem;
    }

    .ferry-icon {
        font-size: 2em;
        line-height: 1;
    }

    .title-text {
        display: flex;
        flex-direction: column;
        line-height: 1.1;
    }

    .subtitle {
        font-size: 0.5rem;
    }

    .view-toggle button {
        padding: 0.35rem 0.6rem;
        font-size: 0.7rem;
    }

    .theme-toggle,
    .help-toggle {
        width: 32px;
        height: 32px;
    }

    .direction-toggle button {
        padding: 0.4rem 1rem;
        font-size: 0.8rem;
    }

    .date-chip {
        padding: 0.25rem 0.5rem;
        min-width: 44px;
    }

    .chip-label {
        font-size: 0.625rem;
    }

    .chip-date {
        font-size: 0.875rem;
    }

    .legend-panel {
        padding: 1rem;
    }
}

/* Scrollbar styling */
::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}

::-webkit-scrollbar-track {
    background: var(--bg-primary);
}

::-webkit-scrollbar-thumb {
    background: var(--bg-highlight);
    border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
    background: var(--text-muted);
}

/* View toggle */
.view-toggle {
    display: flex;
    background: var(--bg-elevated);
    border-radius: 8px;
    padding: 4px;
}

.view-toggle button {
    padding: 0.4rem 0.75rem;
    border: none;
    background: transparent;
    color: var(--text-secondary);
    font-size: 0.75rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
    border-radius: 6px;
}

.view-toggle button.active {
    background: var(--bg-highlight);
    color: var(--text-primary);
}

.view-toggle button:hover:not(.active) {
    color: var(--text-primary);
}

/* Header controls container */
.header-controls {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

/* Theme toggle button */
.theme-toggle {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
    border: none;
    background: var(--bg-elevated);
    color: var(--text-secondary);
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.2s ease;
}

.theme-toggle:hover {
    background: var(--bg-highlight);
    color: var(--text-primary);
}

/* Show sun in dark mode, moon in light mode */
.theme-toggle .icon-sun {
    display: block;
}

.theme-toggle .icon-moon {
    display: none;
}

[data-theme="light"] .theme-toggle .icon-sun {
    display: none;
}

[data-theme="light"] .theme-toggle .icon-moon {
    display: block;
}

/* Scheme toggle */
.scheme-toggle {
    display: flex;
    align-items: center;
    gap: 0.375rem;
}

.scheme-label {
    font-size: 0.75rem;
    color: var(--text-secondary);
    margin-right: 0.25rem;
}

.scheme-btn {
    width: 28px;
    height: 28px;
    border: 2px solid var(--bg-highlight);
    background: var(--bg-elevated);
    color: var(--text-secondary);
    border-radius: 6px;
    cursor: pointer;
    font-size: 0.75rem;
    font-weight: 700;
    font-family: inherit;
    transition: all 0.15s ease;
}

.scheme-btn:hover {
    border-color: var(--text-muted);
    color: var(--text-primary);
}

.scheme-btn.active {
    border-color: var(--accent);
    color: var(--text-primary);
    background: var(--bg-highlight);
}

/* Journey Cards Wrapper */
.journey-cards-wrapper {
    width: 100%;
    max-width: 1200px;
    padding: 1rem;
}

/* Cards Legend */
.cards-legend {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.5rem 0.75rem;
    background: var(--bg-secondary);
    border-radius: 6px;
    margin-top: 0.5rem;
    flex-wrap: wrap;
}

.legend-title {
    font-size: 0.6875rem;
    color: var(--text-secondary);
    font-weight: 500;
}

.legend-items {
    display: flex;
    gap: 0.5rem;
}

.legend-item {
    display: flex;
    align-items: center;
    gap: 0.25rem;
    font-size: 0.6875rem;
    color: var(--text-secondary);
}

.legend-color {
    width: 10px;
    height: 10px;
    border-radius: 2px;
}

.legend-item.fast .legend-color {
    background: var(--quality-fast);
}

.legend-item.meh .legend-color {
    background: var(--quality-meh);
}

.legend-section {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

/* Mobile Tabs */
.mobile-tabs {
    display: flex;
    gap: 0.5rem;
    margin-bottom: 0.5rem;
}

@media (min-width: 768px) {
    .mobile-tabs {
        display: none;
    }
}

.mobile-tab {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    padding: 0.75rem 1rem;
    border: none;
    background: var(--bg-secondary);
    color: var(--text-secondary);
    border-radius: 8px;
    font-size: 0.875rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
}

.mobile-tab {
    color: var(--text-secondary);
}

.mobile-tab svg {
    width: 20px;
    height: 20px;
}

.mobile-tab.active {
    background: var(--bg-highlight);
    color: var(--text-primary);
}

.mobile-tab[data-tab="island"].active {
    border: 2px solid var(--port-gambier);
}

.mobile-tab[data-tab="city"].active {
    border: 2px solid var(--port-hsb);
}

.mobile-tab[data-tab="island"] svg {
    color: var(--port-gambier);
}

.mobile-tab[data-tab="city"] svg {
    color: var(--port-hsb);
}

.mobile-tab:not(.active):hover {
    background: var(--bg-elevated);
    color: var(--text-primary);
}

/* Journey Cards - Dual Column Layout */
.journey-cards-dual {
    display: flex;
    flex-direction: column;
    gap: 2rem;
    width: 100%;
}

@media (min-width: 768px) {
    .journey-cards-dual {
        flex-direction: row;
        gap: 1.5rem;
    }
}

.journey-column {
    flex: 1;
    min-width: 0;
    display: none;
}

.journey-column.active {
    display: block;
}

@media (min-width: 768px) {
    .journey-column {
        display: block;
    }
}

.column-header {
    margin-bottom: 0.5rem;
    padding-bottom: 0.375rem;
    border-bottom: 1px solid var(--border-color);
}

.column-title {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.column-icon {
    width: 20px;
    height: 20px;
}

.journey-column[data-direction="island"] .column-icon {
    color: var(--port-gambier);
}

.journey-column[data-direction="city"] .column-icon {
    color: var(--port-hsb);
}

.column-icon svg {
    width: 100%;
    height: 100%;
}

.column-header h2 {
    font-size: 1rem;
    font-weight: 700;
}

.column-header p {
    color: var(--text-secondary);
    font-size: 0.75rem;
    margin-top: 0.125rem;
}

.journey-cards-list {
    display: flex;
    flex-direction: column;
    gap: 0.375rem;
}

.journey-card {
    background: var(--bg-secondary);
    border-radius: 8px;
    padding: 0.5rem 0.75rem;
    border-left: 3px solid var(--text-muted);
    transition: transform 0.15s ease, box-shadow 0.15s ease;
}

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

.journey-card.fast {
    border-left-color: var(--quality-fast);
}

.journey-card.meh {
    border-left-color: var(--quality-meh);
}

.journey-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 0.375rem;
    gap: 0.5rem;
}

.journey-time {
    font-size: 1rem;
    font-weight: 700;
}

.journey-meta {
    display: flex;
    align-items: center;
    gap: 0.375rem;
}

.journey-badges {
    display: flex;
    gap: 0.375rem;
}

.badge {
    font-size: 0.625rem;
    font-weight: 600;
    padding: 0.1875rem 0.375rem;
    border-radius: 4px;
    text-transform: uppercase;
    letter-spacing: 0.025em;
}

.badge-wait {
    background: rgba(74, 158, 255, 0.2);
    color: #4a9eff;
}

.badge-request {
    background: rgba(255, 107, 53, 0.2);
    color: #ff6b35;
}

.journey-duration {
    font-size: 0.75rem;
    color: var(--text-secondary);
    background: var(--bg-elevated);
    padding: 0.25rem 0.5rem;
    border-radius: 4px;
    border-left: 3px solid var(--bg-highlight);
    font-weight: 600;
}

/* Color the duration chip based on connection quality */
.journey-duration[data-quality="fast"] {
    border-left-color: var(--quality-fast);
    background: rgba(34, 197, 94, 0.1); /* Subtle green tint */
    color: var(--text-primary);
}

.journey-duration[data-quality="meh"] {
    border-left-color: var(--quality-meh);
    background: rgba(253, 224, 71, 0.15); /* Subtle yellow tint */
    color: var(--text-primary);
}

.journey-route {
    display: flex;
    align-items: center;
    gap: 0.25rem;
    flex-wrap: wrap;
}

.journey-stop {
    display: flex;
    align-items: center;
    gap: 0.25rem;
}

.stop-icon {
    width: 16px;
    height: 16px;
    flex-shrink: 0;
    color: var(--text-secondary);
}

.stop-icon svg {
    width: 100%;
    height: 100%;
}

.journey-stop.start .stop-icon {
    color: var(--port-hsb);
}

.journey-stop.end .stop-icon {
    color: var(--port-gambier);
}

.journey-stop.transfer .stop-icon {
    color: var(--port-langdale);
}

/* City-bound journeys swap HSB and Gambier */
.journey-column[data-direction="city"] .journey-stop.start .stop-icon {
    color: var(--port-gambier);
}

.journey-column[data-direction="city"] .journey-stop.end .stop-icon {
    color: var(--port-hsb);
}

.stop-info {
    display: flex;
    align-items: baseline;
    gap: 0.25rem;
}

.stop-name {
    font-weight: 600;
    font-size: 0.75rem;
}

.stop-time {
    font-size: 0.6875rem;
    color: var(--text-secondary);
}

.stop-time.depart {
    color: var(--text-muted);
}

.wait-time {
    font-size: 0.625rem;
    color: var(--text-primary);
    font-weight: 600;
    background: var(--bg-elevated);
    padding: 0.125rem 0.25rem;
    border-radius: 3px;
    border: 1px solid var(--bg-highlight);
}

.journey-card.fast .wait-time {
    background: rgba(34, 197, 94, 0.15);
    border-color: var(--quality-fast);
}

.journey-card.meh .wait-time {
    background: rgba(253, 224, 71, 0.2);
    border-color: var(--quality-meh);
}

.journey-leg {
    width: 12px;
    height: 2px;
    background: var(--bg-highlight);
}

.journey-note {
    margin-top: 0.5rem;
    padding-top: 0.5rem;
    border-top: 1px solid var(--border-color);
    font-size: 0.6875rem;
    color: var(--text-muted);
    font-style: italic;
}

.no-journeys {
    text-align: center;
    padding: 2rem;
    color: var(--text-secondary);
    font-size: 0.875rem;
}

/* Help button */
.help-toggle {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
    border: none;
    background: var(--bg-elevated);
    color: var(--text-secondary);
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.2s ease;
    font-size: 1.25rem;
    font-weight: 700;
    font-family: inherit;
}

.help-toggle:hover {
    background: var(--bg-highlight);
    color: var(--text-primary);
}

/* Modal */
.modal-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.75);
    z-index: 1000;
    align-items: center;
    justify-content: center;
    padding: 1rem;
}

.modal-overlay.active {
    display: flex;
}

.modal-content {
    background: var(--bg-secondary);
    border-radius: 12px;
    max-width: 600px;
    width: 100%;
    max-height: 90vh;
    overflow-y: auto;
    padding: 2rem;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.5);
}

.modal-content h2 {
    font-size: 1.75rem;
    font-weight: 700;
    margin-bottom: 1rem;
    color: var(--text-primary);
}

.modal-content h3 {
    font-size: 1.25rem;
    font-weight: 600;
    margin-top: 1.5rem;
    margin-bottom: 0.75rem;
    color: var(--text-primary);
}

.modal-body {
    color: var(--text-secondary);
    line-height: 1.6;
}

.modal-body p {
    margin-bottom: 1rem;
}

.modal-body ul {
    margin-left: 1.5rem;
    margin-bottom: 1rem;
}

.modal-body li {
    margin-bottom: 0.5rem;
}

.modal-body a {
    color: var(--accent);
    text-decoration: none;
}

.modal-body a:hover {
    text-decoration: underline;
}

.modal-body .disclaimer {
    font-size: 0.875rem;
    color: var(--text-muted);
    margin-top: 1.5rem;
}

.modal-body .link-list {
    list-style: none;
    margin-left: 0;
}

.modal-body .link-list li {
    margin-bottom: 0.375rem;
}

.modal-body .link-list a {
    color: var(--accent);
}

.modal-button {
    margin-top: 1.5rem;
    padding: 0.75rem 2rem;
    background: var(--accent);
    color: var(--bg-primary);
    border: none;
    border-radius: 8px;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
    font-family: inherit;
    width: 100%;
}

.modal-button:hover {
    background: var(--accent-hover);
}

/* Mobile adjustments for modal */
@media (max-width: 480px) {
    .modal-content {
        padding: 1.5rem;
    }

    .modal-content h2 {
        font-size: 1.5rem;
    }

    .modal-content h3 {
        font-size: 1.125rem;
    }
}

/* Settings Modal - additional styles */
.setting-group {
    margin-bottom: 2rem;
}

.setting-group:last-child {
    margin-bottom: 0;
}

.setting-group h3 {
    font-size: 1rem;
    font-weight: 600;
    margin-bottom: 0.75rem;
    color: var(--text-primary);
}

.setting-options {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.setting-option {
    display: flex;
    align-items: center;
    padding: 0.75rem;
    background: var(--bg-elevated);
    border: 2px solid var(--border-color);
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.2s ease;
}

.setting-option:hover {
    background: var(--bg-highlight);
    border-color: var(--text-muted);
}

.setting-option input[type="radio"] {
    margin-right: 0.75rem;
    width: 18px;
    height: 18px;
    cursor: pointer;
}

.setting-option input[type="radio"]:checked {
    accent-color: var(--accent);
}

.setting-option:has(input:checked) {
    background: var(--bg-highlight);
    border-color: var(--accent);
}

.option-label {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.9375rem;
    font-weight: 500;
    color: var(--text-primary);
}

.option-icon {
    flex-shrink: 0;
}

.setting-help {
    margin-top: 0.5rem;
    font-size: 0.8125rem;
    color: var(--text-secondary);
    font-style: italic;
}

/* Mobile adjustments for settings */
@media (max-width: 480px) {
    .setting-option {
        padding: 0.625rem;
    }

    .option-label {
        font-size: 0.875rem;
    }
}

/* Swipe animations - side-by-side sliding */
.schedule-slide-wrapper {
    position: relative;
    overflow: hidden;
    flex: 1;
}

.schedule-slide-container {
    display: flex;
    width: 200%;
    transition: transform 0.3s ease-out;
}

/* Initial state for previous (swipe right) animation */
.schedule-slide-container.slide-start-right {
    transform: translateX(-50%);
}

/* Animation states */
.schedule-slide-container.animating-next {
    transform: translateX(-50%);
}

.schedule-slide-container.animating-prev {
    transform: translateX(0);
}

.schedule-slide-item {
    width: 50%;
    flex-shrink: 0;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.schedule-slide-item .chart-svg-container,
.schedule-slide-item .journey-cards-wrapper {
    flex: 1;
}

/* Constrain SVG size during animation */
.schedule-slide-item svg {
    max-width: 100%;
    height: auto;
}

/* Constrain journey cards during animation */
.schedule-slide-item .journey-cards-dual {
    max-width: 100%;
}

/* Flip animation for direction switch */
@keyframes flip {
    0% {
        transform: rotateY(0deg);
    }
    50% {
        transform: rotateY(90deg);
    }
    100% {
        transform: rotateY(0deg);
    }
}

.chart-wrapper,
.journey-cards-wrapper {
    perspective: 1000px;
}

.chart-svg-container.flipping,
.journey-cards-dual.flipping {
    animation: flip 0.3s ease-in-out;
    transform-style: preserve-3d;
}

/* PWA Install Hint */
.pwa-hint {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    background: linear-gradient(135deg, rgba(29, 185, 84, 0.9) 0%, rgba(21, 153, 71, 0.9) 100%);
    backdrop-filter: blur(8px);
    padding: 0.75rem 1rem;
    box-shadow: 0 -2px 8px rgba(0, 0, 0, 0.3);
    z-index: 1000;
    animation: slideUp 0.3s ease-out;
}

@keyframes slideUp {
    from {
        transform: translateY(100%);
    }
    to {
        transform: translateY(0);
    }
}

.pwa-hint-content {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    max-width: 800px;
    margin: 0 auto;
}

.pwa-hint-text {
    flex: 1;
    color: white;
    font-size: 0.875rem;
    font-weight: 400;
    line-height: 1.4;
}

.pwa-inline-icon {
    display: inline-block;
    vertical-align: middle;
}

.pwa-hint-close {
    background: none;
    border: none;
    color: white;
    font-size: 1.75rem;
    line-height: 1;
    padding: 0;
    width: 32px;
    height: 32px;
    cursor: pointer;
    flex-shrink: 0;
    opacity: 0.8;
    transition: opacity 0.2s;
    display: flex;
    align-items: center;
    justify-content: center;
}

.pwa-hint-close:hover {
    opacity: 1;
}

@media (max-width: 480px) {
    .pwa-hint {
        padding: 0.625rem 0.75rem;
    }

    .pwa-hint-content {
        gap: 0.5rem;
    }

    .pwa-hint-text {
        font-size: 0.8125rem;
    }

    .pwa-inline-icon {
        width: 16px;
        height: 16px;
    }

    .pwa-hint-close {
        width: 28px;
        height: 28px;
        font-size: 1.5rem;
    }
}

/* Version number */
.version-number {
    position: fixed;
    bottom: 0.5rem;
    right: 0.5rem;
    font-size: 0.75rem;
    color: var(--text-tertiary);
    opacity: 0.4;
    font-weight: 400;
    padding: 0.25rem 0.5rem;
    border-radius: 4px;
    font-family: 'SF Mono', 'Monaco', 'Cascadia Code', 'Courier New', monospace;
    pointer-events: none;
    z-index: 9999;
}
