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

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

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

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

.header h1 {
    font-size: 1.8rem;
    margin-bottom: 5px;
}

.header .subtitle {
    font-size: 0.95rem;
    opacity: 0.9;
}

/* Main Layout */
.main-layout {
    display: flex;
    gap: 20px;
}

/* Controls Panel */
.controls-panel {
    width: 400px;
    flex-shrink: 0;
    max-height: calc(100vh - 160px);
    overflow-y: auto;
}

/* Control Section */
.control-section {
    background: white;
    border-radius: 8px;
    padding: 15px;
    margin-bottom: 15px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.05);
}

.control-section h3 {
    font-size: 0.95rem;
    color: #4a5568;
    margin-bottom: 12px;
    padding-bottom: 8px;
    border-bottom: 1px solid #e2e8f0;
}

/* Collapsible */
.collapsible-header {
    cursor: pointer;
    display: flex;
    justify-content: space-between;
    align-items: center;
    user-select: none;
}

.collapsible-header:hover {
    color: #667eea;
}

.collapse-icon {
    transition: transform 0.3s;
    font-size: 0.8rem;
}

.collapsible-header.collapsed .collapse-icon {
    transform: rotate(-90deg);
}

.collapsible-content {
    overflow: hidden;
    transition: max-height 0.3s ease-out;
    max-height: 1000px;
}

.collapsible-content.collapsed {
    max-height: 0;
    padding-top: 0;
    padding-bottom: 0;
    margin-top: 0;
}

/* Form elements */
.form-group {
    margin-bottom: 12px;
}

.form-group label {
    display: block;
    font-size: 0.85rem;
    color: #4a5568;
    margin-bottom: 4px;
    font-weight: 500;
}

.form-control {
    width: 100%;
    padding: 8px 12px;
    border: 1px solid #e2e8f0;
    border-radius: 6px;
    font-size: 0.9rem;
    transition: border-color 0.2s, box-shadow 0.2s;
}

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

/* Slider */
.slider {
    width: 100%;
    height: 6px;
    border-radius: 3px;
    background: #e2e8f0;
    outline: none;
    -webkit-appearance: none;
}

.slider::-webkit-slider-thumb {
    -webkit-appearance: none;
    width: 18px;
    height: 18px;
    border-radius: 50%;
    background: #667eea;
    cursor: pointer;
    transition: transform 0.2s;
}

.slider::-webkit-slider-thumb:hover {
    transform: scale(1.1);
}

/* Checkbox group */
.checkbox-group {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.checkbox-label {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 0.85rem;
    color: #4a5568;
    cursor: pointer;
}

.checkbox-label input[type="checkbox"] {
    width: 16px;
    height: 16px;
    accent-color: #667eea;
}

/* Percentile inputs */
.percentile-inputs {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 10px;
}

.percentile-inputs input {
    width: 70px;
    padding: 6px 8px;
    border: 1px solid #e2e8f0;
    border-radius: 4px;
    font-size: 0.85rem;
}

.percentile-inputs span {
    font-size: 0.85rem;
    color: #718096;
}

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

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

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

.btn-secondary {
    width: 100%;
    padding: 8px 16px;
    background: #e2e8f0;
    color: #4a5568;
    border: none;
    border-radius: 6px;
    font-size: 0.9rem;
    font-weight: 500;
    cursor: pointer;
    transition: background 0.2s;
}

.btn-secondary:hover {
    background: #cbd5e0;
}

/* Action buttons */
.action-buttons {
    margin-top: 20px;
}

/* SKU count */
.sku-count {
    text-align: center;
    font-weight: 600;
    color: #667eea;
    padding: 8px;
    background: #eef2ff;
    border-radius: 6px;
    margin-top: 10px;
}

/* Info text */
.info-text {
    font-size: 0.8rem;
    color: #718096;
    margin-top: 6px;
    padding: 8px;
    background: #f7fafc;
    border-radius: 4px;
    line-height: 1.4;
}

/* Progress Section */
.progress-section {
    background: white;
    border-radius: 8px;
    padding: 15px;
    margin-top: 15px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.05);
}

