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

:root {
    --primary-color: #2E7D32;
    --primary-hover: #1B5E20;
    --secondary-color: #64748b;
    --danger-color: #dc2626;
    --danger-hover: #b91c1c;
    --success-color: #2E7D32;
    --accent-color: #FFC107;
    --background: #f1f8f4;
    --surface: #ffffff;
    --text-primary: #1e293b;
    --text-secondary: #64748b;
    --border-color: #c8e6c9;
    --shadow: 0 1px 3px 0 rgba(0, 0, 0, 0.1);
    --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1);
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    background: var(--background);
    color: var(--text-primary);
    line-height: 1.6;
}

.container {
    max-width: 1400px;
    margin: 0 auto;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

/* Header */
.header {
    background: linear-gradient(135deg, #2E7D32 0%, #1B5E20 100%);
    color: white;
    padding: 1.5rem 1.5rem 2rem;
    text-align: center;
    box-shadow: var(--shadow-lg);
    position: relative;
    overflow: hidden;
}

.header::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: linear-gradient(135deg, rgba(255,193,7,0.1) 0%, transparent 50%);
    pointer-events: none;
}

.header-content {
    position: relative;
    z-index: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 1.5rem;
    flex-wrap: wrap;
}

.logo-container {
    width: 90px;
    height: 90px;
    background: white;
    border-radius: 50%;
    padding: 0.4rem;
    box-shadow: 0 4px 16px rgba(0,0,0,0.25), 0 0 0 3px #FFC107;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: transform 0.3s ease;
}

.logo-container:hover {
    transform: scale(1.05);
}

.logo-container img {
    width: 100%;
    height: 100%;
    object-fit: contain;
    border-radius: 50%;
}

.header-text {
    text-align: left;
}

.header h1 {
    font-size: 2rem;
    font-weight: 700;
    margin-bottom: 0.25rem;
    text-shadow: 2px 2px 4px rgba(0,0,0,0.2);
}

.city-name {
    color: #FFC107;
    font-size: 1.1rem;
    font-weight: 600;
    margin-bottom: 0.25rem;
    text-transform: uppercase;
    letter-spacing: 1px;
}

.subtitle {
    font-size: 0.95rem;
    opacity: 0.95;
    font-weight: 400;
}

@media (max-width: 767px) {
    .header-content {
        flex-direction: column;
        gap: 1rem;
    }
    
    .header-text {
        text-align: center;
    }
    
    .logo-container {
        width: 70px;
        height: 70px;
    }
    
    .header h1 {
        font-size: 1.5rem;
    }
}

/* Main Content Layout */
.main-content {
    display: grid;
    grid-template-columns: 1fr;
    gap: 1.5rem;
    padding: 1.5rem;
    flex: 1;
}

@media (min-width: 768px) {
    .main-content {
        grid-template-columns: 2fr 1fr;
    }
}

/* Map Section */
.map-section {
    background: var(--surface);
    border-radius: 12px;
    box-shadow: var(--shadow);
    overflow: hidden;
    display: flex;
    flex-direction: column;
}

.map-controls {
    display: flex;
    gap: 0.75rem;
    padding: 1rem;
    background: var(--surface);
    border-bottom: 1px solid var(--border-color);
    flex-wrap: wrap;
}

/* Destination Search */
.destination-search {
    padding: 0 1rem 1rem;
    background: var(--surface);
    border-bottom: 1px solid var(--border-color);
}

.search-container {
    position: relative;
    width: 100%;
}

.search-input {
    width: 100%;
    padding: 0.875rem 1rem;
    border: 2px solid var(--border-color);
    border-radius: 8px;
    font-size: 1rem;
    transition: all 0.2s;
    background: white;
}

.search-input:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(46, 125, 50, 0.1);
    border-radius: 8px 8px 0 0;
}

.search-suggestions {
    position: absolute;
    top: calc(100% + 2px);
    left: 0;
    right: 0;
    background: white;
    border: 2px solid var(--primary-color);
    border-top: none;
    border-radius: 0 0 8px 8px;
    max-height: 250px;
    overflow-y: auto;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    z-index: 1000;
    margin-top: -2px;
}

