/* Mobile-First Compact Design - Dark Theme */
:root {
    --bg-primary: #0a0a0f;
    --bg-card: #12121a;
    --bg-elevated: #1a1a24;
    --border-color: #2a2a3a;
    --text-primary: #e8e8ed;
    --text-secondary: #9898a8;
    --text-muted: #606070;
    --accent-blue: #3b82f6;
    --accent-amber: #f59e0b;
}

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

html, body {
    font-family: -apple-system, BlinkMacSystemFont, "SF Pro Text", "SF Pro Display", system-ui, "Segoe UI", Roboto, "Helvetica Neue", sans-serif;
    background-color: var(--bg-primary);
    color: var(--text-primary);
    line-height: 1.4;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

/* App Container - fits viewport */
.app-container {
    padding: 16px;
    padding-bottom: 80px; /* Space for sticky button */
    max-width: 400px;
    margin: 0 auto;
    min-height: 100dvh;
    display: flex;
    flex-direction: column;
}

/* Header - minimal */
.header {
    text-align: center;
    margin-bottom: 8px;
}

.title {
    font-size: 15px;
    font-weight: 600;
    color: var(--text-secondary);
    letter-spacing: -0.2px;
}

.subtitle {
    display: none; /* Hide subtitle for cleaner look */
}

/* Journey Card - edge-to-edge container */
.journey-card {
    display: flex;
    flex-direction: column;
}

/* Inputs Section */
.inputs-section {
    display: flex;
    flex-direction: column;
    gap: 8px;
    margin-bottom: 16px;
}

/* Start Button - sticky at bottom for thumb-zone access */
.start-button-container {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    display: flex;
    justify-content: center;
    padding: 12px 16px calc(12px + env(safe-area-inset-bottom, 0px));
    background: linear-gradient(to top, var(--bg-primary) 60%, transparent);
    z-index: 50;
}

.start-button {
    padding: 12px 40px;
    font-size: 14px;
    font-weight: 600;
    color: #ffffff;
    background-color: var(--accent-blue);
    border: none;
    border-radius: 10px;
    cursor: pointer;
    transition: background-color 0.15s ease, opacity 0.15s ease;
}

.start-button:hover:not(:disabled) {
    background-color: #2563eb;
}

.start-button:active:not(:disabled) {
    background-color: #1d4ed8;
}

.start-button:disabled {
    opacity: 0.4;
    cursor: not-allowed;
}

/* Results Section */
.results-section {
    flex: 1;
    display: flex;
    flex-direction: column;
    justify-content: flex-start;
    padding: 0 16px;
}

.results-grid {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

/* Phase message - the three-beat ritual */
.phase-message {
    font-size: 15px;
    font-style: italic;
    color: var(--text-muted);
    text-align: center;
    padding: 24px 16px;
}

/* Results Carousel - horizontal paging */
.results-carousel-wrapper {
    margin-left: -16px;
    margin-right: -16px;
    width: calc(100% + 32px);
}

.results-carousel.embla {
    overflow: hidden;
}

.results-carousel .embla__container {
    display: flex;
    gap: 0;
    padding: 0;
}

.results-carousel .embla__slide {
    flex: 0 0 100%;
    min-width: 0;
}

.results-slide {
    min-height: 300px;
    display: flex;
    align-items: flex-start;
    justify-content: center;
}

.results-slide-content {
    width: 100%;
    padding: 0 16px;
}

/* Adjust panels inside results carousel */
.results-carousel .journey-summary {
    margin-top: 0;
}

.results-carousel .poster-panel {
    margin: 0;
    padding: 0;
    background: transparent;
}

.results-carousel .poster-preview {
    width: 100%;
    height: auto;
    border-radius: 12px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.5);
}

.results-carousel .travel-log-panel {
    margin: 0;
    padding: 8px;
    background-color: var(--bg-elevated);
    border-radius: 12px;
    box-shadow: 0 2px 12px rgba(0, 0, 0, 0.4);
}

.results-carousel .travel-log-preview {
    width: 100%;
    height: auto;
    border-radius: 8px;
}

.results-carousel .results-data {
    margin-top: 0;
}

/* Results carousel dots - centered below */
.results-carousel-wrapper .embla__dots {
    padding: 16px 0 8px;
}

/* Results data container - staggered fade-in */
.results-data {
    display: flex;
    flex-direction: column;
    gap: 10px;
    margin-top: 12px;
    padding: 16px;
    border-radius: 12px;
    background-color: var(--bg-elevated);
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.3), 0 1px 2px rgba(0, 0, 0, 0.2);
}

