/* --- Right Sidebar Styles --- */
#right-sidebar {
    position: fixed;
    top: 50px;
    right: 0;
    width: 25%;
    min-width: 300px; /* Slightly wider for better content spacing */
    height: 100vh;
    background: rgb(var(--white));
    box-shadow: -2px 0 20px rgba(0,0,0,0.12); /* Enhanced shadow */
    transform: translateX(100%);
    transition: transform 0.3s cubic-bezier(.4,0,.2,1);
    z-index: 1050;
    display: flex;
    flex-direction: column;
    pointer-events: none;
    border-left: 1px solid rgba(147, 51, 234, 0.1); /* Subtle purple border */
}

#right-sidebar[aria-expanded="true"] {
    transform: translateX(0);
    pointer-events: auto;
}

.right-sidebar-header {
    padding: 0.5rem 1rem;
    border-bottom: 1px solid var(--table-border-color);
}

.right-sidebar-title-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.5rem;
}

#right-sidebar .export-link {
    background: transparent;
    border: none;
    color: #6D28D9; /* Purple link */
    font-size: 0.85rem; /* slightly smaller */
    padding: 0;
    margin: 0;
    cursor: pointer;
    text-decoration: underline;
    display: none; /* shown when first mock/test appears */
}

#right-sidebar .export-link:hover {
    color: #7c3aed;
}

#right-sidebar-toggle {
    position: fixed;
    top: 50%;
    right: 0;
    transform: translateY(-50%);
    background: rgb(var(--gun-metal));
    border-radius: 12px 0 0 12px;
    width: 40px;
    height: 48px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    z-index: 1100;
}

#right-sidebar-toggle:hover {
    background: rgb(var(--gun-metal-hover));
}

#right-sidebar .right-sidebar-content {
    overflow-y: auto;
    flex: 1;
}

/* --- Empty state --- */
.right-sidebar-empty-state {
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    padding: 16px 12px 32px;
    color: var(--font-color);
    user-select: none;
}

.right-sidebar-empty-state .empty-illustration {
    position: relative;
    width: 260px;
    height: 160px;
    margin-top: 48px;
    margin-bottom: 8px;
}

.right-sidebar-empty-state .empty-bg {
    position: absolute;
    top: 56px;
    left: 50%;
    transform: translateX(-50%);
    width: 200px;
}

.right-sidebar-empty-state .empty-frownie {
    position: absolute;
    top: 16px;
    left: 50%;
    transform: translateX(-50%);
    width: 84px;
}

.right-sidebar-empty-state .empty-magnify {
    position: absolute;
    bottom: 18px;
    left: calc(50% + 32px);
    width: 30px;
}

.right-sidebar-empty-state .empty-title {
    margin: 10px 0 6px;
    font-weight: 600;
}

.right-sidebar-empty-state .empty-subtitle {
    margin: 0;
    font-size: 14px;
    color: #6B7280; /* slate-500 */
    max-width: 85%;
}

/* Show sidebar on hover at right edge */
body:hover #right-sidebar:not([aria-expanded="true"]):hover,
#right-sidebar-toggle:hover ~ #right-sidebar:not([aria-expanded="true"]) {
    transform: translateX(0);
    pointer-events: auto;
}

#right-sidebar[aria-expanded="true"] ~ #right-sidebar-toggle {
    display: none;
}

/* Process Bar Styling */
.process-bar {
    background: #fff;
    border-bottom: 1px solid var(--table-border-color);
    padding: 12px 16px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    min-height: 48px;
}

.process-bar:hover,
.process-bar.hover {
    background: var(--light-gray);
}

