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

:root {
    --primary-color: #2563eb;
    --primary-hover: #1d4ed8;
    --success-color: #10b981;
    --success-hover: #059669;
    --secondary-color: #6b7280;
    --background: #f9fafb;
    --card-background: #ffffff;
    --text-primary: #111827;
    --text-secondary: #6b7280;
    --border-color: #e5e7eb;
    --shadow: 0 1px 3px 0 rgba(0, 0, 0, 0.1), 0 1px 2px 0 rgba(0, 0, 0, 0.06);
    --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05);
}

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    background: var(--background);
    color: var(--text-primary);
    line-height: 1.6;
    padding: 20px;
}

.container {
    max-width: 1200px;
    margin: 0 auto;
}

header {
    text-align: center;
    margin-bottom: 40px;
    padding: 30px 0;
}

header h1 {
    font-size: 2.5rem;
    font-weight: 700;
    color: var(--text-primary);
    margin-bottom: 10px;
}

.subtitle {
    font-size: 1.125rem;
    color: var(--text-secondary);
}

.main-content {
    display: flex;
    flex-direction: column;
    gap: 24px;
}

.card {
    background: var(--card-background);
    border-radius: 12px;
    padding: 28px;
    box-shadow: var(--shadow);
    transition: box-shadow 0.2s;
}

.card:hover {
    box-shadow: var(--shadow-lg);
}

.card h2 {
    font-size: 1.5rem;
    font-weight: 600;
    margin-bottom: 20px;
    color: var(--text-primary);
    border-bottom: 2px solid var(--border-color);
    padding-bottom: 12px;
}

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

.form-group label {
    display: block;
    font-weight: 500;
    margin-bottom: 8px;
    color: var(--text-primary);
}

.form-group input {
    width: 100%;
    padding: 12px 16px;
    border: 2px solid var(--border-color);
    border-radius: 8px;
    font-size: 1rem;
    transition: border-color 0.2s;
}

.form-group input:focus {
    outline: none;
    border-color: var(--primary-color);
}

.form-row {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 20px;
}

.btn {
    padding: 12px 24px;
    border: none;
    border-radius: 8px;
    font-size: 1rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s;
    display: inline-block;
}

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

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

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

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

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

.btn-secondary:hover {
    background: #4b5563;
}

.btn-sm {
    padding: 8px 16px;
    font-size: 0.875rem;
}

.btn-large {
    padding: 16px 32px;
    font-size: 1.125rem;
    width: 100%;
}

.result-box {
    margin-top: 20px;
    padding: 16px;
    background: #f0f9ff;
    border-left: 4px solid var(--primary-color);
    border-radius: 6px;
}

.result-box p {
    margin: 8px 0;
    color: var(--text-primary);
}

.help-text {
    color: var(--text-secondary);
    font-size: 0.875rem;
    margin-bottom: 16px;
}

.help-text strong {
    color: var(--text-primary);
    font-weight: 600;
}

.form-group small {
    display: block;
    color: var(--text-secondary);
    font-size: 0.75rem;
    margin-top: 4px;
    font-style: italic;
}

.point-input-section {
    margin-bottom: 20px;
}

.input-controls {
    display: flex;
    gap: 10px;
    margin-bottom: 16px;
    flex-wrap: wrap;
}

.point-input {
    flex: 1;
    min-width: 200px;
    padding: 10px 14px;
    border: 2px solid var(--border-color);
    border-radius: 6px;
    font-size: 0.95rem;
}

.points-list {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-bottom: 16px;
}

.point-badge {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 6px 12px;
    background: #eff6ff;
    border: 1px solid #bfdbfe;
    border-radius: 6px;
    font-size: 0.875rem;
    color: var(--text-primary);
}

.point-badge .remove-btn {
    background: none;
    border: none;
    color: #ef4444;
    cursor: pointer;
    font-size: 1.2rem;
    padding: 0;
    width: 20px;
    height: 20px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 4px;
}

.point-badge .remove-btn:hover {
    background: #fee2e2;
}

.chart-container {
    width: 100%;
    height: 400px;
    margin: 20px 0;
    border: 1px solid var(--border-color);
    border-radius: 8px;
    padding: 10px;
}

.loading {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 40px;
    gap: 16px;
}

