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

body {
  min-height: 100vh;
  width: 100%;
  margin: 0;
  overflow: hidden;
  font-family: Arial, Helvetica, sans-serif;
  background-color: #F4F5F6;
}

.container {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  display: flex;
  flex-direction: row;
  background-color: #F4F5F6;
}

.if-vid {
  flex: 1;
  /* padding: 8px; */
  overflow: auto;
  display: flex;
  flex-direction: column;
  align-items: center;
}

.p-head {
  font-family: Arial, Helvetica, sans-serif;
  font-weight: 600;
  letter-spacing: 0.5px;
  margin-bottom: 20px;
  font-size: 18px;
  color: #333;
  margin-left: -500px;
  margin-top: 16px;
}
/* Workbench Area */
.workbench {
    position: relative;
    flex: 1;
    width: 100%;
    overflow: hidden;
    z-index: 10;
    background: #f4f5f6;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
}

.interfacing {
    position: relative;
    display: inline-block;
    width: 100%;
    max-width: 700px;
    margin: 0 auto;
    
}

#circuitImg {
    width: 70%;
    height: auto;
    margin-top: 70px;
    
    display: block;
    transition: all 0.3s ease;    pointer-events: none;
    user-select: none;
    -webkit-user-drag: none;
    -moz-user-select: none;
    -webkit-user-select: none;
    -ms-user-select: none;}
    

/* Hidden PIR Sensor for detection */
.pir-sensor-hidden {
    position: absolute;
    top: 29%;
    left: 62%;
    width: 60px;
    height: 60px;
    pointer-events: none;
}

.detection-zone {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 300px;
    height: 300px;
    border-radius: 50%;
    border: 2px dashed rgba(34, 197, 94, 0.5);
    pointer-events: none;
    opacity: 0;
    transition: opacity 0.5s;
    background: rgba(34, 197, 94, 0.05);
}

.detection-zone.active {
    opacity: 1;
    border-color: rgba(34, 197, 94, 0.8);
}

/* Draggable Person */
.draggable-person {
    position: absolute;
    top: 50%;
    left: 50%;
    z-index: 50;
    cursor: grab;
    touch-action: none;
    user-select: none;
}

.draggable-person:active {
    cursor: grabbing;
}

.draggable-person:hover .person-icon {
    transform: scale(1.1);
}

.draggable-person:active .person-icon {
    transform: scale(1.2);
}

.draggable-person:active .person-shadow {
    transform: translate(-50%, 0) scale(0.75);
    opacity: 0.4;
}

.person-content {
    position: relative;
}

.person-shadow {
    position: absolute;
    top: 100%;
    left: 50%;
    transform: translateX(-50%);
    width: 48px;
    height: 16px;
    background: rgba(0, 0, 0, 0.2);
    filter: blur(4px);
    border-radius: 50%;
    transition: all 0.2s;
}

