/* WickWise Professional LFA Designer - Real Data Integration */
/* CSS Variables for consistent theming */
:root {
    --primary: #667eea;
    --primary-dark: #764ba2;
    --success: #10b981;
    --warning: #f59e0b;
    --danger: #ef4444;
    --bg-primary: #f8fafc;
    --bg-secondary: white;
    --text-primary: #1e293b;
    --text-secondary: #64748b;
    --border: #e2e8f0;
    --shadow: 0 1px 3px rgba(0,0,0,0.1);
    --shadow-lg: 0 10px 25px rgba(0,0,0,0.1);
    --border-radius: 8px;
    --border-radius-lg: 12px;
    --transition: all 0.3s ease;
}

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

body {
    font-family: system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, 'Open Sans', 'Helvetica Neue', sans-serif;
    background: var(--bg-primary);
    color: var(--text-primary);
    overflow: hidden;
    line-height: 1.6;
}

/* Main App Container */
.app-container {
    display: flex;
    height: 100vh;
    padding-top: 0;
}

/* Header Styles */
.header {
    position: fixed;
    top: 56px; /* Height of SciCanvas header */
    left: 0;
    right: 0;
    height: 50px;
    background: linear-gradient(135deg, var(--primary) 0%, var(--primary-dark) 100%);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 30px;
    box-shadow: var(--shadow-lg);
    z-index: 1000;
}

.logo-section {
    display: flex;
    align-items: center;
    gap: 15px;
}

.logo {
    font-size: 28px;
    font-weight: bold;
    color: white;
    text-decoration: none;
}

.version-badge {
    background: rgba(255,255,255,0.2);
    color: white;
    padding: 4px 8px;
    border-radius: 12px;
    font-size: 12px;
    font-weight: 500;
    backdrop-filter: blur(10px);
}

.header-center {
    display: flex;
    gap: 20px;
    color: rgba(255,255,255,0.9);
    font-size: 14px;
}

.design-info {
    display: flex;
    align-items: center;
    gap: 8px;
}

.status-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--success);
    animation: pulse 2s infinite;
}

@keyframes pulse {
    0%, 100% { opacity: 0.6; transform: scale(1); }
    50% { opacity: 1; transform: scale(1.1); }
}

.header-actions {
    display: flex;
    gap: 12px;
}

/* Button Styles */
.btn {
    padding: 10px 18px;
    border: none;
    border-radius: var(--border-radius);
    cursor: pointer;
    font-size: 14px;
    font-weight: 500;
    transition: var(--transition);
    display: flex;
    align-items: center;
    gap: 8px;
    text-decoration: none;
}

.btn-primary {
    background: rgba(255,255,255,0.15);
    color: white;
    border: 1px solid rgba(255,255,255,0.2);
    backdrop-filter: blur(10px);
}

.btn-primary:hover {
    background: rgba(255,255,255,0.25);
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(0,0,0,0.15);
}

.btn-success {
    background: var(--success);
    color: white;
}

.btn-success:hover {
    background: #059669;
    transform: translateY(-1px);
}

.btn-warning {
    background: var(--warning);
    color: white;
}

.btn-warning:hover {
    background: #d97706;
    transform: translateY(-1px);
}

.btn-danger {
    background: var(--danger);
    color: white;
}

.btn-danger:hover {
    background: #dc2626;
    transform: translateY(-1px);
}

.btn-secondary {
    background-color: #64748b;
    color: white;
    border: none;
}

.btn-secondary:hover {
    background-color: #475569;
    box-shadow: 0 4px 12px rgba(100, 116, 139, 0.3);
}

/* Sidebar Styles */
.sidebar {
    width: 350px;
    background: var(--bg-secondary);
    border-right: 1px solid var(--border);
    margin-top: 106px; /* Combined height of both headers */
    overflow-y: auto;
    height: calc(100vh - 106px);
    box-shadow: var(--shadow);
}

