/**
 * Szeged Transit Planner - Main Stylesheet
 * Responsive design for mobile and desktop
 */

/* Reset and Base Styles */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
    font-size: 14px;
    line-height: 1.5;
    color: #333;
    background-color: #f5f5f5;
    overflow: hidden;
}

/* App Container */
#app {
    display: flex;
    flex-direction: column;
    height: 100vh;
    width: 100vw;
}

/* Header */
.app-header {
    background-color: #1E90FF;
    color: white;
    padding: 12px 16px;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
    z-index: 1000;
}

.app-header h1 {
    font-size: 20px;
    font-weight: 600;
}

/* Main Content */
.app-content {
    flex: 1;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    position: relative;
}

/* Search Section */
.search-section {
    position: absolute;
    top: 16px;
    left: 16px;
    right: 16px;
    z-index: 500;
}

.search-input {
    width: 100%;
    padding: 12px 16px;
    font-size: 16px;
    border: none;
    border-radius: 8px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
    background-color: white;
}

.search-input:focus {
    outline: 2px solid #1E90FF;
}

.search-results {
    display: none;
    margin-top: 8px;
    background-color: white;
    border-radius: 8px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
    max-height: 300px;
    overflow-y: auto;
}

.search-result-item {
    padding: 12px 16px;
    cursor: pointer;
    border-bottom: 1px solid #eee;
}

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

.search-result-item:hover {
    background-color: #f0f8ff;
}

.result-name {
    font-weight: 500;
    margin-bottom: 4px;
}

.result-name strong {
    color: #1E90FF;
}

.result-distance {
    font-size: 12px;
    color: #666;
}

.search-no-results {
    padding: 12px 16px;
    color: #666;
    text-align: center;
}

/* Vehicle Filter Section */
.filter-section {
    position: absolute;
    top: 80px;
    left: 16px;
    z-index: 500;
    background-color: white;
    border-radius: 8px;
    padding: 12px 16px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
    max-width: 250px;
}

.filter-section h3 {
    font-size: 14px;
    font-weight: 600;
    margin-bottom: 8px;
}

