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

body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
    color: #1a1a2e;
}

#app {
    display: flex;
    height: 100vh;
}

#sidebar {
    width: 420px;
    min-width: 420px;
    padding: 24px;
    overflow-y: auto;
    background: #f8f9fa;
    border-right: 1px solid #dee2e6;
}

#map {
    flex: 1;
}

h1 {
    font-size: 1.5rem;
    margin-bottom: 4px;
}

.subtitle {
    color: #6c757d;
    font-size: 0.9rem;
    margin-bottom: 20px;
}

.form-group {
    margin-bottom: 12px;
}

.form-group label {
    display: block;
    font-size: 0.85rem;
    font-weight: 600;
    margin-bottom: 4px;
    color: #495057;
}

.form-group input,
.form-group select {
    width: 100%;
    padding: 8px 12px;
    border: 1px solid #ced4da;
    border-radius: 6px;
    font-size: 0.9rem;
    background: white;
}

/* Input with action buttons (geolocation) */
.input-with-actions {
    display: flex;
    gap: 0;
}

.input-with-actions input {
    border-top-right-radius: 0;
    border-bottom-right-radius: 0;
    border-right: none;
}

.input-action-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 38px;
    min-width: 38px;
    border: 1px solid #ced4da;
    border-left: none;
    border-radius: 0 6px 6px 0;
    background: white;
    color: #6c757d;
    cursor: pointer;
    transition: color 0.2s, background 0.2s;
}

.input-action-btn:hover {
    color: #4361ee;
    background: #f0f0ff;
}

.input-action-btn.loading {
    color: #adb5bd;
    pointer-events: none;
}

/* Swap button between origin and destination */
.swap-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
    margin: -4px auto 4px;
    border: 1px solid #dee2e6;
    border-radius: 50%;
    background: white;
    color: #6c757d;
    cursor: pointer;
    transition: color 0.2s, border-color 0.2s, transform 0.2s;
}

.swap-btn:hover {
    color: #4361ee;
    border-color: #4361ee;
    transform: rotate(180deg);
}

/* Suggestions dropdown (history) */
.input-wrap {
    position: relative;
}

.suggestions-dropdown {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    background: white;
    border: 1px solid #ced4da;
    border-top: none;
    border-radius: 0 0 6px 6px;
    max-height: 180px;
    overflow-y: auto;
    z-index: 1000;
    box-shadow: 0 4px 12px rgba(0,0,0,0.1);
}

.suggestion-item {
    padding: 8px 12px;
    font-size: 0.85rem;
    cursor: pointer;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.suggestion-item:hover {
    background: #e8ecff;
    color: #4361ee;
}

.form-group input:focus,
.form-group select:focus {
    outline: none;
    border-color: #4361ee;
    box-shadow: 0 0 0 3px rgba(67, 97, 238, 0.15);
}

.form-row {
    display: flex;
    gap: 12px;
}

.form-row .form-group {
    flex: 1;
}

#calculate-btn {
    width: 100%;
    padding: 12px;
    background: #4361ee;
    color: white;
    border: none;
    border-radius: 8px;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    margin-top: 8px;
    transition: background 0.2s;
}

#calculate-btn:hover {
    background: #3a56d4;
}

#calculate-btn:disabled {
    background: #adb5bd;
    cursor: not-allowed;
}

#results {
    margin-top: 20px;
}

/* Route comparison cards */
.route-card {
    background: white;
    border: 2px solid #dee2e6;
    border-radius: 10px;
    padding: 14px 16px;
    margin-bottom: 10px;
    cursor: pointer;
    transition: border-color 0.2s, box-shadow 0.2s;
}

.route-card:hover {
    border-color: var(--route-color, #4361ee);
}

.route-card.selected {
    border-color: var(--route-color, #4361ee);
    box-shadow: 0 0 0 3px color-mix(in srgb, var(--route-color, #4361ee) 20%, transparent);
}

.route-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 8px;
}

.route-label {
    display: flex;
    align-items: center;
    gap: 8px;
    font-weight: 600;
    font-size: 0.95rem;
}

.route-dot {
    width: 12px;
    height: 12px;
    border-radius: 50%;
    display: inline-block;
    flex-shrink: 0;
}

.route-total {
    font-size: 1.3rem;
    font-weight: 700;
    color: #1a1a2e;
}

.cheapest-tag {
    background: #d4edda;
    color: #155724;
    font-size: 0.7rem;
    font-weight: 600;
    padding: 2px 8px;
    border-radius: 10px;
}

.savings-tag {
    background: #f8d7da;
    color: #721c24;
    font-size: 0.7rem;
    font-weight: 600;
    padding: 2px 8px;
    border-radius: 10px;
}

.route-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 6px 14px;
    font-size: 0.8rem;
    color: #6c757d;
}

.route-portals {
    margin-top: 12px;
    padding-top: 12px;
    border-top: 1px solid #e9ecef;
}

.breakdown-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.78rem;
}

.breakdown-table th {
    background: #e9ecef;
    padding: 5px 6px;
    text-align: left;
    font-weight: 600;
}

.breakdown-table td {
    padding: 5px 6px;
    border-bottom: 1px solid #f0f0f0;
}

.breakdown-table tr:last-child td {
    border-bottom: none;
}

.no-portals {
    text-align: center;
    color: #2d6a4f;
    padding: 10px !important;
}

.band-tbfp { color: #2d6a4f; }
.band-tbp { color: #e76f51; }
.band-ts { color: #d62828; font-weight: 600; }

#no-tolls {
    background: #d4edda;
    padding: 16px;
    border-radius: 8px;
    text-align: center;
    margin-top: 12px;
}

#error {
    background: #f8d7da;
    color: #721c24;
    padding: 12px;
    border-radius: 8px;
    margin-top: 16px;
    font-size: 0.85rem;
}

.tip {
    margin-top: 20px;
    padding: 12px;
    background: #fff3cd;
    border-radius: 8px;
    font-size: 0.8rem;
    color: #856404;
}

.hidden {
    display: none !important;
}

/* Map markers */
.portal-marker {
    background: #6c757d;
    border: 2px solid white;
    border-radius: 50%;
    width: 12px;
    height: 12px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.3);
}

.portal-marker.crossed {
    background: #e63946;
    width: 14px;
    height: 14px;
}

.pin-marker {
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 12px;
    font-weight: 700;
    color: white;
    border-radius: 50%;
    box-shadow: 0 2px 6px rgba(0,0,0,0.3);
}

.pin-start {
    background: #2d6a4f;
}

.pin-end {
    background: #d62828;
}

/* Mobile responsive */
@media (max-width: 768px) {
    #app {
        flex-direction: column;
    }
    #sidebar {
        width: 100%;
        min-width: unset;
        max-height: 50vh;
        border-right: none;
        border-bottom: 1px solid #dee2e6;
    }
    #map {
        min-height: 50vh;
    }
}
