/* Reset and base styles */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
    line-height: 1.6;
    color: #333;
    background-color: #f5f5f5;
}

/* Container */
.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 20px;
}

/* Header */
header {
    text-align: center;
    margin-bottom: 40px;
    padding: 20px 0;
}

header h1 {
    font-size: 2.5rem;
    color: #2c3e50;
    margin-bottom: 8px;
}

.subtitle {
    color: #7f8c8d;
    font-size: 1.1rem;
}

/* Configuration Section */
.config-section {
    background: white;
    border-radius: 8px;
    padding: 30px;
    margin-bottom: 30px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

.config-section h2 {
    color: #2c3e50;
    margin-bottom: 20px;
    font-size: 1.8rem;
}

.config-group {
    margin-bottom: 30px;
    padding-bottom: 30px;
    border-bottom: 1px solid #ecf0f1;
}

.config-group:last-of-type {
    border-bottom: none;
    padding-bottom: 0;
}

.config-group h3 {
    color: #34495e;
    margin-bottom: 15px;
    font-size: 1.3rem;
}

.form-row {
    margin-bottom: 15px;
}

.info-text {
    color: #7f8c8d;
    font-size: 0.9rem;
    padding: 8px 12px;
    background: #ecf0f1;
    border-radius: 4px;
    font-weight: 500;
}

.info-text span {
    color: #2c3e50;
    font-weight: 600;
}

.time-estimate {
    margin-left: 12px;
    color: #7f8c8d;
    font-weight: 400;
}

label {
    display: block;
    font-weight: 500;
    color: #34495e;
    margin-bottom: 5px;
}

.checkbox-label {
    display: flex;
    align-items: center;
    cursor: pointer;
}

.checkbox-label input[type="checkbox"] {
    margin-right: 8px;
    width: 18px;
    height: 18px;
    cursor: pointer;
}

/* Form inputs */
.number-input {
    padding: 8px 12px;
    border: 1px solid #bdc3c7;
    border-radius: 4px;
    font-size: 1rem;
    width: 150px;
}

.payout-input {
    padding: 6px 10px;
    border: 1px solid #bdc3c7;
    border-radius: 4px;
    font-size: 1rem;
    width: 80px;
}

.payout-label {
    margin-left: 10px;
    padding: 6px 12px;
    background-color: #ecf0f1;
    border-radius: 4px;
    font-weight: 600;
    color: #2c3e50;
}

.slider {
    width: 200px;
    margin: 0 15px;
}

.slider-value {
    display: inline-block;
    min-width: 50px;
    padding: 4px 8px;
    background-color: #ecf0f1;
    border-radius: 4px;
    font-weight: 600;
    text-align: center;
}

.strategy-select {
    padding: 8px 12px;
    border: 1px solid #bdc3c7;
    border-radius: 4px;
    font-size: 1rem;
    width: 100%;
    max-width: 300px;
}

.editor-link {
    display: inline-block;
    color: #3498db;
    text-decoration: none;
    font-size: 0.95rem;
    margin-top: 5px;
}

.editor-link:hover {
    text-decoration: underline;
}

/* Buttons */
.btn {
    padding: 12px 24px;
    font-size: 1rem;
    font-weight: 600;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.3s ease;
}

.btn-primary {
    background-color: #27ae60;
    color: white;
}

.btn-primary:hover:not(:disabled) {
    background-color: #229954;
    transform: translateY(-1px);
    box-shadow: 0 4px 8px rgba(39, 174, 96, 0.3);
}

.btn-primary:disabled {
    background-color: #95a5a6;
    cursor: not-allowed;
}

.btn-secondary {
    background-color: #3498db;
    color: white;
    margin-right: 10px;
}

.btn-secondary:hover {
    background-color: #2980b9;
}

.form-actions {
    margin-top: 30px;
    text-align: center;
}

/* Loading Spinner */
.loading {
    text-align: center;
    padding: 40px;
    background: white;
    border-radius: 8px;
    margin-bottom: 30px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

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

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

/* Error Message */
.error-message {
    background-color: #e74c3c;
    color: white;
    padding: 15px 20px;
    border-radius: 6px;
    margin-bottom: 20px;
    text-align: center;
}

/* Results Section */
.results-section {
    background: white;
    border-radius: 8px;
    padding: 30px;
    margin-bottom: 30px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

.results-section h2 {
    color: #2c3e50;
    margin-bottom: 25px;
    font-size: 1.8rem;
}

/* Summary Stats Grid */
.summary-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 20px;
    margin-bottom: 30px;
}

.stat-card {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    padding: 20px;
    border-radius: 8px;
    text-align: center;
    box-shadow: 0 4px 6px rgba(0,0,0,0.1);
}

.stat-card.positive {
    background: linear-gradient(135deg, #11998e 0%, #38ef7d 100%);
}

.stat-card.negative {
    background: linear-gradient(135deg, #eb3349 0%, #f45c43 100%);
}

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

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

.stat-sublabel {
    font-size: 0.85rem;
    opacity: 0.8;
}

/* Chart */
.charts-grid {
    display: flex;
    flex-direction: column;
    gap: 30px;
    margin: 30px 0;
}

.chart-container {
    padding: 20px;
    background: #f8f9fa;
    border-radius: 8px;
    max-width: 1200px;
    width: 100%;
}

.chart-container h3 {
    margin-top: 0;
    margin-bottom: 15px;
    color: #2c3e50;
    font-size: 1.1rem;
    text-align: center;
}

/* Analysis Sections */
.analysis-section {
    margin: 40px 0;
    padding: 30px 0;
    border-top: 2px solid #e0e0e0;
}

.analysis-section:first-of-type {
    border-top: none;
    padding-top: 0;
}

.section-heading {
    color: #2c3e50;
    font-size: 1.5rem;
    margin: 0 0 25px 0;
    padding-bottom: 10px;
    border-bottom: 2px solid #3498db;
}

/* Detailed Stats Table */
.detailed-stats {
    margin: 30px 0;
}

.detailed-stats h3 {
    color: #34495e;
    margin-bottom: 15px;
}

.stats-table {
    width: 100%;
    border-collapse: collapse;
    margin-bottom: 20px;
}

.stats-table thead {
    background-color: #34495e;
    color: white;
}

.stats-table th,
.stats-table td {
    padding: 12px 15px;
    text-align: left;
}

.stats-table tbody tr {
    border-bottom: 1px solid #ecf0f1;
}

.stats-table tbody tr:hover {
    background-color: #f8f9fa;
}

.stats-table td.indent {
    padding-left: 40px;
    font-size: 0.95rem;
    color: #555;
}

/* Download Actions */
.download-actions {
    text-align: center;
    margin-top: 30px;
}

/* Footer */
footer {
    text-align: center;
    padding: 20px 0;
    color: #7f8c8d;
    font-size: 0.9rem;
}

footer a {
    color: #3498db;
    text-decoration: none;
}

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

/* Utility Classes */
.hidden {
    display: none;
}

/* Responsive Design */
@media (max-width: 768px) {
    header h1 {
        font-size: 2rem;
    }

    .config-section,
    .results-section {
        padding: 20px;
    }

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

    .slider {
        width: 150px;
    }

    .number-input,
    .strategy-select {
        width: 100%;
        max-width: none;
    }
}

/* Debug Section */
.debug-section {
    margin-top: 2rem;
    padding: 1.5rem;
    background: #f8f9fa;
    border-radius: 8px;
}

.debug-info {
    font-size: 0.9rem;
    color: #666;
    margin-bottom: 1rem;
}

.debug-examples {
    max-height: 600px;
    overflow-y: auto;
}

.debug-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.85rem;
}

.debug-table th {
    background: #e9ecef;
    padding: 0.75rem;
    text-align: left;
    font-weight: 600;
    border-bottom: 2px solid #dee2e6;
    position: sticky;
    top: 0;
}

.debug-table td {
    padding: 0.75rem;
    border-bottom: 1px solid #dee2e6;
    vertical-align: top;
}

.debug-table code {
    background: #e9ecef;
    padding: 0.2rem 0.4rem;
    border-radius: 3px;
    font-family: 'Courier New', monospace;
    font-size: 0.85em;
}

.example-cell {
    font-family: 'Courier New', monospace;
    font-size: 0.8rem;
    line-height: 1.6;
    max-width: 600px;
}