.vehicle-filter {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.vehicle-filter-item {
    display: flex;
    align-items: center;
    gap: 8px;
}

.vehicle-filter-item input[type="checkbox"] {
    width: 18px;
    height: 18px;
    cursor: pointer;
}

.vehicle-filter-item label {
    cursor: pointer;
    user-select: none;
    font-size: 14px;
}

/* Map Container */
.map-container {
    flex: 1;
    width: 100%;
    height: 100%;
    position: relative;
}

/* Route Display Section */
.route-display {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    max-height: 50vh;
    background-color: white;
    border-top-left-radius: 16px;
    border-top-right-radius: 16px;
    box-shadow: 0 -2px 8px rgba(0, 0, 0, 0.15);
    z-index: 500;
    overflow-y: auto;
    padding: 16px;
}

.route-display h3 {
    font-size: 18px;
    font-weight: 600;
    margin-bottom: 12px;
}

.route-list {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.route-item {
    border: 1px solid #ddd;
    border-radius: 8px;
    padding: 12px;
    background-color: #fafafa;
}

.route-summary {
    margin-bottom: 12px;
}

.route-summary strong {
    display: block;
    font-size: 16px;
    margin-bottom: 8px;
    color: #1E90FF;
}

.route-summary div {
    font-size: 13px;
    color: #666;
    margin-bottom: 4px;
}

.route-steps {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.step {
    padding: 8px 12px;
    border-radius: 6px;
    font-size: 13px;
}

.step-walk {
    background-color: #e8f4f8;
    border-left: 3px solid #4CAF50;
}

.step-transit {
    background-color: #fff3e0;
    border-left: 3px solid #FF9800;
}

/* Stop Popup Styles */
.stop-popup {
    font-size: 13px;
}

.stop-popup strong {
    display: block;
    margin-bottom: 4px;
    font-size: 14px;
}

.stop-popup small {
    color: #666;
}

.departures {
    margin-top: 8px;
    padding-top: 8px;
    border-top: 1px solid #eee;
}

.departures div {
    padding: 4px 0;
    font-size: 12px;
}

/* User Location Marker */
.user-location-marker {
    background: transparent;
    border: none;
}

/* Stop Marker */
.stop-marker {
    background: transparent;
    border: none;
}

/* Responsive Design - Desktop */
@media (min-width: 768px) {
    .app-content {
        flex-direction: row;
    }
    
    .search-section {
        position: static;
        width: 350px;
        padding: 16px;
        background-color: white;
        box-shadow: 2px 0 4px rgba(0, 0, 0, 0.1);
        overflow-y: auto;
    }
    
    .search-input {
        box-shadow: 0 1px 4px rgba(0, 0, 0, 0.1);
    }
    
    .filter-section {
        position: static;
        margin-top: 16px;
        box-shadow: 0 1px 4px rgba(0, 0, 0, 0.1);
        max-width: none;
    }
    
    .map-container {
        flex: 1;
    }
    
    .route-display {
        position: static;
        width: 400px;
        max-height: none;
        border-radius: 0;
        border-left: 1px solid #ddd;
        box-shadow: -2px 0 4px rgba(0, 0, 0, 0.1);
    }
}

/* Responsive Design - Mobile Optimization */
@media (max-width: 767px) {
    .app-header h1 {
        font-size: 18px;
    }
    
    .filter-section {
        max-width: calc(100% - 32px);
    }
    
    .route-display {
        max-height: 60vh;
    }
}

/* Touch-friendly tap targets (minimum 44x44px) */
@media (hover: none) and (pointer: coarse) {
    .search-result-item {
        min-height: 44px;
        display: flex;
        flex-direction: column;
        justify-content: center;
    }
    
    .vehicle-filter-item {
        min-height: 44px;
    }
}

/* Accessibility - Focus Indicators */
.search-input:focus,
.vehicle-filter-item input:focus,
.search-result-item:focus {
    outline: 2px solid #1E90FF;
    outline-offset: 2px;
}

/* Loading Indicator */
.loading {
    display: inline-block;
    width: 20px;
    height: 20px;
    border: 3px solid rgba(30, 144, 255, 0.3);
    border-radius: 50%;
    border-top-color: #1E90FF;
    animation: spin 1s ease-in-out infinite;
}

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

/* Offline Indicator */
.offline-banner {
    position: fixed;
    top: 60px;
    left: 50%;
    transform: translateX(-50%);
    background-color: #ff9800;
    color: white;
    padding: 8px 16px;
    border-radius: 4px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
    z-index: 2000;
    font-size: 13px;
}


/* Route Display Styles */
.route-list {
    display: flex;
    flex-direction: column;
    gap: 12px;
    padding: 12px;
}

.route-card {
    background: white;
    border-radius: 8px;
    padding: 16px;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
    cursor: pointer;
    transition: all 0.2s ease;
}

.route-card:hover {
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.15);
    transform: translateY(-2px);
}

.route-card.selected {
    border: 2px solid #1E90FF;
    box-shadow: 0 4px 12px rgba(30, 144, 255, 0.3);
}

.route-summary {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.route-time-info {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.route-times {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 18px;
    font-weight: 600;
}

.departure-time {
    color: #333;
}

.time-arrow {
    color: #999;
    font-size: 16px;
}

.arrival-time {
    color: #333;
}

.route-duration {
    font-size: 14px;
    color: #666;
    font-weight: 500;
}

.route-details {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 13px;
    color: #666;
}

.route-separator {
    color: #ccc;
}

.route-vehicles {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin-top: 4px;
}

.vehicle-badge {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 4px 8px;
    border-radius: 12px;
    color: white;
    font-size: 12px;
    font-weight: 600;
}

.no-routes {
    padding: 24px;
    text-align: center;
    color: #666;
    font-size: 14px;
}

/* Route Directions */
.route-directions {
    background: #f9f9f9;
    border-radius: 8px;
    padding: 16px;
    margin: 0 12px 12px 12px;
}

.route-directions h3 {
    font-size: 16px;
    font-weight: 600;
    margin-bottom: 12px;
    color: #333;
}

.route-steps {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.route-step {
    display: flex;
    gap: 12px;
    align-items: flex-start;
}

.step-icon {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 18px;
    flex-shrink: 0;
    background-color: #e0e0e0;
}

.route-step-transit .step-icon {
    color: white;
}

.step-content {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.step-title {
    font-weight: 600;
    font-size: 14px;
    color: #333;
}

.step-details {
    font-size: 13px;
    color: #666;
}

.step-meta {
    font-size: 12px;
    color: #999;
    display: flex;
    align-items: center;
    gap: 6px;
}

/* Responsive Design */
@media (max-width: 768px) {
    .route-card {
        padding: 12px;
    }
    
    .route-times {
        font-size: 16px;
    }
    
    .route-duration {
        font-size: 13px;
    }
    
    .route-details {
        font-size: 12px;
    }
    
    .vehicle-badge {
        font-size: 11px;
        padding: 3px 6px;
    }
}

/* Touch-friendly tap targets (minimum 44x44px) */
@media (pointer: coarse) {
    .route-card {
        min-height: 44px;
        padding: 16px;
    }
    
    .vehicle-badge {
        min-height: 28px;
        padding: 6px 10px;
    }
}
