/* ============================================================
   Pico IDE PRO: Master UI System (Full Restoration)
   ============================================================ */
:root {
    --primary: #667eea;
    --primary-hover: #5a67d8;
    --secondary: #764ba2;
    --success: #48bb78;
    --error: #f56565;
    --bg-main: #f0f2f5;
    --bg-card: #ffffff;
    --header-dark: #2d3748;
    --text-primary: #2d3748;
    --text-muted: #718096;
    --border-color: #e2e8f0;
    --header-height: 64px;
}

* {
    box-sizing: border-box;
}

body {
    margin: 0;
    font-family: 'Inter', -apple-system, sans-serif;
    background-color: var(--bg-main);
    color: var(--text-primary);
    overflow: hidden;
    height: 100vh;
}

.container {
    display: flex;
    flex-direction: column;
    height: 100vh;
}

/* ------------------------------------------------------------
   Header System
   ------------------------------------------------------------ */
header {
    height: var(--header-height);
    background: var(--header-dark);
    color: white;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 20px;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.2);
    z-index: 1000;
}

.header-left {
    display: flex;
    align-items: center;
    gap: 15px;
}

.header-left h1 {
    margin: 0;
    font-size: 1.25em;
    font-weight: 800;
    display: flex;
    align-items: center;
    gap: 8px;
}

.ai-studio-trigger-btn,
.header-action-btn,
.serial-trigger-btn {
    border: none;
    padding: 8px 16px;
    border-radius: 8px;
    font-weight: 600;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 8px;
    transition: all 0.2s;
    font-size: 0.85em;
    background: rgba(255, 255, 255, 0.1);
    color: white;
}

.ai-studio-trigger-btn {
    background: #667eea;
}

.connect-btn {
    background: #3182ce;
}

.connect-btn:hover {
    background: #2c5282;
}

.header-right {
    display: flex;
    align-items: center;
    gap: 15px;
}

.header-status-indicator {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 0.8em;
    font-weight: 600;
    background: rgba(0, 0, 0, 0.25);
    padding: 5px 12px;
    border-radius: 20px;
}

.status-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: #94a3b8;
}

.status-dot.connected {
    background: #48bb78;
    box-shadow: 0 0 8px #48bb78;
}

.user-profile-badge {
    display: none;
    /* Hidden by default */
    align-items: center;
    gap: 8px;
    background: rgba(255, 255, 255, 0.05);
    padding: 2px 10px;
    border-radius: 50px;
    border: 1px solid rgba(255, 255, 255, 0.1);
}

.user-profile-badge.active {
    display: flex;
    /* Shown when active */
}

.user-profile-badge img {
    width: 28px;
    height: 28px;
    border-radius: 50%;
    background: #444;
}

.user-profile-badge span {
    font-size: 0.85em;
    font-weight: 600;
}

.icon-text-btn {
    background: rgba(255, 255, 255, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.2);
    color: white;
    padding: 4px 12px;
    border-radius: 6px;
    font-size: 0.75em;
    cursor: pointer;
    font-weight: 700;
    transition: all 0.2s;
    margin-left: 5px;
}

.icon-text-btn:hover {
    background: rgba(239, 68, 68, 0.2);
    border-color: #ef4444;
    color: #feb2b2;
}

.auth-btn {
    background: #4a5568;
    border: none;
    color: white;
    padding: 6px 12px;
    border-radius: 6px;
    cursor: pointer;
    font-size: 0.85em;
}

/* ------------------------------------------------------------
   Dashboard Layout & Fullscreen Support
   ------------------------------------------------------------ */
.main-content {
    display: grid;
    grid-template-columns: 1fr 400px;
    gap: 15px;
    padding: 15px;
    flex: 1;
    overflow: hidden;
}

body.fullscreen-mode .main-content {
    grid-template-columns: 1fr;
    padding: 0;
    height: 100vh;
}

body.fullscreen-mode header,
body.fullscreen-mode .right-panel,
body.fullscreen-mode .console-box,
body.fullscreen-mode .ai-prompt-container,
body.fullscreen-mode .editor-header-row .file-info,
body.fullscreen-mode .editor-header-row .editor-tabs,
body.fullscreen-mode .editor-header-row .web-mode-control,
body.fullscreen-mode .editor-header-row .font-controls-group,
body.fullscreen-mode .editor-header-row .run-btn,
body.fullscreen-mode .editor-header-row .stop-btn {
    display: none !important;
}

body.fullscreen-mode .left-panel {
    width: 100vw;
    height: 100vh;
    padding: 0;
    gap: 0;
}

body.fullscreen-mode .editor-container {
    border-radius: 0;
    border: none;
    height: 100vh !important;
}

body.fullscreen-mode .editor-header-row {
    border-radius: 0;
    justify-content: flex-end;
    /* Push exit button to right */
    background: rgba(255, 255, 255, 0.9);
    position: absolute;
    top: 0;
    right: 0;
    z-index: 1000;
    width: auto;
    border: none;
    padding: 10px;
}

.left-panel {
    display: flex;
    flex-direction: column;
    gap: 15px;
    min-width: 0;
    height: 100%;
}

.editor-container {
    flex: 1;
    display: flex;
    flex-direction: column;
    min-height: 0;
    background: white;
    border-radius: 12px;
    border: 1px solid var(--border-color);
    overflow: hidden;
}

.editor-view.active {
    display: flex;
    flex-direction: column;
    flex: 1;
    width: 100%;
    min-height: 0;
}

.right-panel {
    background: white;
    border-radius: 12px;
    border: 1px solid var(--border-color);
    display: flex;
    flex-direction: column;
    overflow: hidden;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.05);
    height: 100%;
    width: 100%;
}

.sim-right-panel {
    flex: 1;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    /* Top level don't scroll */
}

.tab-content {
    flex: 1;
    display: none;
    flex-direction: column;
    overflow: hidden;
    /* Container should not scroll, components inside should */
}

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

#blockly-container {
    width: 100%;
    height: 100%;
    border-radius: 0 0 12px 12px;
    overflow: hidden;
    flex: 1;
}

#blocklyDiv {
    width: 100% !important;
    height: 100% !important;
}

.editor-view {
    display: none;
}

.editor-view.active {
    display: block;
}