.progress-section h3 {
    font-size: 0.95rem;
    color: #4a5568;
    margin-bottom: 15px;
}

.progress-item {
    margin-bottom: 15px;
}

.progress-label {
    display: flex;
    justify-content: space-between;
    font-size: 0.85rem;
    color: #4a5568;
    margin-bottom: 4px;
}

.progress-bar {
    height: 8px;
    background: #e2e8f0;
    border-radius: 4px;
    overflow: hidden;
}

.progress-fill {
    height: 100%;
    background: linear-gradient(90deg, #667eea 0%, #764ba2 100%);
    border-radius: 4px;
    transition: width 0.3s ease;
}

.current-sku {
    font-size: 0.85rem;
    color: #667eea;
    font-weight: 500;
    margin-top: 10px;
    padding: 8px;
    background: #eef2ff;
    border-radius: 4px;
    text-align: center;
}

.status-message {
    font-size: 0.85rem;
    padding: 8px;
    border-radius: 4px;
    margin-top: 10px;
    text-align: center;
}

.status-message.success {
    background: #d4edda;
    color: #155724;
}

.status-message.error {
    background: #f8d7da;
    color: #721c24;
}

.status-message.loading {
    background: #cce5ff;
    color: #004085;
}

/* Charts Panel */
.charts-panel {
    flex: 1;
    background: white;
    border-radius: 8px;
    padding: 15px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.05);
    min-height: calc(100vh - 180px);
}

/* Tabs */
.tabs {
    display: flex;
    gap: 5px;
    margin-bottom: 15px;
    border-bottom: 2px solid #e2e8f0;
    padding-bottom: 10px;
}

.tab-btn {
    padding: 10px 20px;
    background: transparent;
    border: none;
    border-radius: 6px 6px 0 0;
    font-size: 0.9rem;
    font-weight: 500;
    color: #718096;
    cursor: pointer;
    transition: background 0.2s, color 0.2s;
}

.tab-btn:hover {
    background: #f7fafc;
    color: #4a5568;
}

.tab-btn.active {
    background: #667eea;
    color: white;
}

/* Chart containers */
.chart-container {
    display: none;
    height: calc(100vh - 280px);
    min-height: 500px;
}

.chart-container.active {
    display: block;
}

/* Empty state */
.empty-state {
    display: flex;
    align-items: center;
    justify-content: center;
    height: calc(100vh - 280px);
    color: #a0aec0;
    font-size: 1.1rem;
}

.no-data {
    text-align: center;
    color: #a0aec0;
    padding: 40px;
}

/* Scrollbar styling */
.controls-panel::-webkit-scrollbar {
    width: 6px;
}

.controls-panel::-webkit-scrollbar-track {
    background: #f1f1f1;
    border-radius: 3px;
}

.controls-panel::-webkit-scrollbar-thumb {
    background: #c1c1c1;
    border-radius: 3px;
}

.controls-panel::-webkit-scrollbar-thumb:hover {
    background: #a8a8a8;
}

/* Help Section */
.help-section {
    background: linear-gradient(135deg, #e8f5e9 0%, #c8e6c9 100%);
    border: 1px solid #a5d6a7;
}

.help-section h3 {
    color: #2e7d32;
    border-bottom-color: #a5d6a7;
}

.help-list {
    margin: 0;
    padding-left: 20px;
    font-size: 0.9rem;
    color: #1b5e20;
}

.help-list li {
    margin-bottom: 6px;
    line-height: 1.4;
}

.help-list li:last-child {
    margin-bottom: 0;
}

/* Responsive */
@media (max-width: 1200px) {
    .main-layout {
        flex-direction: column;
    }

    .controls-panel {
        width: 100%;
        max-height: none;
    }

    .charts-panel {
        min-height: 600px;
    }
}
