/**
 * Interactive System Configurator Styles
 */

.configurator-wrapper {
    max-width: 1400px;
    margin: 0 auto;
    padding: 20px;
}

.configurator-header {
    text-align: center;
    margin-bottom: 32px;
}

.configurator-header h2 {
    font-size: 2rem;
    color: #0D3B6E;
    margin-bottom: 8px;
}

.configurator-header p {
    font-size: 1.125rem;
    color: #64748B;
}

/* Main Grid Layout */
.configurator-grid {
    display: grid;
    grid-template-columns: 400px 1fr;
    gap: 24px;
    margin-bottom: 32px;
}

@media (max-width: 1024px) {
    .configurator-grid {
        grid-template-columns: 1fr;
    }
}

/* Component Controls */
.component-controls {
    background: white;
    border-radius: 12px;
    padding: 24px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    height: fit-content;
    position: sticky;
    top: 90px;
}

.component-controls h3 {
    font-size: 1.25rem;
    color: #0D3B6E;
    margin-bottom: 20px;
}

.control-section {
    margin-bottom: 24px;
    padding-bottom: 24px;
    border-bottom: 2px solid #E2E8F0;
}

.control-section:last-of-type {
    border-bottom: none;
}

.control-header {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 12px;
}

.control-icon {
    font-size: 1.5rem;
}

.control-title {
    font-size: 1.125rem;
    font-weight: 600;
    color: #0D3B6E;
}

/* Component Select */
.component-select {
    width: 100%;
    padding: 12px;
    border: 2px solid #E2E8F0;
    border-radius: 8px;
    font-size: 0.9375rem;
    background: white;
    cursor: pointer;
    transition: all 0.2s;
}

.component-select:hover {
    border-color: #1565C0;
}

.component-select:focus {
    outline: none;
    border-color: #1565C0;
    box-shadow: 0 0 0 3px rgba(21, 101, 192, 0.1);
}

/* Component Info */
.component-info {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-top: 12px;
}

.info-badge {
    padding: 4px 12px;
    background: #F1F5F9;
    border-radius: 6px;
    font-size: 0.875rem;
    color: #475569;
    font-weight: 500;
}

.info-price {
    padding: 4px 12px;
    background: #DBEAFE;
    border-radius: 6px;
    font-size: 0.875rem;
    color: #1565C0;
    font-weight: 600;
    margin-left: auto;
}

/* Quantity Control */
.quantity-control {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 16px;
    padding: 12px;
    background: #F8FAFC;
    border-radius: 8px;
}

.qty-btn {
    width: 40px;
    height: 40px;
    border: 2px solid #1565C0;
    background: white;
    color: #1565C0;
    font-size: 1.5rem;
    font-weight: 600;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.2s;
    display: flex;
    align-items: center;
    justify-content: center;
}

.qty-btn:hover {
    background: #1565C0;
    color: white;
    transform: scale(1.05);
}

.qty-btn:active {
    transform: scale(0.95);
}

.qty-display {
    font-size: 1.5rem;
    font-weight: 700;
    color: #0D3B6E;
    min-width: 40px;
    text-align: center;
}

/* Wiring Configuration */
.wiring-config {
    display: flex;
    flex-direction: column;
    gap: 8px;
    margin-top: 12px;
    padding: 12px;
    background: #F8FAFC;
    border-radius: 8px;
}

.wiring-config label {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 0.875rem;
    color: #475569;
    cursor: pointer;
}

.wiring-config input[type="radio"] {
    width: 18px;
    height: 18px;
    cursor: pointer;
}

/* Total Cost Display */
.total-cost-display {
    background: linear-gradient(135deg, #1565C0, #0D3B6E);
    padding: 20px;
    border-radius: 12px;
    text-align: center;
    color: white;
    margin-bottom: 16px;
}

.cost-label {
    font-size: 0.875rem;
    opacity: 0.9;
    margin-bottom: 8px;
}

.cost-amount {
    font-size: 2rem;
    font-weight: 800;
    margin-bottom: 4px;
}

.cost-change {
    font-size: 0.875rem;
    font-weight: 600;
}

.cost-change.increase {
    color: #FEF3C7;
}

.cost-change.decrease {
    color: #D1FAE5;
}

.cost-change.same {
    color: #E0E7FF;
}

/* Reset Button */
.btn-reset {
    width: 100%;
    padding: 12px;
    background: #F1F5F9;
    border: 2px solid #E2E8F0;
    border-radius: 8px;
    font-size: 0.9375rem;
    font-weight: 600;
    color: #475569;
    cursor: pointer;
    transition: all 0.2s;
}

.btn-reset:hover {
    background: #E2E8F0;
    border-color: #CBD5E1;
}

/* Graph Container */
.graph-container {
    background: white;
    border-radius: 12px;
    padding: 28px;
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.12);
    border: 2px solid #E2E8F0;
}