/* ------------------------------------------------------------
   Editor Section
   ------------------------------------------------------------ */
.editor-header-row {
    background: #f8fafc;
    padding: 8px 12px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 1px solid var(--border-color);
    border-radius: 12px 12px 0 0;
}

.file-info {
    display: flex;
    align-items: center;
    gap: 5px;
}

#project-name {
    border: 1px solid #e2e8f0;
    padding: 4px 8px;
    border-radius: 5px;
    font-weight: 600;
    font-size: 0.9em;
    outline: none;
    width: 120px;
}

.editor-tabs {
    display: flex;
    gap: 5px;
    background: #edf2f7;
    padding: 2px;
    border-radius: 8px;
}

.editor-tab {
    border: none;
    background: transparent;
    padding: 5px 12px;
    cursor: pointer;
    font-weight: 700;
    color: #718096;
    border-radius: 6px;
    display: flex;
    align-items: center;
    gap: 5px;
    font-size: 0.85em;
}

.editor-tab.active {
    background: white;
    color: var(--primary);
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
}

.editor-controls {
    display: flex;
    align-items: center;
    gap: 8px;
}

.toolbar-btn {
    border: none;
    padding: 6px 12px;
    border-radius: 6px;
    font-weight: 700;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 5px;
    font-size: 0.85em;
    transition: 0.2s;
}

.toolbar-btn {
    border: none;
    padding: 6px 14px;
    border-radius: 8px;
    font-weight: 700;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 0.85em;
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
}

.run-btn {
    background: #10b981;
    /* Emerald 500 */
    color: white;
}

.run-btn:hover {
    background: #059669;
    box-shadow: 0 4px 12px rgba(16, 185, 129, 0.2);
}

.stop-btn {
    background: #ef4444;
    /* Red 500 */
    color: white;
}

.stop-btn:hover {
    background: #dc2626;
    box-shadow: 0 4px 12px rgba(239, 68, 68, 0.2);
}

.divider {
    width: 1px;
    height: 20px;
    background: #cbd5e0;
    margin: 0 5px;
}

.CodeMirror {
    flex: 1;
    /* FILL CONTAINER */
    height: 100% !important;
    border-radius: 0 0 12px 12px;
    font-family: 'Consolas', monospace;
    font-size: 15px;
}

/* ------------------------------------------------------------
   Console System
   ------------------------------------------------------------ */
.console-box {
    background: #1a202c;
    border-radius: 12px;
    color: #e2e8f0;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.console-header {
    padding: 8px 15px;
    background: #111;
    display: flex;
    justify-content: space-between;
    font-size: 0.85em;
    font-weight: 700;
    border-bottom: 1px solid #333;
}

#serial-output {
    height: 180px;
    padding: 12px;
    font-family: 'JetBrains Mono', monospace;
    font-size: 13px;
    overflow-y: auto;
    line-height: 1.5;
    background: #0f172a;
    color: #e2e8f0;
}

/* Custom Scrollbar for Terminal */
#serial-output::-webkit-scrollbar {
    width: 6px;
}

#serial-output::-webkit-scrollbar-track {
    background: transparent;
}

#serial-output::-webkit-scrollbar-thumb {
    background: #334155;
    border-radius: 10px;
}

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

/* ------------------------------------------------------------
   AI Inline Helper
   ------------------------------------------------------------ */
.gemini-ai-inline {
    background: white;
    padding: 12px 15px;
    border-radius: 12px;
    border: 1px solid var(--border-color);
    display: flex;
    align-items: center;
    gap: 10px;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.02);
}

.ai-input-wrapper {
    flex: 1;
    background: #f8fafc;
    border-radius: 50px;
    padding: 2px 15px;
    display: flex;
    align-items: center;
    border: 1px solid #edf2f7;
}

.ai-input-wrapper input {
    border: none;
    background: transparent;
    padding: 10px;
    flex: 1;
    font-size: 0.9em;
    outline: none;
}

/* AI Response Bubble Premium Styling */
.ai-response-bubble {
    background: #ffffff;
    border: 1px solid #e2e8f0;
    border-radius: 16px;
    margin-top: 15px;
    padding: 20px;
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.08);
    display: flex;
    flex-direction: column;
    gap: 15px;
    animation: slideUp 0.3s ease-out;
}