.results-data .result-item {
    opacity: 0;
    animation: fadeQuick 0.2s ease-out forwards;
}

.results-data .result-item:nth-child(1) { animation-delay: 0ms; }
.results-data .result-item:nth-child(2) { animation-delay: 40ms; }
.results-data .result-item:nth-child(3) { animation-delay: 80ms; }
.results-data .result-item:nth-child(4) { animation-delay: 120ms; }
.results-data .result-item:nth-child(5) { animation-delay: 160ms; }
.results-data .result-item:nth-child(6) { animation-delay: 200ms; }

@keyframes fadeQuick {
    from { opacity: 0; }
    to { opacity: 1; }
}

/* Summary - blur to sharp */
.journey-summary.fade-in {
    animation: blurToSharp 0.25s ease-out;
}

@keyframes blurToSharp {
    from {
        opacity: 0;
        filter: blur(4px);
    }
    to {
        opacity: 1;
        filter: blur(0);
    }
}

/* Poster - clean fade */
.poster-panel.slide-in {
    animation: fadeClean 0.3s ease-out;
}

@keyframes fadeClean {
    from { opacity: 0; }
    to { opacity: 1; }
}

/* Time Comparison Chart */
.time-chart {
    margin-top: 16px;
    padding: 14px;
    background-color: var(--bg-elevated);
    border-radius: 12px;
    display: flex;
    flex-direction: column;
    gap: 12px;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.3), 0 1px 2px rgba(0, 0, 0, 0.2);
}

.time-chart-title {
    font-size: 11px;
    font-weight: 600;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 2px;
}

.time-chart-row {
    display: flex;
    align-items: center;
    gap: 10px;
}

.time-chart-label {
    font-size: 11px;
    font-weight: 600;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    width: 36px;
    flex-shrink: 0;
}

.time-chart-bar-container {
    flex: 1;
    height: 8px;
    background-color: var(--border-color);
    border-radius: 4px;
    overflow: hidden;
}

.time-chart-bar {
    height: 100%;
    border-radius: 4px;
    transition: width 0.4s ease-out;
}

.time-chart-bar.ship {
    background-color: var(--accent-amber);
}

.time-chart-bar.earth {
    background-color: var(--text-secondary);
}

.time-chart-value {
    font-size: 12px;
    font-weight: 600;
    color: var(--text-primary);
    min-width: 70px;
    text-align: right;
    font-variant-numeric: tabular-nums;
}

.time-chart-value.ship-time {
    color: var(--accent-amber);
}

/* Unified label styling for all result items */
.result-item {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.result-label {
    font-size: 11px;
    font-weight: 600;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

/* Primary results - arrival times (same size as secondary) */
.result-item.primary .result-value {
    font-size: 17px;
    font-weight: 600;
    color: var(--text-primary);
    font-variant-numeric: tabular-nums;
}

.result-item.primary .result-value.ship-time {
    color: var(--accent-amber);
}

/* Secondary results - smaller values */
.result-item.secondary .result-value {
    font-size: 17px;
    font-weight: 600;
    color: var(--text-primary);
    font-variant-numeric: tabular-nums;
}

.result-item.secondary .result-value.ship-time {
    color: var(--accent-amber);
}

.result-item.secondary .result-value.highlight {
    color: var(--accent-blue);
}

/* Journey Summary - the narrative */
.journey-summary {
    margin-top: 10px;
    padding: 14px;
    background-color: var(--bg-elevated);
    border-radius: 12px;
    font-size: 14px;
    line-height: 1.5;
    color: var(--text-secondary);
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.3), 0 1px 2px rgba(0, 0, 0, 0.2);
}

.journey-summary .summary-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    margin-bottom: 6px;
}

