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

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

.container {
    max-width: 600px;
    margin: 0 auto;
    background: white;
    border-radius: 20px;
    padding: 40px;
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.1);
}

h1 {
    text-align: center;
    font-size: 2.5rem;
    margin-bottom: 10px;
    color: #4a5568;
}

.subtitle {
    text-align: center;
    color: #718096;
    margin-bottom: 40px;
    font-size: 1.1rem;
}

.calculator {
    background: #f8fafc;
    padding: 30px;
    border-radius: 15px;
    margin-bottom: 30px;
    border: 2px solid #e2e8f0;
}

.input-group {
    margin-bottom: 30px;
}

.input-group label {
    display: block;
    font-weight: 600;
    margin-bottom: 10px;
    color: #4a5568;
    font-size: 1.1rem;
}

.time-inputs, .pace-inputs {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
}

input[type="number"] {
    padding: 12px 16px;
    border: 2px solid #e2e8f0;
    border-radius: 8px;
    font-size: 1.2rem;
    width: 80px;
    text-align: center;
    transition: all 0.2s ease;
    background: white;
}

input[type="number"]:focus {
    outline: none;
    border-color: #667eea;
    box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.1);
}

input[type="number"]:hover {
    border-color: #cbd5e0;
}

.time-inputs span, .pace-inputs span {
    font-weight: 500;
    color: #718096;
    font-size: 1rem;
}

.result {
    background: linear-gradient(135deg, #667eea, #764ba2);
    color: white;
    padding: 30px;
    border-radius: 15px;
    text-align: center;
    margin-top: 20px;
}

.result h2 {
    font-size: 1.5rem;
    margin-bottom: 20px;
    opacity: 0.9;
}

.distance-display {
    display: flex;
    align-items: baseline;
    justify-content: center;
    gap: 10px;
    margin-bottom: 15px;
}

.distance-value {
    font-size: 4rem;
    font-weight: bold;
    line-height: 1;
}

.distance-unit {
    font-size: 2rem;
    opacity: 0.8;
}

.distance-miles {
    font-size: 1.2rem;
    opacity: 0.8;
}

.info {
    background: #edf2f7;
    padding: 25px;
    border-radius: 15px;
    border-left: 4px solid #667eea;
}

.info h3 {
    color: #4a5568;
    margin-bottom: 15px;
    font-size: 1.3rem;
}

.info p {
    color: #718096;
    line-height: 1.6;
    margin-bottom: 10px;
}

.info p:first-of-type {
    font-family: 'Monaco', 'Menlo', monospace;
    background: white;
    padding: 10px;
    border-radius: 6px;
    font-size: 0.95rem;
    border: 1px solid #e2e8f0;
}

/* Responsive design */
@media (max-width: 480px) {
    .container {
        padding: 20px;
        margin: 10px;
    }
    
    h1 {
        font-size: 2rem;
    }
    
    .calculator {
        padding: 20px;
    }
    
    .distance-value {
        font-size: 3rem;
    }
    
    .distance-unit {
        font-size: 1.5rem;
    }
    
    .time-inputs, .pace-inputs {
        justify-content: center;
    }
    
    input[type="number"] {
        width: 70px;
        font-size: 1.1rem;
    }
}

/* Animation for distance changes */
.distance-value {
    transition: all 0.3s ease;
}

/* Hover effects */
.calculator:hover {
    border-color: #cbd5e0;
    transition: border-color 0.2s ease;
}

/* Focus states for better accessibility */
input[type="number"]:focus + span {
    color: #667eea;
    transition: color 0.2s ease;
}

/* Multi-section specific styles */
.sections-container {
    background: #f8fafc;
    border-radius: 15px;
    padding: 30px;
    margin-bottom: 30px;
    border: 2px solid #e2e8f0;
}

.sections-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 25px;
    flex-wrap: wrap;
    gap: 15px;
}

.sections-header h2 {
    color: #4a5568;
    font-size: 1.5rem;
    margin: 0;
}

.add-section-btn {
    background: linear-gradient(135deg, #667eea, #764ba2);
    color: white;
    border: none;
    padding: 12px 20px;
    border-radius: 8px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
    font-size: 1rem;
}

.add-section-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(102, 126, 234, 0.3);
}

