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

body {
    font-family: 'Space Mono', monospace;
    background: #0a0a0a;
    color: #ffffff;
    overflow-x: hidden;
}

#app {
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

header {
    background: #111;
    padding: 1rem 2rem;
    border-bottom: 1px solid #333;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

header h1 {
    font-size: 1.5rem;
    font-weight: 700;
    background: linear-gradient(45deg, #00ff88, #0088ff);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.mode-selector {
    display: flex;
    gap: 0.5rem;
}

.mode-btn {
    padding: 0.5rem 1rem;
    background: transparent;
    border: 1px solid #333;
    color: #888;
    cursor: pointer;
    transition: all 0.3s ease;
    font-family: inherit;
}

.mode-btn.active {
    background: #00ff88;
    color: #000;
    border-color: #00ff88;
}

.mode-btn:hover:not(.active) {
    border-color: #555;
    color: #fff;
}

main {
    flex: 1;
    padding: 2rem;
}

.section {
    display: none;
}

.section.active {
    display: block;
}

/* Builder Section */
.builder-container {
    display: grid;
    grid-template-columns: 1fr 300px;
    gap: 2rem;
    margin-bottom: 2rem;
}

.pc-viewport {
    background: #111;
    border-radius: 8px;
    padding: 2rem;
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 400px;
}

.pc-case {
    width: 300px;
    height: 500px;
    background: linear-gradient(145deg, #1a1a1a, #0f0f0f);
    border: 2px solid #333;
    border-radius: 8px;
    position: relative;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.5);
}

.case-interior {
    padding: 1rem;
    height: 100%;
}

.component-slots {
    height: 100%;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.motherboard-slot {
    height: 120px;
    border: 2px dashed #444;
    border-radius: 4px;
    position: relative;
    transition: all 0.3s ease;
    padding: 0.5rem;
}

.cpu-socket {
    position: absolute;
    top: 30px;
    right: 10px;
    width: 40px;
    height: 40px;
    border: 2px dashed #666;
    border-radius: 4px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s ease;
}

.cpu-socket .slot-label {
    font-size: 0.6rem;
    text-align: center;
}

.expansion-slots {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.gpu-slot, .tpu-slot, .audio-slot {
    height: 40px;
    border: 2px dashed #444;
    border-radius: 4px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s ease;
}

.memory-slots {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.ram-slot {
    height: 30px;
    border: 2px dashed #444;
    border-radius: 4px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s ease;
}

.storage-bay {
    height: 50px;
    border: 2px dashed #444;
    border-radius: 4px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s ease;
}

.component-slots .slot-label {
    color: #666;
    font-size: 0.7rem;
    pointer-events: none;
    text-align: center;
}

[class*="-slot"]:hover, [class*="-slot"].drag-over {
    border-color: #00ff88;
    background: rgba(0, 255, 136, 0.1);
    animation: slot-glow 1s ease-in-out infinite alternate;
}

@keyframes slot-glow {
    from { box-shadow: 0 0 5px rgba(0, 255, 136, 0.3); }
    to { box-shadow: 0 0 15px rgba(0, 255, 136, 0.6); }
}

[class*="-slot"].filled {
    border: 2px solid #00ff88;
    background: rgba(0, 255, 136, 0.2);
}

[class*="-slot"].filled .slot-label {
    display: none;
}

.motherboard {
    width: 90%;
    height: 90%;
    background: linear-gradient(45deg, #2a5a2a, #1a4a1a);
    border-radius: 4px;
    position: relative;
    border: 1px solid #00ff88;
}

.motherboard::before {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 80%;
    height: 80%;
    background: repeating-linear-gradient(
        45deg,
        transparent,
        transparent 2px,
        rgba(0, 255, 136, 0.1) 2px,
        rgba(0, 255, 136, 0.1) 4px
    );
    border-radius: 2px;
}

.components-panel {
    background: #111;
    border-radius: 8px;
    padding: 1.5rem;
    height: fit-content;
}

.components-panel h3 {
    margin-bottom: 1rem;
    color: #00ff88;
}

.component-category h4 {
    color: #ccc;
    margin-bottom: 0.5rem;
    font-size: 0.9rem;
}

.component-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 0.5rem;
}

.component-item {
    background: #1a1a1a;
    border: 1px solid #333;
    border-radius: 4px;
    padding: 0.5rem;
    cursor: grab;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    position: relative;
}

.component-item:hover {
    border-color: #00ff88;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 255, 136, 0.2);
}

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

.component-item.click-to-install {
    animation: pulse 2s infinite;
}

@keyframes pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.7; }
}

.component-item::after {
    content: '+ Click to install';
    position: absolute;
    top: -25px;
    left: 50%;
    transform: translateX(-50%);
    background: rgba(0, 255, 136, 0.9);
    color: #000;
    padding: 2px 6px;
    border-radius: 3px;
    font-size: 0.7rem;
    white-space: nowrap;
    opacity: 0;
    transition: opacity 0.3s ease;
    pointer-events: none;
}

.component-item:hover::after {
    opacity: 1;
}

.component-item.dragging {
    opacity: 0.5;
    cursor: grabbing;
}

.component-item img {
    width: 40px;
    height: 30px;
    object-fit: cover;
    border-radius: 2px;
}

.component-item span {
    font-size: 0.8rem;
    color: #ccc;
}

.build-status {
    background: #111;
    border-radius: 8px;
    padding: 1.5rem;
}

.component-status {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    margin-bottom: 1rem;
}

.status-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 0.9rem;
}

.component-name {
    color: #ccc;
}

.status-indicator {
    font-size: 1rem;
}

.system-monitor {
    background: #1a1a1a;
    padding: 1rem;
    border-bottom: 1px solid #333;
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 1rem;
}

.monitor-item {
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
    font-size: 0.8rem;
}

.progress-bar {
    width: 100%;
    height: 8px;
    background: #333;
    border-radius: 4px;
    overflow: hidden;
}

.progress-fill {
    height: 100%;
    background: linear-gradient(90deg, #00ff88, #0088ff);
    width: 0%;
    transition: width 0.3s ease;
}

#build-info {
    margin-bottom: 1rem;
    color: #ccc;
    font-size: 0.9rem;
}

.activate-btn {
    width: 100%;
    padding: 0.75rem;
    background: #00ff88;
    color: #000;
    border: none;
    border-radius: 4px;
    font-family: inherit;
    font-weight: 700;
    cursor: pointer;
    transition: all 0.3s ease;
}

.activate-btn:disabled {
    background: #333;
    color: #666;
    cursor: not-allowed;
}

.activate-btn:not(:disabled):hover {
    background: #00dd77;
    transform: translateY(-2px);
}

.overclock-control {
    background: #1a1a1a;
    padding: 1rem;
    border: 1px solid #333;
    border-radius: 8px;
    margin-bottom: 1rem;
}

.overclock-control h4 {
    color: #00ff88;
    margin-bottom: 0.5rem;
    font-size: 0.9rem;
}

.overclock-slider {
    width: 100%;
    height: 6px;
    border-radius: 3px;
    background: #333;
    outline: none;
    -webkit-appearance: none;
    margin-bottom: 0.5rem;
}

.overclock-slider::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 16px;
    height: 16px;
    border-radius: 50%;
    background: #00ff88;
    cursor: pointer;
    box-shadow: 0 0 4px rgba(0, 255, 136, 0.5);
}

.overclock-slider::-moz-range-thumb {
    width: 16px;
    height: 16px;
    border-radius: 50%;
    background: #00ff88;
    cursor: pointer;
    border: none;
    box-shadow: 0 0 4px rgba(0, 255, 136, 0.5);
}

.overclock-info {
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 0.8rem;
    color: #ccc;
}

.overclock-percentage {
    color: #00ff88;
    font-weight: bold;
}

/* Chat Section */
.chat-container {
    max-width: 800px;
    margin: 0 auto;
    background: #111;
    border-radius: 8px;
    overflow: hidden;
    height: 600px;
    display: flex;
    flex-direction: column;
}

.chat-header {
    background: #1a1a1a;
    padding: 1rem;
    border-bottom: 1px solid #333;
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 1rem;
}

.pc-status {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.status-indicator {
    width: 12px;
    height: 12px;
    border-radius: 50%;
    background: #666;
    transition: all 0.3s ease;
}

.status-indicator.online {
    background: #00ff88;
    box-shadow: 0 0 10px rgba(0, 255, 136, 0.5);
}

.pc-name {
    color: #00ff88;
    font-weight: 700;
}

.research-toggle {
    display: flex;
    align-items: center;
}

.toggle-switch {
    position: relative;
    display: inline-block;
    width: 160px;
    height: 34px;
    cursor: pointer;
}

.toggle-switch input {
    opacity: 0;
    width: 0;
    height: 0;
}

.slider {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: #333;
    transition: .4s;
    border-radius: 34px;
    display: flex;
    align-items: center;
    justify-content: center;
    border: 1px solid #555;
}

.slider:before {
    position: absolute;
    content: "";
    height: 26px;
    width: 26px;
    left: 4px;
    bottom: 3px;
    background-color: #666;
    transition: .4s;
    border-radius: 50%;
}

input:checked + .slider {
    background: linear-gradient(45deg, #00ff88, #0088ff);
    border-color: #00ff88;
}

input:checked + .slider:before {
    transform: translateX(126px);
    background-color: #fff;
}

.toggle-text {
    color: #fff;
    font-size: 0.8rem;
    font-weight: 700;
    z-index: 1;
}

.chat-messages {
    flex: 1;
    padding: 1rem;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.message {
    max-width: 70%;
    padding: 0.75rem 1rem;
    border-radius: 8px;
    font-size: 0.9rem;
    line-height: 1.4;
}

.message.user {
    align-self: flex-end;
    background: #00ff88;
    color: #000;
}

.message.ai {
    align-self: flex-start;
    background: #1a1a1a;
    color: #fff;
    border: 1px solid #333;
}

.system-message {
    text-align: center;
    color: #666;
    font-style: italic;
    padding: 1rem;
}

.chat-input-container {
    padding: 1rem;
    border-top: 1px solid #333;
    display: flex;
    gap: 0.5rem;
}

#chat-input {
    flex: 1;
    padding: 0.75rem;
    background: #1a1a1a;
    border: 1px solid #333;
    border-radius: 4px;
    color: #fff;
    font-family: inherit;
}

#chat-input:focus {
    outline: none;
    border-color: #00ff88;
}

#chat-input:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

#send-btn {
    padding: 0.75rem 1.5rem;
    background: #00ff88;
    color: #000;
    border: none;
    border-radius: 4px;
    font-family: inherit;
    font-weight: 700;
    cursor: pointer;
    transition: all 0.3s ease;
}

#send-btn:disabled {
    background: #333;
    color: #666;
    cursor: not-allowed;
}

#send-btn:not(:disabled):hover {
    background: #00dd77;
}

#tts-btn {
    padding: 0.75rem;
    background: #333;
    color: #fff;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    transition: all 0.3s ease;
}

#tts-btn:not(:disabled):hover {
    background: #555;
}

#tts-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

#image-btn {
    padding: 0.75rem;
    background: #333;
    color: #fff;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    transition: all 0.3s ease;
}

#image-btn:not(:disabled):hover {
    background: #555;
}

#image-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.image-message {
    max-width: 300px;
    border-radius: 8px;
    margin-bottom: 0.5rem;
}

@media (max-width: 768px) {
    .builder-container {
        grid-template-columns: 1fr;
    }
    
    header {
        padding: 1rem;
        flex-direction: column;
        gap: 1rem;
    }
    
    main {
        padding: 1rem;
    }
}