.journey-summary .persona-name {
    font-size: 11px;
    font-weight: 600;
    color: var(--text-muted);
    margin-bottom: 0;
    font-style: italic;
}

.journey-summary .summary-label {
    font-size: 11px;
    font-weight: 600;
    color: var(--text-muted);
    font-style: italic;
    margin-bottom: 6px;
}

.journey-summary .regenerate-summary {
    appearance: none;
    background: none;
    border: 0;
    /* Mobile-first: keep the text small but make the tap target large. */
    min-height: 44px;
    padding: 0 8px;
    font-size: 11px;
    font-weight: 600;
    color: var(--accent-blue);
    text-decoration: underline;
    cursor: pointer;
    line-height: 1;
    display: inline-flex;
    align-items: center;
    justify-content: flex-end;
}

.journey-summary .regenerate-summary:disabled {
    opacity: 0.5;
    cursor: default;
    text-decoration: none;
}

.journey-summary .summary-text {
    font-style: normal;
    font-size: 16px;
    font-weight: 450;
    line-height: 1.65;
    color: var(--text-primary);
}

.journey-summary .summary-text.calculating {
    font-style: italic;
}

/* Poster panel - full-bleed to viewport edges */
.poster-panel {
    margin-top: 10px;
    margin-left: -32px;
    margin-right: -32px;
    padding: 14px 0 6px 0;
    background-color: var(--bg-primary);
    border-radius: 0;
}

.poster-preview {
    width: 100%;
    height: auto;
    display: block;
    border-radius: 0;
    background: var(--bg-card);
}

/* Travel Log panel - full-bleed inside collapsible */
.travel-log-panel {
    margin-top: 8px;
    padding: 12px 0;
    background-color: var(--bg-elevated);
}

.travel-log-preview {
    width: 100%;
    height: auto;
    display: block;
}

.poster-loading {
    width: 100%;
    border-radius: 0;
    background: var(--bg-card);
    color: var(--text-secondary);
    padding: 24px 16px;
    text-align: center;
    font-size: 13px;
}

.poster-actions {
    display: flex;
    justify-content: flex-end;
    margin-top: 4px;
    padding: 0 16px;
}

.poster-download {
    min-height: 44px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0 10px;
    font-size: 12px;
    font-weight: 700;
    color: var(--accent-blue);
    text-decoration: underline;
}

/* Empty state */
.empty-state {
    text-align: center;
    padding: 40px 16px;
    flex: 1;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    max-width: 360px;
    margin: 0 auto;
}

.empty-state-text {
    font-size: 18px;
    font-weight: 600;
    color: var(--text-primary);
}

.empty-state-subtext {
    font-size: 14px;
    color: var(--text-secondary);
    margin-top: 16px;
    line-height: 1.6;
}

/* Skeleton Loading */
.skeleton-container {
    max-width: 400px;
    margin: 0 auto;
    padding: 16px;
    min-height: 100dvh;
}

.skeleton-header {
    height: 15px;
    width: 160px;
    background: var(--bg-elevated);
    border-radius: 4px;
    margin: 0 auto 16px;
    position: relative;
    overflow: hidden;
}

.skeleton-carousel {
    display: flex;
    gap: 12px;
    overflow: hidden;
    padding: 8px 0;
}

.skeleton-dest-card {
    flex: 0 0 200px;
    height: 145px;
    background: var(--bg-card);
    border-radius: 12px;
    position: relative;
    overflow: hidden;
}

.skeleton-speed-card {
    flex: 0 0 140px;
    height: 50px;
    background: var(--bg-card);
    border-radius: 8px;
    position: relative;
    overflow: hidden;
}

.skeleton-dots {
    display: flex;
    justify-content: center;
    gap: 6px;
    padding: 8px 0 12px;
}

.skeleton-dot {
    width: 6px;
    height: 6px;
    background: var(--border-color);
    border-radius: 50%;
}