.sections-list {
    display: flex;
    flex-direction: column;
    gap: 20px;
    margin-bottom: 30px;
}

.section-item {
    background: white;
    border: 2px solid #e2e8f0;
    border-radius: 12px;
    padding: 20px;
    transition: all 0.2s ease;
}

.section-item:hover {
    border-color: #cbd5e0;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.05);
}

.section-header {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 15px;
}

.section-description {
    flex: 1;
    padding: 8px 12px;
    border: 1px solid #e2e8f0;
    border-radius: 6px;
    font-size: 1rem;
    background: white;
}

.section-description:focus {
    outline: none;
    border-color: #667eea;
    box-shadow: 0 0 0 2px rgba(102, 126, 234, 0.1);
}

.remove-section {
    background: #e53e3e;
    color: white;
    border: none;
    width: 30px;
    height: 30px;
    border-radius: 50%;
    font-size: 1.2rem;
    font-weight: bold;
    cursor: pointer;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    justify-content: center;
}

.remove-section:hover {
    background: #c53030;
    transform: scale(1.1);
}

.section-inputs {
    display: grid;
    grid-template-columns: 1fr auto;
    gap: 25px;
    align-items: start;
}

.section-inputs .input-group {
    margin-bottom: 0;
}

.section-inputs .input-group label {
    font-size: 0.95rem;
    margin-bottom: 10px;
    font-weight: 600;
    display: block;
}

.time-pace-container {
    display: flex;
    flex-direction: column;
    gap: 15px;
}

.section-inputs .time-inputs,
.section-inputs .pace-inputs {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: nowrap;
}

.section-inputs input[type="number"] {
    width: 60px;
    padding: 10px 8px;
    font-size: 1.1rem;
    text-align: center;
}

.section-inputs .time-inputs span,
.section-inputs .pace-inputs span {
    font-size: 0.9rem;
    color: #718096;
    font-weight: 500;
}

.section-result {
    background: linear-gradient(135deg, #667eea, #764ba2);
    color: white;
    padding: 15px;
    border-radius: 10px;
    text-align: center;
    min-width: 120px;
}

.section-distance {
    font-size: 1.2rem;
    font-weight: bold;
    margin-bottom: 5px;
}

.section-distance-miles {
    font-size: 0.9rem;
    opacity: 0.8;
}

.workout-summary {
    background: linear-gradient(135deg, #48bb78, #38a169);
    color: white;
    padding: 25px;
    border-radius: 15px;
    margin-top: 20px;
}

.workout-summary h3 {
    margin-bottom: 20px;
    font-size: 1.4rem;
    text-align: center;
}

.summary-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    gap: 15px;
}

.summary-item {
    text-align: center;
    background: rgba(255, 255, 255, 0.1);
    padding: 15px;
    border-radius: 10px;
}

.summary-label {
    display: block;
    font-size: 0.9rem;
    opacity: 0.8;
    margin-bottom: 5px;
}

.summary-value {
    display: block;
    font-size: 1.3rem;
    font-weight: bold;
}

/* Responsive design for multi-section */
@media (max-width: 768px) {
    .sections-header {
        flex-direction: column;
        align-items: stretch;
    }
    
    .add-section-btn {
        width: 100%;
        text-align: center;
    }
    
    .section-inputs {
        grid-template-columns: 1fr;
        gap: 20px;
    }
    
    .time-pace-container {
        order: 1;
    }
    
    .section-result {
        order: 2;
        min-width: auto;
        margin-top: 10px;
    }
    
    .summary-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}

@media (max-width: 600px) {
    .section-inputs .time-inputs,
    .section-inputs .pace-inputs {
        justify-content: flex-start;
    }
    
    .section-inputs input[type="number"] {
        width: 50px;
    }
    
    .time-pace-container {
        gap: 12px;
    }
}

@media (max-width: 480px) {
    .sections-container {
        padding: 20px;
    }
    
    .section-item {
        padding: 15px;
    }
    
    .summary-grid {
        grid-template-columns: 1fr;
    }
}