.graph-container h3 {
    font-size: 1.375rem;
    color: #0D3B6E;
    margin-bottom: 20px;
    font-weight: 700;
    text-align: center;
}

#energy-chart {
    height: 450px !important;
    max-height: 450px !important;
    width: 100% !important;
}

.chart-legend {
    display: flex;
    justify-content: center;
    gap: 28px;
    margin-top: 20px;
    flex-wrap: wrap;
    padding: 16px;
    background: #F8FAFC;
    border-radius: 8px;
}

.legend-item {
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 0.9375rem;
    color: #334155;
    font-weight: 600;
}

.legend-color {
    width: 24px;
    height: 14px;
    border-radius: 4px;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.15);
}

/* Performance Metrics */
.performance-metrics {
    background: white;
    border-radius: 12px;
    padding: 24px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    margin-bottom: 24px;
}

.performance-metrics h3 {
    font-size: 1.25rem;
    color: #0D3B6E;
    margin-bottom: 20px;
}

.metrics-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 16px;
}

.metric-card {
    background: #F8FAFC;
    border-radius: 12px;
    padding: 20px;
    text-align: center;
    border: 2px solid #E2E8F0;
    transition: all 0.2s;
}

.metric-card:hover {
    border-color: #1565C0;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(21, 101, 192, 0.1);
}

.metric-icon {
    font-size: 2.5rem;
    margin-bottom: 8px;
}

.metric-label {
    font-size: 0.875rem;
    color: #64748B;
    margin-bottom: 8px;
}

.metric-value {
    font-size: 2rem;
    font-weight: 800;
    color: #0D3B6E;
    margin-bottom: 4px;
}

.metric-sub {
    font-size: 0.75rem;
    color: #94A3B8;
}

.metric-bar {
    width: 100%;
    height: 8px;
    background: #E2E8F0;
    border-radius: 4px;
    overflow: hidden;
    margin-top: 12px;
}

.metric-bar-fill {
    height: 100%;
    background: linear-gradient(90deg, #10B981, #059669);
    transition: width 0.5s ease;
}

/* Validation Warnings */
#validation-warnings {
    margin-bottom: 24px;
}

.validation-alert {
    display: flex;
    gap: 16px;
    padding: 16px;
    border-radius: 12px;
    margin-bottom: 12px;
    border: 2px solid;
}

.validation-alert.error {
    background: #FEF2F2;
    border-color: #EF4444;
}

.validation-alert.warning {
    background: #FEF3C7;
    border-color: #F59E0B;
}

.validation-alert.success {
    background: #ECFDF5;
    border-color: #10B981;
}

.alert-icon {
    font-size: 2rem;
    flex-shrink: 0;
}

.alert-content {
    flex: 1;
}

.alert-message {
    font-weight: 600;
    color: #0D3B6E;
    margin-bottom: 4px;
}

.alert-suggestion {
    font-size: 0.875rem;
    color: #64748B;
}

/* Comparison View */
.comparison-view {
    background: white;
    border-radius: 12px;
    padding: 24px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    margin-bottom: 24px;
}

.comparison-view h3 {
    font-size: 1.25rem;
    color: #0D3B6E;
    margin-bottom: 20px;
    text-align: center;
}

.comparison-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 24px;
}

@media (max-width: 768px) {
    .comparison-grid {
        grid-template-columns: 1fr;
    }
}

.comparison-col h4 {
    font-size: 1.125rem;
    color: #0D3B6E;
    margin-bottom: 16px;
    text-align: center;
}

.system-summary {
    background: #F8FAFC;
    border-radius: 12px;
    padding: 20px;
    border: 2px solid #E2E8F0;
}

.system-summary.recommended {
    border-color: #10B981;
    background: #ECFDF5;
}

.system-summary.custom {
    border-color: #1565C0;
    background: #EFF6FF;
}

.summary-row {
    display: flex;
    justify-content: space-between;
    padding: 12px 0;
    border-bottom: 1px solid #E2E8F0;
    font-size: 0.9375rem;
}

.summary-row:last-child {
    border-bottom: none;
}

.summary-row.highlight {
    background: white;
    padding: 12px;
    border-radius: 8px;
    margin-top: 8px;
    border: none;
}

.summary-row span {
    color: #64748B;
}

.summary-row strong {
    color: #0D3B6E;
    font-weight: 600;
}