/* Shimmer animation */
.skeleton-dest-card::after,
.skeleton-speed-card::after,
.skeleton-header::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: linear-gradient(
        90deg,
        transparent 0%,
        rgba(255, 255, 255, 0.04) 50%,
        transparent 100%
    );
    animation: shimmer 1.5s infinite;
}

@keyframes shimmer {
    0% { transform: translateX(-100%); }
    100% { transform: translateX(100%); }
}

/* Blazor error UI */
#blazor-error-ui {
    background: #dc2626;
    bottom: 0;
    box-shadow: 0 -1px 2px rgba(0, 0, 0, 0.2);
    display: none;
    left: 0;
    padding: 12px 16px;
    position: fixed;
    width: 100%;
    z-index: 1000;
    color: white;
    font-size: 14px;
}

#blazor-error-ui .dismiss {
    cursor: pointer;
    position: absolute;
    right: 12px;
    top: 12px;
}

/* Build info */
.build-info {
    padding-top: 0;
    display: flex;
    justify-content: space-between;
    font-size: 10px;
    color: var(--text-muted);
}

.build-info span:first-child {
    font-family: monospace;
}

.build-info .credit {
    font-family: inherit;
}

/* Bottom Sheet Backdrop */
.bottom-sheet-backdrop {
    position: fixed;
    inset: 0;
    background-color: rgba(0, 0, 0, 0.5);
    z-index: 100;
    animation: fadeIn 0.2s ease;
}

@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

/* Bottom Sheet */
.bottom-sheet {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    max-height: 70vh;
    background-color: var(--bg-primary);
    border-radius: 16px 16px 0 0;
    z-index: 101;
    display: flex;
    flex-direction: column;
    animation: slideUp 0.25s ease;
}

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

/* Bottom Sheet Handle (pill) */
.bottom-sheet-handle {
    width: 36px;
    height: 4px;
    background-color: var(--border-color);
    border-radius: 2px;
    margin: 10px auto 6px auto;
}

/* Bottom Sheet Header */
.bottom-sheet-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 8px 16px 12px 16px;
    border-bottom: 1px solid var(--border-color);
}

.bottom-sheet-title {
    font-size: 16px;
    font-weight: 600;
    color: var(--text-primary);
    margin: 0;
}

.bottom-sheet-close {
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 24px;
    font-weight: 300;
    color: var(--text-muted);
    background: none;
    border: none;
    cursor: pointer;
    border-radius: 50%;
    transition: background-color 0.15s ease;
}

.bottom-sheet-close:hover {
    background-color: var(--bg-elevated);
}

/* Bottom Sheet Content */
.bottom-sheet-content {
    flex: 1;
    overflow-y: auto;
    padding: 16px;
}

.bottom-sheet-loading,
.bottom-sheet-empty {
    text-align: center;
    padding: 32px 16px;
    color: var(--text-secondary);
    font-size: 14px;
}

/* NASA Images Carousel - horizontal scroll */
.nasa-images-carousel {
    display: flex;
    gap: 12px;
    overflow-x: auto;
    scroll-snap-type: x mandatory;
    -webkit-overflow-scrolling: touch;
    padding-bottom: 8px;
}

.nasa-images-carousel::-webkit-scrollbar {
    height: 4px;
}

.nasa-images-carousel::-webkit-scrollbar-track {
    background: var(--bg-card);
    border-radius: 2px;
}

.nasa-images-carousel::-webkit-scrollbar-thumb {
    background: var(--border-color);
    border-radius: 2px;
}

/* NASA Image Card */
.nasa-image-card {
    flex: 0 0 auto;
    width: 260px;
    scroll-snap-align: start;
    background-color: var(--bg-elevated);
    border-radius: 10px;
    overflow: hidden;
}

.nasa-image {
    width: 100%;
    height: 180px;
    object-fit: cover;
    display: block;
    background-color: var(--bg-card);
}

