/* ===================================================================== */
/* Local icon fallbacks (replaces external Font Awesome) */
/* ===================================================================== */
.fas,
.far,
.fa-solid {
    font-family: inherit;
    font-style: normal;
    font-weight: 600;
}

.fas:before,
.far:before,
.fa-solid:before {
    display: inline-block;
    width: 1.1em;
    text-align: center;
    margin-right: 0.25em;
}

.fa-water:before { content: "💧"; }
.fa-tint:before { content: "💧"; }
.fa-pipe:before { content: "🚰"; }
.fa-cog:before { content: "⚙"; }
.fa-cogs:before { content: "⚙"; }
.fa-bolt:before { content: "⚡"; }
.fa-lightbulb:before { content: "💡"; }
.fa-sun:before { content: "☀"; }
.fa-moon:before { content: "🌙"; }
.fa-question-circle:before { content: "❓"; }
.fa-tools:before { content: "🛠"; }
.fa-keyboard:before { content: "⌨"; }
.fa-download:before { content: "⬇"; }
.fa-upload:before { content: "⬆"; }
.fa-play:before { content: "▶"; }
.fa-power-off:before { content: "⏻"; }
.fa-rocket:before { content: "🚀"; }
.fa-chart-line:before { content: "📈"; }
.fa-exclamation-circle:before { content: "⚠"; }
.fa-exclamation-triangle:before { content: "⚠"; }
.fa-check-circle:before { content: "✔"; }
.fa-project-diagram:before { content: "🧭"; }
.fa-microchip:before { content: "🔌"; }
.fa-tachometer-alt:before { content: "🧭"; }
.fa-bug:before { content: "🐞"; }
.fa-stethoscope:before { content: "🩺"; }
.fa-calculator:before { content: "🧮"; }
.fa-eraser:before { content: "🧽"; }
.fa-list:before { content: "📋"; }
.fa-terminal:before { content: "⌨"; }
/* Electrical Circuit Simulator - Styles */

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

:root {
    --primary-color: #1976D2;
    --secondary-color: #2196F3;
    --success-color: #1976D2;
    --warning-color: #2196F3;
    --danger-color: #1565C0;
    --bg-light: #f5f5f5;
    --bg-dark: #1a1a1a;
    --text-light: #333;
    --text-dark: #e0e0e0;
    --border-light: #ddd;
    --border-dark: #444;
    --sidebar-width: 220px;
    --header-height: 60px;
}

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    overflow: hidden;
}

/* Light Theme */
.light-theme {
    --bg-primary: #ffffff;
    --bg-secondary: var(--bg-light);
    --text-primary: var(--text-light);
    --text-secondary: #666;
    --border-color: var(--border-light);
}

/* Dark Theme */
.dark-theme {
    --bg-primary: #252525;
    --bg-secondary: var(--bg-dark);
    --text-primary: var(--text-dark);
    --text-secondary: #aaa;
    --border-color: var(--border-dark);
}

body {
    background: var(--bg-secondary);
    color: var(--text-primary);
}

/* App Container */
.app-container {
    display: flex;
    flex-direction: column;
    height: 100vh;
    width: 100vw;
}

/* Header */
.header {
    height: var(--header-height);
    background: var(--bg-primary);
    border-bottom: 2px solid var(--primary-color);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 20px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

.app-title {
    font-size: 1.5em;
    color: var(--primary-color);
    display: flex;
    align-items: center;
    gap: 10px;
}

.app-title i {
    font-size: 1.2em;
}

/* Toolbar */
#toolbar {
    display: flex;
    gap: 5px;
    align-items: center;
}

.toolbar-group {
    display: flex;
    gap: 2px;
}

.toolbar-divider {
    width: 1px;
    height: 30px;
    background: var(--border-color);
    margin: 0 8px;
}

.tool-btn, .icon-btn {
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    color: var(--text-primary);
    padding: 8px 12px;
    cursor: pointer;
    transition: all 0.2s;
    border-radius: 4px;
}

.tool-btn:hover, .icon-btn:hover {
    background: var(--secondary-color);
    color: white;
    border-color: var(--secondary-color);
}

.tool-btn.active {
    background: var(--primary-color);
    color: white;
    border-color: var(--primary-color);
}

.icon-btn {
    padding: 8px 10px;
}

.icon-btn.active {
    background: var(--primary-color);
    color: white;
    border-color: var(--primary-color);
}

.icon-btn.sim-running {
    background: linear-gradient(135deg, var(--primary-color), var(--secondary-color));
    color: #fff;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 2px rgba(0, 122, 204, 0.25);
    animation: sim-pulse 1.6s ease-in-out infinite;
}

