* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    min-height: 100vh;
    padding: 20px;
}

.spectrophotometry-container {
    max-width: 1600px;
    margin: 0 auto;
    background: white;
    border-radius: 20px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
    overflow: hidden;
}

header {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    padding: 40px;
    text-align: center;
}

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

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

main {
    padding: 30px;
}

.visualization-layout {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 30px;
    margin-bottom: 30px;
}

.instrument-panel,
.charts-panel {
    background: #f8f9fa;
    border-radius: 15px;
    padding: 20px;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
}

.instrument-panel h3,
.charts-panel h3 {
    color: #2c3e50;
    margin-bottom: 15px;
    font-size: 1.2rem;
    font-weight: 600;
}

canvas {
    width: 100%;
    border-radius: 10px;
    background: #1a1a1a;
    margin-bottom: 15px;
}

#instrumentCanvas {
    height: 400px;
}

.chart-container {
    margin-bottom: 20px;
}

.chart-container h3 {
    font-size: 1rem;
    color: #34495e;
    margin-bottom: 10px;
}

#spectrumCanvas,
#standardCurveCanvas {
    height: 300px;
}

.instrument-info {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 10px;
    background: white;
    padding: 15px;
    border-radius: 10px;
    border-left: 4px solid #667eea;
}

.info-item {
    font-size: 0.9rem;
    color: #2c3e50;
}

.info-item span:first-child {
    font-weight: 600;
    color: #667eea;
}

.controls-panel {
    background: #f8f9fa;
    border-radius: 15px;
    padding: 25px;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
}

.controls-panel h3 {
    color: #2c3e50;
    margin-bottom: 20px;
    font-size: 1.3rem;
    font-weight: 600;
}

.controls-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 20px;
    margin-bottom: 25px;
}

.control-group {
    background: white;
    padding: 15px;
    border-radius: 10px;
    border: 1px solid #e0e0e0;
}

.control-group label {
    display: block;
    margin-bottom: 8px;
    font-size: 0.9rem;
    color: #2c3e50;
    font-weight: 500;
}

.control-group input[type="range"] {
    width: 100%;
    height: 6px;
    border-radius: 3px;
    background: #ddd;
    outline: none;
    -webkit-appearance: none;
}

.control-group input[type="range"]::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 18px;
    height: 18px;
    border-radius: 50%;
    background: #667eea;
    cursor: pointer;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
}

.control-group input[type="range"]::-moz-range-thumb {
    width: 18px;
    height: 18px;
    border-radius: 50%;
    background: #667eea;
    cursor: pointer;
    border: none;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
}

.control-group select {
    width: 100%;
    padding: 8px 12px;
    border: 1px solid #ddd;
    border-radius: 6px;
    font-size: 0.9rem;
    color: #2c3e50;
    background: white;
    cursor: pointer;
}

.button-group {
    display: flex;
    gap: 15px;
    margin-bottom: 25px;
    flex-wrap: wrap;
}

.control-button {
    padding: 12px 24px;
    border: none;
    border-radius: 8px;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.control-button:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.control-button.measure {
    background: #3498db;
    color: white;
}

.control-button.measure:hover:not(:disabled) {
    background: #2980b9;
    transform: translateY(-2px);
    box-shadow: 0 4px 8px rgba(52, 152, 219, 0.3);
}

.control-button.scan {
    background: #2ecc71;
    color: white;
}

.control-button.scan:hover:not(:disabled) {
    background: #27ae60;
    transform: translateY(-2px);
    box-shadow: 0 4px 8px rgba(46, 204, 113, 0.3);
}

.control-button.calibrate {
    background: #f39c12;
    color: white;
}

.control-button.calibrate:hover:not(:disabled) {
    background: #e67e22;
    transform: translateY(-2px);
    box-shadow: 0 4px 8px rgba(243, 156, 18, 0.3);
}

.control-button.reset {
    background: #e74c3c;
    color: white;
}

.control-button.reset:hover:not(:disabled) {
    background: #c0392b;
    transform: translateY(-2px);
    box-shadow: 0 4px 8px rgba(231, 76, 60, 0.3);
}

.deviation-section {
    background: white;
    padding: 20px;
    border-radius: 10px;
    margin-bottom: 25px;
    border: 2px solid #ffd700;
}

.deviation-section h4 {
    color: #f39c12;
    margin-bottom: 15px;
    font-size: 1.1rem;
}

.deviation-controls {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.checkbox-group {
    display: flex;
    align-items: center;
    gap: 10px;
}

.checkbox-group input[type="checkbox"] {
    width: 20px;
    height: 20px;
    cursor: pointer;
}

.checkbox-group label {
    font-size: 0.95rem;
    color: #2c3e50;
    cursor: pointer;
    margin: 0;
}

.formulas-section {
    background: linear-gradient(135deg, #f5f7fa 0%, #c3cfe2 100%);
    padding: 25px;
    border-radius: 10px;
    margin-bottom: 25px;
}

.formulas-section h3 {
    color: #2c3e50;
    margin-bottom: 20px;
    font-size: 1.2rem;
    font-weight: 600;
}

.formula-list {
    display: grid;
    gap: 15px;
    margin-bottom: 20px;
}

.formula-item {
    background: white;
    padding: 12px 15px;
    border-radius: 8px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.05);
}

.formula-label {
    font-weight: 600;
    color: #667eea;
    font-size: 0.9rem;
}

.formula {
    font-family: 'Courier New', monospace;
    color: #2c3e50;
    font-size: 1rem;
    font-weight: 600;
}

.calculated-values {
    display: flex;
    gap: 30px;
    background: white;
    padding: 15px 20px;
    border-radius: 8px;
    font-weight: 600;
    color: #2c3e50;
}

.calculated-values span:first-child {
    color: #667eea;
}

.explanation {
    background: #f8f9fa;
    padding: 30px;
    border-radius: 15px;
    margin-top: 30px;
}

.explanation h2 {
    color: #2c3e50;
    margin-bottom: 20px;
    font-size: 1.8rem;
}

.explanation h3 {
    color: #34495e;
    margin-top: 25px;
    margin-bottom: 15px;
    font-size: 1.3rem;
}

.explanation p {
    color: #555;
    line-height: 1.8;
    margin-bottom: 15px;
    font-size: 1rem;
}

.explanation ul {
    list-style: none;
    padding-left: 0;
}

.explanation li {
    color: #555;
    line-height: 1.8;
    margin-bottom: 12px;
    padding-left: 25px;
    position: relative;
    font-size: 1rem;
}

.explanation li:before {
    content: "▸";
    position: absolute;
    left: 0;
    color: #667eea;
    font-weight: bold;
}

.explanation strong {
    color: #2c3e50;
    font-weight: 600;
}

@media (max-width: 1024px) {
    .visualization-layout {
        grid-template-columns: 1fr;
    }

    .controls-grid {
        grid-template-columns: 1fr;
    }

    .button-group {
        flex-direction: column;
    }

    .calculated-values {
        flex-direction: column;
        gap: 10px;
    }
}

@media (max-width: 768px) {
    header h1 {
        font-size: 1.5rem;
    }

    .subtitle {
        font-size: 0.9rem;
    }

    .instrument-info {
        grid-template-columns: 1fr;
    }

    .explanation {
        padding: 20px;
    }

    .explanation h2 {
        font-size: 1.4rem;
    }
}
