/* Custom scrollbar */
.custom-scrollbar::-webkit-scrollbar {
    width: 6px;
    height: 6px;
}
.custom-scrollbar::-webkit-scrollbar-track {
    background: rgba(0,0,0,0.1);
}
.custom-scrollbar::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.1);
    border-radius: 4px;
}
.custom-scrollbar::-webkit-scrollbar-thumb:hover {
    background: rgba(245, 158, 11, 0.5); /* Primary color */
}

/* Animations */
@keyframes fadeIn {
    from { opacity: 0; transform: translateY(5px); }
    to { opacity: 1; transform: translateY(0); }
}
.animate-fade-in {
    animation: fadeIn 0.3s ease-out forwards;
}

/* Word break for long tokens */
.word-break {
    word-break: break-all;
}

/* Sequence Diagram Styles */
.actor-badge {
    position: relative;
    display: flex;
    flex-direction: column;
    align-items: center;
    width: 100px;
    z-index: 10;
}

.actor-icon {
    width: 48px;
    height: 48px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 8px;
    box-shadow: 0 4px 15px rgba(0,0,0,0.3);
    border: 2px solid rgba(255,255,255,0.1);
    color: white;
}

.actor-label {
    font-size: 11px;
    font-weight: 600;
    text-align: center;
    color: #E2E8F0;
    text-shadow: 0 1px 2px rgba(0,0,0,0.8);
}

.lifeline {
    width: 2px;
    height: 100%;
    background: linear-gradient(to bottom, rgba(255,255,255,0.1) 0%, rgba(255,255,255,0.02) 100%);
    position: relative;
}

.lifeline::after {
    content: '';
    position: absolute;
    top: 0;
    left: -4px;
    width: 10px;
    height: 100%;
    background: transparent; /* hover area */
}

/* Steps */
.step-row {
    position: relative;
    height: 60px;
    margin: 10px 0;
    width: 100%;
    opacity: 0.3;
    transition: opacity 0.3s;
    cursor: pointer;
}

.step-row.active {
    opacity: 1;
}
.step-row.completed {
    opacity: 0.8;
}
.step-row:hover {
    opacity: 1;
}

.step-arrow-container {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    height: 2px;
    background-color: #64748B;
    display: flex;
    align-items: center;
    justify-content: center;
}

.step-row.active .step-arrow-container {
    background-color: #F59E0B; /* primary */
    box-shadow: 0 0 8px rgba(245, 158, 11, 0.4);
}

/* Arrow head at the end based on direction */
.arrow-head-right {
    position: absolute;
    right: -2px;
    width: 0; 
    height: 0; 
    border-top: 5px solid transparent;
    border-bottom: 5px solid transparent;
    border-left: 8px solid #64748B;
}

.arrow-head-left {
    position: absolute;
    left: -2px;
    width: 0; 
    height: 0; 
    border-top: 5px solid transparent;
    border-bottom: 5px solid transparent;
    border-right: 8px solid #64748B;
}

.step-row.active .arrow-head-right { border-left-color: #F59E0B; }
.step-row.active .arrow-head-left { border-right-color: #F59E0B; }

.step-label {
    position: absolute;
    top: -20px;
    background: #16213E;
    padding: 2px 8px;
    border-radius: 4px;
    font-size: 11px;
    font-weight: 500;
    color: #E2E8F0;
    border: 1px solid rgba(255,255,255,0.1);
    white-space: nowrap;
    transition: all 0.2s;
    z-index: 5;
}

.step-row.active .step-label {
    background: #F59E0B;
    color: #1A1A2E;
    border-color: #F59E0B;
    font-weight: 700;
}

/* Flying packet animation */
.packet {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    width: 16px;
    height: 10px;
    background: #F59E0B;
    border-radius: 2px;
    box-shadow: 0 0 10px #F59E0B;
    z-index: 10;
    opacity: 0;
}

/* Highlighted code syntax */
.key { color: #8B5CF6; }
.val-string { color: #10B981; }
.val-number { color: #F59E0B; }
.val-boolean { color: #EC4899; }
.punctuation { color: #94A3B8; }
