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

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    min-height: 100vh;
    color: #333;
}

.header {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    padding: 1rem 0;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
}

.header-container {
    max-width: 1400px;
    margin: 0 auto;
    padding: 0 2rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.header-left {
    display: flex;
    align-items: center;
}

.logo-link {
    text-decoration: none;
    color: white;
}

.logo {
    font-size: 1.8rem;
    font-weight: bold;
    background: linear-gradient(135deg, #fff 0%, #f0f0f0 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.header-nav {
    display: flex;
    gap: 2rem;
}

.nav-link {
    text-decoration: none;
    color: white;
    font-weight: 500;
    transition: color 0.3s;
}

.nav-link:hover {
    color: #f0f0f0;
}

.nav-link.active {
    color: #f0f0f0;
    border-bottom: 2px solid #f0f0f0;
}

.main-container {
    max-width: 1400px;
    margin: 2rem auto;
    padding: 0 2rem;
    width: 100%;
    box-sizing: border-box;
}

.experiment-container {
    background: rgba(255, 255, 255, 0.95);
    border-radius: 20px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.1);
    padding: 2rem;
}

.experiment-title {
    font-size: 2.5rem;
    color: #667eea;
    margin-bottom: 0.5rem;
    text-align: center;
}

.experiment-subtitle {
    text-align: center;
    color: #666;
    margin-bottom: 2rem;
    font-size: 1.1rem;
}

.experiment-tabs {
    display: flex;
    gap: 1rem;
    margin-bottom: 2rem;
    flex-wrap: wrap;
    justify-content: center;
}

.tab-btn {
    padding: 0.75rem 1.5rem;
    border: none;
    background: #f0f0f0;
    color: #555;
    border-radius: 10px;
    cursor: pointer;
    font-size: 1rem;
    font-weight: 500;
    transition: all 0.3s;
}

.tab-btn:hover {
    background: #e0e0e0;
}

.tab-btn.active {
    background: #667eea;
    color: white;
}

.tab-content {
    display: none;
}

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

.experiment-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 2rem;
    flex-wrap: wrap;
    gap: 1rem;
}

.experiment-header h2 {
    color: #333;
    font-size: 1.8rem;
}

.experiment-select {
    padding: 0.5rem 1rem;
    border: 2px solid #667eea;
    border-radius: 8px;
    font-size: 1rem;
    background: white;
    cursor: pointer;
}

.experiment-workspace {
    display: grid;
    grid-template-columns: 1fr 300px 250px;
    gap: 2rem;
    margin-top: 2rem;
}

.canvas-container {
    background: #f8f9fa;
    border-radius: 15px;
    padding: 1rem;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
}

canvas {
    width: 100%;
    height: auto;
    border-radius: 10px;
    background: white;
}

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

.controls-panel h3,
.data-panel h3 {
    color: #667eea;
    margin-bottom: 1.5rem;
    font-size: 1.3rem;
}

.control-group {
    margin-bottom: 1.5rem;
}

.control-group label {
    display: block;
    margin-bottom: 0.5rem;
    color: #555;
    font-weight: 500;
}

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

.control-group input[type="range"]::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 20px;
    height: 20px;
    border-radius: 50%;
    background: #667eea;
    cursor: pointer;
}

.control-group input[type="range"]::-moz-range-thumb {
    width: 20px;
    height: 20px;
    border-radius: 50%;
    background: #667eea;
    cursor: pointer;
    border: none;
}

.control-value {
    display: inline-block;
    margin-left: 0.5rem;
    padding: 0.25rem 0.75rem;
    background: #667eea;
    color: white;
    border-radius: 5px;
    font-weight: bold;
    min-width: 50px;
    text-align: center;
}

.button-group {
    display: flex;
    gap: 1rem;
    margin-top: 2rem;
}

.btn {
    flex: 1;
    padding: 0.75rem 1.5rem;
    border: none;
    border-radius: 8px;
    font-size: 1rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.3s;
}

.btn-primary {
    background: #667eea;
    color: white;
}

.btn-primary:hover {
    background: #5568d3;
    transform: translateY(-2px);
    box-shadow: 0 4px 8px rgba(102, 126, 234, 0.3);
}

.btn-secondary {
    background: #f0f0f0;
    color: #555;
}

.btn-secondary:hover {
    background: #e0e0e0;
    transform: translateY(-2px);
}

.data-grid {
    display: grid;
    gap: 1rem;
}

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

.data-label {
    font-weight: 500;
    color: #555;
}

.data-value {
    font-weight: bold;
    color: #667eea;
}

.footer {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    padding: 1.5rem 0;
    text-align: center;
    margin-top: 2rem;
}

.footer-content {
    max-width: 1400px;
    margin: 0 auto;
    padding: 0 2rem;
}

.footer-content p {
    color: white;
}

@media (max-width: 1200px) {
    .experiment-workspace {
        grid-template-columns: 1fr 300px;
    }
    
    .data-panel {
        grid-column: 1 / -1;
    }
}

