* {
    box-sizing: border-box;
}

body {
    margin: 0;
    min-height: 100vh;
    background-color: #1e1e1e;
    font-family: 'Consolas', 'Courier New', monospace;
}

.dashboard-container {
    position: relative;
    width: 100%;
    min-height: 100vh;
}

/* ===== LEFT EDITOR PANEL (with tabs) ===== */
.editor-panel {
    position: fixed;
    left: 20px;
    top: 20px;
    bottom: 20px;
    width: 520px;
    background: #1e1e1e;
    border-radius: 8px;
    border: 1px solid #3c3c3c;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    z-index: 10;
}

.editor-tabs {
    display: flex;
    background: #2d2d2d;
    border-bottom: 1px solid #3c3c3c;
    padding: 0 8px;
    gap: 4px;
    align-items: center;
    flex-shrink: 0;
}

.editor-tab {
    background: #1e1e1e;
    border: none;
    color: #cccccc;
    padding: 8px 16px;
    font-size: 12px;
    font-family: 'Consolas', monospace;
    cursor: pointer;
    border-radius: 6px 6px 0 0;
    transition: 0.1s;
}

.editor-tab.active {
    background: #0a0a0a;
    color: #ffffff;
    border-bottom: 2px solid #007acc;
}

.editor-btn {
    margin-left: auto;
    background: #0e639c;
    border: none;
    color: white;
    padding: 4px 12px;
    border-radius: 4px;
    cursor: pointer;
    font-family: inherit;
    font-size: 12px;
}
.editor-btn:hover {
    background: #1177bb;
}

.code-editor {
    flex: 1;
    background: #0a0a0a;
    color: #d4d4d4;
    font-family: 'Consolas', 'Courier New', monospace;
    font-size: 13px;
    line-height: 1.5;
    padding: 12px;
    border: none;
    resize: none;
    outline: none;
    white-space: pre-wrap;
    tab-size: 4;
}

/* ===== CENTER HAT IFRAME ===== */
.case-wrapper {
    position: absolute;
    left: 50%;
    top: 50%;
    transform: translate(-50%, -50%);
    height: 80vh;
    aspect-ratio: 300 / 500;
    background-color: transparent;
    border: none;
}

#hat-frame {
    width: 100%;
    height: 100%;
    border: none;
    background: transparent;
    display: block;
}

/* ===== RIGHT DEBUG PANEL ===== */
#debug-panel {
    position: fixed;
    right: 20px;
    top: 20px;
    bottom: 20px;
    width: 500px;
    background: #111;
    color: #0f0;
    padding: 20px;
    border-radius: 12px;
    border: 1px solid #334155;
    display: flex;
    flex-direction: column;
    gap: 20px;
    z-index: 10;
    overflow-y: auto;
}

/* ===== TABS (inside debug panel) ===== */
.tabs {
    display: flex;
    gap: 4px;
    border-bottom: 1px solid #3c3c3c;
    margin-bottom: 16px;
}

.tab-btn {
    background: #1e1e1e;
    border: none;
    color: #cccccc;
    padding: 8px 16px;
    border-radius: 6px 6px 0 0;
    cursor: pointer;
    font-size: 14px;
    font-weight: 500;
    font-family: inherit;
    transition: 0.1s;
}

.tab-btn.active {
    background: #2d2d2d;
    color: #ffffff;
    border-bottom: 2px solid #007acc;
}

.tab-content {
    display: none;
    flex: 1;
    overflow-y: auto;
    flex-direction: column;
    gap: 16px;
}

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

/* ===== HAT TAB PANELS ===== */
.sensor-panel, .cube-panel {
    background: #1e1e1e;
    border-radius: 8px;
    padding: 12px;
    border: 1px solid #3c3c3c;
}

.sensor-panel h4, .cube-panel h4 {
    margin: 0 0 8px 0;
    color: #ce9178;
    font-size: 14px;
}