.icon-btn.sim-running::after {
    content: 'RUN';
    margin-left: 6px;
    font-size: 10px;
    font-weight: 700;
    letter-spacing: 0.5px;
}

@keyframes sim-pulse {
    0% { box-shadow: 0 0 0 2px rgba(0, 122, 204, 0.25); }
    50% { box-shadow: 0 0 0 6px rgba(0, 122, 204, 0.12); }
    100% { box-shadow: 0 0 0 2px rgba(0, 122, 204, 0.25); }
}

.standard-select {
    background: var(--bg-secondary);
    color: var(--text-primary);
    border: 1px solid var(--border-color);
    padding: 6px 10px !important;
    border-radius: 4px;
    cursor: pointer;
    font-size: 0.9em;
    font-weight: 600;
}

.standard-select:focus {
    outline: none;
    border-color: var(--secondary-color);
}

/* Main Content */
.main-content {
    display: flex;
    flex: 1;
    overflow: hidden;
}

/* Sidebars */
.sidebar {
    width: var(--sidebar-width);
    background: var(--bg-primary);
    border-right: 1px solid var(--border-color);
    overflow-y: auto;
    display: none;
    flex-direction: column;
    transition: all 0.3s ease;
}

.sidebar.visible {
    display: flex;
}

.right-sidebar {
    border-right: none;
    border-left: 1px solid var(--border-color);
}

.panel {
    margin: 10px;
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: 6px;
}

.panel-header {
    background: var(--primary-color);
    color: white;
    padding: 12px;
    font-weight: bold;
    border-radius: 6px 6px 0 0;
}

/* Component Panel - Category Tabs */
.category-tabs {
    display: flex;
    background: var(--bg-secondary);
    border-bottom: 2px solid var(--border-color);
}