@keyframes slideUp {
    from {
        opacity: 0;
        transform: translateY(10px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.ai-response-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    color: var(--primary);
    font-weight: 800;
    font-size: 0.9em;
}

.ai-code-block {
    background: #1a202c;
    color: #e2e8f0;
    padding: 15px;
    border-radius: 10px;
    font-family: 'Fira Code', monospace;
    font-size: 0.85em;
    overflow-x: auto;
    border: 1px solid #2d3748;
}

.ai-actions {
    display: flex;
    justify-content: flex-end;
}

.ai-btn {
    border: none;
    border-radius: 8px;
    font-weight: 700;
    cursor: pointer;
    transition: 0.2s;
    display: flex;
    align-items: center;
    gap: 8px;
}

.btn-insert {
    background: var(--primary);
    color: white;
}

.btn-insert:hover {
    background: var(--primary-hover);
    box-shadow: 0 4px 12px rgba(102, 126, 234, 0.3);
}

.icon-btn-send {
    background: var(--primary);
    color: white;
    border: none;
    width: 32px;
    height: 32px;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
}

.icon-btn-small {
    background: #ffffff;
    border: 1px solid #e2e8f0;
    width: 32px;
    height: 32px;
    border-radius: 8px;
    cursor: pointer;
    color: #4a5568;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.05);
}

.icon-btn-small:hover {
    background: #edf2f7;
    color: var(--primary);
    border-color: var(--primary);
    transform: translateY(-1px);
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.05);
}

.icon-btn-small:active {
    transform: translateY(0);
}

/* Font Controls Group Styling */
.font-controls-group {
    display: flex;
    align-items: center;
    background: #f1f5f9;
    padding: 3px;
    border-radius: 10px;
    gap: 2px;
}

.font-controls-group .icon-btn-small {
    background: transparent;
    border: none;
    width: 28px;
    height: 28px;
    font-weight: 800;
    box-shadow: none;
}

.font-controls-group .icon-btn-small:hover {
    background: white;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.font-label {
    font-size: 0.75em;
    font-weight: 800;
    color: #94a3b8;
    padding: 0 8px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

/* ------------------------------------------------------------
   Simulator (PICO 2W REALISTIC)
   ------------------------------------------------------------ */
.sim-right-panel {
    width: 100%;
    flex: 1;
    display: flex;
    flex-direction: column;
    overflow-y: auto;
    border-top: 1px solid #edf2f7;
    margin-top: 10px;
    background: #ffffff;
    min-height: 250px;
}

.tabs {
    padding: 8px 15px;
    border-bottom: 1px solid #eee;
    background: #f8fafc;
}

.tab-button {
    border: none;
    background: none;
    font-weight: 800;
    font-size: 0.85em;
    color: #4a5568;
    border-bottom: 2px solid #667eea;
    padding-bottom: 4px;
}

.icon-text-btn {
    background: none;
    border: none;
    color: #4a5568;
    font-size: 0.85em;
    font-weight: 700;
    padding: 6px 10px;
    border-radius: 6px;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 5px;
    transition: background 0.2s;
}

.icon-text-btn:hover {
    background: #edf2f7;
}

.icon-text-btn.logout {
    color: #e53e3e;
}

.icon-text-btn.logout:hover {
    background: #fed7d7;
}

#simulator-content {
    padding: 0;
    display: flex;
    flex-direction: column;
    width: 100%;
    height: 100%;
}

.sim-wrapper {
    background: #f8fafc;
    padding: 30px 15px;
    display: flex;
    flex-direction: column;
    /* Vertical Stack: Board then HW Panel */
    align-items: center;
    gap: 20px;
    flex: 1;
    overflow: hidden;
    /* DRAG HANDLES OVERFLOW */
    position: relative;
    cursor: grab;
    /* PANNING SIGN */
    user-select: none;
    transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
}

.sim-wrapper:active {
    cursor: grabbing;
}

/* Simulator Fullscreen (Expanded) Mode */
.sim-wrapper.expanded {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    z-index: 10000;
    padding: 50px;
    background: #f1f5f9;
}

/* Simulator Zoom Controls */
.sim-zoom-controls {
    position: absolute;
    top: 25px;
    right: 25px;
    display: flex;
    flex-direction: column;
    gap: 10px;
    z-index: 11000;
}

/* Hide zoom controls when any modal is open */
body:has(.modal-overlay.active) .sim-zoom-controls {
    display: none;
}

.zoom-divider {
    height: 1px;
    background: #e2e8f0;
    margin: 5px 0;
}

.zoom-btn {
    width: 44px;
    height: 44px;
    background: white;
    border: 1px solid var(--border-color);
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.1);
    transition: all 0.2s;
    color: #4a5568;
}

.zoom-btn:hover {
    background: var(--primary);
    color: white;
    transform: scale(1.05);
    border-color: var(--primary);
}

.zoom-btn .material-symbols-rounded {
    font-size: 24px;
}

.pico-board {
    transform-origin: top center;
    /* CRITICAL FOR ZOOM */
    transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    position: relative;
    width: 180px !important;
    height: 520px !important;
    background-color: #1b5e20;
    border-radius: 12px;
    box-shadow: 0 12px 40px rgba(0, 0, 0, 0.4);
    border: 3px solid #144318;
    background-image: radial-gradient(#2e7d32 1.1px, transparent 1.1px);
    background-size: 8px 8px;
    flex-shrink: 0;
    margin: 20px auto !important;
    /* FORCED CENTERING */
    display: block !important;
}

.pico-usb {
    position: absolute;
    top: -10px;
    left: 60px;
    width: 60px;
    height: 22px;
    background: #90a4ae;
    border-radius: 4px 4px 0 0;
    border: 2px solid #546e7a;
}

.pico-chip {
    position: absolute;
    top: 170px;
    left: 40px;
    width: 100px;
    height: 80px;
    background: #212121;
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 10px;
    font-weight: 900;
    border-radius: 6px;
    border: 1px solid #333;
    z-index: 2;
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.5);
}

.pico-wireless-module {
    position: absolute;
    top: 390px;
    left: 30px;
    width: 120px;
    height: 80px;
    background: #cfd8dc;
    border-radius: 10px;
    border: 1px solid #b0bec5;
    box-shadow: inset 0 2px 5px rgba(255, 255, 255, 0.8);
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0.9;
}

.pico-wireless-module::after {
    content: "PICO 2W";
    font-size: 10px;
    font-weight: 900;
    color: #78909c;
}

.pico-led-onboard {
    position: absolute;
    width: 12px;
    height: 12px;
    background-color: #558b2f;
    top: 50px;
    left: 84px;
    border-radius: 2px;
    border: 1px solid #33691e;
    z-index: 10;
    cursor: help;
}

.pico-led-onboard.active {
    background-color: #76ff03;
    box-shadow: 0 0 15px #76ff03;
}

.pico-bootsel-btn {
    position: absolute;
    top: 90px;
    left: 80px;
    width: 18px;
    height: 18px;
    background: #eceff1;
    border-radius: 50%;
    border: 2px solid #b0bec5;
    box-shadow: 0 2px 0 #90a4ae;
    z-index: 10;
    cursor: pointer;
}

/* Pins System */
.pins-left,
.pins-right {
    position: absolute;
    top: 30px;
    bottom: 70px;
    width: 50px;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    gap: 1px;
}

.pin {
    position: relative;
    width: 40px;
    /* SLIMMER */
    height: 16px;
    /* COMPACT */
    border-radius: 2px;
    font-size: 7px;
    /* TINY BUT READABLE */
    font-weight: 800;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    z-index: 100;
    border: 1px solid rgba(0, 0, 0, 0.2);
}

.pins-left {
    left: -20px;
    align-items: flex-end;
}

.pins-right {
    right: -20px;
    align-items: flex-start;
}

.pin.gpio {
    background: #FFD54F;
    color: #5D4037;
}

.pin.gnd {
    background: #212121 !important;
    color: white !important;
}

.pin.power {
    background: #E53935 !important;
    color: white !important;
}

.pin.adc {
    background: #9575CD !important;
    color: white !important;
    border-color: #673AB7;
}

.pin.control {
    background: #ffffff !important;
    color: #2d3748 !important;
    border-color: #cbd5e0 !important;
}

/* RUN PIN WHITE */

/* Active Pin Glowing Feedback - HIGH INTENSITY */
.pin.pin-active {
    background: #00f2ff !important;
    /* Cyan Neon */
    color: #000 !important;
    box-shadow: 0 0 20px #00f2ff, 0 0 40px rgba(0, 242, 255, 0.4);
    border-color: #fff !important;
    animation: neonPulse 0.6s infinite alternate;
}

@keyframes neonPulse {
    from {
        transform: scale(1);
        filter: brightness(1);
    }

    to {
        transform: scale(1.1);
        filter: brightness(1.5);
    }
}

/* Live Pin Activity Panel Styling */
.live-pin-panel {
    background: #f8fafc;
    border-top: 1px solid #e2e8f0;
    padding: 15px 20px;
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    min-height: 50px;
}

.live-pin-item {
    background: white;
    border: 1px solid #edf2f7;
    padding: 6px 12px;
    border-radius: 8px;
    font-size: 0.8em;
    font-weight: 700;
    display: flex;
    align-items: center;
    gap: 8px;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.02);
    animation: fadeIn 0.2s ease-out;
}