.sidebar-header {
    padding: 22px 24px;
    background: linear-gradient(to right, #f1f5f9, #e2e8f0);
    border-bottom: 1px solid var(--border);
}

.sidebar-title {
    font-size: 18px;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 5px;
}

.design-summary {
    font-size: 13px;
    color: var(--text-secondary);
}

.sidebar-section {
    padding: 12px 15px;
    border-bottom: 1px solid var(--border);
    transition: var(--transition);
}

.sidebar-section:hover {
    background-color: #f8fafc;
}

.sidebar-section h3 {
    font-size: 15px;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 10px;
    display: flex;
    align-items: center;
}

.section-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 28px;
    height: 28px;
    margin-right: 8px;
    font-size: 16px;
    background: linear-gradient(135deg, #f0f9ff 0%, #e0f2fe 100%);
    border-radius: 6px;
    color: var(--primary);
}

/* Component Grid */
.component-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 8px;
    margin-bottom: 10px;
}

.component-card {
    background: var(--bg-secondary);
    border: 1px solid var(--border);
    border-radius: var(--border-radius);
    padding: 10px;
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    cursor: pointer;
    transition: var(--transition);
}

.component-card:hover {
    border-color: var(--primary);
    background: #f0f4ff;
    transform: translateY(-2px);
    box-shadow: 0 4px 8px rgba(0,0,0,0.08);
}

.component-card.selected {
    border-color: var(--primary);
    background: linear-gradient(135deg, #e0e7ff 0%, #f0f4ff 100%);
    box-shadow: 0 0 0 1px rgba(102, 126, 234, 0.2);
}

.component-card .icon {
    font-size: 24px;
    margin-bottom: 8px;
    display: block;
    color: var(--primary-dark);
}

.component-name {
    font-weight: 600;
    margin-bottom: 4px;
    font-size: 14px;
    color: #1e293b;
}

.component-desc {
    font-size: 12px;
    color: var(--text-secondary);
    line-height: 1.4;
}

/* Form Elements */
.form-group {
    margin-bottom: 8px;
}

.form-group label {
    display: block;
    margin-bottom: 4px;
    font-size: 13px;
    font-weight: 500;
    color: var(--text-secondary);
}

.form-control {
    width: 100%;
    padding: 10px 12px;
    border: 1px solid var(--border);
    border-radius: var(--border-radius);
    font-size: 14px;
    transition: var(--transition);
    background: white;
    color: #1e293b;
}

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

.form-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 15px;
    margin-bottom: 20px;
    width: 100%;
}

.form-row .form-group {
    margin-bottom: 0;
}

.form-row:last-child, .form-group:last-child {
    margin-bottom: 0;
}

/* Range input styling - refined for cross-browser consistency */
.range-input {
    -webkit-appearance: none;
    appearance: none;
    width: 100%;
    height: 5px;
    border-radius: 5px;
    background: #e2e8f0;
    outline: none;
    margin: 15px 0 10px 0;
    position: relative;
    cursor: pointer;
}

/* WebKit (Chrome, Safari, newer versions of Opera) */
.range-input::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 16px;
    height: 16px;
    border-radius: 50%;
    background: var(--primary);
    cursor: pointer;
    box-shadow: 0 2px 4px rgba(0,0,0,0.2);
    margin-top: -5.5px; /* Center the thumb on the track */
    position: relative;
    z-index: 2;
}

/* Firefox */
.range-input::-moz-range-thumb {
    width: 16px;
    height: 16px;
    border-radius: 50%;
    background: var(--primary);
    cursor: pointer;
    border: none;
    box-shadow: 0 2px 4px rgba(0,0,0,0.2);
    position: relative;
    z-index: 2;
}

/* Track styling for WebKit */
.range-input::-webkit-slider-runnable-track {
    height: 5px;
    background: #e2e8f0;
    border-radius: 5px;
    width: 100%;
}

/* Track styling for Firefox */
.range-input::-moz-range-track {
    height: 5px;
    background: #e2e8f0;
    border-radius: 5px;
    width: 100%;
}

/* Focused state */
.range-input:focus {
    outline: none;
}

.range-input:focus::-webkit-slider-thumb {
    box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.2);
}

.range-input:focus::-moz-range-thumb {
    box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.2);
}

