/* Scope resets to the calculator only */
.csf-container * {
    box-sizing: border-box;
}

.csf-container {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    background: linear-gradient(135deg, #f0f9ff 0%, #e0f2fe 100%);
    color: #1e293b;
    line-height: 1.6;
    max-width: 1200px;
    margin: 0 auto;
    padding: 20px;
}

/* Header */
.csf-header {
    text-align: center;
    margin-bottom: 40px;
    padding: 40px 20px;
    background: linear-gradient(135deg, #0ea5e9 0%, #0284c7 100%);
    color: white;
    border-radius: 16px;
    box-shadow: 0 20px 40px rgba(14, 165, 233, 0.2);
}

.csf-header h1 {
    font-size: 2.5rem;
    font-weight: 700;
    margin-bottom: 10px;
}

.csf-header p {
    font-size: 1.2rem;
    opacity: 0.9;
}

/* Tabs */
.csf-tabs {
    display: flex;
    background: white;
    border-radius: 12px;
    padding: 8px;
    margin-bottom: 24px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
    gap: 8px;
    flex-wrap: wrap;
}

.csf-tab-button {
    flex: 1;
    padding: 12px 20px;
    border: none;
    background: transparent;
    border-radius: 8px;
    cursor: pointer;
    font-weight: 500;
    transition: all 0.3s ease;
}

.csf-tab-button.active {
    background: linear-gradient(135deg, #0ea5e9, #0284c7);
    color: white;
}

.csf-tab-content {
    display: none;
    background: white;
    border-radius: 16px;
    padding: 32px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.1);
}

.csf-tab-content.active {
    display: block;
}

/* Forms */
.csf-form-section {
    margin-bottom: 32px;
}

.csf-form-section h3 {
    color: #0ea5e9;
    margin-bottom: 16px;
    font-size: 1.4rem;
    font-weight: 600;
}

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

.csf-form-group {
    margin-bottom: 16px;
}

.csf-form-group label {
    display: block;
    margin-bottom: 6px;
    font-weight: 500;
    color: #374151;
}

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

.csf-form-group input:focus,
.csf-form-group select:focus {
    outline: none;
    border-color: #0ea5e9;
    box-shadow: 0 0 0 3px rgba(14, 165, 233, 0.1);
}

/* Buttons */
.csf-button {
    background: linear-gradient(135deg, #10b981, #059669);
    color: white;
    border: none;
    padding: 12px 24px;
    border-radius: 8px;
    cursor: pointer;
    font-weight: 500;
    transition: all 0.3s ease;
    margin-right: 12px;
    margin-bottom: 8px;
}

.csf-button:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 20px rgba(16, 185, 129, 0.3);
}

.csf-button-danger {
    background: linear-gradient(135deg, #ef4444, #dc2626);
}

.csf-button-danger:hover {
    box-shadow: 0 8px 20px rgba(239, 68, 68, 0.3);
}

/* Panel items + list */
.csf-panel-item {
    background: #f8fafc;
    border: 2px solid #e2e8f0;
    border-radius: 12px;
    padding: 20px;
    margin-bottom: 16px;
    position: relative;
}

.csf-panel-item h4 {
    color: #0ea5e9;
    margin-bottom: 12px;
    font-size: 1.2rem;
}

.csf-remove-button {
    position: absolute;
    top: 12px;
    right: 12px;
    background: #ef4444;
    color: white;
    border: none;
    width: 28px;
    height: 28px;
    border-radius: 50%;
    cursor: pointer;
    font-size: 16px;
    display: flex;
    align-items: center;
    justify-content: center;
}

/* Results */
.csf-results-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 20px;
    margin-bottom: 32px;
}

.csf-result-card {
    background: linear-gradient(135deg, #f0f9ff, #e0f2fe);
    border: 2px solid #0ea5e9;
    border-radius: 12px;
    padding: 24px;
    text-align: center;
}

.csf-result-value {
    font-size: 2rem;
    font-weight: 700;
    color: #0ea5e9;
    margin-bottom: 8px;
}

.csf-result-label {
    color: #64748b;
    font-weight: 500;
}

/* Protections */
.csf-protection-section {
    background: #fef2f2;
    border: 2px solid #fca5a5;
    border-radius: 12px;
    padding: 24px;
    margin-bottom: 20px;
}

.csf-protection-section h4 {
    color: #dc2626;
    margin-bottom: 16px;
    display: flex;
    align-items: center;
    gap: 8px;
}

.csf-protection-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 16px;
}

.csf-protection-item {
    background: white;
    padding: 16px;
    border-radius: 8px;
    border-left: 4px solid #dc2626;
}

/* Formulas */
.csf-formula-section {
    background: #f1f5f9;
    border: 2px solid #cbd5e1;
    border-radius: 12px;
    padding: 24px;
    margin-top: 24px;
}

.csf-formula-item {
    margin-bottom: 12px;
    font-family: 'Courier New', monospace;
    background: white;
    padding: 8px 12px;
    border-radius: 6px;
    border-left: 4px solid #0ea5e9;
}

/* Diagram */
.csf-diagram {
    background: white;
    border: 2px solid #e2e8f0;
    border-radius: 12px;
    padding: 24px;
    text-align: center;
}

.csf-diagram-element {
    display: inline-block;
    margin: 8px;
    padding: 12px 16px;
    border-radius: 8px;
    font-weight: 600;
    font-size: 12px;
}

.csf-panel-element {
    background: #fbbf24;
    color: #92400e;
    border: 2px solid #f59e0b;
}

.csf-battery-element {
    background: #10b981;
    color: white;
    border: 2px solid #059669;
}

.csf-protection-element {
    background: #ef4444;
    color: white;
    border: 2px solid #dc2626;
}

.csf-regulator-element {
    background: #0ea5e9;
    color: white;
    border: 2px solid #0284c7;
}

.csf-connection-line {
    display: inline-block;
    width: 40px;
    height: 2px;
    background: #6b7280;
    margin: 0 8px;
    vertical-align: middle;
}

/* Responsive */
@media (max-width: 768px) {
    .csf-container {
        padding: 12px;
    }
    .csf-header h1 {
        font-size: 2rem;
    }
    .csf-form-grid {
        grid-template-columns: 1fr;
    }
    .csf-results-grid {
        grid-template-columns: 1fr;
    }
}