#sensor-values div, #cube-state div {
    margin: 4px 0;
    font-size: 13px;
    color: #d4d4d4;
}

#sensor-values span, #cube-state span {
    color: #4ec9b0;
    font-weight: bold;
}

#gizmo-container {
    background: #0a0a0a;
    border-radius: 8px;
    padding: 8px;
    border: 1px solid #3c3c3c;
    min-height: 260px;
    position: relative;
}

/* ===== GDB DEBUG LAYOUT ===== */
.debug-layout {
    display: flex;
    gap: 12px;
    height: 100%;
    min-height: 400px;
}

.debug-sidebar {
    width: 220px;
    flex-shrink: 0;
    background: #1e1e1e;
    border-radius: 6px;
    overflow-y: auto;
    border: 1px solid #3c3c3c;
}

.debug-section {
    border-bottom: 1px solid #3c3c3c;
}

.section-header {
    background: #2d2d2d;
    padding: 6px 8px;
    font-size: 11px;
    font-weight: bold;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: #cccccc;
    cursor: pointer;
    user-select: none;
}

.section-content {
    padding: 6px 0;
    font-size: 12px;
}

.debug-variable, .debug-stack, .debug-breakpoint {
    padding: 2px 8px;
    color: #d4d4d4;
    font-size: 12px;
}

.debug-variable .var-name { color: #9cdcfe; }
.debug-variable .var-value { color: #ce9178; }
.debug-stack { color: #dcdcaa; }
.debug-breakpoint { color: #4ec9b0; }
.debug-breakpoint .bp-loc { color: #ce9178; }

.debug-console-area {
    flex: 1;
    display: flex;
    flex-direction: column;
    background: #1e1e1e;
    border-radius: 6px;
    border: 1px solid #3c3c3c;
    overflow: hidden;
}

.debug-console-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 6px 12px;
    background: #2d2d2d;
    border-bottom: 1px solid #3c3c3c;
    font-size: 12px;
    font-weight: bold;
    color: #cccccc;
}

.clear-console {
    background: #0e639c;
    border: none;
    color: white;
    padding: 2px 12px;
    border-radius: 4px;
    cursor: pointer;
    font-family: inherit;
    font-size: 11px;
}
.clear-console:hover {
    background: #1177bb;
}

#gdb-log {
    flex: 1;
    overflow-y: auto;
    padding: 8px;
    background: #0a0a0a;
    font-size: 12px;
    font-family: 'Consolas', monospace;
    white-space: pre-wrap;
    word-break: break-all;
    margin: 0;
}

.log-entry {
    padding: 2px 0;
    border-bottom: 1px solid #2d2d2d;
}
.log-time {
    color: #6a9955;
    margin-right: 8px;
}

/* ===== HIDE UNUSED ELEMENTS ===== */
.gizmo-buttons, .gizmo-buttons-side, #log-output, .spacer, .editor-header {
    display: none;
}
/* Hamburger menu */
.menu-dropdown {
    position: relative;
    margin-left: auto;
}

.menu-btn {
    background: #0e639c;
    border: none;
    color: white;
    padding: 4px 12px;
    border-radius: 4px;
    cursor: pointer;
    font-family: inherit;
    font-size: 16px;
    font-weight: bold;
}
.menu-btn:hover {
    background: #1177bb;
}

.dropdown-content {
    display: none;
    position: absolute;
    right: 0;
    top: 100%;
    background-color: #2d2d2d;
    min-width: 120px;
    box-shadow: 0px 8px 16px rgba(0,0,0,0.2);
    border-radius: 6px;
    z-index: 20;
    border: 1px solid #3c3c3c;
}

.dropdown-content a {
    color: #cccccc;
    padding: 8px 12px;
    text-decoration: none;
    display: block;
    font-size: 13px;
    font-family: 'Consolas', monospace;
}

.dropdown-content a:hover {
    background-color: #1e1e1e;
    color: white;
}

.show {
    display: block;
}