.nasa-image-title {
    padding: 10px 12px;
    font-size: 12px;
    font-weight: 500;
    color: var(--text-secondary);
    line-height: 1.4;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

/* NASA Credit */
.nasa-credit {
    margin-top: 12px;
    font-size: 10px;
    color: var(--text-muted);
    text-align: right;
}

/* ========================================
   Scroll-Snap Picker Styles
   ======================================== */

/* Shared picker wrapper - naturally edge-to-edge */
.destination-picker-wrapper,
.speed-picker-wrapper {
    position: relative;
    width: 100%;
}

.destination-picker-wrapper {
    margin-bottom: 4px;
}

/* Embla carousel base styles */
.embla {
    overflow: hidden;
}

.embla__container {
    display: flex;
    gap: 12px;
    padding: 8px 16px; /* Match app container padding for edge peek */
    scroll-padding: 16px;
}

.embla__slide {
    flex: 0 0 auto;
    min-width: 0;
}

/* Both pickers use Embla */
.destination-picker.embla,
.speed-picker.embla {
    /* Embla handles scrolling */
    user-select: none;
}

/* Speed picker container adjustments */
.speed-picker .embla__container {
    gap: 10px;
    padding: 4px 16px;
}

/* Destination cards */
.destination-card {
    width: 200px;
    height: 145px;
    border-radius: 12px;
    position: relative;
    overflow: hidden;
    cursor: pointer;
    background: var(--bg-card);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.3), 0 1px 2px rgba(0, 0, 0, 0.2);
    /* Transform and opacity controlled by Embla JS for smooth scaling */
    transition: box-shadow 0.2s;
    display: flex;
    flex-direction: column;
    will-change: transform, opacity;
    user-select: none;
}

.destination-card:hover {
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.4), 0 2px 4px rgba(0, 0, 0, 0.3);
}

.destination-card.selected {
    box-shadow: 0 0 0 2px var(--accent-blue), 0 4px 16px rgba(59, 130, 246, 0.3);
}

.destination-image {
    flex: 1;
    background-color: var(--bg-elevated);
    background-size: cover;
    background-position: center;
}

.destination-name {
    padding: 6px 10px 1px;
    font-size: 13px;
    font-weight: 600;
    color: var(--text-primary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.destination-tagline {
    padding: 0 10px 1px;
    font-size: 10px;
    color: var(--text-secondary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.destination-info {
    padding: 0 10px 4px;
    font-size: 10px;
    color: var(--text-muted);
}

/* Speed cards */
.speed-card {
    width: 140px;
    height: 50px;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    background: var(--bg-card);
    box-shadow: 0 1px 4px rgba(0, 0, 0, 0.3), 0 1px 2px rgba(0, 0, 0, 0.2);
    /* Transform and opacity controlled by Embla JS for smooth scaling */
    transition: box-shadow 0.2s, background-color 0.2s;
    will-change: transform, opacity;
    user-select: none;
}

.speed-card:hover {
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.4), 0 1px 3px rgba(0, 0, 0, 0.3);
}

.speed-card.selected {
    background: rgba(59, 130, 246, 0.15);
    box-shadow: 0 0 0 2px var(--accent-blue), 0 2px 10px rgba(59, 130, 246, 0.3);
}

.speed-name {
    font-size: 13px;
    font-weight: 500;
    color: var(--text-primary);
    text-align: center;
    padding: 0 8px;
}

/* Arrow buttons - hidden for touch-first design */
.picker-arrow {
    display: none;
}

/* Disabled state for pickers */
.destination-picker-wrapper.disabled,
.speed-picker-wrapper.disabled {
    opacity: 0.5;
    pointer-events: none;
}

.destination-picker-wrapper.disabled .picker-arrow,
.speed-picker-wrapper.disabled .picker-arrow {
    display: none;
}

/* Pagination dots - iOS-style */
.embla__dots {
    display: flex;
    justify-content: center;
    gap: 6px;
    padding: 8px 0 4px;
}

.embla__dot {
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: var(--border-color);
    border: none;
    padding: 0;
    cursor: pointer;
    transition: background 0.2s, transform 0.2s;
}

.embla__dot.active {
    background: var(--accent-blue);
    transform: scale(1.2);
}