.category-tab {
    flex: 1;
    padding: 12px 8px;
    background: var(--bg-primary);
    border: none;
    border-bottom: 3px solid transparent;
    cursor: pointer;
    font-size: 0.85em;
    font-weight: 600;
    color: var(--text-secondary);
    transition: all 0.3s;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.category-tab:hover {
    background: var(--bg-secondary);
    color: var(--text-primary);
}

.category-tab.active {
    background: var(--bg-primary);
    color: var(--primary-color);
    border-bottom-color: var(--primary-color);
}

.main-category-content {
    display: none;
}

.main-category-content.active {
    display: block;
}

/* Component Panel */
.component-list {
    padding: 0;
    overflow-y: auto;
    max-height: calc(100vh - 180px);
}

/* Main Category Group (ELECTRICAL / ELECTRONICS) */
.main-category-group {
    margin-bottom: 4px;
    border-bottom: 2px solid var(--primary-color);
}

.main-category-header {
    background: linear-gradient(135deg, var(--primary-color) 0%, #0D47A1 100%);
    color: white;
    padding: 10px 12px;
    font-weight: bold;
    font-size: 0.85em;
    text-transform: uppercase;
    letter-spacing: 1px;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 8px;
    transition: all 0.3s;
}

.main-category-header:hover {
    background: linear-gradient(135deg, #0D47A1 0%, var(--primary-color) 100%);
    transform: translateX(3px);
}

.main-category-title {
    flex: 1;
    font-size: 0.9em;
}

.main-category-content {
    display: block;
    background: var(--bg-secondary);
}

/* Category within main group */
.component-category {
    margin-bottom: 0;
    border-bottom: 1px solid var(--border-color);
}

.category-header {
    background: var(--secondary-color);
    color: white;
    padding: 8px 12px;
    font-weight: 600;
    font-size: 0.75em;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    border-left: 3px solid var(--primary-color);
    display: flex;
    align-items: center;
    gap: 6px;
    cursor: pointer;
    transition: all 0.2s;
}

.category-header:hover {
    background: var(--primary-color);
    padding-left: 16px;
}

.category-name {
    flex: 1;
}

.component-count {
    font-size: 0.85em;
    opacity: 0.7;
}

.collapse-icon {
    font-size: 0.7em;
    transition: transform 0.2s;
    min-width: 12px;
}

.category-content {
    background: var(--bg-primary);
}

.category-symbol {
    font-size: 1.1em;
}

.component-list-item {
    display: flex;
    align-items: center;
    padding: 6px 8px;
    background: var(--bg-primary);
    border-bottom: 1px solid var(--border-color);
    cursor: pointer;
    transition: all 0.2s;
    gap: 8px;
    font-size: 0.85em;
}

.component-list-item:hover {
    background: var(--secondary-color);
    color: white;
    padding-left: 12px;
    border-left: 3px solid var(--primary-color);
}

.component-list-item.clicked {
    background: var(--primary-color);
    color: white;
}

.component-symbol {
    font-size: 1.1em;
    font-weight: bold;
    min-width: 30px;
    text-align: center;
    font-family: 'Courier New', monospace;
}

.component-name {
    font-size: 0.8em;
    flex: 1;
    text-transform: capitalize;
}

/* ========== TREE VIEW COMPONENT PANEL ========== */
.component-list.tree-view {
    padding: 0;
    overflow-y: auto;
    max-height: calc(100vh - 180px);
}

.tree-root {
    list-style: none;
    margin: 0;
    padding: 0;
}

.tree-item {
    list-style: none;
    margin: 0;
    padding: 0;
}

.tree-branch {
    border-bottom: 1px solid var(--border-color);
}

.tree-branch-header {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 10px 12px;
    background: var(--secondary-color);
    color: white;
    font-weight: 600;
    font-size: 0.85em;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    cursor: pointer;
    transition: all 0.2s ease;
    border-left: 4px solid var(--primary-color);
}

.tree-branch-header:hover {
    background: var(--primary-color);
    padding-left: 16px;
}

.tree-toggle {
    display: inline-flex;
    align-items: center;
    width: 16px;
    height: 16px;
    font-size: 0.7em;
    transition: transform 0.2s ease;
    cursor: pointer;
}

.tree-toggle.open {
    transform: rotate(90deg);
}

.tree-icon {
    font-size: 1.2em;
    display: inline-flex;
    align-items: center;
}

.tree-label {
    flex: 1;
    font-size: 0.9em;
}

.tree-count {
    font-size: 0.75em;
    opacity: 0.8;
    background: rgba(0, 0, 0, 0.2);
    padding: 2px 6px;
    border-radius: 3px;
}

.tree-children {
    list-style: none;
    margin: 0;
    padding: 0;
    background: var(--bg-primary);
    border-left: 2px solid var(--primary-color);
    display: none;
}

.tree-leaf {
    border-bottom: 1px solid var(--border-color);
    margin: 0;
    padding: 0;
}

.tree-leaf-content {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px 12px 8px 24px;
    background: var(--bg-primary);
    color: var(--text-color);
    font-size: 0.85em;
    cursor: pointer;
    transition: all 0.2s ease;
}

.tree-leaf-content:hover {
    background: var(--secondary-color);
    color: white;
    padding-left: 32px;
    border-left: 3px solid var(--primary-color);
    margin-left: -1px;
}

.tree-leaf-icon {
    font-size: 0.9em;
    font-weight: bold;
    display: inline-flex;
    align-items: center;
    width: 16px;
    text-align: center;
}

.tree-leaf-label {
    font-size: 0.85em;
    flex: 1;
}

/* Properties Panel */
.properties-content, .analysis-content {
    padding: 15px;
}

.no-selection {
    text-align: center;
    color: var(--text-secondary);
    padding: 20px;
}

.property-group {
    margin-bottom: 15px;
}

.property-group h4 {
    color: var(--primary-color);
    margin-bottom: 10px;
}

.property-group label {
    display: block;
    margin-bottom: 5px;
    font-size: 0.9em;
    color: var(--text-secondary);
}

.property-group input,
.property-group select {
    width: 100%;
    padding: 8px;
    border: 1px solid var(--border-color);
    border-radius: 4px;
    background: var(--bg-primary);
    color: var(--text-primary);
    font-size: 0.9em;
}

.property-group input[readonly] {
    background: var(--bg-secondary);
    cursor: not-allowed;
}

/* Analysis Panel */
.analysis-mode {
    margin-bottom: 15px;
}

.analysis-results {
    margin-top: 15px;
}

.analysis-report h4, .analysis-report h5 {
    color: var(--primary-color);
    margin: 10px 0 5px 0;
}

.results-list {
    list-style: none;
    padding: 0;
    margin: 10px 0;
}

.results-list li {
    padding: 6px 10px;
    background: var(--bg-secondary);
    border-left: 3px solid var(--secondary-color);
    margin-bottom: 4px;
    font-family: 'Courier New', monospace;
    font-size: 0.9em;
}

/* Canvas Area */
.canvas-area {
    flex: 1;
    display: flex;
    flex-direction: column;
    position: relative;
}

.canvas-container {
    flex: 1;
    position: relative;
    overflow: hidden;
}

#mainCanvas {
    width: 100%;
    height: 100%;
    cursor: default;
    display: block;
}

.canvas-info {
    background: var(--bg-primary);
    border-top: 1px solid var(--border-color);
    padding: 8px 15px;
    display: flex;
    gap: 20px;
    font-size: 0.85em;
    color: var(--text-secondary);
}

/* Modal / Welcome Landing Page */
.modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    animation: fadeIn 0.4s ease-out;
}

@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

.modal.hidden {
    display: none;
}

.modal-content {
    background: rgba(255, 255, 255, 0.98);
    border-radius: 20px;
    padding: 50px;
    max-width: 900px;
    width: 90%;
    max-height: 90vh;
    overflow-y: auto;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.4);
    animation: slideUp 0.5s ease-out;
}

