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

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    min-height: 100vh;
    padding: 20px;
}

.container {
    max-width: 1200px;
    margin: 0 auto;
    background: white;
    border-radius: 20px;
    box-shadow: 0 20px 60px rgba(0,0,0,0.3);
    overflow: hidden;
}

.header {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    padding: 30px;
    text-align: center;
}

.header h1 { 
    font-size: 2.5em; 
    margin-bottom: 10px; 
}

.header p { 
    font-size: 1.1em; 
    opacity: 0.9; 
}

.content { 
    padding: 40px; 
}

.section {
    background: #f8f9fa;
    padding: 25px;
    border-radius: 12px;
    margin-bottom: 25px;
}

.section h2 {
    color: #667eea;
    margin-bottom: 20px;
    font-size: 1.5em;
    border-bottom: 2px solid #667eea;
    padding-bottom: 10px;
}

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

label {
    display: block;
    font-weight: 600;
    margin-bottom: 8px;
    color: #333;
}

input[type="text"], 
input[type="number"], 
input[type="date"], 
input[type="time"] {
    width: 100%;
    padding: 12px;
    border: 2px solid #ddd;
    border-radius: 8px;
    font-size: 1em;
    transition: border-color 0.3s;
}

input:focus {
    outline: none;
    border-color: #667eea;
}

.checkbox-group {
    display: flex;
    align-items: center;
    gap: 10px;
}

input[type="checkbox"] {
    width: 20px;
    height: 20px;
    cursor: pointer;
}

/* Radio buttons styling */
.radio-group {
    display: flex;
    flex-direction: column;
    gap: 15px;
}

.radio-label {
    display: flex;
    align-items: center;
    padding: 15px;
    background: white;
    border: 2px solid #ddd;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.3s;
}

.radio-label:hover {
    border-color: #667eea;
    background: #f0f4ff;
}

.radio-label input[type="radio"] {
    width: 20px;
    height: 20px;
    margin-right: 12px;
    cursor: pointer;
}

.radio-label input[type="radio"]:checked + span {
    font-weight: 600;
    color: #667eea;
}

.radio-label span {
    flex: 1;
    font-size: 1em;
}

.shipments-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
    gap: 15px;
    margin-top: 15px;
}

.shipment-card {
    background: white;
    padding: 15px;
    border-radius: 8px;
    border: 2px solid #e0e0e0;
    transition: all 0.3s;
    cursor: pointer;
    position: relative;
}

.shipment-card:hover {
    border-color: #667eea;
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(102, 126, 234, 0.2);
}

/* Custom mode: selected state (green) */
.shipment-card.selected {
    background: #e8f5e9;
    border-color: #4CAF50;
}

.shipment-card.selected .selection-badge {
    display: block;
}

/* Random mode: ignored state (red) */
.shipment-card.ignored {
    background: #ffe0e0;
    border-color: #ff6b6b;
    opacity: 0.7;
}

.shipment-card.ignored .ignore-badge {
    display: block;
}

.shipment-card h4 {
    color: #333;
    margin-bottom: 8px;
}

.shipment-card p {
    color: #666;
    font-size: 0.9em;
}

.site-footer {
    text-align: center;
    padding: 20px 0 30px;
    color: #666;
    font-size: 14px;
}

.site-footer a {
    color: #667eea;
    text-decoration: none;
    font-weight: 600;
    margin: 0 6px;
}

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

.duration-input {
    width: 100%;
    padding: 8px;
    margin-top: 8px;
    border: 2px solid #ddd;
    border-radius: 6px;
    font-size: 0.95em;
    font-weight: 600;
}

.duration-input:focus {
    outline: none;
    border-color: #667eea;
}

.ignore-badge {
    position: absolute;
    top: 10px;
    right: 10px;
    background: #ff6b6b;
    color: white;
    padding: 4px 10px;
    border-radius: 12px;
    font-size: 0.8em;
    font-weight: 600;
    display: none;
}

.selection-badge {
    position: absolute;
    top: 10px;
    right: 10px;
    background: #4CAF50;
    color: white;
    padding: 4px 10px;
    border-radius: 12px;
    font-size: 0.8em;
    font-weight: 600;
    display: none;
}

.selection-number {
    position: absolute;
    top: 10px;
    left: 10px;
    background: #667eea;
    color: white;
    width: 30px;
    height: 30px;
    border-radius: 50%;
    display: none;
    align-items: center;
    justify-content: center;
    font-weight: bold;
    font-size: 1.1em;
}

.shipment-card.selected .selection-number {
    display: flex;
}

.btn {
    padding: 15px 40px;
    font-size: 1.1em;
    font-weight: 600;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.3s;
    width: 100%;
}

.btn-primary {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 10px 30px rgba(102, 126, 234, 0.4);
}

.btn-primary:disabled {
    background: #ccc;
    cursor: not-allowed;
    transform: none;
}

.loading {
    text-align: center;
    padding: 40px;
    display: none;
}

.spinner {
    border: 5px solid #f3f3f3;
    border-top: 5px solid #667eea;
    border-radius: 50%;
    width: 60px;
    height: 60px;
    animation: spin 1s linear infinite;
    margin: 0 auto 20px;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

.results {
    display: none;
}

.result-card {
    background: #f8f9fa;
    padding: 20px;
    border-radius: 12px;
    margin-bottom: 15px;
    border-left: 5px solid #667eea;
}

.link-card {
    background: white;
    padding: 15px;
    border-radius: 8px;
    margin: 10px 0;
    border: 2px solid #e0e0e0;
}

.link-card a {
    color: #667eea;
    text-decoration: none;
    font-weight: 600;
}

.link-card a:hover {
    text-decoration: underline;
}

.error {
    background: #ffe0e0;
    color: #d32f2f;
    padding: 20px;
    border-radius: 12px;
    margin: 20px 0;
    border-left: 5px solid #d32f2f;
}

#map {
    width: 100%;
    height: 600px;
    border-radius: 12px;
    box-shadow: 0 5px 15px rgba(0,0,0,0.2);
    margin: 20px 0;
}