.person-icon {
    width: 64px;
    height: 64px;
    background: linear-gradient(to bottom right, #374151, #111827);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.1);
    border: 2px solid #4b5563;
    color: white;
    position: relative;
    overflow: hidden;
    transition: transform 0.2s;
}

.person-icon::before {
    content: '';
    position: absolute;
    inset: 0;
    background: linear-gradient(to top, rgba(0,0,0,0.4), transparent);
}

.person-label {
    position: absolute;
    top: -32px;
    left: 50%;
    transform: translateX(-50%);
    background: rgba(255, 255, 255, 0.9);
    padding: 2px 8px;
    border-radius: 4px;
    font-size: 12px;
    font-weight: bold;
    color: #1f2937;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.05);
    white-space: nowrap;
    pointer-events: none;
}

/* Right Panel */
.right-panel {
    width: 650px;
    display: flex;
    flex-direction: column;
    background-color: #ffffff;
    border-left: 1px solid #e0e0e0;
    overflow: hidden;
}

.instruction-box {
    flex: 0 0 50%;
    display: flex;
    flex-direction: column;
    border-bottom: 1px solid #e0e0e0;
    overflow: hidden;
}

.box-title {
    padding: 15px 20px;
    background-color: #f8f9fa;
    border-bottom: 1px solid #e0e0e0;
    font-size: 16px;
    font-weight: 600;
    color: #333;
    margin: 0;
    flex-shrink: 0;
}

.instruction-content {
    flex: 1;
    overflow-y: auto;
    padding: 20px;
    font-size: 14px;
    line-height: 1.6;
    color: #555;
}

.instruction-content::-webkit-scrollbar {
    width: 8px;
}

.instruction-content::-webkit-scrollbar-track {
    background: #f1f1f1;
}

.instruction-content::-webkit-scrollbar-thumb {
    background: #888;
    border-radius: 4px;
}

.instruction-content::-webkit-scrollbar-thumb:hover {
    background: #555;
}

.instruction-section {
    margin-bottom: 20px;
}

.instruction-section:last-child {
    margin-bottom: 0;
}

.instruction-section h4 {
    color: #2c3e50;
    margin-bottom: 10px;
    font-size: 15px;
    font-weight: 600;
}

.instruction-section p {
    margin-bottom: 10px;
    color: #555;
}

.instruction-section ol,
.instruction-section ul {
    margin-left: 20px;
    margin-bottom: 10px;
}

.instruction-section li {
    margin-bottom: 8px;
    line-height: 1.5;
}

.instruction-section strong {
    color: #333;
    font-weight: 600;
}

.code-box {
    flex: 0 0 50%;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.code-box-header {
    padding: 15px 20px;
    background-color: #2d2d2d;
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 1px solid #3d3d3d;
}

.code-box-header .box-title {
    color: #ffffff;
    background: transparent;
    border: none;
    padding: 0;
    font-size: 14px;
}

.code-actions {
    display: flex;
    gap: 10px;
}

.control-btn {
    padding: 6px 14px;
    border: none;
    border-radius: 3px;
    font-size: 12px;
    font-weight: 600;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 6px;
    transition: all 0.3s ease;
}

.start-btn {
    background-color: #4caf50;
    color: white;
}

.start-btn:hover {
    background-color: #45a049;
}

.stop-btn {
    background-color: #f44336;
    color: white;
}

.stop-btn:hover {
    background-color: #da190b;
}

.play-icon {
    font-size: 10px;
}

.code-content-wrapper {
    flex: 1;
    overflow: hidden;
    background-color: #272822;
}

.code-content {
    flex: 1;
    overflow: hidden;
    background-color: #272822;
    height: 100%;
}

.code-content .CodeMirror {
    width: 100%;
    height: 100%;
    font-family: 'Consolas', 'Courier New', monospace;
    font-size: 13px;
    line-height: 1.5;
}

.code-content .CodeMirror-scroll {
    overflow-y: auto !important;
    overflow-x: auto !important;
    min-height: 100%;
}

.code-content .CodeMirror-hscrollbar {
    height: 12px !important;
}

.code-content .CodeMirror-vscrollbar {
    width: 12px !important;
}

.code-content .CodeMirror-scrollbar-filler {
    background-color: #272822;
}

.code-content .CodeMirror-hscrollbar::-webkit-scrollbar {
    height: 12px;
}

.code-content .CodeMirror-hscrollbar::-webkit-scrollbar-track {
    background: #1e1e1e;
}

.code-content .CodeMirror-hscrollbar::-webkit-scrollbar-thumb {
    background: #555;
    border-radius: 6px;
}

.code-content .CodeMirror-hscrollbar::-webkit-scrollbar-thumb:hover {
    background: #777;
}

.code-content .CodeMirror-vscrollbar::-webkit-scrollbar {
    width: 12px;
}

.code-content .CodeMirror-vscrollbar::-webkit-scrollbar-track {
    background: #1e1e1e;
}

.code-content .CodeMirror-vscrollbar::-webkit-scrollbar-thumb {
    background: #555;
    border-radius: 6px;
}

.code-content .CodeMirror-vscrollbar::-webkit-scrollbar-thumb:hover {
    background: #777;
}

#arduinoCode {
    display: none;
}

/* Syntax Highlighting Colors */
.comment { color: #75715e; }
.keyword { color: #f92672; }
.function { color: #a6e22e; }
.constant { color: #ae81ff; }
.string { color: #e6db74; }

/* Serial Monitor */
.serial-monitor {
    width: 100%;
    height: 200px;
    display: flex;
    flex-direction: column;
    background: #000000;
    color: #00ff00;
    font-family: 'Courier New', Courier, monospace;
    font-size: 12px;
    overflow: hidden;
    border-top: 2px solid #444;
    flex-shrink: 0;
}

.serial-header {
    background: #2d2d2d;
    padding: 8px 15px;
    color: #ffffff;
    font-size: 12px;
    border-bottom: 1px solid #1e1e1e;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.serial-output {
    flex: 1;
    overflow-y: auto;
    overflow-x: hidden;
    padding: 10px;
    line-height: 1.5;
    min-height: 0;
    height: 100%;
    scroll-behavior: smooth;
}

.serial-output::-webkit-scrollbar {
    width: 10px;
}

.serial-output::-webkit-scrollbar-track {
    background: #0a0a0a;
    border-radius: 5px;
}

.serial-output::-webkit-scrollbar-thumb {
    background: #444;
    border-radius: 5px;
    border: 2px solid #0a0a0a;
}

.serial-output::-webkit-scrollbar-thumb:hover {
    background: #666;
}

.serial-empty {
    opacity: 0.5;
    font-style: italic;
}

.serial-log {
    word-break: break-all;
    margin-bottom: 4px;
}