@keyframes slideUp {
    from {
        opacity: 0;
        transform: translateY(50px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.dark-theme .modal-content {
    background: rgba(37, 37, 37, 0.98);
}

.modal-content h2 {
    color: #667eea;
    font-size: 2.5em;
    margin-bottom: 15px;
    display: flex;
    align-items: center;
    gap: 15px;
    font-weight: 700;
    text-align: center;
    justify-content: center;
}

.modal-content h2 i {
    font-size: 1.2em;
    animation: pulse 2s infinite;
}

@keyframes pulse {
    0%, 100% { transform: scale(1); }
    50% { transform: scale(1.1); }
}

.modal-content > p {
    text-align: center;
    font-size: 1.2em;
    color: #666;
    margin-bottom: 35px;
    line-height: 1.6;
}

.dark-theme .modal-content > p {
    color: #aaa;
}

.welcome-info {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 25px;
    margin: 30px 0;
}

.info-section {
    background: linear-gradient(135deg, #f5f7fa 0%, #c3cfe2 100%);
    padding: 25px;
    border-radius: 15px;
    transition: all 0.3s;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.1);
}

.dark-theme .info-section {
    background: linear-gradient(135deg, #2d2d2d 0%, #1a1a1a 100%);
}

.info-section:hover {
    transform: translateY(-5px);
    box-shadow: 0 8px 25px rgba(102, 126, 234, 0.3);
}

.info-section h3 {
    color: #667eea;
    font-size: 1.3em;
    margin-bottom: 15px;
    display: flex;
    align-items: center;
    gap: 10px;
    font-weight: 600;
}

.info-section h3 i {
    font-size: 1.4em;
}

.info-section ul {
    list-style: none;
    padding: 0;
}

.info-section li {
    padding: 10px 0;
    padding-left: 25px;
    position: relative;
    color: #555;
    line-height: 1.5;
    font-size: 0.95em;
}

.dark-theme .info-section li {
    color: #bbb;
}

.info-section li:before {
    content: "✓";
    position: absolute;
    left: 0;
    color: #4CAF50;
    font-weight: bold;
    font-size: 1.2em;
}

kbd {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border: none;
    border-radius: 6px;
    padding: 4px 10px;
    font-family: 'Courier New', monospace;
    font-size: 0.85em;
    font-weight: bold;
    box-shadow: 0 2px 8px rgba(102, 126, 234, 0.3);
    display: inline-block;
    margin: 0 2px;
}

.primary-btn {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border: none;
    padding: 18px 50px;
    border-radius: 50px;
    cursor: pointer;
    font-size: 1.2em;
    font-weight: bold;
    margin-top: 30px;
    transition: all 0.3s;
    box-shadow: 0 8px 20px rgba(102, 126, 234, 0.4);
    text-transform: uppercase;
    letter-spacing: 1px;
    display: block;
    margin-left: auto;
    margin-right: auto;
}

.primary-btn:hover {
    transform: translateY(-3px);
    box-shadow: 0 12px 30px rgba(102, 126, 234, 0.6);
}

.primary-btn:active {
    transform: translateY(-1px);
}

/* Toast Messages */
.toast {
    position: fixed;
    bottom: 20px;
    right: 20px;
    background: var(--bg-primary);
    color: var(--text-primary);
    padding: 15px 20px;
    border-radius: 6px;
    box-shadow: 0 4px 12px rgba(0,0,0,0.2);
    border-left: 4px solid var(--secondary-color);
    z-index: 2000;
    opacity: 0;
    transform: translateY(20px);
    transition: all 0.3s;
}

.toast.show {
    opacity: 1;
    transform: translateY(0);
}

.toast-success { border-left-color: var(--success-color); }
.toast-error { border-left-color: var(--danger-color); }
.toast-warning { border-left-color: var(--warning-color); }
.toast-info { border-left-color: var(--secondary-color); }

/* Scrollbar Styling */
::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}

::-webkit-scrollbar-track {
    background: var(--bg-secondary);
}

::-webkit-scrollbar-thumb {
    background: var(--border-color);
    border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
    background: var(--text-secondary);
}

/* Diagnostics Modal Styles */
.diagnostics-modal {
    max-width: 1000px;
    max-height: 85vh;
}

.diagnostics-modal .modal-close {
    position: absolute;
    top: 20px;
    right: 20px;
    font-size: 30px;
    cursor: pointer;
    color: #666;
    transition: color 0.3s;
}

.diagnostics-modal .modal-close:hover {
    color: #000;
}

.dark-theme .diagnostics-modal .modal-close {
    color: #aaa;
}

.dark-theme .diagnostics-modal .modal-close:hover {
    color: #fff;
}

.diagnostics-status {
    text-align: center;
    padding: 20px;
    border-radius: 10px;
    margin: 20px 0;
    font-weight: bold;
}

.diagnostics-status.good {
    background: linear-gradient(135deg, #4CAF50, #45a049);
    color: white;
}

.diagnostics-status.fair {
    background: linear-gradient(135deg, #FF9800, #f57c00);
    color: white;
}

.diagnostics-status.poor {
    background: linear-gradient(135deg, #F44336, #e53935);
    color: white;
}

.diagnostics-summary {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 15px;
    margin: 20px 0;
}

.stat-box {
    background: var(--bg-secondary);
    border: 2px solid var(--border-color);
    border-radius: 8px;
    padding: 15px;
    text-align: center;
}

.stat-box.good {
    border-color: #4CAF50;
}

.stat-box.warning {
    border-color: #FF9800;
}

.stat-box.error {
    border-color: #F44336;
}

.stat-value {
    font-size: 32px;
    font-weight: bold;
    margin-bottom: 5px;
}

.stat-label {
    font-size: 12px;
    color: var(--text-secondary);
    text-transform: uppercase;
}

.diagnostics-issues,
.diagnostics-recommendations {
    margin: 25px 0;
}

.diagnostics-issues h3,
.diagnostics-recommendations h3 {
    color: var(--primary-color);
    margin-bottom: 15px;
    display: flex;
    align-items: center;
    gap: 10px;
}

.issue-item,
.recommendation-item {
    background: var(--bg-secondary);
    border-left: 4px solid #666;
    border-radius: 5px;
    padding: 15px;
    margin: 10px 0;
}

.issue-item.error {
    border-left-color: #F44336;
}

.issue-item.warning {
    border-left-color: #FF9800;
}

.issue-item.info {
    border-left-color: #2196F3;
}

.recommendation-item.high {
    border-left-color: #F44336;
}

.recommendation-item.medium {
    border-left-color: #FF9800;
}

.recommendation-item.low {
    border-left-color: #4CAF50;
}

.issue-header,
.rec-header {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 8px;
}

.issue-number,
.rec-number {
    background: var(--primary-color);
    color: white;
    width: 24px;
    height: 24px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 12px;
    font-weight: bold;
}

.issue-severity,
.rec-priority {
    background: var(--bg-primary);
    padding: 3px 8px;
    border-radius: 4px;
    font-size: 11px;
    font-weight: bold;
    text-transform: uppercase;
}

.issue-severity {
    color: #F44336;
}

.issue-component {
    font-weight: 600;
    color: var(--text-primary);
}

.issue-message,
.rec-message {
    margin: 8px 0;
    color: var(--text-primary);
}

.issue-recommendation,
.rec-details {
    margin-top: 8px;
    padding: 8px;
    background: rgba(0, 0, 0, 0.05);
    border-radius: 4px;
    font-size: 13px;
    color: var(--text-secondary);
}

.dark-theme .issue-recommendation,
.dark-theme .rec-details {
    background: rgba(255, 255, 255, 0.05);
}

.no-issues {
    text-align: center;
    padding: 40px;
    font-size: 18px;
    color: #4CAF50;
}

.no-issues i {
    font-size: 48px;
    display: block;
    margin-bottom: 15px;
}

.modal-actions {
    text-align: center;
    margin-top: 30px;
    padding-top: 20px;
    border-top: 1px solid var(--border-color);
}

.modal-actions .btn {
    padding: 12px 30px;
    font-size: 16px;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    font-weight: 600;
    transition: all 0.3s;
}

.modal-actions .btn-primary {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
}

.modal-actions .btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(102, 126, 234, 0.4);
}

/* Responsive Design */
@media (max-width: 1200px) {
    .sidebar {
        width: 240px;
    }
}

@media (max-width: 968px) {
    .diagnostics-summary {
        grid-template-columns: repeat(2, 1fr);
    }
    
    .sidebar {
        position: absolute;
        height: calc(100vh - var(--header-height));
        z-index: 100;
        transform: translateX(-100%);
        transition: transform 0.3s;
    }
    
    .sidebar.open {
        transform: translateX(0);
    }
    
    .right-sidebar {
        transform: translateX(100%);
    }
    
    .right-sidebar.open {
        transform: translateX(0);
    }
}

@media (max-width: 600px) {
    .diagnostics-summary {
        grid-template-columns: 1fr;
    }
}

/* Wire Feedback Animations */
@keyframes slideDown {
    from {
        opacity: 0;
        transform: translateX(-50%) translateY(-20px);
    }
    to {
        opacity: 1;
        transform: translateX(-50%) translateY(0);
    }
}

@keyframes slideUp {
    from {
        opacity: 1;
        transform: translateX(-50%) translateY(0);
    }
    to {
        opacity: 0;
        transform: translateX(-50%) translateY(-20px);
    }
}

.wire-feedback {
    pointer-events: none;
    white-space: nowrap;
}

/* Floating Windows */
.floating-window {
    position: fixed;
    top: 100px;
    right: 100px;
    width: 400px;
    max-height: 600px;
    background: var(--bg-primary);
    border: 2px solid var(--primary-color);
    border-radius: 8px;
    box-shadow: 0 10px 40px rgba(0,0,0,0.3);
    z-index: 10000;
    display: flex;
    flex-direction: column;
}

.floating-header {
    background: var(--primary-color);
    color: white;
    padding: 12px 15px;
    border-radius: 6px 6px 0 0;
    display: flex;
    align-items: center;
    justify-content: space-between;
    cursor: move;
    user-select: none;
}

.floating-header h3 {
    margin: 0;
    font-size: 1.1em;
    display: flex;
    align-items: center;
    gap: 8px;
}

.floating-close {
    background: transparent;
    border: none;
    color: white;
    font-size: 24px;
    cursor: pointer;
    padding: 0;
    width: 30px;
    height: 30px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 4px;
}

.floating-close:hover {
    background: rgba(255,255,255,0.2);
}

.floating-content {
    padding: 15px;
    overflow-y: auto;
    max-height: 500px;
}

.help-section {
    margin-bottom: 20px;
}

.help-section h4 {
    color: var(--primary-color);
    font-size: 1em;
    margin-bottom: 10px;
    display: flex;
    align-items: center;
    gap: 8px;
}

.help-section ul {
    list-style: none;
    padding: 0;
    margin: 0;
}

.help-section li {
    padding: 5px 0;
    padding-left: 20px;
    position: relative;
    font-size: 0.9em;
}

.help-section li:before {
    content: "•";
    position: absolute;
    left: 5px;
    color: var(--primary-color);
}

/* Calculator Window */
.calculator-window {
    width: 350px;
}

.calc-input-group {
    margin: 10px 0;
}

.calc-input-group label {
    display: block;
    margin-bottom: 5px;
    font-weight: bold;
    color: var(--text-primary);
}

.calc-input-group input {
    width: 100%;
    padding: 8px;
    border: 1px solid var(--border-color);
    border-radius: 4px;
    background: var(--bg-secondary);
    color: var(--text-primary);
}

.calc-result {
    background: var(--primary-color);
    color: white;
    padding: 15px;
    border-radius: 6px;
    margin-top: 15px;
    font-size: 1.2em;
    font-weight: bold;
    text-align: center;
}

.calc-buttons {
    display: flex;
    gap: 10px;
    margin-top: 15px;
}

.calc-btn {
    flex: 1;
    padding: 10px;
    background: var(--secondary-color);
    color: white;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    font-weight: bold;
}

.calc-btn:hover {
    background: var(--primary-color);
}

/* Oscilloscope Panel */
.scope-panel {
    background: var(--bg-primary);
    border-radius: 6px;
}

.scope-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 10px;
    border-bottom: 1px solid var(--border-color);
}

.scope-canvas {
    width: 100%;
    height: 200px;
    background: #000;
    border-radius: 4px;
}

.scope-controls {
    padding: 10px;
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px;
}

/* Meters */
.meter-display {
    background: var(--bg-secondary);
    border: 2px solid var(--primary-color);
    border-radius: 6px;
    padding: 10px;
    margin: 10px 0;
    text-align: center;
}

.meter-value {
    font-size: 1.5em;
    font-weight: bold;
    color: var(--primary-color);
}

.meter-unit {
    font-size: 0.9em;
    color: var(--text-secondary);
}

.calc-section {
    margin-bottom: 15px;
}

.calc-section h4 {
    color: var(--primary-color);
    margin-bottom: 10px;
    font-size: 0.95em;
}

/* Component List Scrolling */
.component-list::-webkit-scrollbar {
    width: 6px;
}

.component-list::-webkit-scrollbar-track {
    background: var(--bg-secondary);
}

.component-list::-webkit-scrollbar-thumb {
    background: var(--primary-color);
    border-radius: 3px;
}

/* Category Symbol Styling */
.category-symbol {
    font-size: 1em;
}

/* Improved Button Styling */
.tool-btn i {
    margin-right: 0;
}

.tool-btn:active {
    transform: scale(0.95);
}

/* ============================================ */
/* PLC CONTROL PANEL - PROFESSIONAL STYLING */
/* ============================================ */

.plc-control-panel {
    position: fixed;
    right: 20px;
    top: 100px;
    width: 650px;
    max-height: 70vh;
    background: var(--bg-primary);
    border: 2px solid var(--primary-color);
    border-radius: 8px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.3);
    z-index: 1000;
    display: none;
    overflow: hidden;
    font-family: 'Segoe UI', sans-serif;
}

.plc-control-panel .panel-header:hover {
    background: linear-gradient(135deg, var(--primary-color), var(--secondary-color));
}

.plc-control-panel .panel-header {
    background: var(--primary-color);
    color: white;
    padding: 12px 15px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 1px solid rgba(255, 255, 255, 0.2);
}

.plc-control-panel .panel-header h3 {
    font-size: 1.1em;
    margin: 0;
    display: flex;
    align-items: center;
    gap: 8px;
}

.plc-control-panel .close-btn {
    background: rgba(255, 255, 255, 0.2);
    border: none;
    color: white;
    width: 30px;
    height: 30px;
    border-radius: 4px;
    cursor: pointer;
    font-size: 1.2em;
    transition: background 0.2s;
}

.plc-control-panel .close-btn:hover {
    background: rgba(255, 255, 255, 0.3);
}

.plc-control-panel .panel-tabs {
    display: flex;
    background: var(--bg-secondary);
    border-bottom: 1px solid var(--border-color);
}

.plc-control-panel .tab-btn {
    flex: 1;
    padding: 10px 15px;
    background: transparent;
    border: none;
    color: var(--text-primary);
    cursor: pointer;
    font-size: 0.9em;
    transition: all 0.2s;
    border-bottom: 2px solid transparent;
}

.plc-control-panel .tab-btn:hover {
    background: rgba(25, 118, 210, 0.1);
}

.plc-control-panel .tab-btn.active {
    background: var(--bg-primary);
    color: var(--primary-color);
    border-bottom-color: var(--primary-color);
    font-weight: 600;
}

.plc-control-panel .panel-content {
    height: calc(70vh - 200px);
    overflow-y: auto;
    padding: 15px;
}

.plc-control-panel .tab-content {
    display: none;
}

.plc-control-panel .tab-content.active {
    display: block;
}

/* PLC List Styling */
.plc-list, .io-modules-list {
    display: flex;
    flex-direction: column;
    gap: 15px;
}

.plc-item, .io-module-item {
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: 6px;
    padding: 15px;
    transition: box-shadow 0.2s;
}

.plc-item:hover, .io-module-item:hover {
    box-shadow: 0 2px 8px rgba(25, 118, 210, 0.15);
}

.plc-header, .module-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 12px;
    padding-bottom: 10px;
    border-bottom: 1px solid var(--border-color);
}

.plc-header h4, .module-header h4 {
    margin: 0;
    color: var(--text-primary);
    font-size: 1.05em;
    display: flex;
    align-items: center;
    gap: 8px;
}

.status-badge {
    padding: 4px 12px;
    border-radius: 12px;
    font-size: 0.75em;
    font-weight: 600;
    color: white;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.module-type {
    padding: 4px 10px;
    background: var(--primary-color);
    color: white;
    border-radius: 4px;
    font-size: 0.8em;
    font-weight: 600;
}

.plc-specs, .module-info {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 8px 15px;
    margin-bottom: 12px;
}

.spec-row, .module-info div {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 6px 0;
    font-size: 0.85em;
}

.spec-row span, .module-info span {
    color: var(--text-secondary);
}

.spec-row strong, .module-info strong {
    color: var(--text-primary);
    font-weight: 600;
}

.io-summary, .io-count {
    display: flex;
    justify-content: space-around;
    gap: 15px;
    padding-top: 10px;
    border-top: 1px solid var(--border-color);
}

.io-count {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 15px;
    background: rgba(25, 118, 210, 0.1);
    border-radius: 4px;
    font-size: 0.9em;
    font-weight: 500;
}

.io-count i {
    color: var(--primary-color);
}

/* Channel States Grid */
.channel-states {
    margin-top: 15px;
}

.channel-grid {
    display: grid;
    grid-template-columns: repeat(8, 1fr);
    gap: 6px;
}

.channel-indicator {
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 8px 4px;
    background: var(--bg-primary);
    border: 1px solid var(--border-color);
    border-radius: 4px;
    font-size: 0.75em;
}

.channel-indicator span {
    margin-bottom: 4px;
    color: var(--text-secondary);
    font-weight: 600;
}

.channel-indicator .led {
    width: 12px;
    height: 12px;
    border-radius: 50%;
    background: #ddd;
    transition: all 0.2s;
}

.channel-indicator.active .led {
    background: #2ecc71;
    box-shadow: 0 0 8px #2ecc71;
}

.channel-indicator.inactive .led {
    background: #95a5a6;
}

/* No Data Message */
.no-data {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 60px 20px;
    text-align: center;
    color: var(--text-secondary);
}

.no-data i {
    font-size: 3em;
    margin-bottom: 15px;
    color: var(--primary-color);
    opacity: 0.5;
}

.no-data p {
    font-size: 1.1em;
    margin-bottom: 8px;
    color: var(--text-primary);
}

.no-data small {
    font-size: 0.85em;
    color: var(--text-secondary);
}

/* Panel Controls */
.panel-controls {
    display: flex;
    gap: 10px;
    padding: 12px 15px;
    background: var(--bg-secondary);
    border-top: 1px solid var(--border-color);
}

.control-btn {
    flex: 1;
    padding: 10px 15px;
    border: none;
    border-radius: 4px;
    font-size: 0.9em;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
}

.start-btn {
    background: #2ecc71;
    color: white;
}

.start-btn:hover {
    background: #27ae60;
}

.stop-btn {
    background: #e74c3c;
    color: white;
}

.stop-btn:hover {
    background: #c0392b;
}

.reset-btn {
    background: #f39c12;
    color: white;
}

.reset-btn:hover {
    background: #d68910;
}

/* Scrollbar Styling for PLC Panel */
.plc-control-panel .panel-content::-webkit-scrollbar {
    width: 8px;
}

.plc-control-panel .panel-content::-webkit-scrollbar-track {
    background: var(--bg-secondary);
}

.plc-control-panel .panel-content::-webkit-scrollbar-thumb {
    background: var(--primary-color);
    border-radius: 4px;
}

.plc-control-panel .panel-content::-webkit-scrollbar-thumb:hover {
    background: var(--secondary-color);
}

/* ============================================ */
/* CIRCUIT ANALYSIS PANEL */
/* ============================================ */

.circuit-analysis-panel {
    position: fixed;
    left: 20px;
    top: 100px;
    width: 600px;
    max-height: 70vh;
    background: var(--bg-primary);
    border: 2px solid var(--primary-color);
    border-radius: 8px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.3);
    z-index: 1000;
    display: none;
    overflow: hidden;
    font-family: 'Segoe UI', sans-serif;
}

.circuit-analysis-panel .panel-header {
    background: var(--primary-color);
    color: white;
    padding: 12px 15px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 1px solid rgba(255, 255, 255, 0.2);
}

.circuit-analysis-panel .panel-header:hover {
    background: linear-gradient(135deg, var(--primary-color), var(--secondary-color));
}

.circuit-analysis-panel .panel-header h3 {
    font-size: 1.1em;
    margin: 0;
    display: flex;
    align-items: center;
    gap: 8px;
}

.analysis-summary {
    display: grid;
    grid-template-columns: 1fr;
    gap: 15px;
    padding: 15px;
}

.summary-card {
    display: flex;
    align-items: center;
    gap: 15px;
    padding: 15px;
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: 6px;
    transition: box-shadow 0.2s;
}

.summary-card:hover {
    box-shadow: 0 2px 8px rgba(25, 118, 210, 0.15);
}

.summary-icon {
    font-size: 2em;
    color: var(--primary-color);
}

.summary-info h4 {
    margin: 0 0 5px 0;
    color: var(--text-primary);
    font-size: 1.1em;
}

.summary-info p {
    margin: 0;
    color: var(--text-secondary);
    font-size: 0.85em;
}

.data-table {
    width: 100%;
    border-collapse: collapse;
    margin: 15px 0;
}

.data-table thead {
    background: var(--bg-secondary);
}

.data-table th {
    padding: 12px;
    text-align: left;
    font-weight: 600;
    color: var(--text-primary);
    border-bottom: 2px solid var(--border-color);
}

.data-table td {
    padding: 10px 12px;
    border-bottom: 1px solid var(--border-color);
    color: var(--text-primary);
}

.data-table tbody tr:hover {
    background: rgba(25, 118, 210, 0.05);
}

.warning-section {
    margin: 15px 0;
    padding: 15px;
    background: rgba(255, 102, 0, 0.1);
    border-left: 4px solid #ff6600;
    border-radius: 4px;
}

.warning-section h4 {
    margin: 0 0 10px 0;
    color: #ff6600;
    font-size: 1em;
}

.warning-section ul {
    margin: 0;
    padding-left: 20px;
    color: var(--text-primary);
}

.warning-section li {
    margin: 5px 0;
}
