/* CircuitForge - Enhanced PCB Design Styling */
@import url('https://fonts.googleapis.com/css2?family=Roboto+Mono:wght@400;500;700&family=Inter:wght@400;500;600&display=swap');

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

body {
    font-family: 'Inter', sans-serif;
    background: #1a1a1a;
    color: #ffffff;
    overflow: hidden;
}

#container {
    width: 100vw;
    height: 100vh;
    display: flex;
    flex-direction: column;
}

#header {
    background: linear-gradient(90deg, #2D5A27 0%, #1a4d1a 100%);
    padding: 10px 20px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 2px solid #B87333;
    box-shadow: 0 2px 10px rgba(0,0,0,0.3);
}

#title {
    font-family: 'Roboto Mono', monospace;
    font-size: 24px;
    font-weight: 700;
    color: #00FF00;
    text-shadow: 0 0 10px rgba(0,255,0,0.5);
    animation: titleGlow 2s ease-in-out infinite alternate;
}

@keyframes titleGlow {
    from { text-shadow: 0 0 10px rgba(0,255,0,0.5); }
    to { text-shadow: 0 0 20px rgba(0,255,0,0.8); }
}

#nav-tabs {
    display: flex;
    gap: 10px;
}

.nav-tab {
    background: rgba(255,255,255,0.1);
    border: 1px solid rgba(255,255,255,0.2);
    border-radius: 8px;
    padding: 8px 16px;
    color: white;
    cursor: pointer;
    transition: all 0.3s ease;
    font-family: 'Roboto Mono', monospace;
}

.nav-tab:hover {
    background: rgba(255,255,255,0.2);
}

.nav-tab.active {
    background: #B87333;
    border-color: #B87333;
    box-shadow: 0 0 15px rgba(184, 115, 51, 0.5);
}

#header-info {
    display: flex;
    align-items: center;
    gap: 20px;
}

#component-counter {
    background: rgba(0,0,0,0.3);
    padding: 5px 15px;
    border-radius: 15px;
    border: 1px solid #00FF00;
    font-family: 'Roboto Mono', monospace;
    color: #00FF00;
}

#high-voltage-badge {
    background: linear-gradient(45deg, #FF4444, #FF8800);
    padding: 5px 15px;
    border-radius: 15px;
    font-weight: bold;
    font-size: 12px;
    animation: warningBlink 1.5s ease-in-out infinite alternate;
}

@keyframes warningBlink {
    from { opacity: 0.8; }
    to { opacity: 1; }
}

#pwm-indicator {
    background: rgba(0,0,0,0.8);
    border-bottom: 1px solid #B87333;
    padding: 10px 20px;
    display: flex;
    align-items: center;
    gap: 20px;
}

#pwm-canvas {
    border: 1px solid #00FF00;
    border-radius: 5px;
    background: #000;
}

#pwm-readouts {
    display: flex;
    gap: 20px;
}

#pwm-readouts span {
    font-family: 'Roboto Mono', monospace;
    color: #00FF00;
    font-size: 12px;
}

#main-content {
    display: flex;
    flex: 1;
    overflow: hidden;
}

.panel {
    background: linear-gradient(180deg, rgba(45, 90, 39, 0.9) 0%, rgba(26, 77, 26, 0.9) 100%);
    border: 1px solid rgba(184, 115, 51, 0.5);
    backdrop-filter: blur(10px);
    overflow-y: auto;
}

#component-library {
    width: 280px;
    padding: 15px;
    border-right: 2px solid #B87333;
}

#component-library h3 {
    color: #B87333;
    margin-bottom: 15px;
    font-family: 'Roboto Mono', monospace;
}

.component-category {
    margin-bottom: 20px;
}

.component-category h4 {
    color: #FFA500;
    margin-bottom: 10px;
    font-size: 14px;
    border-bottom: 1px solid rgba(255, 165, 0, 0.3);
    padding-bottom: 5px;
}

.component-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(80px, 1fr));
    gap: 8px;
}

.component {
    background: rgba(112, 128, 144, 0.8);
    border: 1px solid #708090;
    border-radius: 8px;
    padding: 8px;
    text-align: center;
    cursor: grab;
    transition: all 0.3s ease;
    user-select: none;
}

.component:hover {
    background: rgba(184, 115, 51, 0.8);
    border-color: #B87333;
    transform: translateY(-2px);
    box-shadow: 0 4px 15px rgba(184, 115, 51, 0.3);
}

.component:active {
    cursor: grabbing;
}

.component-icon {
    font-size: 20px;
    margin-bottom: 5px;
}

.component span {
    font-size: 10px;
    display: block;
}

#circuit-canvas-container {
    flex: 1;
    position: relative;
    background: #1a4d1a;
}

#circuit-canvas {
    width: 100%;
    height: 100%;
    cursor: crosshair;
}

#swarm-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
}

#analysis-panel {
    width: 300px;
    padding: 15px;
    border-left: 2px solid #B87333;
}

#analysis-panel h3 {
    color: #B87333;
    margin-bottom: 15px;
    font-family: 'Roboto Mono', monospace;
}