.live-pin-item .pin-num {
    color: var(--primary);
}

.live-pin-item .pin-val {
    font-family: monospace;
    color: #2d3748;
}

/* ------------------------------------------------------------
   TOOLTIP ENHANCED BOX
   ------------------------------------------------------------ */
.pin::after,
.pico-led-onboard::after,
.pico-bootsel-btn::after {
    content: attr(data-info) !important;
    position: absolute !important;
    top: 0 !important;
    background: rgba(26, 32, 44, 0.98) !important;
    color: #ffffff !important;
    padding: 12px 16px !important;
    border-radius: 10px !important;
    font-size: 11px !important;
    line-height: 1.5 !important;
    white-space: pre-wrap !important;
    z-index: 99999999 !important;
    /* ULTIMATE PRIORITY */
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.8);
    border: 1px solid #4a5568 !important;
    width: 180px !important;
    height: auto !important;
    text-align: left !important;
    transition: opacity 0.2s ease !important;
    box-sizing: border-box !important;
}

.pin:hover,
.pico-led-onboard:hover,
.pico-bootsel-btn:hover {
    z-index: 10000000 !important;
}

/* FORCE LEFT PINS TOOLTIP TO THE RIGHT */
.pins-left .pin::after {
    left: calc(100% + 15px) !important;
    right: auto !important;
}

/* FORCE RIGHT PINS TOOLTIP TO THE LEFT */
.pins-right .pin::after {
    right: calc(100% + 15px) !important;
    left: auto !important;
}

/* Onboard components tooltips */
.pico-led-onboard::after,
.pico-bootsel-btn::after {
    left: 40px !important;
    top: -20px !important;
}

.pin:hover::after,
.pico-led-onboard:hover::after,
.pico-bootsel-btn:hover::after {
    opacity: 1 !important;
    visibility: visible !important;
}

/* ------------------------------------------------------------
   Detection Panel Styles
   ------------------------------------------------------------ */
.connected-devices-container {
    padding: 25px;
    width: 100%;
    border-top: 1px solid #eee;
}

.devices-header {
    display: flex;
    align-items: center;
    gap: 10px;
    font-weight: 800;
    font-size: 1.05em;
    color: #2d3748;
    margin-bottom: 20px;
}

.devices-header .material-symbols-rounded {
    color: #667eea;
}

.empty-hardware-state {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 30px 0;
    color: #a0aec0;
    text-align: center;
}

.empty-hardware-state span {
    font-size: 4em;
    opacity: 0.15;
    margin-bottom: 15px;
}

.empty-hardware-state p {
    font-size: 0.9em;
    font-weight: 600;
    line-height: 1.5;
}

/* ------------------------------------------------------------
   Modals (CRITICAL RESTORATION)
   ------------------------------------------------------------ */
.modal-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    backdrop-filter: blur(10px);
    z-index: 5000;
    align-items: center;
    justify-content: center;
}

.modal-overlay.active {
    display: flex;
}

.modal-content {
    background: white;
    width: 90%;
    max-width: 800px;
    height: auto;
    max-height: 85vh;
    border-radius: 28px;
    box-shadow: 0 30px 100px rgba(0, 0, 0, 0.3);
    display: flex;
    flex-direction: column;
    overflow: hidden;
    animation: modalPop 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

@keyframes modalPop {
    from {
        transform: scale(0.9) translateY(20px);
        opacity: 0;
    }

    to {
        transform: scale(1) translateY(0);
        opacity: 1;
    }
}

.modal-header {
    padding: 20px 30px;
    border-bottom: 1px solid #e2e8f0;
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: #fcfcfc;
}

.modal-header h2 {
    margin: 0;
    font-size: 1.4em;
    font-weight: 800;
    display: flex;
    align-items: center;
    gap: 10px;
    color: #2d3748;
}

.modal-body {
    flex: 1;
    padding: 30px;
    overflow-y: auto;
    background: white;
}

.icon-btn-close {
    background: #f1f5f9;
    border: none;
    width: 36px;
    height: 36px;
    border-radius: 50%;
    cursor: pointer;
    color: #64748b;
    transition: 0.2s;
}

.icon-btn-close:hover {
    background: #e2e8f0;
    color: #ef4444;
}

/* AI Studio Specific */
.ai-mode-tabs {
    display: flex;
    gap: 10px;
    margin-bottom: 25px;
    justify-content: center;
}

.webcam-wrapper {
    width: 100%;
    height: 100%;
    min-height: 240px;
    background: #1a202c;
    border-radius: 12px;
    overflow: hidden;
    position: relative;
}

.webcam-wrapper video,
.webcam-wrapper canvas {
    width: 100%;
    height: 100%;
    object-fit: cover;
    position: absolute;
    top: 0;
    left: 0;
}

/* Pin Mapping UI Improvements */
.pin-mapping-list {
    display: flex;
    flex-direction: column;
    gap: 12px;
    margin-bottom: 20px;
}

.mapping-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px;
    background: #f8fafc;
    border: 1px solid #e2e8f0;
    border-radius: 8px;
    transition: 0.2s;
}

.mapping-item:hover {
    border-color: #cbd5e0;
    background: #edf2f7;
}

