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

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    min-height: 100vh;
    padding: 20px;
    color: #333;
}

.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: 40px;
    text-align: center;
}

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

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

.input-section {
    padding: 40px;
    background: #f8f9fa;
}

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

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

.form-group input,
.form-group select {
    width: 100%;
    padding: 12px 16px;
    border: 2px solid #e1e8ed;
    border-radius: 8px;
    font-size: 1em;
    transition: border-color 0.3s;
}

.form-group input:focus,
.form-group select:focus {
    outline: none;
    border-color: #667eea;
}

.form-group small {
    display: block;
    margin-top: 5px;
    color: #666;
    font-size: 0.85em;
}

.btn-primary {
    width: 100%;
    padding: 16px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border: none;
    border-radius: 8px;
    font-size: 1.1em;
    font-weight: 600;
    cursor: pointer;
    transition: transform 0.2s, box-shadow 0.2s;
}

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

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

.btn-primary:disabled {
    opacity: 0.6;
    cursor: not-allowed;
    transform: none;
}

.swap-button-container {
    display: flex;
    justify-content: center;
    margin: -10px 0 15px 0;
}

.btn-swap {
    background: white;
    border: 2px solid #667eea;
    color: #667eea;
    width: 50px;
    height: 50px;
    border-radius: 50%;
    font-size: 1.8em;
    cursor: pointer;
    transition: all 0.3s;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 2px 8px rgba(102, 126, 234, 0.2);
}

.btn-swap:hover {
    background: #667eea;
    color: white;
    transform: rotate(180deg);
    box-shadow: 0 4px 12px rgba(102, 126, 234, 0.4);
}

.btn-swap:active {
    transform: rotate(180deg) scale(0.95);
}

.results-section {
    padding: 40px;
}

.results-section h2 {
    color: #333;
    margin-bottom: 30px;
    font-size: 2em;
}

.stats-container {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 20px;
    margin-bottom: 40px;
}

.stat-card {
    background: linear-gradient(135deg, #f093fb 0%, #f5576c 100%);
    color: white;
    padding: 25px;
    border-radius: 12px;
    text-align: center;
    box-shadow: 0 5px 15px rgba(0,0,0,0.1);
}

.stat-card:nth-child(2) {
    background: linear-gradient(135deg, #fa709a 0%, #fee140 100%);
}

.stat-card:nth-child(3) {
    background: linear-gradient(135deg, #30cfd0 0%, #330867 100%);
}

.stat-card h3 {
    font-size: 1em;
    margin-bottom: 10px;
    opacity: 0.9;
}

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

.stat-card small {
    opacity: 0.8;
}

.chart-container {
    background: white;
    padding: 20px;
    border-radius: 12px;
    box-shadow: 0 2px 10px rgba(0,0,0,0.05);
    margin-top: 20px;
}

.loading {
    text-align: center;
    padding: 30px 40px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    border-radius: 12px;
    margin-bottom: 30px;
    box-shadow: 0 5px 20px rgba(102, 126, 234, 0.3);
}

.loading p {
    color: white;
    font-size: 1.2em;
    font-weight: 600;
    margin-bottom: 20px;
}

.spinner {
    border: 4px solid rgba(255, 255, 255, 0.3);
    border-top: 4px solid white;
    border-radius: 50%;
    width: 50px;
    height: 50px;
    animation: spin 1s linear infinite;
    margin: 0 auto;
}

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

.heatmap-container {
    background: #fff;
    padding: 20px;
    border-radius: 12px;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.05);
    margin-top: 30px;
}

.heatmap-container h3 {
    color: #333;
    margin-bottom: 20px;
    font-size: 1.5em;
    text-align: center;
}

#trafficHeatmap {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(40px, 1fr));
    gap: 4px;
    padding: 10px;
}

.heatmap-cell {
    aspect-ratio: 1;
    border-radius: 6px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    font-size: 0.7em;
    color: #fff;
    font-weight: 600;
    cursor: pointer;
    transition: transform 0.2s, box-shadow 0.2s;
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.3);
    padding: 8px;
}

.heatmap-cell:hover {
    transform: scale(1.05);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
    z-index: 10;
}

.heatmap-cell .time {
    font-size: 0.9em;
    margin-bottom: 4px;
}

.heatmap-cell .duration {
    font-size: 1.1em;
    font-weight: 700;
}

.heatmap-legend {
    display: flex;
    justify-content: center;
    align-items: center;
    margin-top: 20px;
    gap: 10px;
    font-size: 0.9em;
    color: #666;
}

.legend-gradient {
    width: 200px;
    height: 20px;
    border-radius: 10px;
    background: linear-gradient(to right, #10b981, #fbbf24, #ef4444);
}

@media (max-width: 768px) {
    header h1 {
        font-size: 1.8em;
    }
    
    .input-section,
    .results-section {
        padding: 20px;
    }
    
    .stats-container {
        grid-template-columns: 1fr;
    }
}