.analysis-section {
    margin-bottom: 20px;
    padding: 15px;
    background: rgba(0,0,0,0.3);
    border-radius: 8px;
    border: 1px solid rgba(255,255,255,0.1);
}

.analysis-section h4 {
    color: #FFA500;
    margin-bottom: 10px;
    font-size: 14px;
}

.control-group {
    margin-bottom: 15px;
}

.control-group label {
    display: block;
    color: #ffffff;
    margin-bottom: 5px;
    font-size: 12px;
    font-family: 'Roboto Mono', monospace;
}

.slider {
    width: 100%;
    height: 6px;
    border-radius: 3px;
    background: rgba(255,255,255,0.2);
    outline: none;
    -webkit-appearance: none;
}

.slider::-webkit-slider-thumb {
    -webkit-appearance: none;
    width: 16px;
    height: 16px;
    border-radius: 50%;
    background: #B87333;
    cursor: pointer;
    box-shadow: 0 0 10px rgba(184, 115, 51, 0.5);
}

.readout {
    background: rgba(0,0,0,0.5);
    padding: 10px;
    border-radius: 5px;
    border-left: 3px solid #00FF00;
}

.readout div {
    font-family: 'Roboto Mono', monospace;
    font-size: 12px;
    margin-bottom: 5px;
    color: #00FF00;
}

.temp-indicator {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 10px;
}

.temp-value {
    font-family: 'Roboto Mono', monospace;
    font-weight: bold;
    color: #00FF00;
}

.analysis-btn {
    background: linear-gradient(45deg, #708090, #556B7D);
    border: 1px solid #708090;
    border-radius: 5px;
    color: white;
    padding: 8px 12px;
    cursor: pointer;
    font-size: 12px;
    transition: all 0.3s ease;
}

.analysis-btn:hover {
    background: linear-gradient(45deg, #B87333, #A0622C);
    border-color: #B87333;
}

.efficiency-display {
    background: rgba(0,0,0,0.5);
    padding: 10px;
    border-radius: 5px;
    border-left: 3px solid #FFA500;
}

.metric {
    display: flex;
    justify-content: space-between;
    margin-bottom: 5px;
    font-family: 'Roboto Mono', monospace;
    font-size: 12px;
    color: #FFA500;
}

.efficiency-value {
    font-weight: bold;
    color: #00FF00;
}

#safety-alerts {
    max-height: 150px;
    overflow-y: auto;
}

.alert {
    padding: 8px;
    border-radius: 5px;
    margin-bottom: 8px;
    font-size: 12px;
}

.alert.warning {
    background: rgba(255, 165, 0, 0.2);
    border-left: 3px solid #FFA500;
    color: #FFA500;
}

.alert.info {
    background: rgba(0, 255, 255, 0.2);
    border-left: 3px solid #00FFFF;
    color: #00FFFF;
}

#simulation-controls {
    background: linear-gradient(90deg, #2D5A27 0%, #1a4d1a 100%);
    border-top: 2px solid #B87333;
    padding: 15px 20px;
    display: flex;
    align-items: center;
    gap: 20px;
}

.control-btn {
    background: linear-gradient(45deg, #32CD32, #228B22);
    border: 1px solid #32CD32;
    border-radius: 8px;
    color: white;
    padding: 10px 20px;
    cursor: pointer;
    font-family: 'Roboto Mono', monospace;
    font-weight: 500;
    transition: all 0.3s ease;
    box-shadow: 0 4px 15px rgba(50, 205, 50, 0.3);
}

.control-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(50, 205, 50, 0.4);
}

.control-btn.primary {
    font-size: 16px;
    padding: 12px 24px;
}

.sim-control-group {
    display: flex;
    flex-direction: column;
    gap: 5px;
}

.sim-control-group label {
    color: #ffffff;
    font-size: 12px;
    font-family: 'Roboto Mono', monospace;
}

.sim-control-group select {
    background: rgba(0,0,0,0.5);
    border: 1px solid #B87333;
    border-radius: 5px;
    color: white;
    padding: 5px 10px;
    font-size: 12px;
}

/* Responsive Design */
@media (max-width: 1200px) {
    #component-library {
        width: 240px;
    }
    
    #analysis-panel {
        width: 260px;
    }
}

@media (max-width: 768px) {
    #header {
        padding: 8px 15px;
    }
    
    #title {
        font-size: 18px;
    }
    
    #nav-tabs {
        gap: 5px;
    }
    
    .nav-tab {
        padding: 6px 12px;
        font-size: 12px;
    }
    
    #component-library,
    #analysis-panel {
        width: 200px;
    }
    
    #simulation-controls {
        padding: 10px 15px;
        gap: 15px;
        flex-wrap: wrap;
    }
    
    .control-btn.primary {
        font-size: 14px;
        padding: 10px 20px;
    }
}

/* Accessibility */
@media (prefers-reduced-motion: reduce) {
    * {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
}

/* Custom scrollbar */
::-webkit-scrollbar {
    width: 8px;
}

::-webkit-scrollbar-track {
    background: rgba(0,0,0,0.3);
    border-radius: 4px;
}

::-webkit-scrollbar-thumb {
    background: rgba(184, 115, 51, 0.6);
    border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
    background: rgba(184, 115, 51, 0.8);
}