/* Action Buttons */
.configurator-actions {
    display: flex;
    justify-content: space-between;
    gap: 16px;
    margin-top: 32px;
}

@media (max-width: 640px) {
    .configurator-actions {
        flex-direction: column;
    }
}

/* Animations */
@keyframes slideIn {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.configurator-wrapper > * {
    animation: slideIn 0.4s ease-out;
}

.configurator-wrapper > *:nth-child(2) {
    animation-delay: 0.1s;
}

.configurator-wrapper > *:nth-child(3) {
    animation-delay: 0.2s;
}

.configurator-wrapper > *:nth-child(4) {
    animation-delay: 0.3s;
}


/* =====================================================
   FINANCIAL ANALYSIS & SAVINGS
   ===================================================== */
.financial-analysis-section {
    background: white;
    border-radius: 12px;
    padding: 28px;
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.12);
    border: 2px solid #E2E8F0;
    margin-bottom: 24px;
}

.financial-analysis-section h3 {
    font-size: 1.5rem;
    color: #0D3B6E;
    margin-bottom: 24px;
    font-weight: 700;
    text-align: center;
}

.financial-analysis-section h4 {
    font-size: 1.125rem;
    color: #0D3B6E;
    margin: 24px 0 16px 0;
    font-weight: 700;
}

.section-subtitle {
    text-align: center;
    color: #64748B;
    font-size: 0.9375rem;
    margin-bottom: 20px;
}

/* Before vs After Comparison */
.before-after-comparison {
    display: grid;
    grid-template-columns: 1fr auto 1fr;
    gap: 24px;
    margin-bottom: 32px;
    align-items: center;
}

.comparison-column {
    background: #F8FAFC;
    border-radius: 12px;
    padding: 24px;
    border: 3px solid #E2E8F0;
}

