/**
 * RO Desalination Calculator - Professional Engineering Styles
 * Clean, technical interface optimized for engineering workflows
 */

/* Reset and Base Styles */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    background: linear-gradient(135deg, #f7fafc 0%, #edf2f7 100%);
    color: #2d3748;
    line-height: 1.6;
    min-height: 100vh;
}

/* Typography */
h1, h2, h3, h4, h5, h6 {
    font-weight: 600;
    color: #1a365d;
    margin-bottom: 1rem;
}

h1 { font-size: 2.5rem; }
h2 { font-size: 2rem; }
h3 { font-size: 1.5rem; }
h4 { font-size: 1.25rem; }
h5 { font-size: 1.125rem; }
h6 { font-size: 1rem; }

/* Layout Container */
.container {
    max-width: 1400px;
    margin: 0 auto;
    padding: 2rem;
}

/* Header */
.header {
    background: linear-gradient(135deg, #1a365d 0%, #2d3748 100%);
    color: white;
    padding: 2rem 0;
    margin-bottom: 2rem;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
}

.header-content {
    max-width: 1400px;
    margin: 0 auto;
    padding: 0 2rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.header h1 {
    color: white;
    margin: 0;
    font-size: 2rem;
    font-weight: 700;
}

.header-subtitle {
    color: #cbd5e0;
    font-size: 1rem;
    margin-top: 0.5rem;
}

/* Main Calculator Layout */
.calculator-grid {
    display: grid;
    grid-template-columns: 1fr 1fr 1fr;
    gap: 2rem;
    margin-bottom: 2rem;
}

.calculator-panel {
    background: white;
    border-radius: 12px;
    padding: 1.5rem;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.05);
    border: 1px solid #e2e8f0;
    transition: all 0.3s ease;
}

.calculator-panel:hover {
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.1);
    transform: translateY(-2px);
}

.panel-header {
    display: flex;
    align-items: center;
    margin-bottom: 1.5rem;
    padding-bottom: 1rem;
    border-bottom: 2px solid #e2e8f0;
}

.panel-icon {
    width: 24px;
    height: 24px;
    margin-right: 0.75rem;
    color: #ed8936;
}

.panel-title {
    font-size: 1.25rem;
    font-weight: 600;
    color: #1a365d;
    margin: 0;
}

/* Input Groups */
.input-group {
    margin-bottom: 1.5rem;
}

.input-label {
    display: block;
    font-weight: 500;
    color: #2d3748;
    margin-bottom: 0.5rem;
    font-size: 0.875rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.input-wrapper {
    position: relative;
    display: flex;
    align-items: center;
}

.input-field {
    width: 100%;
    padding: 0.75rem 1rem;
    border: 2px solid #e2e8f0;
    border-radius: 8px;
    font-size: 1rem;
    font-weight: 500;
    color: #2d3748;
    background: white;
    transition: all 0.3s ease;
}

.input-field:focus {
    outline: none;
    border-color: #ed8936;
    box-shadow: 0 0 0 3px rgba(237, 137, 54, 0.1);
}

.input-unit {
    position: absolute;
    right: 1rem;
    color: #718096;
    font-size: 0.875rem;
    font-weight: 500;
    pointer-events: none;
}

/* Select Inputs */
.select-field {
    width: 100%;
    padding: 0.75rem 1rem;
    border: 2px solid #e2e8f0;
    border-radius: 8px;
    font-size: 1rem;
    font-weight: 500;
    color: #2d3748;
    background: white;
    cursor: pointer;
    transition: all 0.3s ease;
}

.select-field:focus {
    outline: none;
    border-color: #ed8936;
    box-shadow: 0 0 0 3px rgba(237, 137, 54, 0.1);
}

/* Range Sliders */
.range-slider {
    width: 100%;
    height: 8px;
    border-radius: 4px;
    background: #e2e8f0;
    outline: none;
    cursor: pointer;
    -webkit-appearance: none;
    appearance: none;
}

.range-slider::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 20px;
    height: 20px;
    border-radius: 50%;
    background: #ed8936;
    cursor: pointer;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
    transition: all 0.3s ease;
}

.range-slider::-webkit-slider-thumb:hover {
    background: #dd6b20;
    transform: scale(1.1);
}

.range-slider::-moz-range-thumb {
    width: 20px;
    height: 20px;
    border-radius: 50%;
    background: #ed8936;
    cursor: pointer;
    border: none;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
}

.range-value {
    display: inline-block;
    margin-left: 0.75rem;
    padding: 0.25rem 0.75rem;
    background: #ed8936;
    color: white;
    border-radius: 20px;
    font-size: 0.875rem;
    font-weight: 600;
    min-width: 60px;
    text-align: center;
}

/* Results Display */
.result-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1rem;
    margin-bottom: 0.75rem;
    background: #f7fafc;
    border-radius: 8px;
    border-left: 4px solid #ed8936;
    transition: all 0.3s ease;
}

.result-item:hover {
    background: #edf2f7;
    transform: translateX(4px);
}

.result-label {
    font-weight: 500;
    color: #2d3748;
    font-size: 0.875rem;
}

.result-value {
    font-weight: 700;
    color: #1a365d;
    font-size: 1rem;
    font-family: 'JetBrains Mono', monospace;
}

