:root {
    --primary: #007bff;
    --success: #28a745;
    --warning: #fd7e14;
    --passed: #6c757d;
    --bg: #f4f7f9;
}

body {
    font-family: 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;
    margin: 0;
    background-color: var(--bg);
    -webkit-tap-highlight-color: transparent;
}

.sticky-header {
    position: sticky;
    top: 0;
    z-index: 100;
    background: white;
    padding: 15px;
    box-shadow: 0 2px 10px rgba(0,0,0,0.1);
}

.controls {
    max-width: 500px;
    margin: 0 auto;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

input[type="date"] {
    padding: 12px;
    border: 2px solid #ddd;
    border-radius: 8px;
    font-size: 16px;
    outline: none;
}

.button-group {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px;
}

button {
    padding: 14px;
    border: none;
    border-radius: 8px;
    font-size: 15px;
    font-weight: bold;
    cursor: pointer;
    transition: transform 0.1s;
}

.dir-btn {
    background: #e9ecef;
    color: #495057;
    border: 2px solid transparent;
}
.dir-btn.active-dir {
    background: var(--primary);
    color: white;
    border-color: #0056b3;
}
button:active { transform: scale(0.97); }

.results-container {
    max-width: 500px;
    margin: 20px auto;
    padding: 0 15px 20px 15px;
}

.card {
    background: white;
    border-radius: 12px;
    padding: 16px;
    margin-bottom: 15px;
    box-shadow: 0 2px 5px rgba(0,0,0,0.05);
    border-left: 6px solid #dee2e6;
    transition: opacity 0.3s;
}

.card.status-passed { border-left-color: var(--passed); opacity: 0.6; }
.card.status-optimal { border-left-color: var(--success); }
.card.status-tight { border-left-color: var(--warning); }

.timeline { display: flex; flex-direction: column; gap: 8px; }
.step { display: flex; align-items: center; gap: 10px; font-size: 14px; }
.time { font-weight: bold; font-size: 16px; min-width: 50px; }

.badge {
    display: inline-block;
    padding: 4px 8px;
    border-radius: 4px;
    font-size: 12px;
    margin-top: 10px;
    font-weight: bold;
}
.badge-tight { background: #fff3cd; color: #856404; }
.badge-optimal { background: #d4edda; color: #155724; }

.fab-share {
    position: fixed;
    bottom: 25px;
    right: 25px;
    width: 56px;
    height: 56px;
    border-radius: 28px;
    background: var(--primary);
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 4px 12px rgba(0,0,0,0.3);
}

/* Skeleton Loading Animation */
.skeleton {
    height: 100px;
    background: linear-gradient(90deg, #ececec 25%, #f5f5f5 50%, #ececec 75%);
    background-size: 200% 100%;
    animation: loading 1.5s infinite;
    border-radius: 12px;
    margin-bottom: 15px;
}
@keyframes loading { 0% { background-position: 200% 0; } 100% { background-position: -200% 0; } }

.welcome-msg {
    text-align: center;
    color: #6c757d;
    font-size: 16px;
    margin-top: 20px;
    line-height: 1.5;
}

.app-footer {
    max-width: 500px;
    margin: 0 auto;
    padding: 0 15px 100px 15px;
    text-align: center;
}

.app-footer h4 {
    margin-top: 10px;
    margin-bottom: 15px;
    color: #495057;
}

.footer-links {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.footer-btn {
    display: inline-block;
    padding: 12px;
    background: #e9ecef;
    color: #495057;
    text-decoration: none;
    border-radius: 8px;
    font-weight: bold;
    font-size: 14px;
    transition: background 0.2s, transform 0.1s;
}

.footer-btn:hover {
    background: #dee2e6;
}

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

/* Tabs */
.tabs-container {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 15px;
    gap: 10px;
}

.tabs {
    display: flex;
    background: #e9ecef;
    border-radius: 8px;
    padding: 4px;
    flex: 1;
}

.tab {
    flex: 1;
    text-align: center;
    padding: 8px 12px;
    text-decoration: none;
    color: #495057;
    font-weight: bold;
    border-radius: 6px;
    font-size: 14px;
    transition: background 0.2s;
}

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

.btn-icon {
    background: #e9ecef;
    color: #495057;
    padding: 8px;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 18px;
    width: 40px;
    height: 40px;
}

/* City Card specific */
.city-card {
    border-left-color: var(--primary);
}

.main-stop {
    font-size: 15px;
}

.spoiler-wrapper {
    margin-top: 12px;
    background: #f8f9fa;
    border-radius: 8px;
    padding: 8px;
}

.toggle-spoiler {
    background: none;
    border: none;
    color: var(--primary);
    width: 100%;
    text-align: left;
    padding: 4px;
    font-size: 14px;
    font-weight: normal;
}

.stops-list {
    margin-top: 8px;
    padding-top: 8px;
    border-top: 1px solid #dee2e6;
    font-size: 13px;
    color: #6c757d;
}

.stops-ul {
    list-style: none;
    padding: 0;
    margin: 0;
}

.stops-ul li {
    display: flex;
    justify-content: space-between;
    padding: 4px 0;
    border-bottom: 1px solid #f1f3f5;
}
.stops-ul li:last-child { border-bottom: none; }

.return-trips {
    margin-top: 12px;
    padding-top: 12px;
    border-top: 1px dashed #dee2e6;
}

.return-title {
    margin: 0 0 8px 0;
    font-size: 13px;
    color: #495057;
}

.return-times {
    display: flex;
    gap: 8px;
}

.return-badge {
    background: #e9ecef;
    padding: 4px 8px;
    border-radius: 4px;
    font-size: 13px;
    font-weight: bold;
    color: #495057;
    border: none;
    transition: background 0.2s, transform 0.1s;
}

.clickable-badge {
    cursor: pointer;
    background: #e3f2fd;
    color: var(--primary);
    border: 1px solid #b6effb;
}

.return-badge-warning {
    background: #fff3cd !important;
    color: #856404 !important;
    border-color: #ffeeba !important;
}

.clickable-badge:hover {
    background: #cce5ff;
    transform: scale(1.05);
}

.clickable-badge:active {
    transform: scale(0.95);
}

.loader {
    text-align: center;
    padding: 10px;
    color: var(--primary);
}

/* Bottom Sheet */
.sheet-overlay {
    position: fixed;
    top: 0; left: 0; right: 0; bottom: 0;
    background: rgba(0,0,0,0.5);
    z-index: 1000;
    opacity: 0;
    transition: opacity 0.3s ease;
}
.sheet-overlay.visible {
    opacity: 1;
}
.bottom-sheet {
    position: fixed;
    left: 0; right: 0; bottom: 0;
    max-height: 85vh;
    background: white;
    border-radius: 20px 20px 0 0;
    z-index: 1001;
    display: flex;
    flex-direction: column;
    box-shadow: 0 -4px 20px rgba(0,0,0,0.15);
    transform: translateY(100%);
    transition: transform 0.3s cubic-bezier(0.2, 0.8, 0.2, 1);
}
.bottom-sheet.open {
    transform: translateY(0) !important;
}
.sheet-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 16px 20px;
    border-bottom: 1px solid #dee2e6;
}
.sheet-header h3 {
    margin: 0;
    font-size: 18px;
    font-weight: 600;
    color: #495057;
}
.sheet-close {
    background: none;
    border: none;
    font-size: 24px;
    color: #6c757d;
    cursor: pointer;
    line-height: 1;
    padding: 0 5px;
}
.sheet-content {
    padding: 16px 20px;
    overflow-y: auto;
    flex: 1;
}

/* Vertical Timeline for Stops */
.stops-timeline {
    position: relative;
    padding-left: 20px;
    margin-top: 5px;
    margin-bottom: 20px;
}
.stops-timeline::before {
    content: '';
    position: absolute;
    left: 7px;
    top: 15px;
    bottom: 15px;
    width: 2px;
    background: #dee2e6;
}
.stop-item {
    position: relative;
    padding: 12px 0;
    display: flex;
    justify-content: space-between;
    align-items: center;
}
.stop-item::before {
    content: '';
    position: absolute;
    left: -18px;
    top: 50%;
    transform: translateY(-50%);
    width: 12px;
    height: 12px;
    border-radius: 50%;
    background: white;
    border: 2px solid var(--primary);
    z-index: 1;
}
.stop-item.passed::before {
    border-color: var(--passed);
    background: var(--passed);
}
.stop-item.passed .stop-name, .stop-item.passed .stop-time {
    color: var(--passed);
}
.stop-name {
    font-size: 15px;
    font-weight: 500;
    color: #343a40;
    flex: 1;
    padding-right: 15px;
}
.stop-time {
    font-weight: bold;
    font-size: 15px;
    color: #495057;
}

.stop-item.highlighted-stop .stop-name {
    font-weight: 800;
    color: var(--primary);
}

.stop-item.highlighted-stop .stop-time {
    font-weight: 800;
    color: white;
    background: var(--primary);
    padding: 2px 6px;
    border-radius: 4px;
}