.suggestion-item {
    padding: 0.75rem 1rem;
    cursor: pointer;
    transition: background-color 0.15s;
    border-bottom: 1px solid #f1f5f9;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

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

.suggestion-item:hover {
    background-color: #f1f8f4;
}

.suggestion-item.active {
    background-color: #e8f5e9;
}

.suggestion-icon {
    color: var(--primary-color);
    font-size: 1.1rem;
}

.suggestion-text {
    flex: 1;
}

.suggestion-name {
    font-weight: 600;
    color: var(--text-primary);
    display: block;
}

.suggestion-category {
    font-size: 0.8rem;
    color: var(--text-secondary);
}

#map {
    height: 50vh;
    min-height: 400px;
    flex: 1;
}

@media (min-width: 768px) {
    #map {
        height: 60vh;
        min-height: 500px;
    }
}

.coordinates-display {
    padding: 1rem;
    background: var(--background);
    border-top: 1px solid var(--border-color);
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    font-size: 0.875rem;
}

.coord-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.coord-label {
    font-weight: 600;
    color: var(--text-secondary);
}

.coord-value {
    color: var(--text-primary);
    font-family: 'Courier New', monospace;
}

/* Parameters Section */
.parameters-section {
    background: var(--surface);
    border-radius: 12px;
    box-shadow: var(--shadow);
    padding: 1.5rem;
    position: sticky;
    top: 1.5rem;
    height: fit-content;
    max-height: calc(100vh - 3rem);
    overflow-y: auto;
}

.parameters-section h2 {
    font-size: 1.25rem;
    margin-bottom: 1rem;
    color: var(--text-primary);
}

/* Form Styles */
.form-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 0.75rem 1rem;
    margin-bottom: 1rem;
}

.form-group {
    margin-bottom: 0.75rem;
}

.form-group.full-width {
    grid-column: 1 / -1;
}

.form-group label {
    display: block;
    font-weight: 600;
    margin-bottom: 0.375rem;
    color: var(--text-primary);
    font-size: 0.8rem;
}

.form-control {
    width: 100%;
    padding: 0.625rem 0.75rem;
    border: 2px solid var(--border-color);
    border-radius: 8px;
    font-size: 0.9rem;
    transition: border-color 0.2s, box-shadow 0.2s;
    background: var(--surface);
}

.form-control:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.1);
}

.form-control:read-only {
    background: var(--background);
    color: var(--text-secondary);
    cursor: not-allowed;
}

select.form-control {
    cursor: pointer;
}

/* Responsive grid - stack on small screens */
@media (max-width: 1200px) {
    .form-grid {
        grid-template-columns: 1fr;
    }
}

/* Buttons */
.btn {
    padding: 0.75rem 1.5rem;
    border: none;
    border-radius: 8px;
    font-size: 0.875rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
}

.btn:hover {
    transform: translateY(-1px);
    box-shadow: var(--shadow-lg);
}

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

.btn-primary {
    background: var(--primary-color);
    color: white;
    width: 100%;
    padding: 1rem;
    font-size: 1rem;
}

.btn-primary:hover {
    background: var(--primary-hover);
}

.btn-primary:disabled {
    background: var(--secondary-color);
    cursor: not-allowed;
    opacity: 0.6;
}

.btn-secondary {
    background: var(--secondary-color);
    color: white;
}

.btn-secondary:hover {
    background: #475569;
}

.btn-danger {
    background: var(--danger-color);
    color: white;
}

.btn-danger:hover {
    background: var(--danger-hover);
}

.spinner {
    animation: spin 1s linear infinite;
}

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