.result-unit {
    font-size: 0.75rem;
    color: #718096;
    margin-left: 0.25rem;
}

/* Status Indicators */
.status-good {
    border-left-color: #38a169;
}

.status-warning {
    border-left-color: #d69e2e;
}

.status-error {
    border-left-color: #e53e3e;
}

/* Membrane Selection */
.membrane-card {
    background: white;
    border: 2px solid #e2e8f0;
    border-radius: 12px;
    padding: 1.5rem;
    margin-bottom: 1rem;
    cursor: pointer;
    transition: all 0.3s ease;
}

.membrane-card:hover {
    border-color: #ed8936;
    box-shadow: 0 4px 12px rgba(237, 137, 54, 0.15);
}

.membrane-card.selected {
    border-color: #ed8936;
    background: #fffaf0;
    box-shadow: 0 4px 12px rgba(237, 137, 54, 0.2);
}

.membrane-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1rem;
}

.membrane-name {
    font-weight: 600;
    color: #1a365d;
    font-size: 1.125rem;
}

.membrane-manufacturer {
    color: #718096;
    font-size: 0.875rem;
}

.membrane-specs {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 0.75rem;
    margin-bottom: 1rem;
}

.spec-item {
    display: flex;
    justify-content: space-between;
    font-size: 0.875rem;
}

.spec-label {
    color: #718096;
}

.spec-value {
    font-weight: 600;
    color: #2d3748;
    font-family: 'JetBrains Mono', monospace;
}

/* Chart Containers */
.chart-container {
    background: white;
    border-radius: 12px;
    padding: 1.5rem;
    margin-bottom: 2rem;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.05);
    border: 1px solid #e2e8f0;
}

.chart-title {
    font-size: 1.25rem;
    font-weight: 600;
    color: #1a365d;
    margin-bottom: 1.5rem;
    text-align: center;
}

/* System Diagram */
.system-diagram {
    background: white;
    border-radius: 12px;
    padding: 1.5rem;
    margin-bottom: 2rem;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.05);
    border: 1px solid #e2e8f0;
}

/* Action Buttons */
.action-button {
    background: linear-gradient(135deg, #ed8936 0%, #dd6b20 100%);
    color: white;
    border: none;
    padding: 0.75rem 1.5rem;
    border-radius: 8px;
    font-weight: 600;
    font-size: 1rem;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 4px 6px rgba(237, 137, 54, 0.2);
}

.action-button:hover {
    background: linear-gradient(135deg, #dd6b20 0%, #c05621 100%);
    transform: translateY(-2px);
    box-shadow: 0 6px 12px rgba(237, 137, 54, 0.3);
}

.action-button:active {
    transform: translateY(0);
}

.action-button.secondary {
    background: linear-gradient(135deg, #718096 0%, #4a5568 100%);
}

.action-button.secondary:hover {
    background: linear-gradient(135deg, #4a5568 0%, #2d3748 100%);
}

/* Export Section */
.export-section {
    background: white;
    border-radius: 12px;
    padding: 1.5rem;
    margin-top: 2rem;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.05);
    border: 1px solid #e2e8f0;
}

.export-buttons {
    display: flex;
    gap: 1rem;
    flex-wrap: wrap;
}

/* Responsive Design */
@media (max-width: 1200px) {
    .calculator-grid {
        grid-template-columns: 1fr 1fr;
    }
}

@media (max-width: 768px) {
    .calculator-grid {
        grid-template-columns: 1fr;
    }
    
    .container {
        padding: 1rem;
    }
    
    .header-content {
        flex-direction: column;
        text-align: center;
    }
    
    .export-buttons {
        flex-direction: column;
    }
}

/* Loading States */
.loading {
    position: relative;
    overflow: hidden;
}

.loading::after {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(237, 137, 54, 0.2), transparent);
    animation: loading 1.5s infinite;
}

@keyframes loading {
    0% { left: -100%; }
    100% { left: 100%; }
}

/* Error States */
.error-message {
    background: #fed7d7;
    color: #c53030;
    padding: 0.75rem 1rem;
    border-radius: 8px;
    margin-bottom: 1rem;
    border-left: 4px solid #e53e3e;
    font-size: 0.875rem;
    font-weight: 500;
}

/* Success States */
.success-message {
    background: #c6f6d5;
    color: #2f855a;
    padding: 0.75rem 1rem;
    border-radius: 8px;
    margin-bottom: 1rem;
    border-left: 4px solid #38a169;
    font-size: 0.875rem;
    font-weight: 500;
}

/* Help Tooltips */
.tooltip {
    position: relative;
    cursor: help;
}

.tooltip::after {
    content: attr(data-tooltip);
    position: absolute;
    bottom: 125%;
    left: 50%;
    transform: translateX(-50%);
    background: #1a365d;
    color: white;
    padding: 0.5rem 0.75rem;
    border-radius: 4px;
    font-size: 0.75rem;
    white-space: nowrap;
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s ease;
    z-index: 1000;
}

.tooltip:hover::after {
    opacity: 1;
    visibility: visible;
}

/* Print Styles */
@media print {
    .header,
    .action-button,
    .export-section {
        display: none;
    }
    
    .calculator-panel {
        break-inside: avoid;
        box-shadow: none;
        border: 1px solid #e2e8f0;
    }
}