.range-value, .temp-display {
    display: block;
    font-size: 13px;
    font-weight: 500;
    color: #475569;
    text-align: right;
    margin-top: 6px;
}

.temp-display {
    font-size: 16px;
    font-weight: 600;
    color: var(--primary);
    text-align: right;
    margin-top: 6px;
}

/* Main Content */
.main-content {
    flex: 1;
    margin-top: 106px;
    padding: 30px;
    overflow: auto;
    background: var(--bg-primary);
}

.canvas-container {
    background: var(--bg-secondary);
    border-radius: 16px;
    box-shadow: var(--shadow-lg);
    padding: 30px;
    min-height: calc(100vh - 160px);
    position: relative;
}

.canvas-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 8px;
    padding: 10px 15px;
    background: var(--bg-secondary);
    border-radius: var(--border-radius);
    box-shadow: var(--shadow);
}

.canvas-title-section {
    display: flex;
    align-items: center;
    gap: 15px;
}

.canvas-title {
    font-size: 24px;
    font-weight: 600;
    color: var(--text-primary);
}

.design-status {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 6px 12px;
    background: #f0fdf4;
    border: 1px solid #bbf7d0;
    border-radius: 20px;
    font-size: 12px;
    color: #15803d;
}

.canvas-actions {
    display: flex;
    gap: 12px;
}

/* LFA Builder */
.lfa-builder {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 30px;
}

.lfa-strip-container {
    background: linear-gradient(135deg, #f8fafc 0%, #e2e8f0 100%);
    padding: 40px;
    border-radius: 20px;
    border: 2px dashed var(--border);
    position: relative;
    overflow: hidden;
}

.lfa-strip-container::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: radial-gradient(circle at 20% 50%, rgba(102, 126, 234, 0.05) 0%, transparent 50%);
    pointer-events: none;
}

.lfa-strip {
    display: flex;
    align-items: center;
    gap: 8px;
    position: relative;
    z-index: 1;
}

.lfa-component {
    height: 100px;
    border-radius: var(--border-radius-lg);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    color: white;
    font-weight: 600;
    font-size: 13px;
    text-align: center;
    position: relative;
    cursor: pointer;
    transition: var(--transition);
    box-shadow: 0 4px 15px rgba(0,0,0,0.1);
    backdrop-filter: blur(10px);
}

.lfa-component:hover {
    transform: translateY(-5px) scale(1.02);
    box-shadow: 0 8px 25px rgba(0,0,0,0.15);
}