/* Prediction Result */
.prediction-result {
    margin-top: 2rem;
    padding: 1.5rem;
    background: linear-gradient(135deg, #e8f5e9 0%, #c8e6c9 100%);
    border-radius: 12px;
    text-align: center;
    border: 3px solid var(--success-color);
    box-shadow: 0 4px 12px rgba(46, 125, 50, 0.2);
    animation: slideIn 0.3s ease-out;
    position: relative;
    overflow: hidden;
}

.prediction-result::before {
    content: '🎉';
    position: absolute;
    top: 10px;
    right: 10px;
    font-size: 2rem;
    opacity: 0.3;
}

@keyframes slideIn {
    from {
        opacity: 0;
        transform: translateY(-10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.prediction-result h3 {
    color: var(--success-color);
    font-size: 1rem;
    margin-bottom: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.fare-amount {
    font-size: 3rem;
    font-weight: 700;
    color: var(--success-color);
    margin: 0.5rem 0;
}

.result-note {
    font-size: 0.875rem;
    color: var(--text-secondary);
    margin-top: 0.5rem;
}

/* Error Message */
.error-message {
    margin-top: 1rem;
    padding: 1rem;
    background: #fee2e2;
    border: 2px solid var(--danger-color);
    border-radius: 8px;
    color: var(--danger-color);
    font-size: 0.875rem;
    animation: slideIn 0.3s ease-out;
}

/* Instructions */
.instructions {
    margin-top: 2rem;
    padding: 1.5rem;
    background: var(--background);
    border-radius: 8px;
    border-left: 4px solid var(--primary-color);
}

.instructions h3 {
    font-size: 1rem;
    margin-bottom: 1rem;
    color: var(--primary-color);
}

.instructions ol {
    margin-left: 1.25rem;
    color: var(--text-secondary);
}

.instructions li {
    margin-bottom: 0.5rem;
    font-size: 0.875rem;
}

/* Footer */
.footer {
    background: var(--surface);
    border-top: 1px solid var(--border-color);
    padding: 1.5rem;
    text-align: center;
    color: var(--text-secondary);
    font-size: 0.875rem;
}

.footer a {
    color: var(--primary-color);
    text-decoration: none;
}

.footer a:hover {
    text-decoration: underline;
}

/* Custom Leaflet Marker Styles */
.leaflet-marker-icon {
    border-radius: 50%;
}

/* Responsive Design */
@media (max-width: 767px) {
    .header h1 {
        font-size: 1.5rem;
    }
    
    .subtitle {
        font-size: 0.875rem;
    }
    
    .map-controls {
        flex-direction: column;
    }
    
    .btn {
        width: 100%;
    }
    
    .fare-amount {
        font-size: 2.5rem;
    }
    
    .parameters-section {
        position: relative;
        top: 0;
        max-height: none;
    }
    
    .search-suggestions {
        max-height: 200px;
    }
    
    .search-input {
        font-size: 16px; /* Prevents zoom on iOS */
    }
}

/* Loading State */
.loading-overlay {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(255, 255, 255, 0.9);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
}

/* Accessibility */
.btn:focus,
.form-control:focus {
    outline: 2px solid var(--primary-color);
    outline-offset: 2px;
}

/* Route Options Selector */
.route-options-container {
    margin-bottom: 1rem;
    padding: 0.75rem;
    background: #f8fafc;
    border-radius: 10px;
    border: 2px solid var(--border-color);
}

.route-options-title {
    font-size: 0.75rem;
    font-weight: 600;
    color: var(--text-secondary);
    margin-bottom: 0.5rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.route-option {
    background: white;
    border: 2px solid #e2e8f0;
    border-radius: 6px;
    padding: 0.625rem 0.75rem;
    margin-bottom: 0.375rem;
    cursor: pointer;
    transition: all 0.2s ease;
}

.route-option:last-child {
    margin-bottom: 0;
}

.route-option:hover {
    border-color: var(--primary-color);
    transform: translateY(-1px);
    box-shadow: 0 2px 8px rgba(46, 125, 50, 0.1);
}

.route-option.selected {
    border-color: var(--primary-color);
    background: linear-gradient(135deg, rgba(46, 125, 50, 0.05) 0%, rgba(46, 125, 50, 0.02) 100%);
    box-shadow: 0 2px 8px rgba(46, 125, 50, 0.15);
}

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

.route-option-title {
    font-weight: 600;
    color: var(--text-primary);
    font-size: 0.85rem;
}

.route-badge {
    background: var(--primary-color);
    color: white;
    padding: 0.125rem 0.5rem;
    border-radius: 10px;
    font-size: 0.7rem;
    font-weight: 600;
}

.route-option-details {
    display: flex;
    gap: 0.875rem;
}

.route-detail {
    display: flex;
    align-items: center;
    gap: 0.25rem;
    color: var(--text-secondary);
    font-size: 0.8rem;
}

.route-detail svg {
    color: var(--primary-color);
    flex-shrink: 0;
}

/* Print Styles */
@media print {
    .map-controls,
    .btn,
    .instructions {
        display: none;
    }
}