.map-container {
    position: relative;
}

.map-legend {
    position: absolute;
    top: 10px;
    right: 10px;
    background: white;
    padding: 15px;
    border-radius: 8px;
    box-shadow: 0 2px 10px rgba(0,0,0,0.2);
    z-index: 1000;
    max-width: 200px;
}

.legend-item {
    display: flex;
    align-items: center;
    margin: 8px 0;
    font-size: 0.9em;
}

.legend-color {
    width: 30px;
    height: 4px;
    margin-right: 10px;
    border-radius: 2px;
}

.trip-details {
    background: white;
    border-radius: 12px;
    padding: 20px;
    margin: 15px 0;
}

.trip-timeline {
    position: relative;
    padding-left: 40px;
    margin: 20px 0;
}

.timeline-item {
    position: relative;
    padding: 20px;
    margin: 15px 0;
    background: #f8f9fa;
    border-radius: 8px;
    border-left: 4px solid #667eea;
}

.timeline-item::before {
    content: '';
    position: absolute;
    left: -42px;
    top: 25px;
    width: 16px;
    height: 16px;
    border-radius: 50%;
    background: #667eea;
    border: 3px solid white;
    box-shadow: 0 0 0 2px #667eea;
}

.timeline-connector {
    position: absolute;
    left: -35px;
    top: 45px;
    width: 2px;
    height: calc(100% + 15px);
    background: #ddd;
}

.timeline-item:last-child .timeline-connector {
    display: none;
}

.timeline-start, .timeline-end {
    background: #e3f2fd;
    border-left-color: #2196F3;
}

.timeline-start::before, .timeline-end::before {
    background: #2196F3;
    box-shadow: 0 0 0 2px #2196F3;
}

.time-badge {
    display: inline-block;
    background: #667eea;
    color: white;
    padding: 5px 12px;
    border-radius: 20px;
    font-size: 0.9em;
    font-weight: 600;
    margin-right: 10px;
}

.duration-badge {
    display: inline-block;
    background: #4CAF50;
    color: white;
    padding: 5px 12px;
    border-radius: 20px;
    font-size: 0.9em;
    margin-right: 10px;
}

.location-name {
    font-size: 1.2em;
    font-weight: 600;
    color: #333;
    margin: 10px 0;
}

.stop-number {
    display: inline-block;
    background: #667eea;
    color: white;
    width: 30px;
    height: 30px;
    border-radius: 50%;
    text-align: center;
    line-height: 30px;
    font-weight: bold;
    margin-right: 10px;
}

.summary-card {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 15px;
    margin: 20px 0;
}

.summary-item {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    padding: 20px;
    border-radius: 12px;
    text-align: center;
}

.summary-value {
    font-size: 2em;
    font-weight: bold;
    margin: 10px 0;
}

.summary-label {
    font-size: 0.9em;
    opacity: 0.9;
}

/* Route Tabs */
.route-tabs {
    display: flex;
    gap: 10px;
    margin-bottom: 20px;
    flex-wrap: wrap;
}

.route-tab {
    padding: 12px 24px;
    background: white;
    border: 2px solid #ddd;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.3s;
    font-weight: 600;
    font-size: 1em;
}

.route-tab:hover {
    border-color: #667eea;
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(102, 126, 234, 0.2);
}

.route-tab.active {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border-color: #667eea;
}

.route-content {
    display: none;
}

.route-content.active {
    display: block;
    animation: fadeIn 0.3s ease-in;
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}
/* Responsive layout improvements */
@media (max-width: 992px) {
    body {
        padding: 14px;
    }

    .content {
        padding: 24px;
    }

    .header h1 {
        font-size: 2rem;
    }

    #map {
        height: 460px;
    }
}

@media (max-width: 768px) {
    body {
        padding: 8px;
    }

    .container {
        border-radius: 14px;
    }

    .header,
    .content {
        padding: 18px;
    }

    .header h1 {
        font-size: 1.6rem;
    }

    .section {
        padding: 16px;
        margin-bottom: 16px;
    }

    .section h2 {
        font-size: 1.2rem;
    }

    .btn {
        padding: 12px 20px;
        font-size: 1rem;
    }

    .map-legend {
        position: static;
        max-width: 100%;
        margin-top: 12px;
    }

    #map {
        height: 340px;
        margin: 12px 0;
    }

    .trip-timeline {
        padding-left: 28px;
    }

    .timeline-item {
        padding: 14px;
    }

    .timeline-item::before {
        left: -31px;
    }

    .timeline-connector {
        left: -24px;
    }
}

@media (max-width: 576px) {
    .header p,
    .radio-label span,
    .shipment-card p,
    .legend-item {
        font-size: 0.9rem;
    }

    .shipments-grid,
    .summary-card {
        grid-template-columns: 1fr;
    }

    .ignore-badge,
    .selection-badge {
        font-size: 0.7rem;
        padding: 3px 8px;
    }

    .selection-number,
    .stop-number {
        width: 26px;
        height: 26px;
        line-height: 26px;
        font-size: 0.9rem;
    }

    .time-badge,
    .duration-badge {
        margin-bottom: 8px;
    }

    #map {
        height: 260px;
    }
}