.sample-pad { 
    width: 110px; 
    background: linear-gradient(135deg, #ef4444 0%, #dc2626 100%); 
}

.conjugate-pad { 
    width: 130px; 
    background: linear-gradient(135deg, #f59e0b 0%, #d97706 100%); 
}

.membrane { 
    width: 220px; 
    background: linear-gradient(135deg, #10b981 0%, #059669 100%); 
}

.absorbent-pad { 
    width: 110px; 
    background: linear-gradient(135deg, #3b82f6 0%, #2563eb 100%); 
}

.component-label {
    font-size: 12px;
    font-weight: 600;
    margin-bottom: 4px;
}

.component-material {
    font-size: 10px;
    opacity: 0.9;
}

.flow-arrow {
    font-size: 32px;
    color: var(--primary);
    animation: flow 3s ease-in-out infinite;
    filter: drop-shadow(0 2px 4px rgba(0,0,0,0.1));
}

@keyframes flow {
    0%, 100% { opacity: 0.6; transform: scale(1); }
    50% { opacity: 1; transform: scale(1.1); }
}

.component-details {
    position: absolute;
    bottom: -40px;
    left: 50%;
    transform: translateX(-50%);
    background: rgba(0,0,0,0.9);
    color: white;
    padding: 8px 12px;
    border-radius: var(--border-radius);
    font-size: 11px;
    opacity: 0;
    transition: var(--transition);
    white-space: nowrap;
    backdrop-filter: blur(10px);
}

.lfa-component:hover .component-details {
    opacity: 1;
    bottom: -35px;
}

/* Data Source Panel */
.data-source-panel {
    margin-top: 30px;
    padding: 20px;
    background: linear-gradient(135deg, #e0f2fe 0%, #b3e5fc 100%);
    border-radius: var(--border-radius-lg);
    border: 1px solid #81d4fa;
}

.data-source-panel h4 {
    margin-bottom: 15px;
    color: #0277bd;
    font-weight: 600;
}

.data-sources {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
}

.data-badge {
    background: rgba(255,255,255,0.8);
    color: #0277bd;
    padding: 6px 12px;
    border-radius: 20px;
    font-size: 12px;
    font-weight: 500;
    border: 1px solid #81d4fa;
}

/* Simulation Panel */
.simulation-panel {
    margin-top: 40px;
    padding: 30px;
    background: linear-gradient(135deg, #f8fafc 0%, #e2e8f0 100%);
    border-radius: 16px;
    border: 1px solid var(--border);
    position: relative;
}

.simulation-description {
    margin-bottom: 20px;
    color: var(--text-secondary);
    font-size: 15px;
    line-height: 1.5;
}

.simulation-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 15px;
    flex-wrap: wrap;
    gap: 15px;
}

.simulation-title {
    font-size: 20px;
    font-weight: 600;
    color: var(--text-primary);
}

.simulation-controls {
    display: flex;
    gap: 10px;
}

.simulation-controls .btn-primary {
    background-color: #3b82f6;
    color: white;
    border: none;
    box-shadow: 0 2px 8px rgba(59, 130, 246, 0.3);
    padding: 10px 20px;
    font-size: 14px;
}

.simulation-controls .btn-primary:hover {
    background-color: #2563eb;
    box-shadow: 0 4px 12px rgba(59, 130, 246, 0.4);
}

/* Advanced Simulation Results */
.advanced-simulation-results {
    display: flex;
    flex-direction: column;
    gap: 20px;
}

/* Results-specific styles */
.results-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 20px;
    margin-bottom: 20px;
}

.result-section {
    background-color: white;
    border-radius: 8px;
    padding: 20px;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05);
    transition: all 0.3s ease;
}

.result-section h4 {
    margin-top: 0;
    margin-bottom: 15px;
    font-size: 16px;
    color: #2c3e50;
    font-weight: 600;
    padding-bottom: 10px;
    border-bottom: 1px solid #f1f5f9;
}

.result-item {
    display: flex;
    justify-content: space-between;
    margin-bottom: 12px;
    font-size: 14px;
}

.result-label {
    color: #64748b;
}

.result-value {
    font-weight: 600;
    color: #334155;
    font-size: 16px;
}

/* Optimization Suggestion */
.optimization-suggestion {
    background-color: #e8f4f8;
    border-left: 4px solid #3498db;
    padding: 15px;
    margin-top: 10px;
    margin-bottom: 20px;
    border-radius: 0 4px 4px 0;
    font-size: 14px;
    line-height: 1.5;
}

/* Kinetics Visualization - Now positioned below results */
.kinetics-visualization {
    margin-top: 20px;
    background-color: white;
    border-radius: 10px;
    padding: 20px;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05);
}

.kinetics-visualization h4 {
    margin-top: 0;
    margin-bottom: 15px;
    font-size: 16px;
    font-weight: 600;
    color: #2c3e50;
}

.visualization-options {
    display: flex;
    margin-bottom: 15px;
    gap: 10px;
}

.visualization-options button {
    padding: 6px 15px;
    font-size: 14px;
    background-color: #f1f5f9;
    color: #334155;
    border: none;
    border-radius: 4px;
    cursor: pointer;
}

.visualization-options button.active {
    background-color: #3b82f6;
    color: white;
}

#kineticsCanvas {
    max-width: 100%;
    display: block;
    margin: 0 auto;
    border: 1px solid #e2e8f0;
    border-radius: 4px;
}

.visualization-legend {
    display: flex;
    justify-content: center;
    gap: 20px;
    margin-top: 15px;
}

.visualization-legend div {
    display: flex;
    align-items: center;
    font-size: 14px;
    color: #64748b;
}

.visualization-legend div::before {
    content: '';
    display: inline-block;
    width: 12px;
    height: 12px;
    margin-right: 8px;
    border-radius: 2px;
}

.visualization-legend div:first-child::before {
    background-color: #3498db;
}

.visualization-legend div:last-child::before {
    background-color: #e74c3c;
}

/* Cost Panel */
.cost-panel {
    background: linear-gradient(135deg, #fef3c7 0%, #fde68a 100%);
    padding: 20px;
    border-radius: var(--border-radius-lg);
    margin-top: 20px;
    border: 1px solid #f59e0b;
}

.cost-title {
    font-weight: 600;
    color: #92400e;
    margin-bottom: 15px;
}

.cost-breakdown {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    gap: 15px;
}

.cost-item {
    background: rgba(255,255,255,0.7);
    padding: 12px;
    border-radius: var(--border-radius);
    text-align: center;
}

.cost-value {
    font-size: 18px;
    font-weight: bold;
    color: #92400e;
}

.cost-label {
    font-size: 12px;
    color: #78350f;
}

/* Modal Styles */
.modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.5);
    z-index: 1000;
    opacity: 0;
    transition: opacity 0.3s ease-in-out;
}