@media (max-width: 768px) {
    .header-container {
        flex-direction: column;
        gap: 1rem;
    }
    
    .experiment-workspace {
        grid-template-columns: 1fr;
    }
    
    .experiment-title {
        font-size: 1.8rem;
    }
    
    .experiment-tabs {
        flex-direction: column;
    }
    
    .experiment-header {
        flex-direction: column;
        align-items: flex-start;
    }
}

.circuit-simulator {
    display: grid;
    grid-template-columns: 280px 1fr 280px;
    gap: 1rem;
    margin-top: 1rem;
    max-width: 100%;
    overflow: hidden;
}

.component-panel {
    background: white;
    border-radius: 10px;
    padding: 1.5rem;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
    max-height: 700px;
    overflow-y: auto;
}

.component-panel h3 {
    margin-bottom: 1rem;
    color: #333;
    font-size: 1.2rem;
}

.component-categories {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.component-category h4 {
    margin-bottom: 0.5rem;
    color: #555;
    font-size: 1rem;
    font-weight: 600;
}

.component-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 0.5rem;
}

.component-item {
    background: #f8f9fa;
    border: 2px solid #e9ecef;
    border-radius: 8px;
    padding: 0.75rem;
    text-align: center;
    cursor: grab;
    transition: all 0.2s ease;
    user-select: none;
}

.component-item:hover {
    background: #e9ecef;
    border-color: #667eea;
    transform: translateY(-2px);
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.component-item:active {
    cursor: grabbing;
}

.component-item[data-is-dragging="true"] {
    opacity: 0.5;
    transform: scale(0.95);
}

.component-icon {
    font-size: 1.5rem;
    margin-bottom: 0.25rem;
}

.component-name {
    font-size: 0.75rem;
    color: #555;
    font-weight: 500;
}

@media (hover: none) {
    .component-item {
        cursor: pointer;
    }
    
    .component-item:active {
        opacity: 0.7;
        transform: scale(0.95);
    }
}

.circuit-workspace {
    background: white;
    border-radius: 10px;
    padding: 1rem;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
}

.workspace-toolbar {
    display: flex;
    gap: 0.5rem;
    margin-bottom: 1rem;
    flex-wrap: wrap;
}

.tool-btn {
    padding: 0.5rem 1rem;
    border: 2px solid #e9ecef;
    background: white;
    border-radius: 6px;
    cursor: pointer;
    font-weight: 500;
    transition: all 0.2s ease;
}

.tool-btn:hover {
    background: #f8f9fa;
    border-color: #667eea;
}

.tool-btn.active {
    background: #667eea;
    color: white;
    border-color: #667eea;
}

.action-btn {
    padding: 0.5rem 1rem;
    background: #667eea;
    color: white;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    font-weight: 500;
    transition: all 0.2s ease;
}

.action-btn:hover {
    background: #5568d3;
    transform: translateY(-1px);
}

.canvas-wrapper {
    border: 2px dashed #e9ecef;
    border-radius: 8px;
    overflow: hidden;
    background: #fafafa;
    max-width: 100%;
    box-sizing: border-box;
}

#circuit-canvas {
    display: block;
    cursor: crosshair;
    width: 900px;
    height: 500px;
    max-width: 100%;
    box-sizing: border-box;
}

.properties-panel {
    background: white;
    border-radius: 10px;
    padding: 1.5rem;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
    max-height: 700px;
    overflow-y: auto;
    max-width: 100%;
    box-sizing: border-box;
}

.properties-panel h3 {
    margin-bottom: 1rem;
    color: #333;
    font-size: 1.2rem;
}

.no-selection {
    color: #999;
    text-align: center;
    padding: 2rem 0;
}

.property-group {
    margin-bottom: 1rem;
}

.property-group label {
    display: block;
    margin-bottom: 0.5rem;
    color: #555;
    font-weight: 500;
}

.property-group input[type="number"],
.property-group input[type="text"],
.property-group select {
    width: 100%;
    padding: 0.5rem;
    border: 1px solid #e9ecef;
    border-radius: 4px;
    font-size: 0.9rem;
}

.property-group input:focus,
.property-group select:focus {
    outline: none;
    border-color: #667eea;
}

.simulation-results {
    background: white;
    border-radius: 10px;
    padding: 1.5rem;
    margin-top: 1rem;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
}

.simulation-results h3 {
    margin-bottom: 1rem;
    color: #333;
    font-size: 1.2rem;
}

.results-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 1rem;
}

.result-item {
    background: #f8f9fa;
    padding: 1rem;
    border-radius: 8px;
    text-align: center;
}

.result-label {
    display: block;
    color: #555;
    font-size: 0.9rem;
    margin-bottom: 0.5rem;
}

.result-value {
    display: block;
    color: #667eea;
    font-size: 1.5rem;
    font-weight: bold;
}

@media (max-width: 1200px) {
    .circuit-simulator {
        grid-template-columns: 1fr 280px;
    }
    
    .component-panel {
        grid-column: 2;
    }
    
    .circuit-workspace {
        grid-column: 1;
    }
    
    .properties-panel {
        grid-column: 1 / -1;
    }
}

@media (max-width: 768px) {
    .circuit-simulator {
        grid-template-columns: 1fr;
    }
    
    .component-panel,
    .circuit-workspace,
    .properties-panel {
        grid-column: 1;
    }
    
    .results-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}