.spinner {
    width: 40px;
    height: 40px;
    border: 4px solid var(--border-color);
    border-top-color: var(--primary-color);
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

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

.error-box {
    margin-top: 20px;
    padding: 16px;
    background: #fef2f2;
    border-left: 4px solid #ef4444;
    border-radius: 6px;
    color: #991b1b;
}

.results-section {
    margin-top: 20px;
}

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

.stat-card {
    background: linear-gradient(135deg, var(--stat-card-1-start, #667eea) 0%, var(--stat-card-1-end, #764ba2) 100%);
    padding: 24px;
    border-radius: 12px;
    color: white;
    text-align: center;
}

.stat-card:nth-child(2) {
    background: linear-gradient(135deg, var(--stat-card-2-start, #f093fb) 0%, var(--stat-card-2-end, #f5576c) 100%);
}

.stat-card:nth-child(3) {
    background: linear-gradient(135deg, var(--stat-card-3-start, #4facfe) 0%, var(--stat-card-3-end, #00f2fe) 100%);
}

.stat-label {
    font-size: 0.875rem;
    opacity: 0.9;
    margin-bottom: 8px;
}

.stat-value {
    font-size: 2rem;
    font-weight: 700;
    margin-bottom: 4px;
}

.stat-detail {
    font-size: 0.875rem;
    opacity: 0.8;
}

.plot-container {
    margin-bottom: 30px;
}

.plot-container h3 {
    font-size: 1.25rem;
    margin-bottom: 16px;
    color: var(--text-primary);
}

.plot-container img {
    width: 100%;
    border-radius: 8px;
    box-shadow: var(--shadow);
}

.download-section {
    text-align: center;
    margin-top: 30px;
}

.progress-container {
    margin: 20px 0;
    padding: 20px;
    background: #f9fafb;
    border-radius: 8px;
}

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

.progress-header h3 {
    margin: 0;
    font-size: 1.25rem;
    color: var(--text-primary);
}

.progress-header span {
    font-size: 1.125rem;
    font-weight: 600;
    color: var(--primary-color);
}

.progress-bar {
    width: 100%;
    height: 24px;
    background: var(--border-color);
    border-radius: 12px;
    overflow: hidden;
    margin-bottom: 12px;
}

.progress-fill {
    height: 100%;
    background: linear-gradient(90deg, var(--primary-color), var(--success-color));
    width: 0%;
    transition: width 0.3s ease;
    border-radius: 12px;
}

.progress-details {
    color: var(--text-secondary);
    font-size: 0.875rem;
}

.best-airfoil-preview {
    margin-top: 30px;
    padding: 20px;
    background: #f0f9ff;
    border-radius: 8px;
    border-left: 4px solid var(--primary-color);
}

.best-airfoil-preview h3 {
    margin-top: 0;
    margin-bottom: 16px;
    font-size: 1.125rem;
    color: var(--text-primary);
}

.best-airfoil-preview img {
    width: 100%;
    max-width: 500px;
    border-radius: 8px;
    box-shadow: var(--shadow);
    margin-bottom: 16px;
}

.best-airfoil-preview p {
    margin: 8px 0;
    color: var(--text-primary);
}

/* Hall of Fame Styles */
.category-selector, .re-bin-selector {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
}

.airfoil-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 20px;
    margin-top: 20px;
}

.airfoil-card {
    background: var(--card-background);
    border: 2px solid var(--border-color);
    border-radius: 8px;
    padding: 12px;
    cursor: pointer;
    transition: all 0.2s;
    text-align: center;
}

.airfoil-card:hover {
    border-color: var(--primary-color);
    box-shadow: var(--shadow-lg);
    transform: translateY(-2px);
}

.airfoil-rank {
    font-size: 1.25rem;
    font-weight: 700;
    color: var(--primary-color);
    margin-bottom: 8px;
}

.airfoil-card img {
    width: 100%;
    height: auto;
    border-radius: 4px;
    margin-bottom: 8px;
}

.airfoil-card-stats {
    font-size: 0.875rem;
    color: var(--text-secondary);
    line-height: 1.6;
}

.airfoil-card-stats strong {
    color: var(--text-primary);
}

/* Modal Styles */
.modal {
    display: none;
    position: fixed;
    z-index: 1000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    overflow: auto;
    background-color: rgba(0, 0, 0, 0.7);
}

.modal-content {
    background-color: var(--card-background);
    margin: 2% auto;
    padding: 30px;
    border-radius: 12px;
    max-width: 900px;
    width: 90%;
    max-height: 90vh;
    overflow-y: auto;
    box-shadow: var(--shadow-lg);
    position: relative;
}

.modal-close {
    position: absolute;
    right: 20px;
    top: 20px;
    font-size: 2rem;
    font-weight: bold;
    color: var(--text-secondary);
    cursor: pointer;
    line-height: 1;
}

.modal-close:hover {
    color: var(--text-primary);
}

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

.detail-params {
    margin: 20px 0;
    padding: 16px;
    background: #f9fafb;
    border-radius: 8px;
    color: var(--text-secondary);
}

/* HOF Notification */
.hof-notification {
    margin-top: 20px;
    padding: 16px;
    background: linear-gradient(135deg, #fbbf24 0%, #f59e0b 100%);
    border-radius: 8px;
    color: white;
    text-align: center;
    font-weight: 600;
}

.hof-notification a {
    color: white;
    text-decoration: underline;
}

/* Settings Styles */
.settings-section {
    margin-top: 20px;
}

.color-input-group {
    display: flex;
    align-items: center;
    gap: 15px;
    margin-bottom: 15px;
}

.color-input-group label {
    min-width: 150px;
    font-weight: 500;
}

.color-input-group input[type="color"] {
    width: 60px;
    height: 40px;
    border: 2px solid var(--border-color);
    border-radius: 6px;
    cursor: pointer;
}

@media (max-width: 768px) {
    header h1 {
        font-size: 2rem;
    }
    
    .card {
        padding: 20px;
    }
    
    .form-row {
        grid-template-columns: 1fr;
    }
    
    .stats-grid {
        grid-template-columns: 1fr;
    }
    
    .airfoil-grid {
        grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
        gap: 12px;
    }
    
    .modal-content {
        width: 95%;
        padding: 20px;
        margin: 5% auto;
    }
}