.process-bar-content {
    width: 100%;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.process-info {
    display: flex;
    align-items: center;
    flex: 1;
    min-width: 0; /* Allow text truncation */
}

.process-title-col {
    display: flex;
    flex-direction: column;
    min-width: 0;
}

.process-title {
    font-size: 14px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.process-port {
    font-size: 12px;
    color: #7a8699;
    font-weight: 300 !important;
    margin-top: 4px;
    margin-bottom: 0;
}

.process-status {
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    gap: 2px;
}

.status-text {
    font-size: 14px;
    font-weight: 400;
    margin-left: 6px;
}

.port-text {
    font-size: 10px;
    color: #6b7280;
    font-weight: 500;
}

/* Status Indicators */
.process-dot {
    height: 8px;
    width: 8px;
    border-radius: 50%;
    display: inline-block;
    flex-shrink: 0;
}

.running-dot {
    background: linear-gradient(135deg, #10b981, #059669);
    box-shadow: 0 0 0 2px rgba(16, 185, 129, 0.2);
    animation: pulse-modern 2s ease-in-out infinite;
    position: relative;
}

.running-dot::before {
    content: '';
    position: absolute;
    top: -2px;
    left: -2px;
    right: -2px;
    bottom: -2px;
    background: linear-gradient(135deg, #10b981, #059669);
    border-radius: 50%;
    opacity: 0.3;
    animation: pulse-ring 2s ease-in-out infinite;
}

.stopped-dot {
    background: linear-gradient(135deg, #ef4444, #dc2626);
    box-shadow: 0 0 0 2px rgba(239, 68, 68, 0.2);
}

.done-dot {
    background: linear-gradient(135deg, #6366f1, #4f46e5);
    box-shadow: 0 0 0 2px rgba(99, 102, 241, 0.2);
}

@keyframes pulse-modern {
    0%, 100% {
        transform: scale(1);
        opacity: 1;
    }
    50% {
        transform: scale(1.1);
        opacity: 0.8;
    }
}

@keyframes pulse-ring {
    0% {
        transform: scale(0.8);
        opacity: 0.8;
    }
    50% {
        transform: scale(1.2);
        opacity: 0.3;
    }
    100% {
        transform: scale(1.4);
        opacity: 0;
    }
}

.process-bar.highlight {
    background: #fffcc9 !important;
    transition: background-color 0.2s ease, border-color 0.2s ease;
}

.process-bar.highlight:hover {
    background-color: #fffbd0 !important;
}

/* Modern Accordion Styling */
#right-sidebar .accordion-header {
    display: flex;
    gap: 0.5rem;
    font-weight: 400;
    padding: 0.5rem 0.75rem;
    border: 1px solid var(--dark-gray);
    border-right: none;
    border-left: none;
    background: var(--light-gray);
    cursor: pointer;
    user-select: none;
    outline: none;
    transition: all 0.2s cubic-bezier(.4,0,.2,1);
    position: relative;
    border-top: 0;
}


#right-sidebar .accordion-content .process-bar:last-child {
    margin-bottom: 0;
}

/* Scrollbar Styling */
#right-sidebar .right-sidebar-content::-webkit-scrollbar {
    width: 4px;
}

#right-sidebar .right-sidebar-content::-webkit-scrollbar-track {
    background: transparent;
}

#right-sidebar .right-sidebar-content::-webkit-scrollbar-thumb {
    background: rgba(147, 51, 234, 0.2);
    border-radius: 2px;
}

#right-sidebar .right-sidebar-content::-webkit-scrollbar-thumb:hover {
    background: rgba(147, 51, 234, 0.3);
}

.status-col {
    display: flex;
    flex-direction: row;
    align-items: center;
}

.green-dot, .red-dot {
    display: inline-block;
    width: 12px;
    height: 12px;
    border-radius: 50%;
    vertical-align: middle;
    margin-right: 0;
    margin-bottom: -1px;
}
.green-dot {
    background: linear-gradient(135deg, #10b981, #34d399);
}
.red-dot {
    background: linear-gradient(135deg, #ef4444, #dc2626);
}

.port-line {
    font-size: 12px;
    color: #9ca3af;
    margin-top: 2px;
    font-weight: 500;
}

.accordion-type-icon {
    width: 24px;  
    height: 24px;
    vertical-align: middle;
}

.activity-badge {
    position: absolute;
    top: -8px;
    background: #ef4444;
    color: #fff;
    border-radius: 999px;
    padding: 2px 8px;
    font-size: 12px;
    font-weight: bold;
    z-index: 10;
    box-shadow: 0 2px 6px rgba(0,0,0,0.2);
}
@keyframes pulseColor {
  0%, 100% {
    transform: scale(1);
    background-color: #ef4444;  /* Original red */
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.2);
  }
  50% {
    transform: scale(1.2);
    background-color: #f87171;  /* Lighter red highlight */
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.4);
  }
}

.pulse-animation {
  animation: pulseColor 1s ease-in-out infinite;
}

/* Attention pulse (glow + scale) when a run action is triggered */
@media (prefers-reduced-motion: no-preference) {
    @keyframes sidebar-pulse {
    /* Subtle horizontal bob: center -> right -> center, strong glow at peak */
    0% { transform: translateY(-50%) translateX(0); box-shadow: 0 0 0 0 rgba(150,110,255,0); }
    50% { transform: translateY(-50%) translateX(12px); box-shadow: 0 0 14px 8px rgba(150,110,255,0.9); }
    100% { transform: translateY(-50%) translateX(0); box-shadow: 0 0 0 0 rgba(150,110,255,0); }
    }
    #right-sidebar-toggle.attention-pulse {
    animation: sidebar-pulse 0.6s cubic-bezier(.65,.05,.36,1) 0.2s 2;
    will-change: transform;
    }
}

@media (prefers-reduced-motion: reduce) {
    @keyframes sidebar-outline {
        0% { box-shadow: 0 0 0 0 rgba(150,110,255,0); }
        20% { box-shadow: 0 0 0 4px rgba(150,110,255,0.5); }
        100% { box-shadow: 0 0 0 0 rgba(150,110,255,0); }
    }
    #right-sidebar-toggle.attention-pulse {
        animation: sidebar-outline 0.7s ease;
    }
}
