/**
 * IDTA Sequence Simulation Demo Styles
 * Reference: https://dualsoft.com/aas/submodel/sequenceSimulation
 */

/* ============================================================
   State Colors (R/G/F/H)
   ============================================================ */

.state-R {
    background: linear-gradient(135deg, #e3f2fd 0%, #bbdefb 100%);
    color: #1565c0;
    border: 2px solid #1565c0;
}

.state-G {
    background: linear-gradient(135deg, #e8f5e9 0%, #c8e6c9 100%);
    color: #2e7d32;
    border: 2px solid #2e7d32;
    animation: pulse-going 1s ease-in-out infinite;
}

.state-F {
    background: linear-gradient(135deg, #fff3e0 0%, #ffe0b2 100%);
    color: #e65100;
    border: 2px solid #e65100;
}

.state-H {
    background: linear-gradient(135deg, #f3e5f5 0%, #e1bee7 100%);
    color: #7b1fa2;
    border: 2px solid #7b1fa2;
    animation: pulse-homing 0.8s ease-in-out infinite;
}

@keyframes pulse-going {
    0%, 100% { box-shadow: 0 0 0 0 rgba(46, 125, 50, 0.4); }
    50% { box-shadow: 0 0 0 8px rgba(46, 125, 50, 0); }
}

@keyframes pulse-homing {
    0%, 100% { box-shadow: 0 0 0 0 rgba(123, 31, 162, 0.4); }
    50% { box-shadow: 0 0 0 8px rgba(123, 31, 162, 0); }
}

/* ============================================================
   Demo Container
   ============================================================ */

.demo-container {
    background: linear-gradient(180deg, #0a0a1a 0%, #1a1a2e 100%);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 16px;
    padding: 24px;
    margin: 24px 0;
}

.demo-section {
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 12px;
    padding: 20px;
    margin-bottom: 20px;
}

.demo-section-title {
    font-size: 14px;
    font-weight: 600;
    color: rgba(255, 255, 255, 0.6);
    text-transform: uppercase;
    letter-spacing: 1px;
    margin-bottom: 16px;
    display: flex;
    align-items: center;
    gap: 8px;
}

.demo-section-title::before {
    content: '';
    width: 4px;
    height: 16px;
    background: var(--accent-color, #00f0ff);
    border-radius: 2px;
}

/* ============================================================
   Control Panel
   ============================================================ */

.demo-controls {
    display: flex;
    align-items: center;
    gap: 12px;
    flex-wrap: wrap;
    padding: 16px;
    background: rgba(0, 0, 0, 0.3);
    border-radius: 12px;
    margin-bottom: 20px;
}

.demo-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 10px 20px;
    border: none;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
    min-width: 100px;
}

.demo-btn-start {
    background: linear-gradient(135deg, #10b981 0%, #059669 100%);
    color: white;
}

.demo-btn-start:hover {
    background: linear-gradient(135deg, #34d399 0%, #10b981 100%);
    transform: translateY(-2px);
}

.demo-btn-pause {
    background: linear-gradient(135deg, #f59e0b 0%, #d97706 100%);
    color: white;
}

.demo-btn-pause:hover {
    background: linear-gradient(135deg, #fbbf24 0%, #f59e0b 100%);
    transform: translateY(-2px);
}

.demo-btn-stop {
    background: linear-gradient(135deg, #ef4444 0%, #dc2626 100%);
    color: white;
}

.demo-btn-stop:hover {
    background: linear-gradient(135deg, #f87171 0%, #ef4444 100%);
    transform: translateY(-2px);
}

.demo-btn-reset {
    background: linear-gradient(135deg, #6366f1 0%, #4f46e5 100%);
    color: white;
}

.demo-btn-reset:hover {
    background: linear-gradient(135deg, #818cf8 0%, #6366f1 100%);
    transform: translateY(-2px);
}

.demo-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    transform: none !important;
}

/* Speed Control */
.speed-control {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-left: auto;
    padding: 8px 16px;
    background: rgba(255, 255, 255, 0.05);
    border-radius: 8px;
}

.speed-control label {
    font-size: 13px;
    color: rgba(255, 255, 255, 0.7);
    white-space: nowrap;
}

.speed-slider {
    width: 120px;
    height: 6px;
    -webkit-appearance: none;
    appearance: none;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 3px;
    outline: none;
}

.speed-slider::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 18px;
    height: 18px;
    background: linear-gradient(135deg, #00f0ff 0%, #0080ff 100%);
    border-radius: 50%;
    cursor: pointer;
    transition: transform 0.2s ease;
}

.speed-slider::-webkit-slider-thumb:hover {
    transform: scale(1.2);
}

.speed-value {
    min-width: 50px;
    font-size: 13px;
    font-weight: 600;
    color: #00f0ff;
    text-align: right;
}

/* Status Indicator */
.status-indicator {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 16px;
    background: rgba(255, 255, 255, 0.05);
    border-radius: 8px;
}

.status-dot {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    background: #6b7280;
}

.status-dot.running {
    background: #10b981;
    animation: status-pulse 1s ease-in-out infinite;
}

.status-dot.paused {
    background: #f59e0b;
}

.status-dot.stopped {
    background: #ef4444;
}

@keyframes status-pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.5; }
}

.status-text {
    font-size: 13px;
    font-weight: 600;
    color: rgba(255, 255, 255, 0.8);
}

/* ============================================================
   State Machine Visualization
   ============================================================ */

.state-machine-container {
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 40px 20px;
    overflow-x: auto;
}

.state-machine {
    display: flex;
    align-items: center;
    gap: 24px;
}

.state-node {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    width: 80px;
    height: 80px;
    border-radius: 16px;
    transition: all 0.3s ease;
    position: relative;
}

.state-node-label {
    font-size: 24px;
    font-weight: 700;
}

.state-node-name {
    font-size: 10px;
    margin-top: 4px;
    opacity: 0.8;
}

.state-node.active {
    transform: scale(1.15);
    z-index: 1;
}

.state-arrow {
    display: flex;
    align-items: center;
    color: rgba(255, 255, 255, 0.3);
    font-size: 24px;
}

.state-arrow.active {
    color: #00f0ff;
    animation: arrow-flow 0.5s ease-in-out;
}

@keyframes arrow-flow {
    0% { transform: translateX(-10px); opacity: 0; }
    100% { transform: translateX(0); opacity: 1; }
}

.state-loop {
    position: absolute;
    width: 200px;
    height: 60px;
    border: 2px dashed rgba(255, 255, 255, 0.2);
    border-top: none;
    border-radius: 0 0 100px 100px;
    top: calc(100% + 20px);
    left: 50%;
    transform: translateX(-50%);
}

.state-loop::after {
    content: '↻';
    position: absolute;
    left: -12px;
    top: -8px;
    font-size: 16px;
    color: rgba(255, 255, 255, 0.3);
}

/* ============================================================
   Metrics Dashboard
   ============================================================ */

.metrics-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    gap: 16px;
}

.metric-card {
    background: rgba(0, 0, 0, 0.3);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 12px;
    padding: 20px;
    text-align: center;
    transition: all 0.3s ease;
}

.metric-card:hover {
    border-color: var(--accent-color, #00f0ff);
    transform: translateY(-2px);
}

.metric-label {
    font-size: 12px;
    font-weight: 600;
    color: rgba(255, 255, 255, 0.5);
    text-transform: uppercase;
    letter-spacing: 1px;
    margin-bottom: 8px;
}

.metric-value {
    font-size: 28px;
    font-weight: 700;
    color: white;
    font-family: 'JetBrains Mono', 'Fira Code', monospace;
}

.metric-unit {
    font-size: 14px;
    color: rgba(255, 255, 255, 0.5);
    margin-left: 4px;
}

.metric-trend {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    font-size: 12px;
    margin-top: 8px;
    padding: 4px 8px;
    border-radius: 4px;
}

.metric-trend.up {
    background: rgba(16, 185, 129, 0.2);
    color: #10b981;
}

.metric-trend.down {
    background: rgba(239, 68, 68, 0.2);
    color: #ef4444;
}

/* Clock Display */
.clock-display {
    font-size: 36px;
    font-weight: 700;
    font-family: 'JetBrains Mono', 'Fira Code', monospace;
    color: #00f0ff;
    text-align: center;
    padding: 20px;
    background: rgba(0, 240, 255, 0.1);
    border-radius: 12px;
    border: 1px solid rgba(0, 240, 255, 0.3);
}

/* ============================================================
   Work/Call Grid
   ============================================================ */

.work-grid {
    display: grid;
    gap: 16px;
}

.work-card {
    background: rgba(0, 0, 0, 0.3);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 12px;
    padding: 16px;
    transition: all 0.3s ease;
}

.work-card.state-R { border-left: 4px solid #1565c0; }
.work-card.state-G { border-left: 4px solid #2e7d32; }
.work-card.state-F { border-left: 4px solid #e65100; }
.work-card.state-H { border-left: 4px solid #7b1fa2; }

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

.work-name {
    font-size: 16px;
    font-weight: 600;
    color: white;
}

.work-state-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 700;
}

.call-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.call-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 8px 12px;
    background: rgba(255, 255, 255, 0.03);
    border-radius: 8px;
}

.call-name {
    flex: 1;
    font-size: 13px;
    color: rgba(255, 255, 255, 0.8);
}

.call-state {
    width: 24px;
    height: 24px;
    border-radius: 6px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 11px;
    font-weight: 700;
}

/* ============================================================
   Progress Bar
   ============================================================ */

.progress-bar {
    width: 100%;
    height: 8px;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 4px;
    overflow: hidden;
}

.progress-fill {
    height: 100%;
    background: linear-gradient(90deg, #00f0ff 0%, #0080ff 100%);
    border-radius: 4px;
    transition: width 0.1s linear;
}

.progress-fill.state-G {
    background: linear-gradient(90deg, #10b981 0%, #059669 100%);
}

.progress-fill.state-H {
    background: linear-gradient(90deg, #a855f7 0%, #7c3aed 100%);
}

/* ============================================================
   Event Log
   ============================================================ */

.event-log {
    background: rgba(0, 0, 0, 0.5);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 8px;
    max-height: 300px;
    overflow-y: auto;
}

.event-log::-webkit-scrollbar {
    width: 8px;
}

.event-log::-webkit-scrollbar-track {
    background: rgba(255, 255, 255, 0.05);
    border-radius: 4px;
}

.event-log::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.2);
    border-radius: 4px;
}

.event-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 16px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
    font-size: 13px;
    font-family: 'JetBrains Mono', 'Fira Code', monospace;
}

.event-item:last-child {
    border-bottom: none;
}

.event-time {
    color: rgba(255, 255, 255, 0.4);
    min-width: 80px;
}

.event-type {
    padding: 2px 8px;
    border-radius: 4px;
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
}

.event-type.state { background: rgba(99, 102, 241, 0.3); color: #818cf8; }
.event-type.progress { background: rgba(16, 185, 129, 0.3); color: #34d399; }
.event-type.io { background: rgba(245, 158, 11, 0.3); color: #fbbf24; }
.event-type.cycle { background: rgba(236, 72, 153, 0.3); color: #f472b6; }
.event-type.metric { background: rgba(0, 240, 255, 0.3); color: #00f0ff; }

.event-message {
    flex: 1;
    color: rgba(255, 255, 255, 0.8);
}

/* ============================================================
   Timeline Visualization
   ============================================================ */

.timeline-container {
    position: relative;
    padding: 20px 0;
    overflow-x: auto;
}

.timeline {
    display: flex;
    flex-direction: column;
    gap: 12px;
    min-width: 600px;
}

.timeline-track {
    display: flex;
    align-items: center;
    gap: 8px;
}

.timeline-label {
    width: 120px;
    font-size: 12px;
    color: rgba(255, 255, 255, 0.7);
    text-align: right;
    padding-right: 12px;
}

.timeline-bar {
    flex: 1;
    height: 24px;
    background: rgba(255, 255, 255, 0.05);
    border-radius: 4px;
    position: relative;
    overflow: hidden;
}

.timeline-segment {
    position: absolute;
    height: 100%;
    border-radius: 4px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 10px;
    font-weight: 600;
    color: white;
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.5);
}

.timeline-segment.wt {
    background: linear-gradient(90deg, #6366f1 0%, #4f46e5 100%);
}

.timeline-segment.mt {
    background: linear-gradient(90deg, #10b981 0%, #059669 100%);
}

/* ============================================================
   Snapshot Viewer
   ============================================================ */

.snapshot-viewer {
    background: rgba(0, 0, 0, 0.5);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 8px;
    padding: 16px;
    font-family: 'JetBrains Mono', 'Fira Code', monospace;
    font-size: 12px;
    color: rgba(255, 255, 255, 0.8);
    max-height: 400px;
    overflow-y: auto;
}

.snapshot-key {
    color: #f472b6;
}

.snapshot-string {
    color: #34d399;
}

.snapshot-number {
    color: #fbbf24;
}

.snapshot-boolean {
    color: #818cf8;
}

/* ============================================================
   Filter Buttons
   ============================================================ */

.filter-buttons {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-bottom: 16px;
}

.filter-btn {
    padding: 6px 12px;
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 6px;
    background: transparent;
    color: rgba(255, 255, 255, 0.6);
    font-size: 12px;
    cursor: pointer;
    transition: all 0.2s ease;
}

.filter-btn:hover {
    border-color: rgba(255, 255, 255, 0.4);
    color: white;
}

.filter-btn.active {
    background: var(--accent-color, #00f0ff);
    border-color: var(--accent-color, #00f0ff);
    color: #0a0a1a;
}

/* ============================================================
   Responsive
   ============================================================ */

@media (max-width: 768px) {
    .demo-controls {
        flex-direction: column;
        align-items: stretch;
    }

    .speed-control {
        margin-left: 0;
        justify-content: center;
    }

    .state-machine-container {
        padding: 20px 10px;
    }

    .state-node {
        width: 60px;
        height: 60px;
    }

    .state-node-label {
        font-size: 18px;
    }

    .metrics-grid {
        grid-template-columns: repeat(2, 1fr);
    }

    .metric-value {
        font-size: 22px;
    }
}

/* ============================================================
   Animation Utilities
   ============================================================ */

.fade-in {
    animation: fadeIn 0.3s ease-out;
}

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

.slide-in {
    animation: slideIn 0.3s ease-out;
}

@keyframes slideIn {
    from { opacity: 0; transform: translateX(-20px); }
    to { opacity: 1; transform: translateX(0); }
}

.scale-in {
    animation: scaleIn 0.2s ease-out;
}

@keyframes scaleIn {
    from { opacity: 0; transform: scale(0.9); }
    to { opacity: 1; transform: scale(1); }
}

/* ============================================================
   Page-specific accent colors
   ============================================================ */

.page-simulation { --accent-color: #00f0ff; }
.page-control { --accent-color: #10b981; }
.page-monitoring { --accent-color: #ef4444; }
.page-history { --accent-color: #f59e0b; }
.page-maintenance { --accent-color: #8b5cf6; }

/* ============================================================
   Demo Section Header
   ============================================================ */

.demo-section {
    background: rgba(0, 0, 0, 0.3);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 16px;
    padding: 24px;
    margin-top: 24px;
}

.demo-header {
    text-align: center;
    margin-bottom: 24px;
}

.demo-badge {
    display: inline-block;
    padding: 4px 12px;
    background: linear-gradient(135deg, #00f0ff, #0080ff);
    border-radius: 20px;
    font-size: 10px;
    font-weight: 700;
    color: #0d1117;
    text-transform: uppercase;
    letter-spacing: 1px;
    margin-bottom: 8px;
}

.demo-title {
    display: block;
    font-size: 18px;
    font-weight: 700;
    color: #fff;
    margin-bottom: 4px;
}

.demo-subtitle {
    display: block;
    font-size: 12px;
    color: #8b949e;
}

/* ============================================================
   Control Panel (Page 01)
   ============================================================ */

.control-panel {
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 16px;
    padding: 16px 20px;
    background: rgba(0, 0, 0, 0.4);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 12px;
    margin-bottom: 20px;
}

.control-buttons {
    display: flex;
    gap: 8px;
}

.control-btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 8px 16px;
    border: none;
    border-radius: 8px;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
}

.control-btn .btn-icon {
    font-size: 14px;
}

.control-btn.start { background: #10b981; color: white; }
.control-btn.start:hover { background: #059669; }
.control-btn.pause { background: #f59e0b; color: white; }
.control-btn.pause:hover { background: #d97706; }
.control-btn.stop { background: #ef4444; color: white; }
.control-btn.stop:hover { background: #dc2626; }
.control-btn.reset { background: #6366f1; color: white; }
.control-btn.reset:hover { background: #4f46e5; }

.control-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.speed-control {
    display: flex;
    align-items: center;
    gap: 10px;
}

.speed-control label {
    font-size: 12px;
    color: #8b949e;
}

.speed-control input[type="range"] {
    width: 100px;
    height: 6px;
    -webkit-appearance: none;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 3px;
}

.speed-control input[type="range"]::-webkit-slider-thumb {
    -webkit-appearance: none;
    width: 16px;
    height: 16px;
    background: #00f0ff;
    border-radius: 50%;
    cursor: pointer;
}

#speedValue {
    font-size: 12px;
    font-weight: 600;
    color: #00f0ff;
    min-width: 40px;
}

.status-indicator {
    display: flex;
    align-items: center;
    gap: 8px;
}

.status-dot {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    background: #6b7280;
}

.status-dot.running { background: #10b981; animation: pulse 1s infinite; }
.status-dot.paused { background: #f59e0b; }
.status-dot.stopped { background: #ef4444; }

#statusText {
    font-size: 12px;
    font-weight: 600;
    color: #8b949e;
}

/* ============================================================
   State Machine Visualization (Page 01)
   ============================================================ */

.state-machine-container {
    background: rgba(0, 0, 0, 0.3);
    border-radius: 12px;
    padding: 20px;
    margin-bottom: 20px;
}

.state-machine-title {
    font-size: 13px;
    font-weight: 600;
    color: #8b949e;
    margin-bottom: 16px;
    text-align: center;
}

.state-machine {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 12px;
    flex-wrap: wrap;
}

.state-node {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    width: 80px;
    height: 80px;
    border-radius: 12px;
    transition: all 0.3s ease;
}

.state-node .state-label {
    font-size: 24px;
    font-weight: 700;
}

.state-node .state-name {
    font-size: 10px;
    margin-top: 2px;
}

.state-node .state-desc {
    font-size: 9px;
    opacity: 0.7;
}

.state-node.active {
    transform: scale(1.1);
    box-shadow: 0 0 20px rgba(0, 240, 255, 0.3);
}

.state-arrow {
    font-size: 24px;
    color: #64748b;
}

.state-loop-arrow {
    text-align: center;
    margin-top: 10px;
    position: relative;
}

.loop-label {
    position: absolute;
    bottom: 8px;
    left: 50%;
    transform: translateX(-50%);
    font-size: 10px;
    color: #64748b;
}

/* ============================================================
   Metrics Dashboard (Page 01)
   ============================================================ */

.metrics-dashboard {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 12px;
    margin-bottom: 20px;
}

@media (max-width: 768px) {
    .metrics-dashboard {
        grid-template-columns: repeat(2, 1fr);
    }
}

.metric-card {
    background: rgba(0, 0, 0, 0.4);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 12px;
    padding: 16px;
    display: flex;
    align-items: flex-start;
    gap: 12px;
}

.metric-card.mt { border-left: 3px solid #10b981; }
.metric-card.wt { border-left: 3px solid #6366f1; }
.metric-card.tc { border-left: 3px solid #f59e0b; }
.metric-card.cycle { border-left: 3px solid #ec4899; }

.metric-icon {
    font-size: 20px;
}

.metric-content {
    flex: 1;
}

.metric-label {
    font-size: 11px;
    color: #8b949e;
    margin-bottom: 4px;
}

.metric-value {
    font-size: 24px;
    font-weight: 700;
    color: #fff;
    font-family: 'JetBrains Mono', monospace;
}

.metric-unit {
    font-size: 11px;
    color: #64748b;
    margin-left: 2px;
}

.metric-desc {
    font-size: 9px;
    color: #64748b;
    margin-top: 4px;
}

/* ============================================================
   Progress Section (Page 01)
   ============================================================ */

.progress-section {
    background: rgba(0, 0, 0, 0.3);
    border-radius: 12px;
    padding: 16px;
    margin-bottom: 20px;
}

.progress-title {
    font-size: 13px;
    font-weight: 600;
    color: #8b949e;
    margin-bottom: 12px;
}

.progress-grid {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.progress-item {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.progress-label {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 12px;
}

.work-badge, .call-badge {
    padding: 2px 8px;
    border-radius: 4px;
    font-size: 10px;
    font-weight: 600;
}

.work-badge { background: rgba(16, 185, 129, 0.2); color: #10b981; }
.call-badge { background: rgba(99, 102, 241, 0.2); color: #818cf8; }

.progress-state {
    padding: 2px 6px;
    border-radius: 4px;
    font-size: 10px;
    font-weight: 700;
    margin-left: auto;
}

.progress-bar-container {
    height: 8px;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 4px;
    overflow: hidden;
}

.progress-bar {
    height: 100%;
    border-radius: 4px;
    transition: width 0.3s ease;
}

.progress-bar.work-progress { background: linear-gradient(90deg, #10b981, #059669); }
.progress-bar.call-progress { background: linear-gradient(90deg, #6366f1, #4f46e5); }

/* ============================================================
   Event Log Section
   ============================================================ */

.event-log-section {
    background: rgba(0, 0, 0, 0.3);
    border-radius: 12px;
    padding: 16px;
    margin-bottom: 20px;
}

.event-log-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 12px;
}

.event-log-title {
    font-size: 13px;
    font-weight: 600;
    color: #8b949e;
}

.event-filters {
    display: flex;
    gap: 6px;
}

.filter-btn {
    padding: 4px 10px;
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 6px;
    background: transparent;
    color: #8b949e;
    font-size: 10px;
    cursor: pointer;
    transition: all 0.2s;
}

.filter-btn:hover, .filter-btn.active {
    background: rgba(0, 240, 255, 0.1);
    border-color: rgba(0, 240, 255, 0.3);
    color: #00f0ff;
}

.event-log {
    max-height: 200px;
    overflow-y: auto;
    background: rgba(0, 0, 0, 0.4);
    border-radius: 8px;
}

.event-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px 12px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
    font-size: 11px;
    font-family: 'JetBrains Mono', monospace;
}

.event-item.info .event-type { background: rgba(99, 102, 241, 0.2); color: #818cf8; }
.event-item.success .event-type { background: rgba(16, 185, 129, 0.2); color: #10b981; }
.event-item.warning .event-type { background: rgba(245, 158, 11, 0.2); color: #f59e0b; }
.event-item.error .event-type { background: rgba(239, 68, 68, 0.2); color: #ef4444; }

.event-time {
    color: #64748b;
    min-width: 70px;
}

.event-type {
    padding: 2px 8px;
    border-radius: 4px;
    font-size: 9px;
    font-weight: 600;
}

.event-msg {
    flex: 1;
    color: #b0b0b0;
}

/* ============================================================
   Structure Info Section
   ============================================================ */

.structure-info {
    background: rgba(0, 0, 0, 0.3);
    border-radius: 12px;
    padding: 16px;
    margin-bottom: 20px;
}

.structure-title {
    font-size: 13px;
    font-weight: 600;
    color: #8b949e;
    margin-bottom: 12px;
}

.structure-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 12px;
}

@media (max-width: 768px) {
    .structure-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}

.structure-card {
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 8px;
    padding: 12px;
    text-align: center;
}

.structure-icon {
    font-size: 24px;
    margin-bottom: 8px;
}

.structure-name {
    font-size: 12px;
    font-weight: 700;
    color: #fff;
    margin-bottom: 4px;
}

.structure-desc {
    font-size: 10px;
    color: #8b949e;
    margin-bottom: 8px;
}

.structure-code {
    font-size: 9px;
    font-family: 'JetBrains Mono', monospace;
    color: #00f0ff;
    background: rgba(0, 240, 255, 0.1);
    padding: 4px 8px;
    border-radius: 4px;
    display: inline-block;
}

/* ============================================================
   Semantic ID
   ============================================================ */

.semantic-id {
    text-align: center;
    padding: 12px;
    background: rgba(0, 0, 0, 0.3);
    border-radius: 8px;
}

.semantic-label {
    font-size: 10px;
    color: #8b949e;
    margin-right: 8px;
}

.semantic-id code {
    font-size: 11px;
    font-family: 'JetBrains Mono', monospace;
    color: #00f0ff;
}

/* ============================================================
   HMI Panel (Page 02)
   ============================================================ */

.hmi-panel {
    background: linear-gradient(180deg, #1a1a2e 0%, #16213e 100%);
    border: 2px solid #10b981;
    border-radius: 16px;
    padding: 20px;
    margin-bottom: 20px;
    box-shadow: 0 0 30px rgba(16, 185, 129, 0.2);
}

.hmi-title {
    font-size: 14px;
    font-weight: 700;
    color: #10b981;
    text-align: center;
    margin-bottom: 16px;
    text-transform: uppercase;
    letter-spacing: 2px;
}

.hmi-buttons {
    display: grid;
    grid-template-columns: repeat(6, 1fr);
    gap: 10px;
    margin-bottom: 16px;
}

@media (max-width: 768px) {
    .hmi-buttons {
        grid-template-columns: repeat(3, 1fr);
    }
}

.hmi-btn {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 16px 12px;
    border: 2px solid;
    border-radius: 12px;
    cursor: pointer;
    transition: all 0.2s ease;
    background: rgba(0, 0, 0, 0.3);
}

.hmi-btn .hmi-icon {
    font-size: 24px;
    margin-bottom: 6px;
}

.hmi-btn .hmi-label {
    font-size: 10px;
    font-weight: 700;
    letter-spacing: 1px;
}

.hmi-btn.start { border-color: #10b981; color: #10b981; }
.hmi-btn.start:hover { background: #10b981; color: #0d1117; }
.hmi-btn.stop { border-color: #f59e0b; color: #f59e0b; }
.hmi-btn.stop:hover { background: #f59e0b; color: #0d1117; }
.hmi-btn.estop { border-color: #ef4444; color: #ef4444; }
.hmi-btn.estop:hover { background: #ef4444; color: #fff; }
.hmi-btn.reset { border-color: #6366f1; color: #6366f1; }
.hmi-btn.reset:hover { background: #6366f1; color: #fff; }
.hmi-btn.auto { border-color: #00f0ff; color: #00f0ff; }
.hmi-btn.auto:hover { background: #00f0ff; color: #0d1117; }
.hmi-btn.manual { border-color: #ec4899; color: #ec4899; }
.hmi-btn.manual:hover { background: #ec4899; color: #fff; }

.hmi-status {
    display: flex;
    justify-content: center;
    gap: 24px;
    padding: 12px;
    background: rgba(0, 0, 0, 0.4);
    border-radius: 8px;
}

.hmi-status-item {
    display: flex;
    align-items: center;
    gap: 8px;
}

.status-label {
    font-size: 11px;
    color: #8b949e;
}

.status-value {
    font-size: 12px;
    font-weight: 700;
    color: #10b981;
    padding: 2px 8px;
    background: rgba(16, 185, 129, 0.2);
    border-radius: 4px;
}

.status-value.state-idle { color: #8b949e; background: rgba(139, 148, 158, 0.2); }
.status-value.state-running { color: #10b981; background: rgba(16, 185, 129, 0.2); }
.status-value.state-stopped { color: #f59e0b; background: rgba(245, 158, 11, 0.2); }
.status-value.state-estop { color: #ef4444; background: rgba(239, 68, 68, 0.2); }

/* ============================================================
   Condition Section (Page 02)
   ============================================================ */

.condition-section, .arrow-section, .api-section {
    background: rgba(0, 0, 0, 0.3);
    border-radius: 12px;
    padding: 16px;
    margin-bottom: 20px;
}

.section-title {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 13px;
    font-weight: 600;
    color: #8b949e;
    margin-bottom: 16px;
}

.section-icon {
    font-size: 16px;
}

.condition-tree {
    background: rgba(0, 0, 0, 0.3);
    border-radius: 8px;
    padding: 16px;
}

.condition-node {
    padding: 8px 12px;
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 8px;
    margin-bottom: 8px;
}

.condition-node.root {
    border-color: rgba(16, 185, 129, 0.3);
    background: rgba(16, 185, 129, 0.05);
}

.node-header {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 4px;
}

.node-type {
    padding: 2px 8px;
    border-radius: 4px;
    font-size: 10px;
    font-weight: 700;
    background: rgba(16, 185, 129, 0.2);
    color: #10b981;
}

.node-type.auto { background: rgba(99, 102, 241, 0.2); color: #818cf8; }
.node-type.common { background: rgba(245, 158, 11, 0.2); color: #f59e0b; }
.node-type.trigger { background: rgba(236, 72, 153, 0.2); color: #f472b6; }

.node-name {
    font-size: 12px;
    font-weight: 600;
    color: #fff;
}

.node-status {
    margin-left: auto;
    font-size: 14px;
}

.node-status.true { color: #10b981; }
.node-status.false { color: #ef4444; }
.node-status.evaluating { color: #f59e0b; animation: pulse 1s infinite; }

.node-value {
    font-size: 10px;
    font-family: 'JetBrains Mono', monospace;
    color: #8b949e;
    padding-left: 12px;
}

.condition-children {
    padding-left: 20px;
    margin-top: 12px;
    border-left: 2px dashed rgba(255, 255, 255, 0.1);
}

.condition-legend {
    display: flex;
    justify-content: center;
    gap: 16px;
    margin-top: 12px;
    font-size: 10px;
    color: #8b949e;
}

.legend-item {
    display: flex;
    align-items: center;
    gap: 6px;
}

.legend-dot {
    width: 10px;
    height: 10px;
    border-radius: 3px;
}

.legend-dot.auto { background: #818cf8; }
.legend-dot.common { background: #f59e0b; }
.legend-dot.trigger { background: #f472b6; }

/* ============================================================
   Arrow Flow (Page 02)
   ============================================================ */

.arrow-flow {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 20px;
    overflow-x: auto;
}

.arrow-node {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 12px 16px;
    border-radius: 10px;
    min-width: 80px;
    transition: all 0.3s ease;
}

.arrow-node.start-node {
    background: rgba(16, 185, 129, 0.2);
    border: 2px solid #10b981;
}

.arrow-node.work-node {
    background: rgba(59, 130, 246, 0.2);
    border: 2px solid #3b82f6;
}

.arrow-node.work-node.active {
    background: rgba(16, 185, 129, 0.3);
    border-color: #10b981;
    transform: scale(1.05);
}

.arrow-node.work-node.completed {
    background: rgba(245, 158, 11, 0.2);
    border-color: #f59e0b;
}

.arrow-node.reset-node {
    background: rgba(139, 92, 246, 0.2);
    border: 2px solid #8b5cf6;
}

.arrow-label {
    font-size: 11px;
    font-weight: 700;
    color: #fff;
}

.arrow-type {
    font-size: 9px;
    color: #8b949e;
    margin-top: 2px;
}

.arrow-state {
    margin-top: 6px;
    padding: 2px 8px;
    border-radius: 4px;
    font-size: 10px;
    font-weight: 700;
}

.arrow-connector {
    width: 30px;
    height: 2px;
    background: #64748b;
    position: relative;
}

.arrow-connector::after {
    content: '▶';
    position: absolute;
    right: -8px;
    top: 50%;
    transform: translateY(-50%);
    font-size: 10px;
    color: #64748b;
}

.arrow-connector.active {
    background: #10b981;
}

.arrow-connector.active::after {
    color: #10b981;
}

.predecessor-info {
    margin-top: 16px;
    padding: 12px;
    background: rgba(0, 0, 0, 0.3);
    border-radius: 8px;
}

.pred-title {
    font-size: 11px;
    font-weight: 600;
    color: #8b949e;
    margin-bottom: 8px;
}

.pred-list {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.pred-item {
    padding: 4px 10px;
    background: rgba(99, 102, 241, 0.1);
    border: 1px solid rgba(99, 102, 241, 0.3);
    border-radius: 6px;
    font-size: 10px;
    color: #818cf8;
    font-family: 'JetBrains Mono', monospace;
}

/* ============================================================
   API Tree (Page 02)
   ============================================================ */

.api-tree {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.api-def {
    background: rgba(0, 0, 0, 0.3);
    border-radius: 8px;
    overflow: hidden;
}

.api-def-header {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 10px 14px;
    background: rgba(59, 130, 246, 0.1);
    border-bottom: 1px solid rgba(59, 130, 246, 0.2);
}

.api-icon {
    font-size: 16px;
}

.api-name {
    font-size: 12px;
    font-weight: 600;
    color: #3b82f6;
}

.api-type {
    margin-left: auto;
    padding: 2px 8px;
    background: rgba(59, 130, 246, 0.2);
    border-radius: 4px;
    font-size: 9px;
    color: #60a5fa;
}

.api-calls {
    padding: 8px 14px 8px 32px;
}

.api-call {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 6px 10px;
    margin-bottom: 4px;
    background: rgba(255, 255, 255, 0.02);
    border-radius: 6px;
}

.call-icon {
    font-size: 14px;
}

.call-name {
    font-size: 11px;
    color: #b0b0b0;
}

.call-status {
    margin-left: auto;
    padding: 2px 8px;
    border-radius: 4px;
    font-size: 9px;
    font-weight: 600;
}

.call-status.idle { background: rgba(139, 148, 158, 0.2); color: #8b949e; }
.call-status.running { background: rgba(16, 185, 129, 0.2); color: #10b981; animation: pulse 1s infinite; }
.call-status.complete { background: rgba(245, 158, 11, 0.2); color: #f59e0b; }

.tx-rx-binding {
    margin-top: 16px;
    padding: 12px;
    background: rgba(0, 0, 0, 0.3);
    border-radius: 8px;
}

.binding-title {
    font-size: 11px;
    font-weight: 600;
    color: #8b949e;
    margin-bottom: 8px;
}

.binding-items {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.binding-item {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 10px;
    padding: 6px 10px;
    background: rgba(255, 255, 255, 0.02);
    border-radius: 6px;
}

.tx-label, .rx-label {
    color: #8b949e;
}

.tx-value {
    color: #10b981;
    font-family: 'JetBrains Mono', monospace;
}

.rx-value {
    color: #3b82f6;
    font-family: 'JetBrains Mono', monospace;
}

.binding-arrow {
    color: #64748b;
}

.clear-log-btn {
    padding: 4px 10px;
    border: 1px solid rgba(239, 68, 68, 0.3);
    border-radius: 6px;
    background: transparent;
    color: #ef4444;
    font-size: 10px;
    cursor: pointer;
    transition: all 0.2s;
}

.clear-log-btn:hover {
    background: rgba(239, 68, 68, 0.1);
}

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