/* CircuPlay - Retro 8-bit Pixel Styling */

/* Import pixel font */
@import url('https://fonts.googleapis.com/css2?family=Press+Start+2P&display=swap');

/* CSS Reset and Base Styles */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Press Start 2P', monospace;
    font-size: 12px;
    background-color: #0d1b0f; /* Dark green PCB background */
    color: #eee;
    line-height: 1.4;
    image-rendering: pixelated;
    image-rendering: -moz-crisp-edges;
    image-rendering: crisp-edges;
}

/* App Layout */
#app {
    display: flex;
    flex-direction: column;
    height: 100vh;
    max-height: 100vh;
    overflow: hidden;
}

/* Header */
.header {
    background: linear-gradient(135deg, #16213e, #0f3460);
    border-bottom: 3px solid #533a7b;
    padding: 10px 20px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
}

.title {
    font-size: 16px;
    color: #4cc9f0;
    text-shadow: 2px 2px 0px #1a1a2e;
    letter-spacing: 2px;
}

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

/* Pixel Button Styling */
.btn {
    font-family: 'Press Start 2P', monospace;
    font-size: 10px;
    border: none;
    cursor: pointer;
    transition: all 0.1s ease;
}

.pixel-btn {
    background: linear-gradient(135deg, #4cc9f0, #7209b7);
    color: #fff;
    padding: 8px 16px;
    border: 2px solid #533a7b;
    border-radius: 0;
    box-shadow: 
        2px 2px 0px #1a1a2e,
        inset 1px 1px 0px rgba(255, 255, 255, 0.3);
}

.pixel-btn:hover {
    background: linear-gradient(135deg, #7209b7, #4cc9f0);
    transform: translate(1px, 1px);
    box-shadow: 
        1px 1px 0px #1a1a2e,
        inset 1px 1px 0px rgba(255, 255, 255, 0.3);
}

.pixel-btn:active {
    transform: translate(2px, 2px);
    box-shadow: none;
}

/* Zoom Controls */
.zoom-controls {
    display: flex;
    align-items: center;
    gap: 5px;
    margin-left: 10px;
    padding-left: 10px;
    border-left: 2px solid #533a7b;
}

.zoom-btn {
    padding: 6px 10px;
    font-size: 8px;
    min-width: 30px;
}

.zoom-display {
    background: #16213e;
    border: 2px solid #533a7b;
    padding: 6px 10px;
    min-width: 50px;
    text-align: center;
    font-size: 8px;
    color: #4cc9f0;
    border-radius: 0;
    font-family: 'Press Start 2P', monospace;
}

/* Audio Controls */
.audio-controls {
    display: flex;
    align-items: center;
    gap: 5px;
    margin-left: 10px;
    padding-left: 10px;
    border-left: 2px solid #533a7b;
}

.audio-btn {
    padding: 6px 10px;
    font-size: 8px;
    min-width: 35px;
}

.audio-btn.muted {
    background: linear-gradient(135deg, #ff6b6b, #cc0000);
}

.volume-slider {
    width: 60px;
    height: 20px;
    background: #16213e;
    border: 2px solid #533a7b;
    border-radius: 0;
    outline: none;
    cursor: pointer;
}

.volume-slider::-webkit-slider-thumb {
    appearance: none;
    width: 16px;
    height: 16px;
    background: #4cc9f0;
    border: 2px solid #533a7b;
    border-radius: 0;
    cursor: pointer;
}

.volume-slider::-moz-range-thumb {
    width: 12px;
    height: 12px;
    background: #4cc9f0;
    border: 2px solid #533a7b;
    border-radius: 0;
    cursor: pointer;
}

/* Main Content Layout */
.main-content {
    display: flex;
    flex: 1;
    overflow: hidden;
}

/* Component Toolbar */
.toolbar {
    width: 250px;
    background: linear-gradient(135deg, #0f3460, #16213e);
    border-right: 3px solid #533a7b;
    padding: 20px;
    overflow-y: auto;
    box-shadow: 2px 0 8px rgba(0, 0, 0, 0.3);
}

.toolbar h3 {
    color: #4cc9f0;
    margin-bottom: 15px;
    font-size: 12px;
    text-align: center;
    text-shadow: 1px 1px 0px #1a1a2e;
}

/* Component Palette */
.component-palette {
    display: flex;
    flex-direction: column;
    gap: 10px;
    margin-bottom: 30px;
}

.component-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px;
    background: linear-gradient(135deg, #16213e, #0f3460);
    border: 2px solid #533a7b;
    border-radius: 0;
    cursor: move;
    transition: all 0.1s ease;
    user-select: none;
}

.component-item:hover {
    background: linear-gradient(135deg, #533a7b, #7209b7);
    transform: translateY(-1px);
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.3);
}

.component-item:active {
    transform: translateY(0px);
}

.component-item span {
    font-size: 10px;
    color: #eee;
}

/* Component Icons (pixel art style) */
.component-icon {
    width: 24px;
    height: 24px;
    background-size: contain;
    background-repeat: no-repeat;
    background-position: center;
    image-rendering: pixelated;
    border: 1px solid #533a7b;
}

/* Starter Circuits */
.starter-circuits {
    border-top: 2px solid #533a7b;
    padding-top: 20px;
}

.starter-circuits .btn {
    width: 100%;
    margin-bottom: 10px;
    font-size: 9px;
}

/* Canvas Container */
.canvas-container {
    flex: 1;
    position: relative;
    background: 
        linear-gradient(90deg, rgba(74, 124, 89, 0.2) 1px, transparent 1px),
        linear-gradient(rgba(74, 124, 89, 0.2) 1px, transparent 1px);
    background-size: 20px 20px;
    background-color: #0a1e0c; /* Dark green PCB background */
    overflow: hidden;
}

#circuitCanvas {
    display: block;
    width: 100%;
    height: 100%;
    cursor: crosshair;
    image-rendering: pixelated;
}

.grid-overlay {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    pointer-events: none;
    background-image: 
        linear-gradient(rgba(135, 206, 137, 0.15) 1px, transparent 1px),
        linear-gradient(90deg, rgba(135, 206, 137, 0.15) 1px, transparent 1px);
    background-size: 20px 20px;
}

/* Info Panel */
.info-panel {
    background: linear-gradient(135deg, #16213e, #0f3460);
    border-top: 3px solid #533a7b;
    padding: 10px 20px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 10px;
    color: #4cc9f0;
}

/* Responsive Design */
@media (max-width: 768px) {
    .main-content {
        flex-direction: column;
    }
    
    .toolbar {
        width: 100%;
        height: 150px;
        order: 2;
    }
    
    .component-palette {
        flex-direction: row;
        flex-wrap: wrap;
        gap: 5px;
    }
    
    .component-item {
        flex: 1;
        min-width: 80px;
        flex-direction: column;
        padding: 5px;
        font-size: 8px;
    }
    
    .canvas-container {
        order: 1;
    }
    
    .controls {
        flex-wrap: wrap;
        gap: 5px;
    }
    
    .pixel-btn {
        padding: 6px 12px;
        font-size: 8px;
    }
}

/* Drag and Drop Styles */
.component-item.dragging {
    opacity: 0.5;
    transform: rotate(5deg);
}

.canvas-container.drag-over {
    background-color: rgba(76, 201, 240, 0.1);
}

/* Animation Utilities */
@keyframes pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.5; }
}

@keyframes glow {
    0%, 100% { 
        box-shadow: 0 0 5px rgba(76, 201, 240, 0.5);
    }
    50% { 
        box-shadow: 0 0 20px rgba(76, 201, 240, 0.8);
    }
}

.pulsing {
    animation: pulse 1s infinite;
}

.glowing {
    animation: glow 2s infinite;
}

/* Scrollbar Styling */
::-webkit-scrollbar {
    width: 12px;
}

::-webkit-scrollbar-track {
    background: #0f0f23;
}

::-webkit-scrollbar-thumb {
    background: linear-gradient(135deg, #4cc9f0, #7209b7);
    border-radius: 0;
}

::-webkit-scrollbar-thumb:hover {
    background: linear-gradient(135deg, #7209b7, #4cc9f0);
}

/* Navigation Controls */
.navigation-controls {
    position: absolute;
    bottom: 20px;
    right: 20px;
    display: grid;
    grid-template-columns: 1fr 1fr 1fr;
    grid-template-rows: 1fr 1fr 1fr;
    gap: 2px;
    z-index: 1000;
}

.nav-btn {
    background: #16213e;
    border: 2px solid #533a7b;
    color: #4cc9f0;
    font-family: 'Press Start 2P', monospace;
    font-size: 10px;
    width: 32px;
    height: 32px;
    cursor: pointer;
    transition: all 0.1s ease;
    display: flex;
    align-items: center;
    justify-content: center;
}

.nav-btn:hover {
    background: #533a7b;
    border-color: #4cc9f0;
    transform: scale(1.1);
}

.nav-btn:active {
    transform: scale(0.95);
    background: #4cc9f0;
    color: #16213e;
}

.nav-up {
    grid-column: 2;
    grid-row: 1;
}

.nav-left {
    grid-column: 1;
    grid-row: 2;
}

.nav-center {
    grid-column: 2;
    grid-row: 2;
}

.nav-right {
    grid-column: 3;
    grid-row: 2;
}

.nav-down {
    grid-column: 2;
    grid-row: 3;
}