.comparison-column.before {
    border-color: #FCA5A5;
    background: linear-gradient(135deg, #FEF2F2 0%, #FEE2E2 100%);
}

.comparison-column.after {
    border-color: #86EFAC;
    background: linear-gradient(135deg, #F0FDF4 0%, #DCFCE7 100%);
}

.comparison-header {
    text-align: center;
    margin-bottom: 20px;
}

.comparison-icon {
    font-size: 3rem;
    margin-bottom: 12px;
}

.comparison-header h4 {
    font-size: 1.25rem;
    color: #0D3B6E;
    margin: 0 0 8px 0;
}

.comparison-header p {
    font-size: 0.875rem;
    color: #64748B;
    margin: 0;
}

.comparison-stats {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.stat-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 10px 12px;
    background: white;
    border-radius: 8px;
    font-size: 0.9375rem;
}

.stat-label {
    color: #64748B;
    font-weight: 500;
}

.stat-value {
    color: #0D3B6E;
    font-weight: 700;
}

.stat-value.highlight-red {
    color: #DC2626;
    font-size: 1.0625rem;
}

.stat-value.highlight-green {
    color: #059669;
    font-size: 1.0625rem;
}

.comparison-arrow {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
}

.arrow-icon {
    font-size: 3rem;
    color: #1565C0;
    font-weight: bold;
}

.arrow-label {
    font-size: 0.75rem;
    font-weight: 700;
    color: #1565C0;
    letter-spacing: 1px;
}

/* Savings Highlight */
.savings-highlight {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 20px;
    margin-bottom: 32px;
}

.savings-card {
    background: linear-gradient(135deg, #DBEAFE 0%, #BFDBFE 100%);
    border: 3px solid #1565C0;
    border-radius: 12px;
    padding: 20px;
    text-align: center;
    box-shadow: 0 4px 12px rgba(21, 101, 192, 0.2);
}

.savings-icon {
    font-size: 2.5rem;
    margin-bottom: 12px;
}

.savings-label {
    font-size: 0.875rem;
    color: #0D3B6E;
    font-weight: 600;
    margin-bottom: 8px;
}

.savings-amount {
    font-size: 1.75rem;
    color: #0D3B6E;
    font-weight: 800;
    margin-bottom: 8px;
}

.savings-detail {
    font-size: 0.8125rem;
    color: #475569;
}

/* Energy Flow Analysis */
.energy-flow-analysis {
    background: #F8FAFC;
    border-radius: 12px;
    padding: 24px;
    border: 2px solid #E2E8F0;
    margin-bottom: 32px;
}

.flow-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 16px;
}

.flow-card {
    background: white;
    border-radius: 10px;
    padding: 20px;
    text-align: center;
    border: 2px solid #E2E8F0;
    transition: all 0.3s;
}

.flow-card:hover {
    transform: translateY(-4px);
    box-shadow: 0 8px 16px rgba(0, 0, 0, 0.15);
}

.flow-card.solar {
    border-color: #10B981;
    background: linear-gradient(135deg, #ECFDF5 0%, #D1FAE5 100%);
}

.flow-card.battery-charge {
    border-color: #F59E0B;
    background: linear-gradient(135deg, #FFFBEB 0%, #FEF3C7 100%);
}

.flow-card.battery-discharge {
    border-color: #8B5CF6;
    background: linear-gradient(135deg, #F5F3FF 0%, #EDE9FE 100%);
}

.flow-card.grid {
    border-color: #3B82F6;
    background: linear-gradient(135deg, #EFF6FF 0%, #DBEAFE 100%);
}

.flow-icon {
    font-size: 2.5rem;
    margin-bottom: 12px;
}

.flow-label {
    font-size: 0.875rem;
    color: #64748B;
    font-weight: 600;
    margin-bottom: 8px;
}

.flow-value {
    font-size: 1.5rem;
    color: #0D3B6E;
    font-weight: 800;
    margin-bottom: 6px;
}

.flow-detail {
    font-size: 0.8125rem;
    color: #64748B;
}

/* Battery Impact Section */
.battery-impact-section {
    background: #F8FAFC;
    border-radius: 12px;
    padding: 24px;
    border: 2px solid #E2E8F0;
}

.battery-impact-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 16px;
}

.battery-scenario {
    background: white;
    border: 2px solid #E2E8F0;
    border-radius: 10px;
    padding: 20px;
    text-align: center;
    position: relative;
    transition: all 0.3s;
}

.battery-scenario:hover {
    border-color: #1565C0;
    box-shadow: 0 4px 12px rgba(21, 101, 192, 0.2);
}

.battery-scenario.current {
    border-color: #10B981;
    border-width: 3px;
    background: linear-gradient(135deg, #ECFDF5 0%, #D1FAE5 100%);
}

.scenario-badge {
    position: absolute;
    top: -12px;
    left: 50%;
    transform: translateX(-50%);
    background: #10B981;
    color: white;
    padding: 4px 12px;
    border-radius: 12px;
    font-size: 0.75rem;
    font-weight: 700;
    letter-spacing: 0.5px;
}

.scenario-qty {
    font-size: 1.25rem;
    color: #0D3B6E;
    font-weight: 800;
    margin-bottom: 16px;
}

.scenario-stats {
    display: flex;
    flex-direction: column;
    gap: 10px;
    margin-bottom: 16px;
}

.scenario-stat {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 8px 12px;
    background: #F8FAFC;
    border-radius: 6px;
    font-size: 0.875rem;
}

.scenario-stat .stat-label {
    color: #64748B;
    font-weight: 500;
}

.scenario-stat .stat-value {
    color: #0D3B6E;
    font-weight: 700;
}

.scenario-stat .stat-value.highlight {
    color: #F59E0B;
    font-size: 1rem;
}

.scenario-apply-btn {
    width: 100%;
    padding: 10px 16px;
    background: #1565C0;
    color: white;
    border: none;
    border-radius: 8px;
    font-weight: 600;
    font-size: 0.9375rem;
    cursor: pointer;
    transition: all 0.2s;
}

.scenario-apply-btn:hover {
    background: #0D3B6E;
    transform: translateY(-2px);
    box-shadow: 0 4px 8px rgba(21, 101, 192, 0.3);
}

.scenario-current-label {
    padding: 10px 16px;
    background: #10B981;
    color: white;
    border-radius: 8px;
    font-weight: 700;
    font-size: 0.9375rem;
}

/* Responsive Design */
@media (max-width: 1200px) {
    .before-after-comparison {
        grid-template-columns: 1fr;
        gap: 16px;
    }
    
    .comparison-arrow {
        transform: rotate(90deg);
        margin: 16px 0;
    }
    
    .savings-highlight {
        grid-template-columns: repeat(2, 1fr);
    }
    
    .flow-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}

@media (max-width: 768px) {
    .savings-highlight {
        grid-template-columns: 1fr;
    }
    
    .flow-grid {
        grid-template-columns: 1fr;
    }
    
    .battery-impact-grid {
        grid-template-columns: 1fr;
    }
}


/* ============================================
   PANEL SELECTOR - CARD-BASED UI
   ============================================ */

.panel-selector-container {
    margin: 12px 0;
}

/* Category Tabs */
.panel-category-tabs {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
    margin-bottom: 12px;
    padding: 8px;
    background: #F8FAFC;
    border-radius: 8px;
}

.panel-category-tab {
    flex: 1;
    min-width: 70px;
    padding: 10px 12px;
    background: white;
    border: 2px solid #E2E8F0;
    border-radius: 6px;
    font-size: 14px;
    font-weight: 600;
    color: #475569;
    cursor: pointer;
    transition: all 0.2s;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
}

.panel-category-tab:hover {
    border-color: #3B82F6;
    background: #EFF6FF;
    transform: translateY(-2px);
}

.panel-category-tab.active {
    background: #3B82F6;
    border-color: #3B82F6;
    color: white;
    box-shadow: 0 4px 12px rgba(59, 130, 246, 0.3);
}

.panel-category-tab .tab-count {
    font-size: 11px;
    opacity: 0.8;
}

/* Panel Cards Container */
.panel-cards-container {
    position: relative;
    min-height: 200px;
}

.panel-category-content {
    display: none;
}

.panel-category-content.active {
    display: block;
}

.panel-cards-scroll {
    max-height: 400px;
    overflow-y: auto;
    overflow-x: hidden;
    padding: 4px;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

/* Custom Scrollbar */
.panel-cards-scroll::-webkit-scrollbar {
    width: 8px;
}

.panel-cards-scroll::-webkit-scrollbar-track {
    background: #F1F5F9;
    border-radius: 4px;
}

.panel-cards-scroll::-webkit-scrollbar-thumb {
    background: #CBD5E1;
    border-radius: 4px;
}

.panel-cards-scroll::-webkit-scrollbar-thumb:hover {
    background: #94A3B8;
}

/* Panel Card */
.panel-card {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px;
    background: white;
    border: 2px solid #E2E8F0;
    border-radius: 10px;
    cursor: pointer;
    transition: all 0.2s;
    position: relative;
}

.panel-card:hover {
    border-color: #3B82F6;
    background: #F8FAFC;
    transform: translateX(4px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.08);
}

.panel-card.selected {
    border-color: #10B981;
    background: #ECFDF5;
    box-shadow: 0 4px 16px rgba(16, 185, 129, 0.2);
}

.panel-card.incompatible {
    opacity: 0.5;
    cursor: not-allowed;
    background: #FEF2F2;
    border-color: #FCA5A5;
}

.panel-card.incompatible:hover {
    transform: none;
    box-shadow: none;
}

/* Panel Card Badge */
.panel-card-badge {
    position: absolute;
    top: -8px;
    right: 8px;
    background: #F59E0B;
    color: white;
    font-size: 10px;
    font-weight: 700;
    padding: 4px 8px;
    border-radius: 12px;
    box-shadow: 0 2px 8px rgba(245, 158, 11, 0.3);
    z-index: 1;
}

.panel-card-badge.incompatible-badge {
    background: #EF4444;
}

/* Panel Card Icon (SVG) */
.panel-card-icon {
    flex-shrink: 0;
    width: 60px;
    height: 60px;
}

.panel-card-icon svg {
    width: 100%;
    height: 100%;
    filter: drop-shadow(0 2px 4px rgba(0, 0, 0, 0.1));
}

/* Panel Card Info */
.panel-card-info {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.panel-card-company {
    font-size: 13px;
    font-weight: 700;
    color: #0D3B6E;
    line-height: 1.2;
}

.panel-card-watt {
    font-size: 16px;
    font-weight: 800;
    color: #3B82F6;
}

.panel-card-specs {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
    font-size: 11px;
    color: #64748B;
}

.panel-card-specs span {
    background: #F1F5F9;
    padding: 2px 6px;
    border-radius: 4px;
}

.panel-card-price {
    font-size: 13px;
    font-weight: 700;
    color: #059669;
    margin-top: 2px;
}

/* Panel Card Checkmark */
.panel-card-checkmark {
    position: absolute;
    top: 8px;
    right: 8px;
    width: 28px;
    height: 28px;
    background: #10B981;
    color: white;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 16px;
    font-weight: 900;
    box-shadow: 0 2px 8px rgba(16, 185, 129, 0.4);
}

/* Mobile Responsive */
@media (max-width: 768px) {
    .panel-category-tabs {
        gap: 6px;
    }
    
    .panel-category-tab {
        min-width: 60px;
        padding: 8px 10px;
        font-size: 12px;
    }
    
    .panel-card {
        padding: 10px;
        gap: 10px;
    }
    
    .panel-card-icon {
        width: 50px;
        height: 50px;
    }
    
    .panel-card-company {
        font-size: 12px;
    }
    
    .panel-card-watt {
        font-size: 14px;
    }
    
    .panel-card-specs {
        font-size: 10px;
        gap: 6px;
    }
    
    .panel-card-price {
        font-size: 12px;
    }
}