.mapping-label {
    font-size: 0.9em;
    font-weight: 700;
    color: #4a5568;
}

.mapping-pin-select {
    padding: 6px 12px;
    border-radius: 6px;
    border: 1px solid #cbd5e0;
    background: white;
    font-size: 0.85em;
    color: #2d3748;
    outline: none;
    cursor: pointer;
    min-width: 140px;
}

.mapping-pin-select:focus {
    border-color: #667eea;
    box-shadow: 0 0 0 2px rgba(102, 126, 234, 0.2);
}

.pred-header {
    font-size: 0.75em;
    text-transform: uppercase;
    letter-spacing: 1px;
    color: #a0aec0;
    margin-bottom: 5px;
    font-weight: 700;
}

.pred-result {
    font-size: 1.8em;
    margin: 5px 0 15px;
    color: #2d3748;
    font-weight: 800;
}

.ai-tab {
    border: none;
    padding: 10px 25px;
    border-radius: 50px;
    font-weight: 700;
    cursor: pointer;
    background: #f1f5f9;
    color: #64748b;
    transition: 0.2s;
}

.ai-tab.active {
    background: #667eea;
    color: white;
    box-shadow: 0 4px 10px rgba(102, 126, 234, 0.3);
}

/* AI Studio Premium Layout */
.workflow-stepper {
    display: flex;
    justify-content: space-between;
    margin-bottom: 25px;
    background: #f8fafc;
    padding: 15px;
    border-radius: 50px;
    border: 1px solid #edf2f7;
}

.step-indicator {
    flex: 1;
    text-align: center;
    font-weight: 700;
    color: #a0aec0;
    font-size: 0.9em;
    position: relative;
}

.step-indicator.active {
    color: var(--primary);
}

.step-indicator:not(:last-child)::after {
    content: 'navigate_next';
    font-family: 'Material Symbols Rounded';
    position: absolute;
    right: -10px;
    color: #e2e8f0;
}

.workflow-step {
    background: white;
    border-radius: 12px;
    animation: fadeIn 0.3s ease;
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.sensor-area {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 15px;
    margin-bottom: 25px;
}

.preview-box {
    width: 320px;
    height: 240px;
    background: #1a202c;
    border-radius: 16px;
    overflow: hidden;
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
    border: 4px solid #e2e8f0;
}

.preview-box video {
    width: 100% !important;
    height: 100% !important;
    object-fit: contain !important;
    transform: none !important;
}

.preview-box canvas {
    display: none !important;
}

.preview-box.large {
    width: 500px;
    height: 375px;
}

.placeholder-text {
    color: #4a5568;
    font-weight: 600;
}

.classes-header-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-top: 25px;
    border-top: 1px solid #eee;
    padding-top: 20px;
}

.classes-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
    gap: 20px;
    margin-top: 15px;
}

.class-card {
    background: #ffffff;
    border: 1px solid #e2e8f0;
    border-radius: 16px;
    padding: 20px;
    display: flex;
    flex-direction: column;
    gap: 15px;
    transition: all 0.2s;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.03);
}

.class-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 20px rgba(0, 0, 0, 0.06);
    border-color: var(--primary);
}

.class-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.name-edit-wrapper {
    display: flex;
    align-items: center;
    gap: 10px;
    flex: 1;
}