.modal.active {
    display: flex;
    opacity: 1;
    justify-content: center;
    align-items: center;
}

.modal-content {
    background-color: #fff;
    border-radius: 8px;
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.2);
    width: 80%;
    max-width: 900px;
    max-height: 90vh;
    overflow: hidden;
    transform: translateY(-20px);
    transition: transform 0.3s ease-in-out;
    animation: modalAppear 0.3s forwards;
}

@keyframes modalAppear {
    from {
        transform: translateY(-20px);
        opacity: 0.5;
    }
    to {
        transform: translateY(0);
        opacity: 1;
    }
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 15px 20px;
    border-bottom: 1px solid #e5e7eb;
    background-color: #f8fafc;
}

.modal-header h2 {
    margin: 0;
    font-size: 1.5rem;
    color: #1e3a8a;
}

.close-modal {
    font-size: 24px;
    cursor: pointer;
    color: #64748b;
    transition: color 0.2s;
}

.close-modal:hover {
    color: #e11d48;
}

.modal-body {
    padding: 20px;
    overflow-y: auto;
    max-height: calc(90vh - 70px);
}

/* Template Selection Styles */
.template-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 20px;
    width: 100%;
}

.template-card {
    background: linear-gradient(135deg, #f8f9fa 0%, #e9ecef 100%);
    border-radius: 8px;
    padding: 15px;
    box-shadow: 0 2px 5px rgba(0,0,0,0.1);
    cursor: pointer;
    transition: all 0.2s ease;
    border: 1px solid #dee2e6;
}

.template-card:hover {
    transform: translateY(-3px);
    box-shadow: 0 5px 15px rgba(0,0,0,0.1);
    border-color: var(--primary);
}

.template-header {
    display: flex;
    align-items: center;
    margin-bottom: 10px;
    border-bottom: 1px solid var(--border);
    padding-bottom: 10px;
}

.template-icon {
    font-size: 24px;
    margin-right: 10px;
}

.template-name {
    font-size: 17px;
    font-weight: 600;
    color: var(--text-primary);
}

.template-info p {
    font-size: 13px;
    color: var(--text-secondary);
    margin-bottom: 10px;
    font-style: italic;
}

.template-specs {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 8px;
}

.spec-item {
    font-size: 12px;
    background-color: #f1f3f5;
    padding: 4px 8px;
    border-radius: 4px;
    color: var(--text-secondary);
}

/* Simulation Progress Styles */
.simulation-progress-container {
    height: 10px;
    background-color: var(--border);
    border-radius: 5px;
    margin: 20px 0;
    overflow: hidden;
}

.simulation-progress-bar {
    height: 100%;
    background: linear-gradient(90deg, var(--primary) 0%, var(--primary-dark) 100%);
    width: 0%;
    transition: width 0.3s ease;
}

.simulation-steps {
    display: flex;
    flex-direction: column;
    gap: 10px;
    margin-top: 20px;
}

.simulation-steps .step {
    padding: 10px;
    background-color: #f1f3f5;
    border-radius: 5px;
    color: var(--text-secondary);
    font-size: 14px;
    transition: all 0.3s ease;
}

.simulation-steps .step.active {
    background-color: #e0e7ff;
    color: var(--primary);
    font-weight: 500;
}

.simulation-steps .step.completed {
    background-color: #dcfce7;
    color: var(--success);
}

/* Compatibility Grid */
.compatibility-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 20px;
}

.compatibility-card {
    padding: 20px;
    border-radius: var(--border-radius-lg);
    border: 1px solid var(--border);
    background: white;
    transition: var(--transition);
}

.compatibility-card:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow);
}

.compatibility-good { border-left: 5px solid var(--success); }
.compatibility-warning { border-left: 5px solid var(--warning); }
.compatibility-poor { border-left: 5px solid var(--danger); }

.compatibility-header {
    display: flex;
    align-items: center;
    margin-bottom: 12px;
}

.status-indicator {
    display: inline-block;
    width: 12px;
    height: 12px;
    border-radius: 50%;
    margin-right: 12px;
}

.status-good { background: var(--success); }
.status-warning { background: var(--warning); }
.status-poor { background: var(--danger); }

.compatibility-score {
    margin-left: auto;
    font-weight: bold;
    padding: 4px 8px;
    border-radius: 12px;
    font-size: 12px;
}

.score-good { background: #dcfce7; color: #15803d; }
.score-warning { background: #fef3c7; color: #92400e; }
.score-poor { background: #fef2f2; color: #dc2626; }

/* Material Selector */
.material-selector {
    background: white;
    border: 1px solid var(--border);
    border-radius: var(--border-radius-lg);
    margin-top: 15px;
}

.material-header {
    padding: 15px 20px;
    border-bottom: 1px solid var(--border);
    background: #f8fafc;
    border-radius: var(--border-radius-lg) var(--border-radius-lg) 0 0;
    font-weight: 600;
    font-size: 14px;
}

.material-options {
    max-height: 200px;
    overflow-y: auto;
}

.material-option {
    padding: 12px 20px;
    cursor: pointer;
    transition: background 0.2s;
    border-bottom: 1px solid #f1f5f9;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.material-option:hover {
    background: #f8fafc;
}

.material-option.selected {
    background: #e0e7ff;
    border-left: 3px solid var(--primary);
}

.material-name {
    font-weight: 500;
}

.material-specs {
    font-size: 12px;
    color: var(--text-secondary);
    margin-top: 2px;
}

.material-cost {
    margin-left: auto;
    font-size: 12px;
    color: var(--warning);
    font-weight: 600;
}

/* Notification Styles */
.notification {
    position: fixed;
    top: 80px;
    right: 20px;
    padding: 15px 20px;
    border-radius: var(--border-radius);
    color: white;
    font-weight: 500;
    z-index: 3000;
    transform: translateX(100%);
    transition: transform 0.3s ease;
    max-width: 300px;
    box-shadow: 0 4px 12px rgba(0,0,0,0.15);
}

.notification.success { background: var(--success); }
.notification.warning { background: var(--warning); }
.notification.error { background: var(--danger); }
.notification.info { background: #3b82f6; }

.notification.show {
    transform: translateX(0);
}

/* Responsive Design */
@media (max-width: 1200px) {
    .sidebar {
        width: 300px;
    }
    
    .component-grid {
        grid-template-columns: 1fr;
    }
    
    .canvas-header {
        flex-direction: column;
        gap: 15px;
        align-items: flex-start;
    }
    
    .canvas-actions {
        width: 100%;
        justify-content: flex-start;
    }
}

@media (max-width: 768px) {
    .sidebar {
        position: fixed;
        left: -350px;
        z-index: 1500;
        transition: left 0.3s ease;
        width: 350px;
        margin-top: 106px;
        height: calc(100vh - 106px);
    }
    
    .sidebar.open {
        left: 0;
    }
    
    .main-content {
        margin-top: 0;
    }
    
    .header {
        padding: 0 15px;
    }
    
    .header-center {
        display: none;
    }
    
    .canvas-container {
        padding: 20px;
    }
    
    .lfa-strip-container {
        padding: 20px;
    }
    
    .lfa-strip {
        flex-direction: column;
        gap: 15px;
    }
    
    .flow-arrow {
        transform: rotate(90deg);
        font-size: 24px;
    }
    
    .lfa-component {
        width: 200px !important;
        height: 80px;
    }
    
    .simulation-results {
        grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
        gap: 15px;
    }
    
    .cost-breakdown {
        grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
    }
    
    .modal-content {
        width: 95%;
        padding: 20px;
        margin: 20px;
    }
    
    .compatibility-grid {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 480px) {
    .header {
        height: 60px;
        padding: 0 10px;
    }
    
    .logo {
        font-size: 20px;
    }
    
    .version-badge {
        font-size: 10px;
        padding: 2px 6px;
    }
    
    .header-actions {
        gap: 8px;
    }
    
    .btn {
        padding: 8px 12px;
        font-size: 12px;
    }
    
    .sidebar {
        width: 100%;
        left: -100%;
    }
    
    .main-content {
        margin-top: 0;
        padding: 10px;
    }
    
    .canvas-container {
        padding: 15px;
    }
    
    .canvas-title {
        font-size: 20px;
    }
    
    .lfa-component {
        width: 100% !important;
        height: 60px;
    }
    
    .component-label {
        font-size: 11px;
    }
    
    .component-material {
        font-size: 9px;
    }
    
    .result-value {
        font-size: 24px;
    }
    
    .result-label {
        font-size: 11px;
    }
}

/* Dark mode support (optional) */
@media (prefers-color-scheme: dark) {
    :root {
        --bg-primary: #0f172a;
        --bg-secondary: #1e293b;
        --text-primary: #f1f5f9;
        --text-secondary: #94a3b8;
        --border: #334155;
    }
    
    .component-card {
        background: #1e293b;
        border-color: #334155;
    }
    
    .component-card:hover {
        background: #2d3748;
    }
    
    .form-control {
        background: #1e293b;
        border-color: #334155;
        color: var(--text-primary);
    }
    
    .modal-content {
        background: #1e293b;
        color: var(--text-primary);
    }
}

/* Print styles */
@media print {
    .header,
    .sidebar,
    .canvas-actions,
    .simulation-controls {
        display: none;
    }
    
    .main-content {
        margin-top: 0;
        padding: 0;
    }
    
    .canvas-container {
        box-shadow: none;
        border: 1px solid #000;
    }
    
    .lfa-strip-container {
        border: 2px solid #000;
        background: white;
    }
    
    .lfa-component {
        border: 1px solid #000;
        color: #000 !important;
        background: white !important;
    }
}

/* High contrast mode support */
@media (prefers-contrast: high) {
    :root {
        --primary: #0000ff;
        --success: #008000;
        --warning: #ff8c00;
        --danger: #ff0000;
        --border: #000000;
    }
    
    .btn {
        border: 2px solid;
    }
    
    .component-card {
        border-width: 3px;
    }
    
    .form-control {
        border-width: 2px;
    }
}

/* Reduced motion support */
@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
    
    .status-dot {
        animation: none;
    }
    
    .flow-arrow {
        animation: none;
    }
    
    .progress-fill::after {
        animation: none;
    }
}

/* Binding Kinetics Styles */
.kinetics-info {
    margin-top: 15px;
    border-radius: 8px;
    padding: 12px;
    display: flex;
    flex-wrap: wrap;
    justify-content: space-between;
    box-shadow: 0 1px 2px rgba(0,0,0,0.05);
    border: 1px solid var(--border);
}

.info-item {
    margin: 4px 0;
    font-size: 13px;
    width: 48%;
}

.info-label {
    font-weight: 600;
    color: #475569;
    margin-right: 4px;
}

.info-value {
    color: #1e293b;
    font-weight: 500;
}

/* Performance Metrics Panel */
.performance-panel {
    margin-top: 40px;
    background: linear-gradient(to right, #f8fafc, #f1f5f9);
    border-radius: 12px;
    padding: 25px;
    border: 1px solid var(--border);
    box-shadow: var(--shadow);
}

.panel-header {
    margin-bottom: 20px;
    border-bottom: 1px solid #e2e8f0;
    padding-bottom: 10px;
}

.panel-header h3 {
    margin: 0;
    font-size: 18px;
    font-weight: 600;
    color: var(--text-primary);
}

.performance-metrics {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 15px;
}

.metric {
    background: white;
    padding: 20px;
    border-radius: 8px;
    text-align: center;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05);
    transition: all 0.3s ease;
}

.metric:hover {
    transform: translateY(-3px);
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1);
}

.metric-name {
    font-size: 14px;
    color: var(--text-secondary);
    margin-bottom: 8px;
}

.metric-value {
    font-size: 24px;
    font-weight: 700;
    color: var(--primary);
}

.panel-description {
    color: var(--text-secondary);
    font-size: 14px;
    margin-top: 5px;
    line-height: 1.4;
}

.metric-desc {
    font-size: 12px;
    color: var(--text-secondary);
    margin-top: 5px;
}

.simulation-placeholder {
    text-align: center;
    padding: 40px 20px;
    background: white;
    border-radius: 8px;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05);
}

.placeholder-message {
    font-size: 16px;
    color: #64748b;
    margin-bottom: 20px;
}

.simulation-placeholder .btn {
    margin: 0 auto;
}

/* Select Element Styling */
select.form-control {
    -webkit-appearance: none;
    -moz-appearance: none;
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' fill='%23475569' viewBox='0 0 16 16'%3E%3Cpath d='M3.646 6.854a.5.5 0 0 1 .708 0L8 10.293l3.646-3.647a.5.5 0 0 1 .708.708l-4 4a.5.5 0 0 1-.708 0l-4-4a.5.5 0 0 1 0-.708z'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 0.7rem center;
    background-size: 16px 12px;
    padding-right: 2.5rem;
}

/* Number Input Styling */
input[type="number"].form-control {
    -moz-appearance: textfield;
    width: 100%;
}

input[type="number"].form-control::-webkit-outer-spin-button,
input[type="number"].form-control::-webkit-inner-spin-button {
    -webkit-appearance: none;
    margin: 0;
}

/* Section Headers */
.sidebar-section:last-child {
    border-bottom: none;
}

.sidebar-section:nth-child(odd) {
    background-color: #f8fafc;
}

.sidebar-section:nth-child(even) {
    background-color: white;
}

/* Improved temp slider styling */
.temp-slider {
    margin-bottom: 6px;
}

/* Form layout fixes */
.form-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 15px;
    margin-bottom: 20px;
    width: 100%;
}

.form-row .form-group {
    margin-bottom: 0;
}

/* Numeric input container */
.numeric-input-container {
    display: flex;
    flex-direction: column;
}

.numeric-input-container label {
    margin-bottom: 8px;
}

/* Range input styling */
.range-input {
    -webkit-appearance: none;
    appearance: none;
    width: 100%;
    height: 5px;
    border-radius: 5px;
    background: #e2e8f0;
    outline: none;
    margin: 15px 0 10px 0;
    position: relative;
    cursor: pointer;
}

/* Consistent styling for all value displays */
.range-value, 
.temp-display {
    font-size: 13px;
    color: #475569;
}

/* Kinetics info panel improvements */
.kinetics-info {
    margin-top: 15px;
    border-radius: 8px;
}

/* Numeric input styling */
.numeric-input-container {
    display: flex;
    flex-direction: column;
}

.numeric-input-container input[type="number"] {
    margin-bottom: 6px;
}

.numeric-input-container .range-value {
    text-align: right;
    font-size: 13px;
    color: #475569;
    margin-top: 6px;
}

/* Text value displays for all range displays */
.range-value, .temp-display {
    display: block;
    font-size: 13px;
    font-weight: 500;
    color: #475569;
    text-align: right;
    margin-top: 6px;
}

/* Ensure inputs don't overflow their containers */
input.form-control, select.form-control {
    max-width: 100%;
    box-sizing: border-box;
}