.class-id-badge {
    background: #f1f5f9;
    color: #64748b;
    font-weight: 800;
    font-size: 0.8em;
    width: 24px;
    height: 24px;
    border-radius: 6px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.class-name-input {
    border: none;
    border-bottom: 2px solid #edf2f7;
    padding: 4px 0;
    font-weight: 700;
    color: var(--text-primary);
    outline: none;
    transition: border-color 0.2s;
    width: 100%;
}

.class-name-input:focus {
    border-color: var(--primary);
}

.class-actions {
    display: flex;
    align-items: center;
    gap: 12px;
}

.sample-count {
    font-size: 0.75em;
    font-weight: 800;
    color: #94a3b8;
    background: #f8fafc;
    padding: 4px 10px;
    border-radius: 20px;
}

.samples-grid {
    height: 50px;
    display: flex;
    gap: 4px;
    overflow-x: auto;
    overflow-y: hidden;
    padding: 5px;
    background: #f8fafc;
    border-radius: 10px;
    border: 1px dashed #e2e8f0;
}

.samples-grid canvas {
    width: 40px;
    height: 40px;
    border-radius: 4px;
    border: 1px solid #fff;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
    flex-shrink: 0;
}

.train-btn {
    background: #edf2f7;
    border: 1px solid #e2e8f0;
    color: #4a5568;
    padding: 12px;
    border-radius: 12px;
    font-weight: 800;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    transition: all 0.2s;
    user-select: none;
}

.train-btn:active {
    background: var(--primary);
    color: white;
    transform: scale(0.98);
}

.icon-btn.delete-class {
    background: transparent;
    border: none;
    color: #cbd5e0;
    cursor: pointer;
    transition: 0.2s;
}

.icon-btn.delete-class:hover {
    color: #ef4444;
}

.train-dashboard {
    text-align: center;
    padding: 20px 0;
}

.stats-panel {
    display: flex;
    justify-content: center;
    gap: 40px;
    margin-bottom: 25px;
}

.stat-item {
    display: flex;
    flex-direction: column;
    align-items: center;
}

.stat-item .label {
    font-size: 0.8em;
    font-weight: 800;
    color: #718096;
}

.stat-item .value {
    font-size: 2em;
    font-weight: 900;
    color: var(--primary);
}

.progress-bar-container {
    height: 12px;
    background: #edf2f7;
    border-radius: 10px;
    overflow: hidden;
    margin: 20px 0;
}

.progress-bar {
    height: 100%;
    background: linear-gradient(90deg, #667eea, #764ba2);
    width: 0%;
    transition: width 0.1s linear;
}

.step-actions {
    display: flex;
    margin-top: 30px;
    border-top: 1px solid #eee;
    padding-top: 20px;
}

.step-actions.right-align {
    justify-content: flex-end;
}

.step-actions.space-between {
    justify-content: space-between;
}

.action-btn {
    background: var(--primary);
    color: white;
    border: none;
    padding: 12px 24px;
    border-radius: 50px;
    font-weight: 800;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 10px;
    box-shadow: 0 4px 15px rgba(102, 126, 234, 0.3);
}

.action-btn:disabled {
    background: #cbd5e0;
    box-shadow: none;
    cursor: not-allowed;
}

.full-width {
    width: 100%;
}

.sensor-area .full-width {
    max-width: 320px;
}

.badge {
    background: #667eea;
    color: white;
    padding: 2px 8px;
    border-radius: 10px;
    font-size: 0.7em;
}

/* Buttons & Elements */
.primary-btn {
    background: #667eea;
    color: white;
    border: none;
    padding: 10px 20px;
    border-radius: 8px;
    font-weight: 700;
    cursor: pointer;
    font-size: 0.9em;
    transition: 0.2s;
}

.primary-btn:hover {
    background: #5a67d8;
    transform: translateY(-1px);
}

.secondary-btn {
    background: #edf2f7;
    color: #4a5568;
    border: 1px solid #cbd5e0;
    padding: 10px 20px;
    border-radius: 8px;
    font-weight: 700;
    cursor: pointer;
    font-size: 0.9em;
    transition: 0.2s;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
}

.secondary-btn:hover {
    background: #e2e8f0;
    transform: translateY(-1px);
    color: #2d3748;
}

.small-btn {
    padding: 6px 12px;
    font-size: 0.85em;
}

.profile-section {
    border: 1px solid #e2e8f0;
    border-radius: 12px;
    padding: 20px;
    margin-bottom: 20px;
}

.input-group {
    display: flex;
    gap: 10px;
    margin-top: 10px;
}

.input-group input {
    flex: 1;
    padding: 10px 15px;
    border: 1px solid #e2e8f0;
    border-radius: 8px;
    outline: none;
    font-size: 0.9em;
}

.project-list-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 15px;
}

.project-card {
    border: 1px solid #e2e8f0;
    border-radius: 12px;
    padding: 15px;
    transition: 0.2s;
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.project-card:hover {
    border-color: #667eea;
    box-shadow: 0 4px 12px rgba(102, 126, 234, 0.1);
}

.project-actions {
    display: flex;
    gap: 10px;
    margin-top: 5px;
}

.delete-btn:hover {
    color: #ef4444 !important;
    border-color: #ef4444 !important;
}

/* ============================================================
   REALISTIC HARDWARE SIMULATION STYLES
   ============================================================ */
.sim-external-components {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 10;
}

.sim-wiring-layer {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 5;
}

.sim-component-visual {
    position: absolute;
    pointer-events: auto;
    display: flex;
    flex-direction: column;
    align-items: center;
    filter: drop-shadow(0 4px 10px rgba(0, 0, 0, 0.3));
    padding: 10px;
}

/* OLED SSD1306 Style */
.component-oled {
    width: 130px;
    height: 70px;
    background: #222;
    border: 3px solid #666;
    border-radius: 6px;
    padding: 5px;
}

.oled-screen {
    width: 100%;
    height: 100%;
    background: #000;
    border: 1px solid #444;
    color: #4df;
    font-family: 'JetBrains Mono', monospace;
    font-size: 10px;
    padding: 5px;
    overflow-y: auto;
    line-height: 1.2;
    word-break: break-all;
}

/* DHT11 Style */
.component-dht11 {
    width: 45px;
    height: 55px;
    background: #00a2ff !important;
    /* Bright Blue */
    border-radius: 4px;
    border: 2px solid #0077cc;
    position: relative;
    overflow: hidden;
}

.dht11-grid {
    width: 80%;
    height: 70%;
    background: rgba(255, 255, 255, 0.3);
    margin: 15% auto;
    background-image:
        linear-gradient(90deg, #fff 2px, transparent 1px),
        linear-gradient(#fff 2px, transparent 1px);
    background-size: 6px 6px;
    border-radius: 2px;
}

/* SERVO SG90 Style */
.component-servo {
    width: 50px;
    height: 40px;
    background: #1976d2;
    border-radius: 6px;
    position: relative;
}

.servo-arm {
    width: 45px;
    height: 10px;
    background: #fff;
    border: 1px solid #ccc;
    border-radius: 10px;
    position: absolute;
    top: -5px;
    left: 2px;
    transform-origin: 5px 5px;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.2);
}

.servo-gear {
    width: 14px;
    height: 14px;
    background: #eee;
    border-radius: 50%;
    border: 2px solid #888;
    position: absolute;
    top: -7px;
    left: 0;
}

.sim-component-visual::after {
    content: attr(id);
    position: absolute;
    bottom: -20px;
    background: rgba(0, 0, 0, 0.7);
    color: white;
    font-size: 10px;
    padding: 2px 6px;
    border-radius: 4px;
    white-space: nowrap;
}

/* ============================================================
   AI SMART CONTEXT MENU
   ============================================================ */
.ai-floating-menu {
    position: absolute;
    z-index: 10000;
    background: rgba(255, 255, 255, 0.9);
    backdrop-filter: blur(8px);
    border: 1px solid rgba(102, 126, 234, 0.3);
    border-radius: 12px;
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.15);
    display: flex;
    padding: 6px;
    gap: 4px;
    animation: menuPop 0.2s cubic-bezier(0.18, 0.89, 0.32, 1.28);
}

@keyframes menuPop {
    from {
        opacity: 0;
        transform: translateY(10px) scale(0.9);
    }

    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

.ai-menu-btn {
    background: transparent;
    border: none;
    padding: 8px 12px;
    border-radius: 8px;
    font-size: 0.8em;
    font-weight: 700;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 6px;
    color: #4a5568;
    transition: all 0.2s;
}

.ai-menu-btn:hover {
    background: #667eea;
    color: white;
}

.ai-menu-btn .material-symbols-rounded {
    font-size: 20px;
}

/* ============================================================
   VIRTUAL WEB PREVIEW (Integrated)
   ============================================================ */
.web-preview-pane {
    display: none;
    /* Hidden by default */
    background: #f8fafc;
    border-top: 1px solid var(--border-color);
    flex-shrink: 0;
    height: 300px;
}

body.web-mode-active .web-preview-pane {
    display: flex;
    flex-direction: column;
}

.browser-toolbar {
    padding: 8px 15px;
    background: #edf2f7;
    border-bottom: 1px solid #e2e8f0;
    display: flex;
    align-items: center;
}

.url-bar {
    background: white;
    border: 1px solid #cbd5e0;
    padding: 4px 12px;
    border-radius: 20px;
    flex: 1;
    font-size: 0.8em;
    color: #718096;
    font-family: monospace;
}

#virtual-browser {
    width: 100%;
    height: calc(100% - 40px);
    border: none;
    background: white;
}

/* ============================================================
   VIRTUAL WEB PREVIEW (Integrated)
   ============================================================ */
.web-preview-pane {
    display: none;
    /* Hidden by default */
    background: #f8fafc;
    width: 100%;
    height: 100%;
}

body.web-mode-active .web-preview-pane {
    display: flex;
    flex-direction: column;
}

body.web-mode-active .sim-wrapper {
    display: none !important;
}

/* ============================================================
   WEB MODE TOGGLE & VISIBILITY
   ============================================================ */
.web-mode-control {
    display: flex;
    align-items: center;
    gap: 8px;
    background: rgba(102, 126, 234, 0.1);
    padding: 2px 8px;
    border-radius: 20px;
    border: 1px solid rgba(102, 126, 234, 0.2);
}

.web-mode-control .ctrl-label {
    font-size: 0.75em;
    font-weight: 700;
    color: #4a5568;
}

/* Small iOS-style switch */
.switch-small {
    position: relative;
    display: inline-block;
    width: 34px;
    height: 18px;
}

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

.slider-small {
    position: absolute;
    cursor: pointer;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: #cbd5e0;
    transition: .4s;
}

.slider-small:before {
    position: absolute;
    content: "";
    height: 14px;
    width: 14px;
    left: 2px;
    bottom: 2px;
    background-color: white;
    transition: .4s;
}

input:checked+.slider-small {
    background-color: #667eea;
}

input:checked+.slider-small:before {
    transform: translateX(16px);
}

.slider-small.round {
    border-radius: 20px;
}

.slider-small.round:before {
    border-radius: 50%;
}

/* Obsolete Tab Visibility Cleaned */

/* Material Symbols Scale */
.material-symbols-rounded {
    font-size: 24px;
    vertical-align: middle;
}

/* ============================================================
   SYSTEM NOTIFICATION BANNER
   ============================================================ */
.system-notification-banner {
    position: fixed;
    top: 20px;
    left: 50%;
    transform: translateX(-50%) translateY(-100px);
    /* Hidden above */
    padding: 10px 24px;
    height: auto;
    min-height: 48px;
    width: auto;
    max-width: 90%;
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(10px);
    border: 1px solid rgba(102, 126, 234, 0.2);
    color: #2d3748;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 0.9em;
    z-index: 12000;
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.15);
    transition: transform 0.6s cubic-bezier(0.18, 0.89, 0.32, 1.28), opacity 0.3s;
    gap: 12px;
    border-radius: 50px;
    /* Rounded pill */
    opacity: 0;
}

.system-notification-banner.show {
    transform: translateX(-50%) translateY(0px);
    opacity: 1;
}

.system-notification-banner.loading .material-symbols-rounded {
    animation: spin 1.5s linear infinite;
    color: var(--primary);
}

@keyframes spin {
    from {
        transform: rotate(0deg);
    }

    to {
        transform: rotate(360deg);
    }
}

.system-notification-banner .material-symbols-rounded {
    font-size: 20px;
}

.system-notification-banner.success {
    border-color: rgba(72, 187, 120, 0.4);
    background: rgba(240, 255, 244, 0.98);
    color: #276749;
}

.system-notification-banner.error {
    border-color: rgba(245, 101, 101, 0.4);
    background: rgba(255, 245, 245, 0.98);
    color: #9b2c2c;
}

/* ============================================================
   SENSOR GUIDE MODAL
   ============================================================ */
.sensor-guide-content {
    max-width: 1000px !important;
    width: 90% !important;
    height: 85vh !important;
    padding: 0 !important;
    display: flex;
    flex-direction: column;
}

.sensor-guide-body {
    display: grid;
    grid-template-columns: 280px 1fr;
    flex: 1;
    overflow: hidden;
}

.sensor-sidebar {
    background: #f8fafc;
    border-right: 1px solid var(--border-color);
    display: flex;
    flex-direction: column;
    padding: 15px;
    min-height: 0;
    /* Allow the flex container to shrink for scrolling */
}

.sensor-search-wrapper {
    display: flex;
    align-items: center;
    background: white;
    border: 1px solid var(--border-color);
    border-radius: 10px;
    padding: 2px 10px;
    margin-bottom: 15px;
}

.sensor-search-wrapper input {
    border: none;
    padding: 8px;
    flex: 1;
    font-size: 0.85em;
    outline: none;
}

.sensor-list {
    flex: 1;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.sensor-item {
    padding: 10px;
    border-radius: 10px;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 12px;
    transition: 0.2s;
    background: white;
    border: 1px solid transparent;
}

.sensor-item:hover {
    background: #edf2f7;
}

.sensor-item.active {
    background: rgba(118, 75, 162, 0.1);
    border-color: rgba(118, 75, 162, 0.3);
}

.sensor-item-icon {
    width: 32px;
    height: 32px;
    background: white;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.05);
}

.sensor-item-icon .material-symbols-rounded {
    font-size: 18px;
    color: var(--secondary);
}

.sensor-item-name {
    font-size: 0.85em;
    font-weight: 700;
    color: #2d3748;
}

.sensor-item-cat {
    font-size: 0.7em;
    color: #718096;
}

/* Detail View */
.sensor-main {
    flex: 1;
    overflow-y: auto;
    padding: 30px;
    background: white;
    min-height: 0;
    /* Allow scrolling inside grid */
}

.sensor-detail-header {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 12px;
    margin-bottom: 25px;
    border-bottom: 2px solid #f1f5f9;
    padding-bottom: 15px;
}

.sensor-detail-header h2 {
    margin: 0;
    font-size: 1.6em;
    font-weight: 800;
    color: #2d3748;
}

.badge {
    padding: 6px 14px;
    border-radius: 10px;
    font-size: 0.75em;
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.badge.sensor {
    background: #ebf8ff;
    color: #3182ce;
}

.badge.motion {
    background: #fff5f5;
    color: #e53e3e;
}

.badge.display {
    background: #f0fff4;
    color: #38a169;
}

.section-title {
    font-size: 1em;
    font-weight: 800;
    margin-top: 0;
    margin-bottom: 12px;
    color: #4a5568;
    display: flex;
    align-items: center;
    gap: 8px;
}

.section-title .material-symbols-rounded {
    color: var(--secondary);
}

.sensor-section {
    margin-bottom: 30px;
}

.sensor-grid-info {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 20px;
}

.sensor-pin-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.85em;
}

.sensor-pin-table th,
.sensor-pin-table td {
    border: 1px solid #edf2f7;
    padding: 8px;
    text-align: left;
}

.sensor-pin-table th {
    background: #f8fafc;
}

.circuit-tip {
    background: #fffaf0;
    border: 1px solid #feebc8;
    padding: 15px;
    border-radius: 10px;
    display: flex;
    gap: 12px;
    align-items: flex-start;
}

.circuit-tip p {
    margin: 0;
    font-size: 0.9em;
    color: #7b341e;
}

.circuit-tip .material-symbols-rounded {
    color: #f6ad55;
}

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

.sensor-code {
    background: #1a202c;
    color: #e2e8f0;
    padding: 20px;
    border-radius: 12px;
    font-family: 'Fira Code', monospace;
    font-size: 0.85em;
    line-height: 1.6;
    overflow-x: auto;
}

.copy-code-btn {
    border: none;
    background: #cbd5e0;
    padding: 5px 12px;
    border-radius: 6px;
    font-size: 0.75em;
    font-weight: 700;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 5px;
}

.copy-code-btn:hover {
    background: #a0aec0;
}

.sensor-empty-state {
    height: 100%;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    color: #a0aec0;
    text-align: center;
}

.sensor-empty-state .material-symbols-rounded {
    font-size: 4em;
    margin-bottom: 15px;
}

/* Library Warning Box */
.library-warning {
    background: #fff5f5;
    border: 1px solid #feb2b2;
    border-radius: 12px;
    padding: 15px;
    margin-bottom: 25px;
    display: flex;
    gap: 15px;
    align-items: center;
}

.library-warning .material-symbols-rounded {
    font-size: 2em;
    color: #e53e3e;
}

.library-warning .warning-text strong {
    display: block;
    color: #c53030;
    font-size: 0.9em;
    margin-bottom: 4px;
}

.library-warning .warning-text p {
    margin: 0;
    font-size: 0.85em;
    color: #742a2a;
}

.badge-group {
    display: flex;
    gap: 8px;
    align-items: center;
}

/* ------------------------------------------------------------
   Console System (Inline Restoration)
   ------------------------------------------------------------ */
.console-box {
    background: #0f172a !important;
    border-radius: 12px !important;
    color: #e2e8f0 !important;
    display: flex !important;
    flex-direction: column !important;
    overflow: hidden !important;
    height: 180px !important;
    border: 1px solid #1e293b !important;
}

.console-header {
    padding: 8px 15px !important;
    background: #020617 !important;
    display: flex !important;
    justify-content: space-between !important;
    align-items: center !important;
    font-size: 0.82em !important;
    font-weight: 700 !important;
    border-bottom: 1px solid #1e293b !important;
}

.console-status {
    display: flex !important;
    align-items: center !important;
    gap: 6px !important;
    font-size: 0.85em !important;
    color: #94a3b8 !important;
}

.status-dot {
    width: 8px !important;
    height: 8px !important;
    border-radius: 50% !important;
}

.status-dot.connected {
    background: #10b981 !important;
    box-shadow: 0 0 8px rgba(16, 185, 129, 0.4) !important;
}

.status-dot.disconnected {
    background: #ef4444 !important;
}

/* Modern Flat Buttons Restoration */
.run-btn,
.stop-btn {
    border: none !important;
    padding: 6px 16px !important;
    border-radius: 8px !important;
    font-weight: 700 !important;
    font-size: 0.88em !important;
    box-shadow: none !important;
    transition: all 0.2s ease !important;
    cursor: pointer !important;
}

.run-btn {
    background: #10b981 !important;
    /* Emerald 500 */
    color: white !important;
}

.run-btn:hover {
    background: #059669 !important;
    filter: brightness(1.1) !important;
    box-shadow: 0 4px 12px rgba(16, 185, 129, 0.2) !important;
}

.stop-btn {
    background: #ef4444 !important;
    /* Red 500 */
    color: white !important;
}

.stop-btn:hover {
    background: #dc2626 !important;
    filter: brightness(1.1) !important;
    box-shadow: 0 4px 12px rgba(239, 68, 68, 0.2) !important;
}

/* Glassmorphism AI Prompt Bar (PILL DESIGN) */
.ai-prompt-container {
    padding: 15px 0 10px 0 !important;
}

.ai-prompt-bar {
    display: flex !important;
    align-items: center !important;
    background: white !important;
    border: 2px solid #e2e8f0 !important;
    border-radius: 50px !important;
    padding: 8px 10px 8px 18px !important;
    gap: 15px !important;
    box-shadow: 0 4px 25px rgba(0, 0, 0, 0.08) !important;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1) !important;
}

.ai-prompt-bar:focus-within {
    border-color: #6366f1 !important;
    box-shadow: 0 8px 30px rgba(99, 102, 241, 0.15) !important;
}

.ai-prompt-bar input {
    flex: 1 !important;
    border: none !important;
    outline: none !important;
    font-size: 1.05em !important;
    color: #1e293b !important;
    background: transparent !important;
    height: 36px !important;
}

.ai-sparkle {
    color: #6366f1 !important;
    font-size: 26px !important;
}

.ai-send-btn-circle {
    background: #6366f1 !important;
    color: white !important;
    border: none !important;
    width: 44px !important;
    height: 44px !important;
    border-radius: 50% !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    cursor: pointer !important;
    transition: all 0.2s ease !important;
}

.ai-send-btn-circle:hover {
    background: #4f46e5 !important;
    transform: scale(1.08) !important;
    box-shadow: 0 4px 12px rgba(99, 102, 241, 0.3) !important;
}

.ai-send-btn-circle .material-symbols-rounded {
    font-size: 24px !important;
}